ForwardChannel.h 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. #ifndef FORWARDCHANNEL_H
  2. #define FORWARDCHANNEL_H
  3. #include "CovertChannel.h"
  4. /**
  5. * @class ForwardChannel
  6. *
  7. * A CovertChannel which forwards the traffic it captures.
  8. */
  9. class ForwardChannel : public CovertChannel {
  10. public:
  11. /**
  12. * Sets up a CovertChannel.
  13. *
  14. * Creates a CovertChannel, sets the network interfaces for sniffing and sending and sets the filter.
  15. *
  16. * @param innerInterface name of the interface of the inner network
  17. * @param outerInterface name of the interface of the outer network
  18. * @param filter pcap filter string which will be set for the channel sniffers and negated for the forward sniffers
  19. */
  20. ForwardChannel(const std::string &innerInterface, const std::string &outerInterface);
  21. /**
  22. * Destroys the CovertChannel.
  23. */
  24. virtual ~ForwardChannel();
  25. /* ChannelControls */
  26. /**
  27. * Starts sending a file.
  28. *
  29. * Starts sending a file if no transmission is running and the file exists.
  30. *
  31. * @param fileName name of the file in the file directory
  32. * @return true - file will be sent | false - file was not accepted
  33. */
  34. virtual bool sendFile(const std::string &fileName);
  35. /**
  36. * Get the progress
  37. *
  38. * @return progress counters
  39. */
  40. virtual std::pair<uint32_t, uint32_t> getProgress();
  41. /**
  42. * Test if a transfer is running
  43. *
  44. * @return true - a transfer runs | false - no transfer runs
  45. */
  46. virtual bool isTransferRunning();
  47. /**
  48. * Resets state and sets reset flag so a reset signal is sent in the next packet
  49. */
  50. virtual void reset();
  51. /**
  52. * Test if a transfer is running
  53. *
  54. * @return true - a transfer runs | false - no transfer runs
  55. */
  56. virtual std::time_t getTransferStart();
  57. /**
  58. * Get file name of the file which is currently be sent or received.
  59. *
  60. * @return file name
  61. */
  62. virtual std::string getFileName();
  63. /* =============== */
  64. protected:
  65. /**
  66. * Handler for sniffed packets filterd to forward from the outer network.
  67. *
  68. * Handles incoming packets and forwards them.
  69. *
  70. * @param pdu sniffed packet
  71. *
  72. * @return false = stop loop | true = continue loop
  73. */
  74. virtual bool handleChannelFromOuter(Tins::PDU &pdu);
  75. /**
  76. * Handler for sniffed packets filterd to forward from the inner network.
  77. *
  78. * Handles incoming packets and forwards them.
  79. *
  80. * @param pdu sniffed packet
  81. *
  82. * @return false = stop loop | true = continue loop
  83. */
  84. virtual bool handleChannelFromInner(Tins::PDU &pdu);
  85. };
  86. #endif