Loading src/main-conf.c +12 −2 Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ #include "logger.h" #include "proto-banner1.h" #include "templ-payloads.h" #include "templ-port.h" #include <ctype.h> #include <limits.h> Loading Loading @@ -621,11 +622,19 @@ masscan_set_parameter(struct Masscan *masscan, } else if (EQUALS("exclude-ports", name) || EQUALS("exclude-port", name)) { rangelist_parse_ports(&masscan->exclude_port, value); } else if (EQUALS("arp", name) || EQUALS("arpscan", name)) { /* Add ICMP ping request */ struct Range range; range.begin = Templ_ARP; range.end = Templ_ARP; rangelist_add_range(&masscan->ports, range.begin, range.end); masscan_set_parameter(masscan, "router-mac", "ff-ff-ff-ff-ff-ff"); LOG(5, "--arpscan\n"); } else if (EQUALS("ping", name) || EQUALS("ping-sweep", name)) { /* Add ICMP ping request */ struct Range range; range.begin = 65536*3; range.end = 65536*3; range.begin = Templ_ICMP_echo; range.end = Templ_ICMP_echo; rangelist_add_range(&masscan->ports, range.begin, range.end); LOG(5, "--ping\n"); } else if (EQUALS("range", name) || EQUALS("ranges", name) Loading Loading @@ -964,6 +973,7 @@ is_singleton(const char *name) "send-eth", "send-ip", "iflist", "randomize-hosts", "nmap", "trace-packet", "pfring", "sendq", "banners", "banner", "offline", "ping", "ping-sweep", "arp", 0}; size_t i; Loading src/main-initadapter.c +2 −1 Original line number Diff line number Diff line Loading @@ -39,8 +39,9 @@ masscan_initialize_adapter( else { /* no adapter specified, so find a default one */ int err; ifname2[0] = '\0'; err = rawsock_get_default_interface(ifname2, sizeof(ifname2)); if (err) { if (err || ifname2[0] == '\0') { fprintf(stderr, "FAIL: could not determine default interface\n"); fprintf(stderr, "FAIL:... try \"--interface ethX\"\n"); return -1; Loading src/out-binary.c +18 −15 Original line number Diff line number Diff line #include "output.h" #include "masscan.h" #include "out-record.h" /**************************************************************************** ****************************************************************************/ Loading Loading @@ -43,10 +44,10 @@ binary_out_status(struct Output *out, FILE *fp, int status, unsigned ip, unsigne /* [TYPE] field */ switch (status) { case Port_Open: foo[0] = 1; foo[0] = Out_Open; break; case Port_Closed: foo[0] = 2; foo[0] = Out_Closed; break; default: return; Loading Loading @@ -81,7 +82,7 @@ binary_out_status(struct Output *out, FILE *fp, int status, unsigned ip, unsigne /**************************************************************************** ****************************************************************************/ static void binary_out_banner(struct Output *out, FILE *fp, unsigned ip, unsigned port, binary_out_banner(struct Output *out, FILE *fp, unsigned ip, unsigned ip_proto, unsigned port, unsigned proto, const unsigned char *px, unsigned length) { unsigned char foo[256]; Loading @@ -90,17 +91,17 @@ binary_out_banner(struct Output *out, FILE *fp, unsigned ip, unsigned port, UNUSEDPARM(out); /* [TYPE] field */ foo[0] = 3; /*banner*/ foo[0] = Out_Banner; /*banner*/ /* [LENGTH] field*/ if (length >= 128 * 128 - 12) if (length >= 128 * 128 - 13) return; if (length < 128 - 12) { foo[1] = (unsigned char)(length + 12); if (length < 128 - 13) { foo[1] = (unsigned char)(length + 13); i = 2; } else { foo[1] = (unsigned char)((length + 12)>>7) | 0x80; foo[2] = (unsigned char)((length + 12) & 0x7F); foo[1] = (unsigned char)((length + 13)>>7) | 0x80; foo[2] = (unsigned char)((length + 13) & 0x7F); i = 3; } Loading @@ -115,17 +116,19 @@ binary_out_banner(struct Output *out, FILE *fp, unsigned ip, unsigned port, foo[i+6] = (unsigned char)(ip>> 8); foo[i+7] = (unsigned char)(ip>> 0); foo[i+8] = (unsigned char)(port>>8); foo[i+9] = (unsigned char)(port>>0); foo[i+8] = (unsigned char)(ip_proto); foo[i+10] = (unsigned char)(proto>>8); foo[i+11] = (unsigned char)(proto>>0); foo[i+ 9] = (unsigned char)(port>>8); foo[i+10] = (unsigned char)(port>>0); foo[i+11] = (unsigned char)(proto>>8); foo[i+12] = (unsigned char)(proto>>0); /* Banner */ memcpy(foo+i+12, px, length); memcpy(foo+i+13, px, length); fwrite(&foo, 1, length+i+12, fp); fwrite(&foo, 1, length+i+13, fp); } Loading src/out-null.c +2 −1 Original line number Diff line number Diff line Loading @@ -38,12 +38,13 @@ null_out_status(struct Output *out, FILE *fp, /**************************************************************************** ****************************************************************************/ static void null_out_banner(struct Output *out, FILE *fp, unsigned ip, unsigned port, null_out_banner(struct Output *out, FILE *fp, unsigned ip, unsigned ip_proto, unsigned port, unsigned proto, const unsigned char *px, unsigned length) { UNUSEDPARM(out); UNUSEDPARM(fp); UNUSEDPARM(ip); UNUSEDPARM(ip_proto); UNUSEDPARM(port); UNUSEDPARM(proto); UNUSEDPARM(px); Loading src/out-record.h 0 → 100644 +9 −0 Original line number Diff line number Diff line #ifndef OUT_RECORD_H #define OUT_RECORD_H enum OutputRecordType { Out_Open = 1, Out_Closed = 2, Out_Banner = 5, }; #endif No newline at end of file Loading
src/main-conf.c +12 −2 Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ #include "logger.h" #include "proto-banner1.h" #include "templ-payloads.h" #include "templ-port.h" #include <ctype.h> #include <limits.h> Loading Loading @@ -621,11 +622,19 @@ masscan_set_parameter(struct Masscan *masscan, } else if (EQUALS("exclude-ports", name) || EQUALS("exclude-port", name)) { rangelist_parse_ports(&masscan->exclude_port, value); } else if (EQUALS("arp", name) || EQUALS("arpscan", name)) { /* Add ICMP ping request */ struct Range range; range.begin = Templ_ARP; range.end = Templ_ARP; rangelist_add_range(&masscan->ports, range.begin, range.end); masscan_set_parameter(masscan, "router-mac", "ff-ff-ff-ff-ff-ff"); LOG(5, "--arpscan\n"); } else if (EQUALS("ping", name) || EQUALS("ping-sweep", name)) { /* Add ICMP ping request */ struct Range range; range.begin = 65536*3; range.end = 65536*3; range.begin = Templ_ICMP_echo; range.end = Templ_ICMP_echo; rangelist_add_range(&masscan->ports, range.begin, range.end); LOG(5, "--ping\n"); } else if (EQUALS("range", name) || EQUALS("ranges", name) Loading Loading @@ -964,6 +973,7 @@ is_singleton(const char *name) "send-eth", "send-ip", "iflist", "randomize-hosts", "nmap", "trace-packet", "pfring", "sendq", "banners", "banner", "offline", "ping", "ping-sweep", "arp", 0}; size_t i; Loading
src/main-initadapter.c +2 −1 Original line number Diff line number Diff line Loading @@ -39,8 +39,9 @@ masscan_initialize_adapter( else { /* no adapter specified, so find a default one */ int err; ifname2[0] = '\0'; err = rawsock_get_default_interface(ifname2, sizeof(ifname2)); if (err) { if (err || ifname2[0] == '\0') { fprintf(stderr, "FAIL: could not determine default interface\n"); fprintf(stderr, "FAIL:... try \"--interface ethX\"\n"); return -1; Loading
src/out-binary.c +18 −15 Original line number Diff line number Diff line #include "output.h" #include "masscan.h" #include "out-record.h" /**************************************************************************** ****************************************************************************/ Loading Loading @@ -43,10 +44,10 @@ binary_out_status(struct Output *out, FILE *fp, int status, unsigned ip, unsigne /* [TYPE] field */ switch (status) { case Port_Open: foo[0] = 1; foo[0] = Out_Open; break; case Port_Closed: foo[0] = 2; foo[0] = Out_Closed; break; default: return; Loading Loading @@ -81,7 +82,7 @@ binary_out_status(struct Output *out, FILE *fp, int status, unsigned ip, unsigne /**************************************************************************** ****************************************************************************/ static void binary_out_banner(struct Output *out, FILE *fp, unsigned ip, unsigned port, binary_out_banner(struct Output *out, FILE *fp, unsigned ip, unsigned ip_proto, unsigned port, unsigned proto, const unsigned char *px, unsigned length) { unsigned char foo[256]; Loading @@ -90,17 +91,17 @@ binary_out_banner(struct Output *out, FILE *fp, unsigned ip, unsigned port, UNUSEDPARM(out); /* [TYPE] field */ foo[0] = 3; /*banner*/ foo[0] = Out_Banner; /*banner*/ /* [LENGTH] field*/ if (length >= 128 * 128 - 12) if (length >= 128 * 128 - 13) return; if (length < 128 - 12) { foo[1] = (unsigned char)(length + 12); if (length < 128 - 13) { foo[1] = (unsigned char)(length + 13); i = 2; } else { foo[1] = (unsigned char)((length + 12)>>7) | 0x80; foo[2] = (unsigned char)((length + 12) & 0x7F); foo[1] = (unsigned char)((length + 13)>>7) | 0x80; foo[2] = (unsigned char)((length + 13) & 0x7F); i = 3; } Loading @@ -115,17 +116,19 @@ binary_out_banner(struct Output *out, FILE *fp, unsigned ip, unsigned port, foo[i+6] = (unsigned char)(ip>> 8); foo[i+7] = (unsigned char)(ip>> 0); foo[i+8] = (unsigned char)(port>>8); foo[i+9] = (unsigned char)(port>>0); foo[i+8] = (unsigned char)(ip_proto); foo[i+10] = (unsigned char)(proto>>8); foo[i+11] = (unsigned char)(proto>>0); foo[i+ 9] = (unsigned char)(port>>8); foo[i+10] = (unsigned char)(port>>0); foo[i+11] = (unsigned char)(proto>>8); foo[i+12] = (unsigned char)(proto>>0); /* Banner */ memcpy(foo+i+12, px, length); memcpy(foo+i+13, px, length); fwrite(&foo, 1, length+i+12, fp); fwrite(&foo, 1, length+i+13, fp); } Loading
src/out-null.c +2 −1 Original line number Diff line number Diff line Loading @@ -38,12 +38,13 @@ null_out_status(struct Output *out, FILE *fp, /**************************************************************************** ****************************************************************************/ static void null_out_banner(struct Output *out, FILE *fp, unsigned ip, unsigned port, null_out_banner(struct Output *out, FILE *fp, unsigned ip, unsigned ip_proto, unsigned port, unsigned proto, const unsigned char *px, unsigned length) { UNUSEDPARM(out); UNUSEDPARM(fp); UNUSEDPARM(ip); UNUSEDPARM(ip_proto); UNUSEDPARM(port); UNUSEDPARM(proto); UNUSEDPARM(px); Loading
src/out-record.h 0 → 100644 +9 −0 Original line number Diff line number Diff line #ifndef OUT_RECORD_H #define OUT_RECORD_H enum OutputRecordType { Out_Open = 1, Out_Closed = 2, Out_Banner = 5, }; #endif No newline at end of file