Commit 996d99a5 authored by robertdavidgraham's avatar robertdavidgraham
Browse files

#71 readscan now reports start time correctly

parent 1903d0d7
Loading
Loading
Loading
Loading
+21 −0
Original line number Diff line number Diff line
@@ -226,6 +226,27 @@ parse_file(struct Output *out, const char *filename)
        goto end;
    }

    /*
     * Look for start time
     */
    if (buf[11] == '.' && strtoul((char*)buf+12,0,0) >= 2) {
        unsigned i;

        /* move to next field */
        for (i=0; i<'a' && buf[i] && buf[i] != '\n'; i++)
            ;
        i++;

        if (buf[i] == 's')
            i++;
        if (buf[i] == ':')
            i++;

        /* extract timestamp */
        if (i < 'a')
            out->when_scan_started = strtoul((char*)buf+i,0,0);
    }

    /* Now read all records */
    for (;;) {
        unsigned type;
+2 −1
Original line number Diff line number Diff line
@@ -16,7 +16,8 @@ binary_out_open(struct Output *out, FILE *fp)


    memset(firstrecord, 0, 2+'a');
    sprintf_s(firstrecord, 2+'a', "masscan/1.1.01");
    sprintf_s(firstrecord, 2+'a', "masscan/1.1.02\ns:%u\n", 
        (unsigned)out->when_scan_started);
    bytes_written = fwrite(firstrecord, 1, 2+'a', fp);
    if (bytes_written != 2+'a') {
        perror("output");