forked from robertdavidgraham/masscan
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmasscan-app.c
82 lines (77 loc) · 2.6 KB
/
masscan-app.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
#include "masscan-app.h"
#include "string_s.h"
/******************************************************************************
* When outputing results, we call this function to print out the type of
* banner that we've collected
******************************************************************************/
const char *
masscan_app_to_string(enum ApplicationProtocol proto)
{
static char tmp[64];
switch (proto) {
case PROTO_NONE: return "unknown";
case PROTO_HEUR: return "unknown";
case PROTO_SSH1: return "ssh";
case PROTO_SSH2: return "ssh";
case PROTO_HTTP: return "http";
case PROTO_FTP: return "ftp";
case PROTO_DNS_VERSIONBIND: return "dns-ver";
case PROTO_SNMP: return "snmp";
case PROTO_NBTSTAT: return "nbtstat";
case PROTO_SSL3: return "ssl";
case PROTO_SMTP: return "smtp";
case PROTO_POP3: return "pop";
case PROTO_IMAP4: return "imap";
case PROTO_UDP_ZEROACCESS: return "zeroaccess";
case PROTO_X509_CERT: return "X509";
case PROTO_HTML_TITLE: return "title";
case PROTO_HTML_FULL: return "html";
case PROTO_NTP: return "ntp";
case PROTO_VULN: return "vuln";
case PROTO_HEARTBLEED: return "heartbleed";
case PROTO_VNC_RFB: return "vnc";
case PROTO_SAFE: return "safe";
default:
sprintf_s(tmp, sizeof(tmp), "(%u)", proto);
return tmp;
}
}
/******************************************************************************
******************************************************************************/
enum ApplicationProtocol
masscan_string_to_app(const char *str)
{
const static struct {
const char *name;
enum ApplicationProtocol value;
} list[] = {
{"ssh1", PROTO_SSH1},
{"ssh2", PROTO_SSH2},
{"ssh", PROTO_SSH2},
{"http", PROTO_HTTP},
{"ftp", PROTO_FTP},
{"dns-ver", PROTO_DNS_VERSIONBIND},
{"snmp", PROTO_SNMP},
{"ssh2", PROTO_SSH2},
{"nbtstat", PROTO_NBTSTAT},
{"ssl", PROTO_SSL3},
{"pop", PROTO_POP3},
{"imap", PROTO_IMAP4},
{"x509", PROTO_X509_CERT},
{"zeroaccess", PROTO_UDP_ZEROACCESS},
{"title", PROTO_HTML_TITLE},
{"html", PROTO_HTML_FULL},
{"ntp", PROTO_NTP},
{"vuln", PROTO_VULN},
{"heartbleed", PROTO_HEARTBLEED},
{"vnc", PROTO_VNC_RFB},
{"safe", PROTO_SAFE},
{0,0}
};
size_t i;
for (i=0; list[i].name; i++) {
if (strcmp(str, list[i].name) == 0)
return list[i].value;
}
return 0;
}