Skip to content

Commit

Permalink
--readrange
Browse files Browse the repository at this point in the history
  • Loading branch information
robertdavidgraham committed Feb 3, 2014
1 parent 489051c commit 2138cf3
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/main-conf.c
Original file line number Diff line number Diff line change
Expand Up @@ -1376,6 +1376,8 @@ masscan_set_parameter(struct Masscan *masscan,
} else if (EQUALS("randomize-hosts", name)) {
/* already do that */
;
} else if (EQUALS("readrange", name) || EQUALS("readranges", name)) {
masscan->op = Operation_ReadRange;
} else if (EQUALS("reason", name)) {
masscan->output.is_reason = 1;
} else if (EQUALS("redis", name)) {
Expand Down Expand Up @@ -1584,6 +1586,7 @@ is_singleton(const char *name)
"banners", "banner", "nobanners", "nobanner",
"offline", "ping", "ping-sweep",
"arp", "infinite", "interactive",
"read-range", "read-ranges", "readrange", "read-ranges",
0};
size_t i;

Expand Down Expand Up @@ -1646,9 +1649,9 @@ masscan_command_line(struct Masscan *masscan, int argc, char *argv[])
* -- name value
*/
if (argv[i][0] == '-' && argv[i][1] == '-') {
if (strcmp(argv[i], "--help") == 0)
if (strcmp(argv[i], "--help") == 0) {
masscan_help();
else if (EQUALS("readscan", argv[i]+2)) {
} else if (EQUALS("readscan", argv[i]+2)) {
/* Read in a binary file instead of scanning the network*/
masscan->op = Operation_ReadScan;

Expand Down
5 changes: 5 additions & 0 deletions src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
#include "pixie-backtrace.h"
#include "proto-sctp.h"
#include "script.h"
#include "main-readrange.h"

#include <assert.h>
#include <limits.h>
Expand Down Expand Up @@ -1494,6 +1495,10 @@ int main(int argc, char *argv[])
rawsock_selftest_if(masscan->nic[i].ifname);
return 0;

case Operation_ReadRange:
main_readrange(masscan);
return 0;

case Operation_ReadScan:
{
unsigned start;
Expand Down
1 change: 1 addition & 0 deletions src/masscan.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ enum Operation {
Operation_DebugIF = 4, /* --debug if */
Operation_ListScan = 5, /* -sL */
Operation_ReadScan = 6, /* --readscan <binary-output> */
Operation_ReadRange = 7, /* --readrange */
};

/**
Expand Down
2 changes: 2 additions & 0 deletions vs10/masscan.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
<ClCompile Include="..\src\event-timeout.c" />
<ClCompile Include="..\src\main-listscan.c" />
<ClCompile Include="..\src\main-ptrace.c" />
<ClCompile Include="..\src\main-readrange.c" />
<ClCompile Include="..\src\main-src.c" />
<ClCompile Include="..\src\in-binary.c" />
<ClCompile Include="..\src\masscan-app.c" />
Expand Down Expand Up @@ -95,6 +96,7 @@
<ClInclude Include="..\src\logger.h" />
<ClInclude Include="..\src\main-dedup.h" />
<ClInclude Include="..\src\main-ptrace.h" />
<ClInclude Include="..\src\main-readrange.h" />
<ClInclude Include="..\src\main-src.h" />
<ClInclude Include="..\src\main-status.h" />
<ClInclude Include="..\src\main-throttle.h" />
Expand Down
6 changes: 6 additions & 0 deletions vs10/masscan.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,9 @@
<ClCompile Include="..\src\main-status.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\src\main-readrange.c">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\src\proto-arp.h">
Expand Down Expand Up @@ -410,6 +413,9 @@
<ClInclude Include="..\src\main-status.h">
<Filter>Source Files\misc</Filter>
</ClInclude>
<ClInclude Include="..\src\main-readrange.h">
<Filter>Source Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<None Include="..\README.md" />
Expand Down

0 comments on commit 2138cf3

Please sign in to comment.