There's more...
The huawei-hg5xx-udp-info script uses a standard connect-style in which a socket is created, the connection is established, data is sent and/or received, and the connection is closed.
If you need more control, the nmap library also supports reading and writing raw packets. The scripting engine uses a libpcap wrapper through Nsock to read raw packets and can send them at either the Ethernet or IP layer.
When reading raw packets, you will need to open the capture device and register a listener that will process the packets as they arrive. The pcap_open(), pcap_receive(), and pcap_close() functions correspond to opening a capture device, receiving packets, and closing the listener. I recommend that you look at the scripts sniffer-detect ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access