1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586 |
- #ifndef COVERTCHANNEL_H
- #define COVERTCHANNEL_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 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, const std::string &filter);
- /**
- * 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 handleChannelToInner(Tins::PDU &pdu) = 0;
- virtual bool handleChannelToOuter(Tins::PDU &pdu) = 0;
- void startInnerForwardSniffing();
- void startOuterForwardSniffing();
- void startInnerChannelSniffing();
- void startOuterChannelSniffing();
- /**
- * Tins sniffer object.
- */
- Tins::Sniffer *innerForwardSniffer;
- Tins::Sniffer *outerForwardSniffer;
- Tins::Sniffer *innerChannelSniffer;
- Tins::Sniffer *outerChannelSniffer;
- Tins::PacketSender innerSender;
- Tins::PacketSender outerSender;
- };
- #endif
|