7cc1504616
tests & ok benoit@, thanks
112 lines
5.6 KiB
Plaintext
112 lines
5.6 KiB
Plaintext
$OpenBSD: patch-service_scan_cc,v 1.1 2012/07/16 07:39:31 giovanni Exp $
|
|
--- service_scan.cc.orig Fri May 25 14:45:48 2012
|
|
+++ service_scan.cc Fri May 25 15:10:52 2012
|
|
@@ -1968,10 +1968,10 @@ static void startNextProbe(nsock_pool nsp, nsock_iod n
|
|
// if the last probe was the NULL probe.
|
|
probe = svc->nextProbe(false);
|
|
if (probe) {
|
|
- svc->currentprobe_exec_time = *nsock_gettimeofday();
|
|
+ svc->currentprobe_exec_time = (const timeval&)*nsock_gettimeofday();
|
|
send_probe_text(nsp, nsi, svc, probe);
|
|
nsock_read(nsp, nsi, servicescan_read_handler,
|
|
- svc->currentprobe_timemsleft(nsock_gettimeofday()), svc);
|
|
+ svc->currentprobe_timemsleft((const timeval*)nsock_gettimeofday()), svc);
|
|
} else {
|
|
// Should only happen if someone has a highly perverse nmap-service-probes
|
|
// file. Null scan should generally never be the only probe.
|
|
@@ -2016,11 +2016,11 @@ static void startNextProbe(nsock_pool nsp, nsock_iod n
|
|
} else {
|
|
assert(svc->proto == IPPROTO_UDP);
|
|
/* Can maintain the same UDP "connection" */
|
|
- svc->currentprobe_exec_time = *nsock_gettimeofday();
|
|
+ svc->currentprobe_exec_time = (const timeval&)*nsock_gettimeofday();
|
|
send_probe_text(nsp, nsi, svc, probe);
|
|
// Now let us read any results
|
|
nsock_read(nsp, nsi, servicescan_read_handler,
|
|
- svc->currentprobe_timemsleft(nsock_gettimeofday()), svc);
|
|
+ svc->currentprobe_timemsleft((const timeval*)nsock_gettimeofday()), svc);
|
|
}
|
|
} else {
|
|
// No more probes remaining! Failed to match
|
|
@@ -2087,14 +2087,14 @@ static void considerPrintingStats(ServiceGroup *SG) {
|
|
if (keyWasPressed()) {
|
|
SG->SPM->printStats(SG->services_finished.size() /
|
|
((double)SG->services_remaining.size() + SG->services_in_progress.size() +
|
|
- SG->services_finished.size()), nsock_gettimeofday());
|
|
+ SG->services_finished.size()), (const timeval*)nsock_gettimeofday());
|
|
}
|
|
|
|
|
|
/* Perhaps this should be made more complex, but I suppose it should be
|
|
good enough for now. */
|
|
- if (SG->SPM->mayBePrinted(nsock_gettimeofday())) {
|
|
- SG->SPM->printStatsIfNecessary(SG->services_finished.size() / ((double)SG->services_remaining.size() + SG->services_in_progress.size() + SG->services_finished.size()), nsock_gettimeofday());
|
|
+ if (SG->SPM->mayBePrinted((const timeval*)nsock_gettimeofday())) {
|
|
+ SG->SPM->printStatsIfNecessary(SG->services_finished.size() / ((double)SG->services_remaining.size() + SG->services_in_progress.size() + SG->services_finished.size()), (const timeval*)nsock_gettimeofday());
|
|
}
|
|
}
|
|
|
|
@@ -2121,7 +2121,7 @@ static void handleHostIfDone(ServiceGroup *SG, Target
|
|
}
|
|
|
|
if (!found) {
|
|
- target->stopTimeOutClock(nsock_gettimeofday());
|
|
+ target->stopTimeOutClock((const timeval*)nsock_gettimeofday());
|
|
if (target->timedOut(NULL)) {
|
|
SG->num_hosts_timedout++;
|
|
}
|
|
@@ -2177,7 +2177,7 @@ static int launchSomeServiceProbes(nsock_pool nsp, Ser
|
|
!SG->services_remaining.empty()) {
|
|
// Start executing a probe from the new list and move it to in_progress
|
|
svc = SG->services_remaining.front();
|
|
- if (svc->target->timedOut(nsock_gettimeofday())) {
|
|
+ if (svc->target->timedOut((const timeval*)nsock_gettimeofday())) {
|
|
end_svcprobe(nsp, PROBESTATE_INCOMPLETE, SG, svc, NULL);
|
|
continue;
|
|
}
|
|
@@ -2236,7 +2236,7 @@ static void servicescan_connect_handler(nsock_pool nsp
|
|
|
|
assert(type == NSE_TYPE_CONNECT || type == NSE_TYPE_CONNECT_SSL);
|
|
|
|
- if (svc->target->timedOut(nsock_gettimeofday())) {
|
|
+ if (svc->target->timedOut((const timeval*)nsock_gettimeofday())) {
|
|
end_svcprobe(nsp, PROBESTATE_INCOMPLETE, SG, svc, nsi);
|
|
} else if (status == NSE_STATUS_SUCCESS) {
|
|
|
|
@@ -2262,10 +2262,10 @@ static void servicescan_connect_handler(nsock_pool nsp
|
|
|
|
// Yeah! Connection made to the port. Send the appropriate probe
|
|
// text (if any is needed -- might be NULL probe)
|
|
- svc->currentprobe_exec_time = *nsock_gettimeofday();
|
|
+ svc->currentprobe_exec_time = (const timeval&)*nsock_gettimeofday();
|
|
send_probe_text(nsp, nsi, svc, probe);
|
|
// Now let us read any results
|
|
- nsock_read(nsp, nsi, servicescan_read_handler, svc->currentprobe_timemsleft(nsock_gettimeofday()), svc);
|
|
+ nsock_read(nsp, nsi, servicescan_read_handler, svc->currentprobe_timemsleft((const timeval*)nsock_gettimeofday()), svc);
|
|
} else if (status == NSE_STATUS_TIMEOUT || status == NSE_STATUS_ERROR) {
|
|
// This is not good. The connect() really shouldn't generally
|
|
// be timing out like that. We'll mark this svc as incomplete
|
|
@@ -2300,11 +2300,11 @@ static void servicescan_write_handler(nsock_pool nsp,
|
|
if (keyWasPressed()) {
|
|
SG->SPM->printStats(SG->services_finished.size() /
|
|
((double)SG->services_remaining.size() + SG->services_in_progress.size() +
|
|
- SG->services_finished.size()), nsock_gettimeofday());
|
|
+ SG->services_finished.size()), (const timeval*)nsock_gettimeofday());
|
|
}
|
|
|
|
|
|
- if (svc->target->timedOut(nsock_gettimeofday())) {
|
|
+ if (svc->target->timedOut((const timeval*)nsock_gettimeofday())) {
|
|
end_svcprobe(nsp, PROBESTATE_INCOMPLETE, SG, svc, nsi);
|
|
return;
|
|
}
|
|
@@ -2350,7 +2350,7 @@ static void servicescan_read_handler(nsock_pool nsp, n
|
|
|
|
assert(type == NSE_TYPE_READ);
|
|
|
|
- if (svc->target->timedOut(nsock_gettimeofday())) {
|
|
+ if (svc->target->timedOut((const timeval*)nsock_gettimeofday())) {
|
|
end_svcprobe(nsp, PROBESTATE_INCOMPLETE, SG, svc, nsi);
|
|
} else if (status == NSE_STATUS_SUCCESS) {
|
|
// w00p, w00p, we read something back from the port.
|