Loading src/main-conf.c +2 Changes for src/main-conf.c: 2 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -1144,6 +1144,8 @@ masscan_set_parameter(struct Masscan *masscan, } else if (EQUALS("connection-timeout", name) || EQUALS("tcp-timeout", name)) { /* The timeout for "banners" TCP connections */ masscan->tcp_connection_timeout = (unsigned)parseInt(value); } else if (EQUALS("hello-timeout", name)) { masscan->tcp_hello_timeout = (unsigned)parseInt(value); } else if (EQUALS("datadir", name)) { strcpy_s(masscan->nmap.datadir, sizeof(masscan->nmap.datadir), value); } else if (EQUALS("data-length", name)) { Loading src/main.c +8 Changes for src/main.c: 8 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -631,6 +631,14 @@ receive_thread(void *v) strlen(foo), foo); } if (masscan->tcp_hello_timeout) { char foo[64]; sprintf_s(foo, sizeof(foo), "%u", masscan->tcp_connection_timeout); tcpcon_set_parameter( tcpcon, "hello-timeout", strlen(foo), foo); } for (pay = masscan->tcp_payloads; pay; pay = pay->next) { char name[64]; Loading src/masscan.h +7 Changes for src/masscan.h: 7 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -338,6 +338,13 @@ struct Masscan unsigned http_user_agent_length; unsigned tcp_connection_timeout; /** Number of seconds to wait for a 'hello' from the server before * giving up and sending a 'hello' from the client. Should be a small * value when doing scans that expect client-side hellos, like HTTP or * SSL, but should be a longer value when doing scans that expect server * hellos, such as FTP or VNC */ unsigned tcp_hello_timeout; struct { const char *header_name; unsigned char *header_value; Loading src/proto-banner1.c +26 −12 Changes for src/proto-banner1.c: 26 added lines, 12 removed lines. Original line number Diff line number Diff line /* 7 state machine for receiving banners state machine for receiving banners */ #include "smack.h" #include "rawsock-pcapfile.h" Loading Loading @@ -34,11 +34,17 @@ struct Patterns patterns[] = { {"\x15\x03\x01",3, PROTO_SSL3, SMACK_ANCHOR_BEGIN}, {"\x15\x03\x02",3, PROTO_SSL3, SMACK_ANCHOR_BEGIN}, {"\x15\x03\x03",3, PROTO_SSL3, SMACK_ANCHOR_BEGIN}, {"RFB 003.003\n", 12, PROTO_VNC_RFB, SMACK_ANCHOR_BEGIN}, {"RFB 003.005\n", 12, PROTO_VNC_RFB, SMACK_ANCHOR_BEGIN}, {"RFB 003.007\n", 12, PROTO_VNC_RFB, SMACK_ANCHOR_BEGIN}, {"RFB 003.008\n", 12, PROTO_VNC_RFB, SMACK_ANCHOR_BEGIN}, {"RFB 003.009\n", 12, PROTO_VNC_RFB, SMACK_ANCHOR_BEGIN}, {"RFB 000.000\n", 12, PROTO_VNC_RFB, SMACK_ANCHOR_BEGIN, 1}, /* UltraVNC repeater mode */ {"RFB 003.003\n", 12, PROTO_VNC_RFB, SMACK_ANCHOR_BEGIN, 3}, /* default version for everything */ {"RFB 003.005\n", 12, PROTO_VNC_RFB, SMACK_ANCHOR_BEGIN, 3}, /* broken, same as 003.003 */ {"RFB 003.006\n", 12, PROTO_VNC_RFB, SMACK_ANCHOR_BEGIN, 3}, /* broken, same as 003.003 */ {"RFB 003.007\n", 12, PROTO_VNC_RFB, SMACK_ANCHOR_BEGIN, 7}, {"RFB 003.008\n", 12, PROTO_VNC_RFB, SMACK_ANCHOR_BEGIN, 8}, {"RFB 003.889\n", 12, PROTO_VNC_RFB, SMACK_ANCHOR_BEGIN, 8}, /* Apple's remote desktop, 003.007 */ {"RFB 003.009\n", 12, PROTO_VNC_RFB, SMACK_ANCHOR_BEGIN, 8}, {"RFB 004.000\n", 12, PROTO_VNC_RFB, SMACK_ANCHOR_BEGIN, 8}, /* Intel AMT KVM */ {"RFB 004.001\n", 12, PROTO_VNC_RFB, SMACK_ANCHOR_BEGIN, 8}, /* RealVNC 4.6 */ {"RFB 004.002\n", 12, PROTO_VNC_RFB, SMACK_ANCHOR_BEGIN, 8}, {0,0} }; Loading @@ -57,6 +63,7 @@ banner1_parse( { size_t x; unsigned offset = 0; unsigned proto; switch (tcb_state->app_proto) { Loading @@ -66,8 +73,12 @@ banner1_parse( banner1->smack, &tcb_state->state, px, &offset, (unsigned)length); if (x != SMACK_NOT_FOUND && !(x == PROTO_SSL3 && !tcb_state->is_sent_sslhello)) { if (x != SMACK_NOT_FOUND) proto = patterns[x].id; else proto = 0xFFFFFFFF; if (proto != 0xFFFFFFFF && !(proto == PROTO_SSL3 && !tcb_state->is_sent_sslhello)) { unsigned i; /* re-read the stuff that we missed */ Loading @@ -76,14 +87,17 @@ banner1_parse( /* Kludge: patterns look confusing, so add port info to the * pattern */ switch (x) { switch (proto) { case PROTO_FTP2: if (tcb_state->port == 25 || tcb_state->port == 587) x = PROTO_SMTP; proto = PROTO_SMTP; break; case PROTO_VNC_RFB: tcb_state->sub.vnc.version = patterns[x].extra; break; } tcb_state->app_proto = (unsigned short)x; tcb_state->app_proto = (unsigned short)proto; /* reset the state back again */ tcb_state->state = 0; Loading Loading @@ -187,7 +201,7 @@ banner1_create(void) b->smack, patterns[i].pattern, patterns[i].pattern_length, patterns[i].id, i, patterns[i].is_anchored); smack_compile(b->smack); Loading src/proto-banner1.h +23 Changes for src/proto-banner1.h: 23 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -70,7 +70,28 @@ struct SSLRECORD { }; struct PIXEL_FORMAT { unsigned short red_max; unsigned short green_max; unsigned short blue_max; unsigned char red_shift; unsigned char green_shift; unsigned char blue_shift; unsigned char bits_per_pixel; unsigned char depth; unsigned char big_endian_flag:1; unsigned char true_colour_flag:1; }; struct VNCSTUFF { unsigned sectype; unsigned char version; unsigned char len; unsigned short width; unsigned short height; struct PIXEL_FORMAT pixel; }; struct ProtocolState { unsigned state; Loading @@ -83,6 +104,7 @@ struct ProtocolState { union { struct SSLRECORD ssl; struct VNCSTUFF vnc; } sub; }; Loading Loading @@ -117,6 +139,7 @@ struct Patterns { unsigned pattern_length; unsigned id; unsigned is_anchored; unsigned extra; }; struct Banner1 * Loading Loading
src/main-conf.c +2 Changes for src/main-conf.c: 2 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -1144,6 +1144,8 @@ masscan_set_parameter(struct Masscan *masscan, } else if (EQUALS("connection-timeout", name) || EQUALS("tcp-timeout", name)) { /* The timeout for "banners" TCP connections */ masscan->tcp_connection_timeout = (unsigned)parseInt(value); } else if (EQUALS("hello-timeout", name)) { masscan->tcp_hello_timeout = (unsigned)parseInt(value); } else if (EQUALS("datadir", name)) { strcpy_s(masscan->nmap.datadir, sizeof(masscan->nmap.datadir), value); } else if (EQUALS("data-length", name)) { Loading
src/main.c +8 Changes for src/main.c: 8 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -631,6 +631,14 @@ receive_thread(void *v) strlen(foo), foo); } if (masscan->tcp_hello_timeout) { char foo[64]; sprintf_s(foo, sizeof(foo), "%u", masscan->tcp_connection_timeout); tcpcon_set_parameter( tcpcon, "hello-timeout", strlen(foo), foo); } for (pay = masscan->tcp_payloads; pay; pay = pay->next) { char name[64]; Loading
src/masscan.h +7 Changes for src/masscan.h: 7 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -338,6 +338,13 @@ struct Masscan unsigned http_user_agent_length; unsigned tcp_connection_timeout; /** Number of seconds to wait for a 'hello' from the server before * giving up and sending a 'hello' from the client. Should be a small * value when doing scans that expect client-side hellos, like HTTP or * SSL, but should be a longer value when doing scans that expect server * hellos, such as FTP or VNC */ unsigned tcp_hello_timeout; struct { const char *header_name; unsigned char *header_value; Loading
src/proto-banner1.c +26 −12 Changes for src/proto-banner1.c: 26 added lines, 12 removed lines. Original line number Diff line number Diff line /* 7 state machine for receiving banners state machine for receiving banners */ #include "smack.h" #include "rawsock-pcapfile.h" Loading Loading @@ -34,11 +34,17 @@ struct Patterns patterns[] = { {"\x15\x03\x01",3, PROTO_SSL3, SMACK_ANCHOR_BEGIN}, {"\x15\x03\x02",3, PROTO_SSL3, SMACK_ANCHOR_BEGIN}, {"\x15\x03\x03",3, PROTO_SSL3, SMACK_ANCHOR_BEGIN}, {"RFB 003.003\n", 12, PROTO_VNC_RFB, SMACK_ANCHOR_BEGIN}, {"RFB 003.005\n", 12, PROTO_VNC_RFB, SMACK_ANCHOR_BEGIN}, {"RFB 003.007\n", 12, PROTO_VNC_RFB, SMACK_ANCHOR_BEGIN}, {"RFB 003.008\n", 12, PROTO_VNC_RFB, SMACK_ANCHOR_BEGIN}, {"RFB 003.009\n", 12, PROTO_VNC_RFB, SMACK_ANCHOR_BEGIN}, {"RFB 000.000\n", 12, PROTO_VNC_RFB, SMACK_ANCHOR_BEGIN, 1}, /* UltraVNC repeater mode */ {"RFB 003.003\n", 12, PROTO_VNC_RFB, SMACK_ANCHOR_BEGIN, 3}, /* default version for everything */ {"RFB 003.005\n", 12, PROTO_VNC_RFB, SMACK_ANCHOR_BEGIN, 3}, /* broken, same as 003.003 */ {"RFB 003.006\n", 12, PROTO_VNC_RFB, SMACK_ANCHOR_BEGIN, 3}, /* broken, same as 003.003 */ {"RFB 003.007\n", 12, PROTO_VNC_RFB, SMACK_ANCHOR_BEGIN, 7}, {"RFB 003.008\n", 12, PROTO_VNC_RFB, SMACK_ANCHOR_BEGIN, 8}, {"RFB 003.889\n", 12, PROTO_VNC_RFB, SMACK_ANCHOR_BEGIN, 8}, /* Apple's remote desktop, 003.007 */ {"RFB 003.009\n", 12, PROTO_VNC_RFB, SMACK_ANCHOR_BEGIN, 8}, {"RFB 004.000\n", 12, PROTO_VNC_RFB, SMACK_ANCHOR_BEGIN, 8}, /* Intel AMT KVM */ {"RFB 004.001\n", 12, PROTO_VNC_RFB, SMACK_ANCHOR_BEGIN, 8}, /* RealVNC 4.6 */ {"RFB 004.002\n", 12, PROTO_VNC_RFB, SMACK_ANCHOR_BEGIN, 8}, {0,0} }; Loading @@ -57,6 +63,7 @@ banner1_parse( { size_t x; unsigned offset = 0; unsigned proto; switch (tcb_state->app_proto) { Loading @@ -66,8 +73,12 @@ banner1_parse( banner1->smack, &tcb_state->state, px, &offset, (unsigned)length); if (x != SMACK_NOT_FOUND && !(x == PROTO_SSL3 && !tcb_state->is_sent_sslhello)) { if (x != SMACK_NOT_FOUND) proto = patterns[x].id; else proto = 0xFFFFFFFF; if (proto != 0xFFFFFFFF && !(proto == PROTO_SSL3 && !tcb_state->is_sent_sslhello)) { unsigned i; /* re-read the stuff that we missed */ Loading @@ -76,14 +87,17 @@ banner1_parse( /* Kludge: patterns look confusing, so add port info to the * pattern */ switch (x) { switch (proto) { case PROTO_FTP2: if (tcb_state->port == 25 || tcb_state->port == 587) x = PROTO_SMTP; proto = PROTO_SMTP; break; case PROTO_VNC_RFB: tcb_state->sub.vnc.version = patterns[x].extra; break; } tcb_state->app_proto = (unsigned short)x; tcb_state->app_proto = (unsigned short)proto; /* reset the state back again */ tcb_state->state = 0; Loading Loading @@ -187,7 +201,7 @@ banner1_create(void) b->smack, patterns[i].pattern, patterns[i].pattern_length, patterns[i].id, i, patterns[i].is_anchored); smack_compile(b->smack); Loading
src/proto-banner1.h +23 Changes for src/proto-banner1.h: 23 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -70,7 +70,28 @@ struct SSLRECORD { }; struct PIXEL_FORMAT { unsigned short red_max; unsigned short green_max; unsigned short blue_max; unsigned char red_shift; unsigned char green_shift; unsigned char blue_shift; unsigned char bits_per_pixel; unsigned char depth; unsigned char big_endian_flag:1; unsigned char true_colour_flag:1; }; struct VNCSTUFF { unsigned sectype; unsigned char version; unsigned char len; unsigned short width; unsigned short height; struct PIXEL_FORMAT pixel; }; struct ProtocolState { unsigned state; Loading @@ -83,6 +104,7 @@ struct ProtocolState { union { struct SSLRECORD ssl; struct VNCSTUFF vnc; } sub; }; Loading Loading @@ -117,6 +139,7 @@ struct Patterns { unsigned pattern_length; unsigned id; unsigned is_anchored; unsigned extra; }; struct Banner1 * Loading