A Hardware Hacking Tool with Web-Based CLI That Speaks Every Protocol
C arduinobluetoothcan-busdebuggingeepromesp32flipperzerogpiohardware-hackingi2cjtagopenocdprotocolspwmradiorfidspisubghzuartwifi
Added nmap services
Andrei Vladescub397b7ebde0e
diff --git a/src/Data/NmapUtils.h b/src/Data/NmapUtils.hindex e28356c3..bdab55c6 100644--- a/src/Data/NmapUtils.h+++ b/src/Data/NmapUtils.h@@ -15,5 +15,237 @@ enum nmap_rc_enumUDP_OPEN_FILTERED = 12};+struct NmapOptions {+ bool tcp = true; // -t sets TCP only (default)+ bool udp = false; // -u sets UDP only+ int verbosity = 0; // -v/-vv+ bool hasPort = false; // Did user pass `-p` ?+ std::string ports; // "80", "22,80-90"+ bool hasTrash = false; // Did user pass non-option tokens?+ bool help = false; // -h or --help+ bool pingOnly = false; // -sn+};++enum class Layer4Protocol+{+ TCP,+ UDP+};++struct PortService {+ uint16_t port;+ Layer4Protocol proto;+ const char* service; // nullptr when unknown/ambiguous+};++static const int CONNECT_TIMEOUT_MS = 600;static const int SMALL_DELAY_MS = 5;++static constexpr PortService TOP100_TCP_MAP[] = {+ {7, Layer4Protocol::TCP, "echo"},+ {9, Layer4Protocol::TCP, "discard"},+ {13, Layer4Protocol::TCP, "daytime"},+ {21, Layer4Protocol::TCP, "ftp"},+ {22, Layer4Protocol::TCP, "ssh"},+ {23, Layer4Protocol::TCP, "telnet"},+ {25, Layer4Protocol::TCP, "smtp"},+ {26, Layer4Protocol::TCP, "smtp-alt"},+ {37, Layer4Protocol::TCP, "time"},+ {53, Layer4Protocol::TCP, "dns"},+ {79, Layer4Protocol::TCP, "finger"},+ {80, Layer4Protocol::TCP, "http"},+ {81, Layer4Protocol::TCP, "http-alt"},+ {88, Layer4Protocol::TCP, "kerberos"},+ {106, Layer4Protocol::TCP, "poppassd"},+ {110, Layer4Protocol::TCP, "pop3"},+ {111, Layer4Protocol::TCP, "rpcbind"},+ {113, Layer4Protocol::TCP, "ident"},+ {119, Layer4Protocol::TCP, "nntp"},+ {135, Layer4Protocol::TCP, "msrpc"},+ {139, Layer4Protocol::TCP, "netbios-ssn"},+ {143, Layer4Protocol::TCP, "imap"},+ {144, Layer4Protocol::TCP, "news"},+ {179, Layer4Protocol::TCP, "bgp"},+ {199, Layer4Protocol::TCP, "smux"},+ {389, Layer4Protocol::TCP, "ldap"},+ {427, Layer4Protocol::TCP, "slp"},+ {443, Layer4Protocol::TCP, "https"},+ {444, Layer4Protocol::TCP, "snpp"},+ {445, Layer4Protocol::TCP, "microsoft-ds"},+ {465, Layer4Protocol::TCP, "smtps"},+ {513, Layer4Protocol::TCP, "rlogin"},+ {514, Layer4Protocol::TCP, "shell"},+ {515, Layer4Protocol::TCP, "lpd"},+ {543, Layer4Protocol::TCP, "klogin"},+ {544, Layer4Protocol::TCP, "kshell"},+ {548, Layer4Protocol::TCP, "afp"},+ {554, Layer4Protocol::TCP, "rtsp"},+ {587, Layer4Protocol::TCP, "submission"},+ {631, Layer4Protocol::TCP, "ipp"},+ {646, Layer4Protocol::TCP, "ldp"},+ {873, Layer4Protocol::TCP, "rsync"},+ {990, Layer4Protocol::TCP, "ftps"},+ {993, Layer4Protocol::TCP, "imaps"},+ {995, Layer4Protocol::TCP, "pop3s"},+ {1025, Layer4Protocol::TCP, "msrpc"},+ {1026, Layer4Protocol::TCP, "dcom"},+ {1027, Layer4Protocol::TCP, "iis"},+ {1028, Layer4Protocol::TCP, "ms-lsa"},+ {1029, Layer4Protocol::TCP, "ms-lsa"},+ {1110, Layer4Protocol::TCP, "nfsd-status"},+ {1433, Layer4Protocol::TCP, "ms-sql-s"},+ {1720, Layer4Protocol::TCP, "h323q931"},+ {1723, Layer4Protocol::TCP, "pptp"},+ {1755, Layer4Protocol::TCP, "mms"},+ {1900, Layer4Protocol::TCP, "ssdp"},+ {2000, Layer4Protocol::TCP, "cisco-sccp"},+ {2001, Layer4Protocol::TCP, "dc"},+ {2049, Layer4Protocol::TCP, "nfs"},+ {2121, Layer4Protocol::TCP, "ftp-alt"},+ {2717, Layer4Protocol::TCP, nullptr},+ {3000, Layer4Protocol::TCP, "http-alt"},+ {3128, Layer4Protocol::TCP, "http-proxy"},+ {3306, Layer4Protocol::TCP, "mysql"},+ {3389, Layer4Protocol::TCP, "ms-wbt-server"},+ {3986, Layer4Protocol::TCP, "mapper-ws-ethd"},+ {4899, Layer4Protocol::TCP, "radmin"},+ {5000, Layer4Protocol::TCP, "http-alt"},+ {5009, Layer4Protocol::TCP, "airport-admin"},+ {5051, Layer4Protocol::TCP, "ida-agent"},+ {5060, Layer4Protocol::TCP, "sip"},+ {5101, Layer4Protocol::TCP, "admdog"},+ {5190, Layer4Protocol::TCP, "aol"},+ {5357, Layer4Protocol::TCP, "wsdapi"},+ {5432, Layer4Protocol::TCP, "postgresql"},+ {5631, Layer4Protocol::TCP, "pcanywheredata"},+ {5666, Layer4Protocol::TCP, "nrpe"},+ {5800, Layer4Protocol::TCP, "vnc-http"},+ {5900, Layer4Protocol::TCP, "vnc"},+ {6000, Layer4Protocol::TCP, "x11"},+ {6001, Layer4Protocol::TCP, "x11-1"},+ {6646, Layer4Protocol::TCP, "mcafee-net-agent"},+ {7070, Layer4Protocol::TCP, "realserver"},+ {8000, Layer4Protocol::TCP, "http-alt"},+ {8008, Layer4Protocol::TCP, "http-alt"},+ {8009, Layer4Protocol::TCP, "ajp13"},+ {8080, Layer4Protocol::TCP, "http-proxy"},+ {8081, Layer4Protocol::TCP, "http-alt"},+ {8443, Layer4Protocol::TCP, "https-alt"},+ {8888, Layer4Protocol::TCP, "http-alt"},+ {9100, Layer4Protocol::TCP, "jetdirect"},+ {9999, Layer4Protocol::TCP, "abyss"},+ {10000, Layer4Protocol::TCP, "webmin"},+ {32768, Layer4Protocol::TCP, "omad"},+ {49152, Layer4Protocol::TCP, "msrpc-dynamic"},+ {49153, Layer4Protocol::TCP, "msrpc-dynamic"},+ {49154, Layer4Protocol::TCP, "msrpc-dynamic"},+ {49155, Layer4Protocol::TCP, "msrpc-dynamic"},+ {49156, Layer4Protocol::TCP, "msrpc-dynamic"},+ {49157, Layer4Protocol::TCP, "msrpc-dynamic"},+};+static constexpr size_t TOP100_TCP_MAP_COUNT = sizeof(TOP100_TCP_MAP)/sizeof(TOP100_TCP_MAP[0]);++static constexpr PortService TOP100_UDP_MAP[] = {+ {7, Layer4Protocol::UDP, "echo"},+ {9, Layer4Protocol::UDP, "discard"},+ {17, Layer4Protocol::UDP, "qotd"},+ {19, Layer4Protocol::UDP, "chargen"},+ {49, Layer4Protocol::UDP, "tacacs"},+ {53, Layer4Protocol::UDP, "dns"},+ {67, Layer4Protocol::UDP, "dhcps"},+ {68, Layer4Protocol::UDP, "dhcpc"},+ {69, Layer4Protocol::UDP, "tftp"},+ {80, Layer4Protocol::UDP, "http-alt"},+ {88, Layer4Protocol::UDP, "kerberos"},+ {111, Layer4Protocol::UDP, "rpcbind"},+ {120, Layer4Protocol::UDP, "cfdp"},+ {123, Layer4Protocol::UDP, "ntp"},+ {135, Layer4Protocol::UDP, "msrpc"},+ {136, Layer4Protocol::UDP, "profile"},+ {137, Layer4Protocol::UDP, "netbios-ns"},+ {138, Layer4Protocol::UDP, "netbios-dgm"},+ {139, Layer4Protocol::UDP, "netbios-ssn"},+ {158, Layer4Protocol::UDP, "pcmail-srv"},+ {161, Layer4Protocol::UDP, "snmp"},+ {162, Layer4Protocol::UDP, "snmptrap"},+ {177, Layer4Protocol::UDP, "xdmcp"},+ {427, Layer4Protocol::UDP, "slp"},+ {443, Layer4Protocol::UDP, "quic"},+ {445, Layer4Protocol::UDP, "microsoft-ds"},+ {497, Layer4Protocol::UDP, "retrospect"},+ {500, Layer4Protocol::UDP, "isakmp"},+ {514, Layer4Protocol::UDP, "syslog"},+ {515, Layer4Protocol::UDP, "printer"},+ {518, Layer4Protocol::UDP, "ntalk"},+ {520, Layer4Protocol::UDP, "rip"},+ {593, Layer4Protocol::UDP, "http-rpc-epmap"},+ {623, Layer4Protocol::UDP, "ipmi-rmcp"},+ {626, Layer4Protocol::UDP, nullptr},+ {631, Layer4Protocol::UDP, "ipp"},+ {996, Layer4Protocol::UDP, nullptr},+ {997, Layer4Protocol::UDP, nullptr},+ {998, Layer4Protocol::UDP, nullptr},+ {999, Layer4Protocol::UDP, nullptr},+ {1022, Layer4Protocol::UDP, nullptr},+ {1023, Layer4Protocol::UDP, nullptr},+ {1025, Layer4Protocol::UDP, nullptr},+ {1026, Layer4Protocol::UDP, nullptr},+ {1027, Layer4Protocol::UDP, nullptr},+ {1028, Layer4Protocol::UDP, nullptr},+ {1029, Layer4Protocol::UDP, nullptr},+ {1030, Layer4Protocol::UDP, nullptr},+ {1433, Layer4Protocol::UDP, "ms-sql-m"},+ {1434, Layer4Protocol::UDP, "ms-sql-s"},+ {1645, Layer4Protocol::UDP, "radius-old"},+ {1646, Layer4Protocol::UDP, "radius-acct-old"},+ {1701, Layer4Protocol::UDP, "l2tp"},+ {1718, Layer4Protocol::UDP, "h323gatedisc"},+ {1719, Layer4Protocol::UDP, "h323gatestat"},+ {1812, Layer4Protocol::UDP, "radius"},+ {1813, Layer4Protocol::UDP, "radius-acct"},+ {1900, Layer4Protocol::UDP, "ssdp"},+ {2000, Layer4Protocol::UDP, "cisco-sccp"},+ {2048, Layer4Protocol::UDP, "dls-monitor"},+ {2049, Layer4Protocol::UDP, "nfs"},+ {2222, Layer4Protocol::UDP, nullptr},+ {2223, Layer4Protocol::UDP, nullptr},+ {3283, Layer4Protocol::UDP, "apple-remote-mgmt"},+ {3456, Layer4Protocol::UDP, nullptr},+ {3703, Layer4Protocol::UDP, nullptr},+ {4444, Layer4Protocol::UDP, "krb524"},+ {4500, Layer4Protocol::UDP, "ipsec-nat-t"},+ {5000, Layer4Protocol::UDP, "upnp"},+ {5060, Layer4Protocol::UDP, "sip"},+ {5353, Layer4Protocol::UDP, "mdns"},+ {5632, Layer4Protocol::UDP, "pcanywherestat"},+ {9200, Layer4Protocol::UDP, nullptr},+ {10000,Layer4Protocol::UDP, nullptr},+ {17185,Layer4Protocol::UDP, nullptr},+ {20031,Layer4Protocol::UDP, nullptr},+ {30718,Layer4Protocol::UDP, nullptr},+ {31337,Layer4Protocol::UDP, "backorifice"},+ {32768,Layer4Protocol::UDP, "sunrpc"},+ {32769,Layer4Protocol::UDP, "sunrpc"},+ {32771,Layer4Protocol::UDP, "sunrpc"},+ {32815,Layer4Protocol::UDP, nullptr},+ {33281,Layer4Protocol::UDP, nullptr},+ {49152,Layer4Protocol::UDP, "ephemeral"},+ {49153,Layer4Protocol::UDP, "ephemeral"},+ {49154,Layer4Protocol::UDP, "ephemeral"},+ {49156,Layer4Protocol::UDP, "ephemeral"},+ {49181,Layer4Protocol::UDP, "ephemeral"},+ {49182,Layer4Protocol::UDP, "ephemeral"},+ {49185,Layer4Protocol::UDP, "ephemeral"},+ {49186,Layer4Protocol::UDP, "ephemeral"},+ {49188,Layer4Protocol::UDP, "ephemeral"},+ {49190,Layer4Protocol::UDP, "ephemeral"},+ {49191,Layer4Protocol::UDP, "ephemeral"},+ {49192,Layer4Protocol::UDP, "ephemeral"},+ {49193,Layer4Protocol::UDP, "ephemeral"},+ {49194,Layer4Protocol::UDP, "ephemeral"},+ {49200,Layer4Protocol::UDP, "ephemeral"},+ {49201,Layer4Protocol::UDP, "ephemeral"},+ {65024,Layer4Protocol::UDP, nullptr},+};+static constexpr size_t TOP100_UDP_MAP_COUNT = sizeof(TOP100_UDP_MAP)/sizeof(TOP100_UDP_MAP[0]);diff --git a/src/Services/NmapService.cpp b/src/Services/NmapService.cppindex 7a661d44..8dbbc707 100644--- a/src/Services/NmapService.cpp+++ b/src/Services/NmapService.cpp@@ -7,7 +7,6 @@#include <cstring>#include <freertos/FreeRTOS.h>#include <freertos/task.h>-#include <Data/NmapUtils.h>#include <unordered_set>#include <ESP32Ping.h>diff --git a/src/Services/NmapService.h b/src/Services/NmapService.hindex 30e30a78..dd2006d5 100644--- a/src/Services/NmapService.h+++ b/src/Services/NmapService.h@@ -4,22 +4,7 @@#include <vector>#include "Transformers/ArgTransformer.h"#include "Services/ICMPService.h"--struct NmapOptions {- bool tcp = true; // -t sets TCP only (default)- bool udp = false; // -u sets UDP only- int verbosity = 0; // -v/-vv- bool hasPort = false; // Did user pass `-p` ?- std::string ports; // "80", "22,80-90"- bool hasTrash = false; // Did user pass non-option tokens?- bool help = false; // -h or --help- bool pingOnly = false; // -sn-};--enum class Layer4Protocol {- TCP,- UDP-};+#include "Data/NmapUtils.h"class NmapService {public: