Quantcast
Viewing all articles
Browse latest Browse all 40524

ofxSniffer and packet sniffing

So, I got a little bit further, I am trying to detect ARP requests, here is my code, I based it on the other methods in the sniffer addon:

class ofxSnifferARPRequestFrame {
public:
    bool isValid = false;

    string ssid;
    HWAddress<6> addr;

    ofxSnifferARPRequestFrame() {}

    ofxSnifferARPRequestFrame(Packet packet) {
        try {
            packet.pdu()->rfind_pdu<Tins::ARP>();
            cout<<"ARP REQUEST RECEIVED"<<endl;

            const Tins::ARP &data = packet.pdu()->rfind_pdu<Tins::ARP>();

            addr = get_dst_addr_ARP(data);
            isValid = true;
        } catch (...) {
        }
    }
};

The code compiles, but I dont get any response when an arp request is present on the network. I checked with wirecast and I do see an arp request when I connect a new device to the network. As far as I could tell this line:

 packet.pdu()->rfind_pdu<Tins::ARP>();
 <<"ARP REQUEST RECEIVED"<<endl;

Should print out "ARP REQUEST RECEIVED" if the packet is formatted as an ARP request. As usual I am a little over my head.

For reference the addon I am using is here:

https://github.com/HalfdanJ/ofxSniffer

Cheers


Viewing all articles
Browse latest Browse all 40524

Trending Articles