Commit 81cd1a76 authored by robertdavidgraham's avatar robertdavidgraham
Browse files

--connection-timeout

parent 4c3c3861
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -892,6 +892,8 @@ masscan_set_parameter(struct Masscan *masscan,
        exit(1);
    } else if (EQUALS("banners", name) || EQUALS("banner", name)) {
        masscan->is_banners = 1;
    } else if (EQUALS("connection-timeout", name)) {
        masscan->tcp_connection_timeout = parseInt(value);
    } else if (EQUALS("datadir", name)) {
        strcpy_s(masscan->nmap.datadir, sizeof(masscan->nmap.datadir), value);
    } else if (EQUALS("data-length", name)) {
+8 −0
Original line number Diff line number Diff line
@@ -601,6 +601,14 @@ receive_thread(void *v)
                                    "http-user-agent",
                                    masscan->http_user_agent_length,
                                    masscan->http_user_agent);
        if (masscan->tcp_connection_timeout) {
            char foo[64];
            sprintf_s(foo, sizeof(foo), "%u", masscan->tcp_connection_timeout);
            tcpcon_set_parameter(   tcpcon,
                                    "timeout",
                                    strlen(foo),
                                    foo);
        }

    }

+1 −0
Original line number Diff line number Diff line
@@ -173,6 +173,7 @@ struct Masscan

    unsigned char *http_user_agent;
    unsigned http_user_agent_length;
    unsigned tcp_connection_timeout;

    struct {
        const char *header_name;
+20 −1
Original line number Diff line number Diff line
@@ -162,6 +162,22 @@ name_equals(const char *lhs, const char *rhs)
    }
}

/***************************************************************************
 ***************************************************************************/
static uint64_t
parseInt(const void *vstr, size_t length)
{
    const char *str = (const char *)vstr;
    uint64_t result = 0;
    size_t i;

    for (i=0; i<length; i++) {
        result = result * 10 + (str[i] - '0');
        str++;
    }
    return result;
}

/***************************************************************************
 * Called at startup, when processing command-line options, to set
 * parameters specific to TCP processing.
@@ -182,7 +198,10 @@ tcpcon_set_parameter(struct TCP_ConnectionTable *tcpcon,
        return;
    }

    if (name_equals(name, "tcp-payload")) {
    if (name_equals(name, "timeout")) {
        uint64_t n = parseInt(value, value_length);
        tcpcon->timeout = (unsigned)n;
        LOG(1, "TCP connection-timeout = %u\n", tcpcon->timeout);
        return;
    }
}