]> git.sesse.net Git - nbtscanner/blobdiff - nbtscanner.c
Import nbtscanner 0.1.1.
[nbtscanner] / nbtscanner.c
index a7c5e25859f33a879c6ee4bd3cefa543ed43c4e0..cbc894527014a6924d46e65b6cfb57cf2b2c5b49 100644 (file)
@@ -32,6 +32,7 @@
 #include <unistd.h>
 #include <arpa/inet.h>
 #include <stdlib.h>
+#include <malloc.h>
 
 #include "nbtscanner.h"
 #include "mysql_interface.h"
@@ -298,23 +299,25 @@ void scan_range(struct in_addr ip, int rangesize)
 
 int main(int argc, char *argv[])
 {
+       int junk = mtrace();
        int fd = open_sockets();
+       int i;
 
        id_list_init();
        init_stats();
 
-       /* note that parse_configfile() will call scan_range()! */
        server_fd = fd;
-       parse_configfile(1);
-
-/*     for (i=1;i<argc;i++) {
-               struct in_addr ip;
+       parse_configfile();
 
-               ip.s_addr = inet_addr(argv[i]); //interpret_addr2(argv[i]);
-               send_nbt_packet(fd, ip);
-               recv_nbt_packets(fd);
-       } */
+       /* really ugly to have here */
+       if (use_mysql) {
+               init_mysql(mysql_host, mysql_username, mysql_password);
+       }
 
+       for (i = 0; i < ranges; i++) {
+               scan_range(scanrange[i], scanrangesize[i]);
+       }
+       
        /*
         * receive answers and resend packets until all answers have
         * been received, or all packets have been timed out