61 lines
2.0 KiB
Plaintext
61 lines
2.0 KiB
Plaintext
--- portscanner.c.orig Sun Aug 9 17:50:35 1998
|
|
+++ portscanner.c Mon May 24 18:20:41 1999
|
|
@@ -24,18 +24,21 @@
|
|
/***********************************************************/
|
|
|
|
#include <stdio.h>
|
|
+#include <stdlib.h>
|
|
+#include <unistd.h>
|
|
#include <sys/socket.h>
|
|
#include <sys/types.h>
|
|
#include <netinet/in.h>
|
|
-#include <unistd.h>
|
|
+#include <arpa/inet.h>
|
|
#include <netdb.h>
|
|
#include <sys/time.h>
|
|
#include <fcntl.h>
|
|
+#include <string.h>
|
|
|
|
int sock = -1;
|
|
struct sockaddr_in address;
|
|
int result;
|
|
-extern char *sys_errlist[];
|
|
+/* extern char *sys_errlist[]; */
|
|
extern int errno;
|
|
int current_port = 0;
|
|
u_short base_port = 0;
|
|
@@ -49,7 +52,7 @@
|
|
int main(int argc, char **argv)
|
|
{
|
|
if (argc < 4) {
|
|
- fprintf(stderr,"Usage: portscan [address] [start port] [end port] <-v or -vv>\n");
|
|
+ fprintf(stderr,"Usage: portscanner [address] [start port] [end port] <-v or -vv>\n");
|
|
exit(1);
|
|
}
|
|
|
|
@@ -58,13 +61,13 @@
|
|
verbose = 1;
|
|
else if (!strcmp(argv[4],"-vv"))
|
|
verbose = 2;
|
|
- else { fprintf(stderr,"Usage: portscan [address] [start port] [end port] <-v or -vv>\n");
|
|
+ else { fprintf(stderr,"Usage: portscanner [address] [start port] [end port] <-v or -vv>\n");
|
|
exit(1); }
|
|
|
|
case 4: base_port = (u_short)atoi(argv[2]);
|
|
end_port = (u_short)atoi(argv[3]);
|
|
break;
|
|
- default: fprintf(stderr,"Usage: portscan [address] [start port] [end port] <-v>\n");
|
|
+ default: fprintf(stderr,"Usage: portscanner [address] [start port] [end port] <-v>\n");
|
|
exit(1);
|
|
break;
|
|
}
|
|
@@ -83,7 +86,7 @@
|
|
} else if (verbose == 2) printf(" address valid\n");
|
|
|
|
if ((base_port > end_port) || ((short)base_port < 0)) {
|
|
- fprintf(stderr,"Bad port range : start=%d end=%d !\n");
|
|
+ fprintf(stderr,"Bad port range : start=%d end=%d !\n",base_port,end_port);
|
|
exit(1);
|
|
} else if (verbose == 2) {
|
|
printf("Port range: %d to %d\n",base_port,end_port);
|