robertdavidgraham / masscan

TCP port scanner, spews SYN packets asynchronously, scanning entire Internet in under 5 minutes.
GNU Affero General Public License v3.0
23.3k stars 3.05k forks source link

FAIL: no ports were specified #235

Closed Cnlouds closed 8 years ago

Cnlouds commented 8 years ago
[root@sec bin]# ./masscan -p80 127.0.0.1 --rate=5000
FAIL: no ports were specified
 [hint] try something like "-p80,8000-9000"
 [hint] try something like "--ports 0-65535"
[root@sec bin]# ./masscan --version
Masscan version 1.0.3 ( https://github.com/robertdavidgraham/masscan )
Compiled on: Jul 11 2016 
Compiler: gcc 4.4.6 20120305 (Red Hat 4.4.6-4)
OS: Linux
CPU: unknown (64 bits)
GIT version: 1.0.3-117-gea6e732

test in centos 6.3/7, have install the libpcap thanks

Cnlouds commented 8 years ago

233

fix with this code

case 'p':
         if (argv[i][2])
                arg = argv[i]+2;
         else
                arg = argv[++i]; // Passes a NULL value that breaks rangelist_parse_ports in ranges.c
                //fprintf(stderr, "%.*s: empty parameter\n", argv[0], argv[1]);
                //break;
         masscan_set_parameter(masscan, "ports", arg);
mzpqnxow commented 8 years ago

@Cnlouds please do NOT fix this way.

The correct way is pull request #246

If you fix this way, when you run 'masscan -p' you get a NULL ptr dereference. The initial fix for that issue is what caused this issue... #246 fixes both.

Cnlouds commented 8 years ago

@agreene5 thanks