#ifndef SNIFFER_H #define SNIFFER_H #include /** * @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 CovertChannel { public: /** * Creates a Sniffer. * * Creates a Sniffer and sets the network interface for sniffing. * * @param interface name of the interface for sniffing */ CovertChannel(const std::string &innerInterface, const std::string &outerInterface); /** * Destroys the Sniffer. * * Destructor of the Sniffer. */ virtual ~CovertChannel(); /** * 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(const std::string &filterString); protected: /** * 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); bool handleForwardToInner(Tins::PDU &pdu); bool handleForwardToOuter(Tins::PDU &pdu); virtual bool handleRedirectToInner(Tins::PDU &pdu) = 0; virtual bool handleRedirectToOuter(Tins::PDU &pdu) = 0; void startInnerSniffing(); void startOuterSniffing(); /** * Tins sniffer object. */ Tins::Sniffer *innerSniffer; Tins::Sniffer *outerSniffer; Tins::PacketSender innerSender; Tins::PacketSender outerSender; }; #endif