Skip to content

Wireshark:PacketDissection

Wireshark Packet Dissection (패킷 디스-섹션).

Categories

Examples

  • plcGateway#Wireshark Dissector - 와이뎁에서 개발한 PLC 통신 미들웨어 패킷 분석.

LUA Script

루아 스크립트가 지원되는지 부터 확인해야 한다. 메뉴의 "Help > About Wireshark" 를 클릭하여 "with Lua X.X.X" 가 있는지 확인하자.

Wireshark_-_About.png

서버 패킷 분석

Tcpdump#서버 패킷 분석 항목 참조.

스크립트 적용 방법

스크립트를 업로드할 폴더를 우선 확인하자. "Help > About Wireshark" 메뉴에서 "Folders" 탭을 클릭하면 다음과 같이 업로드 관련 폴더가 출력된다.

Wireshark_-About-_Folders.png

만약 폴더가 없다면 생성하면 된다.

스크립트를 작성하고 해당 폴더에 복사한 후 다음 메뉴에서 "Analyze > Reload Lua Plugins"를 선택.

Wireshark_-Menu-Analyze-_Reload_Lua_Plugins.png

이미 필터링된 패킷이 있다면 다시 불러오는데 꽤 시간이 걸린다.

이후 "Help > About Wireshark" 메뉴에서 "Plugins" 탭을 보면 로드된 lua 스크립트를 확인할 수 있다.

Wireshark_-About-_Plugins.png

또는 메뉴에서 "Analyze > Enabled Protocols" 를 클릭하여 확인할 수 있다.

subtree

엔디안 설정

보통 subtree:add 를 사용하여 추가하면 Big-endian 으로 추가된다.

subtree:add(somefield, buffer(94, 2))

subtree:add_le 으로 추가하면 Little-endian 으로 추가된다.

subtree:add_le(somefield, buffer(94, 2))

필터 적용 방법

예컨데 다음과 같이 #Proto#ProtoField를 적용했을 때:

local plcGateway_p2s_proto = Proto("plcGateway_p2s", "DDRM plcGateway PLC -> Server Packet")

local f_pass_no = ProtoField.uint16("plcGateway_p2s.pass_no", "Pass No", base.DEC)
local f_camera_no = ProtoField.uint16("plcGateway_p2s.camera_no", "Camera No", base.DEC, {
    [1] = "Front Camber",
    [3] = "Rear Camber",
    [4] = "Front Turn",
    [5] = "Rear Turn"
})

plcGateway_p2s 또는 plcGateway_p2s.pass_no == 1 이런식으로 필터를 적용할 수 있다.

기본 포트 등록 방법

#Proto를 tap port table 에 추가할 때 다음과 같이 추가한다. (필요하다면 여러 개 추가할 수 있다.

-- Register the dissector to TCP port
local tcp_table = DissectorTable.get("tcp.port")
tcp_table:add(30000, plcGateway_s2p_proto)  -- Default to all TCP ports; adjust as needed (aaa)
tcp_table:add(30002, plcGateway_s2p_proto)  -- Default to all TCP ports; adjust as needed (bbb)

See also

Favorite site

Guide