CommandLine.h 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. #ifndef CommandLine_h
  2. #define CommandLine_h
  3. #include "configs.h"
  4. #ifdef HAS_SCREEN
  5. #include "MenuFunctions.h"
  6. #include "Display.h"
  7. #endif
  8. #include "WiFiScan.h"
  9. #include "Web.h"
  10. #include "SDInterface.h"
  11. #ifdef HAS_SCREEN
  12. extern MenuFunctions menu_function_obj;
  13. extern Display display_obj;
  14. #endif
  15. extern WiFiScan wifi_scan_obj;
  16. extern Web web_obj;
  17. extern SDInterface sd_obj;
  18. extern LinkedList<AccessPoint>* access_points;
  19. extern LinkedList<ssid>* ssids;
  20. extern const String PROGMEM version_number;
  21. //// Commands
  22. // Admin
  23. const char PROGMEM CH_CMD[] = "channel";
  24. const char PROGMEM CLEARAP_CMD[] = "clearlist";
  25. const char PROGMEM REBOOT_CMD[] = "reboot";
  26. const char PROGMEM UPDATE_CMD[] = "update";
  27. // WiFi sniff/scan
  28. const char PROGMEM SCANAP_CMD[] = "scanap";
  29. const char PROGMEM SNIFF_BEACON_CMD[] = "sniffbeacon";
  30. const char PROGMEM SNIFF_PROBE_CMD[] = "sniffprobe";
  31. const char PROGMEM SNIFF_PWN_CMD[] = "sniffpwn";
  32. const char PROGMEM SNIFF_ESP_CMD[] = "sniffesp";
  33. const char PROGMEM SNIFF_DEAUTH_CMD[] = "sniffdeauth";
  34. const char PROGMEM SNIFF_PMKID_CMD[] = "sniffpmkid";
  35. const char PROGMEM STOPSCAN_CMD[] = "stopscan";
  36. // WiFi attack
  37. const char PROGMEM ATTACK_CMD[] = "attack";
  38. const char PROGMEM ATTACK_TYPE_DEAUTH[] = "deauth";
  39. const char PROGMEM ATTACK_TYPE_BEACON[] = "beacon";
  40. const char PROGMEM ATTACK_TYPE_PROBE[] = "probe";
  41. const char PROGMEM ATTACK_TYPE_RR[] = "rickroll";
  42. // WiFi Aux
  43. const char PROGMEM LIST_AP_CMD[] = "list";
  44. const char PROGMEM SEL_CMD[] = "select";
  45. const char PROGMEM SSID_CMD[] = "ssid";
  46. // Bluetooth sniff/scan
  47. const char PROGMEM BT_SNIFF_CMD[] = "sniffbt";
  48. const char PROGMEM BT_SKIM_CMD[] = "sniffskim";
  49. class CommandLine {
  50. private:
  51. String getSerialInput();
  52. LinkedList<String> parseCommand(String input, char* delim);
  53. void runCommand(String input);
  54. bool checkValueExists(LinkedList<String>* cmd_args_list, int index);
  55. bool inRange(int max, int index);
  56. bool apSelected();
  57. bool hasSSIDs();
  58. int argSearch(LinkedList<String>* cmd_args, String key);
  59. const char* ascii_art =
  60. "\r\n"
  61. " @@@@@@ \r\n"
  62. " @@@@@@@@ \r\n"
  63. " @@@@@@@@@@@ \r\n"
  64. " @@@@@@ @@@@@@ \r\n"
  65. " @@@@@@@ @@@@@@@ \r\n"
  66. " @@@@@@ @@@@@@ \r\n"
  67. " @@@@@@@ @@@@@@@ \r\n"
  68. " @@@@@@ @@@@@@ \r\n"
  69. "@@@@@@@ @@@@@@@@@@@@@@@@ \r\n"
  70. "@@@@@ @@@@@@@@@@@@@@@ \r\n"
  71. "@@@@@ @@@@@@@ \r\n"
  72. "@@@@@ @@@@@@ \r\n"
  73. "@@@@@@ @@@@@@@ \r\n"
  74. " @@@@@@ @@@@@@@@@@@@\r\n"
  75. " @@@@@@@ @@@@@@ \r\n"
  76. " @@@@@@ @@@@@@ \r\n"
  77. " @@@@@@@ @@@@@@ \r\n"
  78. " @@@@@@ @@@@@@ \r\n"
  79. " @@@@@@@ @@@@@@ \r\n"
  80. " @@@@@@ @@@@@@ \r\n"
  81. " @@@@@@@@@ \r\n"
  82. " @@@@@@ \r\n"
  83. " @@@@ \r\n"
  84. "\r\n";
  85. public:
  86. CommandLine();
  87. void RunSetup();
  88. void main(uint32_t currentTime);
  89. };
  90. #endif