From 1bb39e394a26edb3c7ab1d2d145409adfbb8cbdd Mon Sep 17 00:00:00 2001 From: robertdavidgraham Date: Thu, 10 Jul 2014 23:09:03 -0400 Subject: [PATCH] unicorn scan win32 fixes --- src/out-unicornscan.c | 17 +++++++++++++++++ vs10/masscan.vcxproj | 1 + vs10/masscan.vcxproj.filters | 3 +++ 3 files changed, 21 insertions(+) diff --git a/src/out-unicornscan.c b/src/out-unicornscan.c index 8c94f83e..3bbb624e 100644 --- a/src/out-unicornscan.c +++ b/src/out-unicornscan.c @@ -4,7 +4,12 @@ #include "masscan-status.h" #include "unusedparm.h" + +#ifndef WIN32 #include +#else +#include +#endif #include static char * tcp_services[65536]; @@ -21,6 +26,7 @@ static void init_tcp_services() static char *tcp_service_name(int port) { +#ifndef WIN32 int r; struct servent result_buf; struct servent *result; @@ -33,6 +39,16 @@ static char *tcp_service_name(int port) return "unknown"; return strdup(result_buf.s_name); +#else + struct servent *result; + + result = getservbyport(htons((unsigned short)port), "tcp"); + + if (result == NULL) + return "unknown"; + + return _strdup(result->s_name); +#endif } static void @@ -57,6 +73,7 @@ unicornscan_out_status(struct Output *out, FILE *fp, time_t timestamp, { UNUSEDPARM(reason); UNUSEDPARM(out); + UNUSEDPARM(timestamp); if (ip_proto == 6) { fprintf(fp,"TCP open\t%16s[%5d]\t\tfrom %u.%u.%u.%u ttl %-3d\n", diff --git a/vs10/masscan.vcxproj b/vs10/masscan.vcxproj index d8cf7b40..77ee0390 100644 --- a/vs10/masscan.vcxproj +++ b/vs10/masscan.vcxproj @@ -35,6 +35,7 @@ + diff --git a/vs10/masscan.vcxproj.filters b/vs10/masscan.vcxproj.filters index 5846133b..9b3c5472 100644 --- a/vs10/masscan.vcxproj.filters +++ b/vs10/masscan.vcxproj.filters @@ -249,6 +249,9 @@ Source Files\output + + Source Files\output +