2017-12-26 8 views
2

私はwiresharkとそのlua apiを初めて使っています。私は、ポート443でパケットをキャプチャし、内容の一部を変更して宛先に送信できるディセクタを作成する必要があります。私は、リスト全体がhere可能ですdst_port:送信などをdst、SRC、などのフィールドにアクセスすることができますWireshark Luaディセクタのパケットの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) 

:私は私が私の必要に応じて修正したスクリプトhereを見つけました。しかし、私はどのように参照/パケットのチェックサム、選択された暗号スイートなどを変更することができます参照は見つかりません。私は彼らがトランスポート層に存在することを知っていますが、私はアクセス/これらの値。

私は間違っていますか?この点に関する助けに感謝します!

ありがとうございます!

答えて

1

あなたはField Extractorを使用して、任意のフィールドにアクセスすることができ、全体のリストには、参照としてLuaAPI/Pinfo wikiページでは使用できませんが、Wiresharkの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 

をWiresharkのwikiにはLua/Examples多くを提供します。

+0

あなたは正しいです。 wiresharkディスプレイフィルタのリファレンスページは、私が見つけられなかったものです。ありがとう! –

関連する問題