Loading src/in-binary.c +12 −6 Original line number Diff line number Diff line /* Read in the binary file produced by "out-binary.c". This allows you to translate the binary format into something more easily parsed, such as the XML or JSON formats. translate the "binary" format into any of the other output formats. */ #include "in-binary.h" #include "masscan.h" #include "masscan-app.h" #include "masscan-status.h" #include "main-globals.h" #include "output.h" #include "string_s.h" Loading Loading @@ -251,15 +251,20 @@ end: } /*************************************************************************** ***************************************************************************/ /***************************************************************************** * When masscan is called with the "--readscan" parameter, it doesn't * do a scan of the live network, but instead reads scan results from * a file. Those scan results can then be written out in any of the * other formats. This preserves the original timestamps. *****************************************************************************/ void convert_binary_files(struct Masscan *masscan, int arg_first, int arg_max, char *argv[]) convert_binary_files(struct Masscan *masscan, int arg_first, int arg_max, char *argv[]) { struct Output *out; int i; out = output_create(masscan); out = output_create(masscan, 0); for (i=arg_first; i<arg_max; i++) { parse_file(out, argv[i]); Loading @@ -268,3 +273,4 @@ convert_binary_files(struct Masscan *masscan, int arg_first, int arg_max, char * output_destroy(out); } src/main.c +9 −4 Original line number Diff line number Diff line Loading @@ -16,7 +16,7 @@ to make this file relative "flat" this way so that everything is visible. */ #include "masscan.h" #include "masscan-status.h" /* open or closed */ #include "rand-blackrock.h" /* the BlackRock shuffling func */ #include "rand-lcg.h" /* the LCG randomization func */ #include "templ-pkt.h" /* packet template, that we use to send */ Loading Loading @@ -107,6 +107,9 @@ struct ThreadPair { * The index of the network adapter that we are using for this * thread-pair. This is an index into the "masscan->nic[]" * array. * * NOTE: this is also the "thread-id", because we create one * transmit/receive thread pair per NIC. */ unsigned nic_index; Loading Loading @@ -528,14 +531,15 @@ receive_thread(void *v) * strange things people send us. Note that we don't record transmitted * packets, just the packets we've received. */ /*if (masscan->pcap_filename[0]) pcapfile = pcapfile_openwrite(masscan->pcap_filename, 1);*/ if (masscan->pcap_filename[0]) { pcapfile = pcapfile_openwrite(masscan->pcap_filename, 1); } /* * Open output. This is where results are reported when saving * the --output-format to the --output-filename */ out = output_create(masscan); out = output_create(masscan, parms->nic_index); /* * Create deduplication table. This is so when somebody sends us Loading Loading @@ -1371,6 +1375,7 @@ int main(int argc, char *argv[]) */ { int x = 0; x += output_selftest(); x += siphash24_selftest(); x += snmp_selftest(); x += payloads_selftest(); Loading src/masscan-status.h 0 → 100644 +15 −0 Original line number Diff line number Diff line #ifndef MASSCAN_STATUS_H #define MASSCAN_STATUS_H enum PortStatus { Port_Unknown, Port_Open, Port_Closed, Port_IcmpEchoResponse, Port_UdpOpen, Port_UdpClosed, Port_ArpOpen, }; #endif src/masscan.h +1 −9 Original line number Diff line number Diff line Loading @@ -39,15 +39,6 @@ enum OutpuFormat { }; enum PortStatus { Port_Unknown, Port_Open, Port_Closed, Port_IcmpEchoResponse, Port_UdpOpen, Port_UdpClosed, Port_ArpOpen, }; struct Masscan { Loading Loading @@ -101,6 +92,7 @@ struct Masscan unsigned is_offline:1; /* --offline */ unsigned is_interactive:1; /* --interactive */ unsigned is_arp:1; /* --arp */ unsigned is_gmt:1; /* --gmt, all times in GMT */ /** * Wait forever for responses, instead of the default 10 seconds Loading src/out-binary.c +2 −1 Original line number Diff line number Diff line #include "output.h" #include "masscan.h" #include "masscan-app.h" #include "masscan-status.h" #include "out-record.h" #include "string_s.h" /**************************************************************************** ****************************************************************************/ Loading Loading
src/in-binary.c +12 −6 Original line number Diff line number Diff line /* Read in the binary file produced by "out-binary.c". This allows you to translate the binary format into something more easily parsed, such as the XML or JSON formats. translate the "binary" format into any of the other output formats. */ #include "in-binary.h" #include "masscan.h" #include "masscan-app.h" #include "masscan-status.h" #include "main-globals.h" #include "output.h" #include "string_s.h" Loading Loading @@ -251,15 +251,20 @@ end: } /*************************************************************************** ***************************************************************************/ /***************************************************************************** * When masscan is called with the "--readscan" parameter, it doesn't * do a scan of the live network, but instead reads scan results from * a file. Those scan results can then be written out in any of the * other formats. This preserves the original timestamps. *****************************************************************************/ void convert_binary_files(struct Masscan *masscan, int arg_first, int arg_max, char *argv[]) convert_binary_files(struct Masscan *masscan, int arg_first, int arg_max, char *argv[]) { struct Output *out; int i; out = output_create(masscan); out = output_create(masscan, 0); for (i=arg_first; i<arg_max; i++) { parse_file(out, argv[i]); Loading @@ -268,3 +273,4 @@ convert_binary_files(struct Masscan *masscan, int arg_first, int arg_max, char * output_destroy(out); }
src/main.c +9 −4 Original line number Diff line number Diff line Loading @@ -16,7 +16,7 @@ to make this file relative "flat" this way so that everything is visible. */ #include "masscan.h" #include "masscan-status.h" /* open or closed */ #include "rand-blackrock.h" /* the BlackRock shuffling func */ #include "rand-lcg.h" /* the LCG randomization func */ #include "templ-pkt.h" /* packet template, that we use to send */ Loading Loading @@ -107,6 +107,9 @@ struct ThreadPair { * The index of the network adapter that we are using for this * thread-pair. This is an index into the "masscan->nic[]" * array. * * NOTE: this is also the "thread-id", because we create one * transmit/receive thread pair per NIC. */ unsigned nic_index; Loading Loading @@ -528,14 +531,15 @@ receive_thread(void *v) * strange things people send us. Note that we don't record transmitted * packets, just the packets we've received. */ /*if (masscan->pcap_filename[0]) pcapfile = pcapfile_openwrite(masscan->pcap_filename, 1);*/ if (masscan->pcap_filename[0]) { pcapfile = pcapfile_openwrite(masscan->pcap_filename, 1); } /* * Open output. This is where results are reported when saving * the --output-format to the --output-filename */ out = output_create(masscan); out = output_create(masscan, parms->nic_index); /* * Create deduplication table. This is so when somebody sends us Loading Loading @@ -1371,6 +1375,7 @@ int main(int argc, char *argv[]) */ { int x = 0; x += output_selftest(); x += siphash24_selftest(); x += snmp_selftest(); x += payloads_selftest(); Loading
src/masscan-status.h 0 → 100644 +15 −0 Original line number Diff line number Diff line #ifndef MASSCAN_STATUS_H #define MASSCAN_STATUS_H enum PortStatus { Port_Unknown, Port_Open, Port_Closed, Port_IcmpEchoResponse, Port_UdpOpen, Port_UdpClosed, Port_ArpOpen, }; #endif
src/masscan.h +1 −9 Original line number Diff line number Diff line Loading @@ -39,15 +39,6 @@ enum OutpuFormat { }; enum PortStatus { Port_Unknown, Port_Open, Port_Closed, Port_IcmpEchoResponse, Port_UdpOpen, Port_UdpClosed, Port_ArpOpen, }; struct Masscan { Loading Loading @@ -101,6 +92,7 @@ struct Masscan unsigned is_offline:1; /* --offline */ unsigned is_interactive:1; /* --interactive */ unsigned is_arp:1; /* --arp */ unsigned is_gmt:1; /* --gmt, all times in GMT */ /** * Wait forever for responses, instead of the default 10 seconds Loading
src/out-binary.c +2 −1 Original line number Diff line number Diff line #include "output.h" #include "masscan.h" #include "masscan-app.h" #include "masscan-status.h" #include "out-record.h" #include "string_s.h" /**************************************************************************** ****************************************************************************/ Loading