CommandLine.h 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  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. #ifdef HAS_SCREEN
  10. extern MenuFunctions menu_function_obj;
  11. extern Display display_obj;
  12. #endif
  13. extern WiFiScan wifi_scan_obj;
  14. extern LinkedList<AccessPoint>* access_points;
  15. extern LinkedList<ssid>* ssids;
  16. extern const String PROGMEM version_number;
  17. //// Commands
  18. // Admin
  19. const char PROGMEM CH_CMD[] = "channel";
  20. const char PROGMEM CLEARAP_CMD[] = "clearap";
  21. const char PROGMEM REBOOT_CMD[] = "reboot";
  22. // WiFi sniff/scan
  23. const char PROGMEM SCANAP_CMD[] = "scanap";
  24. const char PROGMEM SNIFF_BEACON_CMD[] = "sniffbeacon";
  25. const char PROGMEM SNIFF_DEAUTH_CMD[] = "sniffdeauth";
  26. const char PROGMEM SNIFF_PMKID_CMD[] = "sniffpmkid";
  27. const char PROGMEM STOPSCAN_CMD[] = "stopscan";
  28. // WiFi attack
  29. const char PROGMEM ATTACK_CMD[] = "attack";
  30. const char PROGMEM ATTACK_TYPE_DEAUTH[] = "deauth";
  31. const char PROGMEM ATTACK_TYPE_BEACON[] = "beacon";
  32. const char PROGMEM ATTACK_TYPE_PROBE[] = "probe";
  33. // WiFi Aux
  34. const char PROGMEM LIST_AP_CMD[] = "list";
  35. const char PROGMEM SEL_CMD[] = "select";
  36. const char PROGMEM SSID_CMD[] = "ssid";
  37. class CommandLine {
  38. private:
  39. String getSerialInput();
  40. LinkedList<String> parseCommand(String input, char* delim);
  41. void runCommand(String input);
  42. bool checkValueExists(LinkedList<String>* cmd_args_list, int index);
  43. bool inRange(int max, int index);
  44. int argSearch(LinkedList<String>* cmd_args, String key);
  45. const char* ascii_art =
  46. "\r\n"
  47. " @@@@@@ \r\n"
  48. " @@@@@@@@ \r\n"
  49. " @@@@@@@@@@@ \r\n"
  50. " @@@@@@ @@@@@@ \r\n"
  51. " @@@@@@@ @@@@@@@ \r\n"
  52. " @@@@@@ @@@@@@ \r\n"
  53. " @@@@@@@ @@@@@@@ \r\n"
  54. " @@@@@@ @@@@@@ \r\n"
  55. "@@@@@@@ @@@@@@@@@@@@@@@@ \r\n"
  56. "@@@@@ @@@@@@@@@@@@@@@ \r\n"
  57. "@@@@@ @@@@@@@ \r\n"
  58. "@@@@@ @@@@@@ \r\n"
  59. "@@@@@@ @@@@@@@ \r\n"
  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. public:
  72. CommandLine();
  73. void RunSetup();
  74. void main(uint32_t currentTime);
  75. };
  76. #endif