Commit 8439cfb0 authored by robertdavidgraham's avatar robertdavidgraham
Browse files
parents f08441c9 c8127a29
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -170,8 +170,9 @@ parameter `-oX <filename>`. Or, use the parameters `--output-format xml` and

The second is the binary format. This produces much smaller files, so that
when I scan the Internet my disk doesn't fill up. They need to be parsed,
though. In the `util` subdirectory there is a program `scan2text.c` that will
scan in the binary format and produce text.
though. The command line option `--readscan` will read binary scan files.
Using `--readscan` with the `-oX` option will produce a XML version of the 
results file.


## Comparison with Nmap
+4 −1
Original line number Diff line number Diff line
@@ -138,7 +138,10 @@ masscan <ip addresses/ranges> \-p \fIports\fR \fIoptions\fR
\fB\-oX <filename>\fR: sets the output format to XML and saves the output in the given filename\. This is equivelent to using the \fB\-\-output\-format\fR and \fB\-\-output\-filename\fR parameters\.
.
.IP "\(bu" 4
\fB\-oB <filename>\fR: sets the output format to binary and saves the output in the given filename\. This is equivelent to using the \fB\-\-output\-format\fR and \fB\-\-output\-filename\fR parameters\. The tool \fBscan2text\fR can then be used to read the binary file\. Binary files are mush smaller than their XML equivelents, but require a separate step to convert back into XML or another readable format\.
\fB\-oB <filename>\fR: sets the output format to binary and saves the output in the given filename\. This is equivelent to using the \fB\-\-output\-format\fR and \fB\-\-output\-filename\fR parameters\. The option \fB\-\-readscan\fR can then be used to read the binary file\. Binary files are mush smaller than their XML equivelents, but require a separate step to convert back into XML or another readable format\.
.
.IP "\(bu" 4
\fB\-\-readscan <filename>\fR: reads the binary scan results and displays to console\. If used with \fB\-oX a XML version of the binary file will be created\.
.
.IP "" 0
.
+12 −2
Original line number Diff line number Diff line
@@ -200,7 +200,7 @@ one port.
    
  * `-oB <filename>`: sets the output format to binary and saves the output in
    the given filename. This is equivelent to using the `--output-format` and
    `--output-filename` parameters. The tool `scan2text` can then be used to
    `--output-filename` parameters. The option `--readscan` can then be used to
    read the binary file. Binary files are mush smaller than their XML
    equivelents, but require a separate step to convert back into XML or
    another readable format.
@@ -267,6 +267,16 @@ their versions, then saves the results in an XML file.

You should be able to import the XML into databases and such.

The following example reads a binary scan results file called bin-test.scan and prints
results to console.

	# masscan --readscan bin-test.scan
	
The following example reads a binary scan results file called bin-test.scan and creates
an XML output file called bin-test.xml.

	# masscan --readscan bin-test.scan -oX bin-test.xml

## ADVANCED EXAMPLES

Let's say that you want to scan the entire Internet and spread the scan
+7 −5
Original line number Diff line number Diff line
@@ -24,6 +24,7 @@
    code and causing the bug to come back again.
*/
#include "event-timeout.h"
#include "logger.h"
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
@@ -78,13 +79,14 @@ timeouts_add(struct Timeouts *timeouts, struct TimeoutEntry *entry,
             size_t offset, uint64_t timestamp)
{
    unsigned index;
    //time_t now = time(0);
    //time_t time_future = (unsigned)(timestamp/16384ULL);

    /* Unlink from wherever the entry came from */
    timeout_unlink(entry);

//printf("++ADD %d.%03u\n", time_future-now, (unsigned)(((timestamp%16384ULL)/16384.0)*1000.0));
    if (entry->prev) {
        LOG(1, "***CHANGE %d-seconds\n", (int)((timestamp-entry->timestamp)/16384ULL));
    }

    /* Initialize the new entry */    
    entry->timestamp = timestamp;
    entry->offset = (unsigned)offset;
@@ -96,10 +98,10 @@ timeouts_add(struct Timeouts *timeouts, struct TimeoutEntry *entry,
    entry->prev = &timeouts->slots[index];
    if (entry->next)
        entry->next->prev = &entry->next;
//printf("++PREV=0x%llx\n", entry->prev);
}

/***************************************************************************
 * Remove the next event that it older than the specified timestamp
 ***************************************************************************/
void *
timeouts_remove(struct Timeouts *timeouts, uint64_t timestamp)
@@ -112,7 +114,7 @@ timeouts_remove(struct Timeouts *timeouts, uint64_t timestamp)
        /* Start at the current slot */
        entry = timeouts->slots[timeouts->current_index & timeouts->mask];

        /* enumerate throug the linked list until we find one */
        /* enumerate through the linked list until we find a used slot */
        while (entry && entry->timestamp > timestamp)
            entry = entry->next;
        if (entry)
+1 −1
Original line number Diff line number Diff line
@@ -44,7 +44,6 @@ timeout_unlink(struct TimeoutEntry *entry)
    entry->next = 0;
    entry->prev = 0;
    entry->timestamp = 0;
//printf("--PREV=0x%llx\n", entry->prev);
}

/***************************************************************************
@@ -69,6 +68,7 @@ void *timeouts_remove(struct Timeouts *timeouts, uint64_t timestamp);
 * that we use for timeouts. The timeval structure probably will come
 * from the packets that we are capturing.
 */
#define TICKS_PER_SECOND (16384ULL)
#define TICKS_FROM_SECS(secs) ((secs)*16384ULL)
#define TICKS_FROM_USECS(usecs) ((usecs)/16384ULL)
#define TICKS_FROM_TV(secs,usecs) (TICKS_FROM_SECS(secs)+TICKS_FROM_USECS(usecs))
Loading