2017-12-26 3 views
2

나는 wireshark와 그 lua api에 익숙하지 않다. 포트 443에서 패킷을 캡처하고 내용 중 일부를 수정 한 다음 대상으로 보낸다.Wireshark 루아 디시 터에서 패킷의 TLS 버전/체크섬에 액세스하는 방법은 무엇입니까?

-- create myproto protocol and its fields 
p_myproto = Proto ("myproto","My Protocol") 
local f_command = ProtoField.uint16("myproto.command", "Command", base.HEX) 
local f_data = ProtoField.string("myproto.data", "Data", FT_STRING) 

p_myproto.fields = {f_command} 

-- myproto dissector function 
function p_myproto.dissector (buf, pkt, root) 
    print ('packet captured') 
    -- validate packet length is adequate, otherwise quit 
    if buf:len() == 0 then return end 
    pkt.cols.protocol = p_myproto.name 
    local colss = pkt.cols 

--pkt.cols.info:append(" " .. tostring(pkt.dst).." -> "..tostring(pkt.src)) 

print ("" .. tostring(pkt.dst)) 
print ("" .. tostring(pkt.src_port)) 
print ("" .. tostring(pkt.dst_port)) 

end 

-- Initialization routine 
function p_myproto.init() 
end 

-- register a chained dissector for port 8002 
local tcp_dissector_table = DissectorTable.get("tcp.port") 
dissector = tcp_dissector_table:get_dissector(443) 
    -- you can call dissector from function p_myproto.dissector above 
    -- so that the previous dissector gets called 
tcp_dissector_table:add(443, p_myproto) 

내가 DST, SRC, dst_port 등 전체 목록 here 수 있습니다처럼 필드에 액세스 할 수 있습니다 나는 내 필요에 따라 수정 한 스크립트 here를 발견했다. 하지만 내가 어디에 액세스 할 수있는/패킷, 선택한 암호 스위트 등 체크섬을 수정하는 방법에 대한 참조를 찾을 수 없습니다. 그들은 교통 계층에 존재하지만 액세스 할 수있는 모든 문서를 찾을 수 없습니다/수정 이 값들.

내가 뭘 잘못하고 있니? 이와 관련하여 도움이 될 것입니다!

감사합니다.

답변

1

당신은 Field Extractor를 사용하는 필드 에 액세스 할 수 있으며, 전체 목록은 참조로 LuaAPI/Pinfo 위키 페이지에 사용할 수 없지만 와이어 샤크 Display Filter Reference 페이지. 당신은 TCP 체크섬을 원하는 경우

예를 들어, 사용할 수 있습니다

fe_tcp_checksum = Field.new("tcp.checksum") 

... 

function p_myproto.dissector (buf, pkt, root) 
    ... 
    f_tcp_checksum = fe_tcp_checksum().value 
    ... 
end 

와이어 샤크 위키 Lua/Examples 이상을 제공합니다.

+0

아, 맞습니다. wireshark 디스플레이 필터 참조 페이지는 찾을 수 없습니다. 감사! –

관련 문제