Loading Makefile +1 −1 Original line number Diff line number Diff line Loading @@ -7,7 +7,7 @@ SYS := $(shell gcc -dumpmachine) # environment where things likely will work -- as well as anything # works on the bajillion of different Linux environments ifneq (, $(findstring linux, $(SYS))) LIBS = -lpcap -lm -lrt -rdynamic LIBS = -lpcap -lm -lrt -ldl -rdynamic INCLUDES = -I. -I../PF_RING/userland/lib endif Loading README.md +17 −13 Original line number Diff line number Diff line Loading @@ -25,19 +25,23 @@ On Debian/Ubuntu, it goes something like this: $ make $ make regresss This puts the program in the 'bin' subdirectory. On Windows, use the VisualStudio 2010 project. On Mac OS X, once you've installed a developer environment, you should be able to likewise just "make; make regress". Detecting the network adapter is currently broken, so you'll get errors telling you what to manually configure when running the program. On BSD's, it oughta be close to working, but I haven't tried it yet. I'd like to see what 'netmap' can do with it -- in theory should be a lot faster than Linux. This puts the program in the `masscan\bin` subdirectory. * Windows: use the Visual Studio 2010 project in the `vs10` subdirectory * Windows: MingGW should work * Windows: cygwin shouldn't work * Mac OS X: once you install the development tools, just `make` * FreeBSD: doesn't work, probably, but I'm hoping to get around to it * other: won't work, don't care The code works with PF_RING. There are no special build instructions. After (or before) building this project, follow the PF_RING directions to install. Run Masscan with the `--pfring` option, and it will go try to use PF_RING instead of libpcap. If it can't find the driver (`pf_ring`) or the shared library (`/usr/lib/libpfring.so`), it'll warn you. For me, even `make install` didn't install things, so I had to manually install the kernel drivers and shared library. With the PF_RING-customized driver `ixgbe` on an Intel 10gbps network card, this program runs at 12-million packets/second. # Regression testing Loading src/main-conf.c +5 −1 Original line number Diff line number Diff line Loading @@ -623,6 +623,10 @@ masscan_set_parameter(struct Masscan *masscan, const char *name, const char *val } else if (EQUALS("privileged", name) || EQUALS("unprivileged", name)) { fprintf(stderr, "nmap(%s): unsupported\n", name); exit(1); } else if (EQUALS("pfring", name)) { masscan->is_pfring = 1; } else if (EQUALS("sendq", name)) { masscan->is_sendq = 1; } else if (EQUALS("port-ratio", name)) { fprintf(stderr, "nmap(%s): unsupported\n", name); exit(1); Loading Loading @@ -729,7 +733,7 @@ is_singleton(const char *name) "log-errors", "append-output", "webxml", "no-stylesheet", "no-stylesheet", "send-eth", "send-ip", "iflist", "randomize-hosts", "nmap", "trace-packet", "nmap", "trace-packet", "pfring", "sendq", 0}; size_t i; Loading src/main.c +14 −4 Original line number Diff line number Diff line Loading @@ -28,7 +28,7 @@ static unsigned control_c_pressed = 0; unsigned control_c_pressed = 0; Loading Loading @@ -245,7 +245,7 @@ initialize_adapter(struct Masscan *masscan, * Once we've figured out which adapter to use, we now need to * turn it on. */ masscan->adapter = rawsock_init_adapter(ifname); masscan->adapter = rawsock_init_adapter(ifname, masscan->is_pfring, masscan->is_sendq); if (masscan->adapter == 0) { fprintf(stderr, "adapter[%s].init: failed\n", ifname); return -1; Loading Loading @@ -567,8 +567,6 @@ int main(int argc, char *argv[]) /* We need to do a separate "raw socket" initialization step */ rawsock_init(); /* Loading @@ -579,8 +577,19 @@ int main(int argc, char *argv[]) masscan->max_rate = 100.0; /* initialize: max rate = hundred packets-per-second */ masscan->adapter_port = 0x10000; /* value not set */ masscan_command_line(masscan, argc, argv); LOG(3, "\n====== MASSCAN ======\n"); /* We need to do a separate "raw socket" initialization step. This is * for Windows and PF_RING. */ rawsock_init(); /* * Apply excludes */ Loading @@ -601,6 +610,7 @@ int main(int argc, char *argv[]) } /* * Once we've read in the configuration, do the operation that was * specified Loading src/masscan.h +2 −0 Original line number Diff line number Diff line Loading @@ -103,6 +103,8 @@ struct Masscan char filename[256]; char stylesheet[256]; } nmap; unsigned is_pfring:1; unsigned is_sendq:1; struct { Loading Loading
Makefile +1 −1 Original line number Diff line number Diff line Loading @@ -7,7 +7,7 @@ SYS := $(shell gcc -dumpmachine) # environment where things likely will work -- as well as anything # works on the bajillion of different Linux environments ifneq (, $(findstring linux, $(SYS))) LIBS = -lpcap -lm -lrt -rdynamic LIBS = -lpcap -lm -lrt -ldl -rdynamic INCLUDES = -I. -I../PF_RING/userland/lib endif Loading
README.md +17 −13 Original line number Diff line number Diff line Loading @@ -25,19 +25,23 @@ On Debian/Ubuntu, it goes something like this: $ make $ make regresss This puts the program in the 'bin' subdirectory. On Windows, use the VisualStudio 2010 project. On Mac OS X, once you've installed a developer environment, you should be able to likewise just "make; make regress". Detecting the network adapter is currently broken, so you'll get errors telling you what to manually configure when running the program. On BSD's, it oughta be close to working, but I haven't tried it yet. I'd like to see what 'netmap' can do with it -- in theory should be a lot faster than Linux. This puts the program in the `masscan\bin` subdirectory. * Windows: use the Visual Studio 2010 project in the `vs10` subdirectory * Windows: MingGW should work * Windows: cygwin shouldn't work * Mac OS X: once you install the development tools, just `make` * FreeBSD: doesn't work, probably, but I'm hoping to get around to it * other: won't work, don't care The code works with PF_RING. There are no special build instructions. After (or before) building this project, follow the PF_RING directions to install. Run Masscan with the `--pfring` option, and it will go try to use PF_RING instead of libpcap. If it can't find the driver (`pf_ring`) or the shared library (`/usr/lib/libpfring.so`), it'll warn you. For me, even `make install` didn't install things, so I had to manually install the kernel drivers and shared library. With the PF_RING-customized driver `ixgbe` on an Intel 10gbps network card, this program runs at 12-million packets/second. # Regression testing Loading
src/main-conf.c +5 −1 Original line number Diff line number Diff line Loading @@ -623,6 +623,10 @@ masscan_set_parameter(struct Masscan *masscan, const char *name, const char *val } else if (EQUALS("privileged", name) || EQUALS("unprivileged", name)) { fprintf(stderr, "nmap(%s): unsupported\n", name); exit(1); } else if (EQUALS("pfring", name)) { masscan->is_pfring = 1; } else if (EQUALS("sendq", name)) { masscan->is_sendq = 1; } else if (EQUALS("port-ratio", name)) { fprintf(stderr, "nmap(%s): unsupported\n", name); exit(1); Loading Loading @@ -729,7 +733,7 @@ is_singleton(const char *name) "log-errors", "append-output", "webxml", "no-stylesheet", "no-stylesheet", "send-eth", "send-ip", "iflist", "randomize-hosts", "nmap", "trace-packet", "nmap", "trace-packet", "pfring", "sendq", 0}; size_t i; Loading
src/main.c +14 −4 Original line number Diff line number Diff line Loading @@ -28,7 +28,7 @@ static unsigned control_c_pressed = 0; unsigned control_c_pressed = 0; Loading Loading @@ -245,7 +245,7 @@ initialize_adapter(struct Masscan *masscan, * Once we've figured out which adapter to use, we now need to * turn it on. */ masscan->adapter = rawsock_init_adapter(ifname); masscan->adapter = rawsock_init_adapter(ifname, masscan->is_pfring, masscan->is_sendq); if (masscan->adapter == 0) { fprintf(stderr, "adapter[%s].init: failed\n", ifname); return -1; Loading Loading @@ -567,8 +567,6 @@ int main(int argc, char *argv[]) /* We need to do a separate "raw socket" initialization step */ rawsock_init(); /* Loading @@ -579,8 +577,19 @@ int main(int argc, char *argv[]) masscan->max_rate = 100.0; /* initialize: max rate = hundred packets-per-second */ masscan->adapter_port = 0x10000; /* value not set */ masscan_command_line(masscan, argc, argv); LOG(3, "\n====== MASSCAN ======\n"); /* We need to do a separate "raw socket" initialization step. This is * for Windows and PF_RING. */ rawsock_init(); /* * Apply excludes */ Loading @@ -601,6 +610,7 @@ int main(int argc, char *argv[]) } /* * Once we've read in the configuration, do the operation that was * specified Loading
src/masscan.h +2 −0 Original line number Diff line number Diff line Loading @@ -103,6 +103,8 @@ struct Masscan char filename[256]; char stylesheet[256]; } nmap; unsigned is_pfring:1; unsigned is_sendq:1; struct { Loading