Loading src/main-conf.c +5 −0 Original line number Diff line number Diff line Loading @@ -1256,7 +1256,12 @@ masscan_command_line(struct Masscan *masscan, int argc, char *argv[]) if (strcmp(argv[i], "--help") == 0) masscan_help(); else if (EQUALS("readscan", argv[i]+2)) { /* Read in a binary file instead of scanning the network*/ masscan->op = Operation_ReadScan; /* This option may be followed by many filenames, therefore, * skip forward in the argument list until the next * argument */ while (i+1 < argc && argv[i+1][0] != '-') i++; continue; Loading src/output.c +2 −1 Original line number Diff line number Diff line Loading @@ -529,7 +529,8 @@ output_report_banner(struct Output *out, time_t now, const struct Masscan *masscan = out->masscan; FILE *fp = out->fp; if (!out->is_banner) return; if (masscan->is_interactive) { unsigned count; Loading src/output.h +1 −0 Original line number Diff line number Diff line Loading @@ -29,6 +29,7 @@ struct Output const struct OutputType *funcs; time_t next_rotate; time_t last_rotate; unsigned is_banner:1; unsigned period; unsigned offset; struct { Loading src/proto-arp.c +3 −0 Original line number Diff line number Diff line Loading @@ -7,6 +7,9 @@ /*************************************************************************** * Process an ARP packet received in response to an ARP-scan. ***************************************************************************/ void handle_arp(struct Output *out, time_t timestamp, const unsigned char *px, unsigned length, struct PreprocessedInfo *parsed) Loading src/proto-dns.c +23 −4 Original line number Diff line number Diff line Loading @@ -161,6 +161,7 @@ dns_extract_name(const unsigned char px[], unsigned offset, unsigned max, struct } } /**************************************************************************** ****************************************************************************/ void Loading Loading @@ -312,17 +313,35 @@ proto_dns_parse(struct DNS_Incoming *dns, const unsigned char px[], unsigned off return; } /*************************************************************************** * Set the "syn-cookie" style information so that we can validate replies * match a valid request. We don't hold "state" on the requests, so this * becomes a hash of the port/IP information. * DNS has a two-byte "transaction id" field, so we can't use the full * cookie, just the lower two bytes of it. * Below in "handle_dns", we validate that the cookie is correct. ***************************************************************************/ unsigned dns_set_cookie(unsigned char *px, size_t length, uint64_t seqno) dns_set_cookie(unsigned char *px, size_t length, uint64_t cookie) { if (length > 2) { px[0] = (unsigned char)(seqno >> 8); px[1] = (unsigned char)(seqno >> 0); return seqno & 0xFFFF; px[0] = (unsigned char)(cookie >> 8); px[1] = (unsigned char)(cookie >> 0); return cookie & 0xFFFF; } else return 0; } /*************************************************************************** * Process a DNS packet received in response to UDP probes to port 53. * This function has three main tasks: * - parse the DNS protocol, and make sure it's valid DNS. * - make sure that the DNS response matches a valid request using * the "syn-cookie" approach. * - parse the "version.bind" response and report it as the version * string for the banner. ***************************************************************************/ unsigned handle_dns(struct Output *out, time_t timestamp, const unsigned char *px, unsigned length, struct PreprocessedInfo *parsed) { Loading Loading
src/main-conf.c +5 −0 Original line number Diff line number Diff line Loading @@ -1256,7 +1256,12 @@ masscan_command_line(struct Masscan *masscan, int argc, char *argv[]) if (strcmp(argv[i], "--help") == 0) masscan_help(); else if (EQUALS("readscan", argv[i]+2)) { /* Read in a binary file instead of scanning the network*/ masscan->op = Operation_ReadScan; /* This option may be followed by many filenames, therefore, * skip forward in the argument list until the next * argument */ while (i+1 < argc && argv[i+1][0] != '-') i++; continue; Loading
src/output.c +2 −1 Original line number Diff line number Diff line Loading @@ -529,7 +529,8 @@ output_report_banner(struct Output *out, time_t now, const struct Masscan *masscan = out->masscan; FILE *fp = out->fp; if (!out->is_banner) return; if (masscan->is_interactive) { unsigned count; Loading
src/output.h +1 −0 Original line number Diff line number Diff line Loading @@ -29,6 +29,7 @@ struct Output const struct OutputType *funcs; time_t next_rotate; time_t last_rotate; unsigned is_banner:1; unsigned period; unsigned offset; struct { Loading
src/proto-arp.c +3 −0 Original line number Diff line number Diff line Loading @@ -7,6 +7,9 @@ /*************************************************************************** * Process an ARP packet received in response to an ARP-scan. ***************************************************************************/ void handle_arp(struct Output *out, time_t timestamp, const unsigned char *px, unsigned length, struct PreprocessedInfo *parsed) Loading
src/proto-dns.c +23 −4 Original line number Diff line number Diff line Loading @@ -161,6 +161,7 @@ dns_extract_name(const unsigned char px[], unsigned offset, unsigned max, struct } } /**************************************************************************** ****************************************************************************/ void Loading Loading @@ -312,17 +313,35 @@ proto_dns_parse(struct DNS_Incoming *dns, const unsigned char px[], unsigned off return; } /*************************************************************************** * Set the "syn-cookie" style information so that we can validate replies * match a valid request. We don't hold "state" on the requests, so this * becomes a hash of the port/IP information. * DNS has a two-byte "transaction id" field, so we can't use the full * cookie, just the lower two bytes of it. * Below in "handle_dns", we validate that the cookie is correct. ***************************************************************************/ unsigned dns_set_cookie(unsigned char *px, size_t length, uint64_t seqno) dns_set_cookie(unsigned char *px, size_t length, uint64_t cookie) { if (length > 2) { px[0] = (unsigned char)(seqno >> 8); px[1] = (unsigned char)(seqno >> 0); return seqno & 0xFFFF; px[0] = (unsigned char)(cookie >> 8); px[1] = (unsigned char)(cookie >> 0); return cookie & 0xFFFF; } else return 0; } /*************************************************************************** * Process a DNS packet received in response to UDP probes to port 53. * This function has three main tasks: * - parse the DNS protocol, and make sure it's valid DNS. * - make sure that the DNS response matches a valid request using * the "syn-cookie" approach. * - parse the "version.bind" response and report it as the version * string for the banner. ***************************************************************************/ unsigned handle_dns(struct Output *out, time_t timestamp, const unsigned char *px, unsigned length, struct PreprocessedInfo *parsed) { Loading