123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566 |
- #ifndef SNIFFER_H
- #define SNIFFER_H
- #include <tins/tins.h>
- /**
- * @class Sniffer
- *
- * Sniffs the network.
- *
- * Sniffer class which will sniff on a network interface. It is supposed to forward the packets to an analyzer or
- * modifyer so we can hide data in the traffic.
- */
- class Sniffer {
- public:
- /**
- * Creates a Sniffer.
- *
- * Creates a Sniffer and sets the network interface for sniffing.
- *
- * @param interface name of the interface for sniffing
- */
- Sniffer(std::string interfaceName);
- /**
- * Destroys the Sniffer.
- *
- * Destructor of the Sniffer.
- */
- ~Sniffer();
- /**
- * Start sniffing on the interface.
- *
- * Starts a sniffing loop which calls handle. The loop will only be stopped if handle returns false.
- */
- void startSniffing();
- /**
- * Sets a filter for the sniffer.
- *
- * Sets the filter for a sniffer with a pcap filter string. E.g. "ip dst 8.8.8.8".
- *
- * @param filterString pcap filter string
- */
- void setFilter(std::string filterString);
- private:
- /**
- * Handler for sniffed packets.
- *
- * Handles incoming connections and provides data for the package analyzer and modifyer.
- *
- * @param pdu sniffed packet
- *
- * @return false = stop loop | true = continue loop
- */
- bool handle(Tins::PDU& pdu);
- /**
- * Tins sniffer object.
- */
- Tins::Sniffer sniffer;
- };
- #endif
|