rapid7/metasploit-framework — pull request #3171 by wvu-r7 (2014-04-01 22:55:52+00:00)
Title: Fix NameError for "r" in Msf::Auxiliary::Nmap

**Problem description:**

Variable ```r``` is used outside its scope, causing a ```NameError```.

**Verification steps:**

Pre-fix:

- [ ] Use ```auxiliary/scanner/oracle/oracle_login```
- [ ] Set ```RHOSTS``` to something valid
- [ ] Set ```RPORTS``` to something invalid
- [ ] Run the module
- [ ] See the ```NameError```

Post-fix:

- [ ] Use ```auxiliary/scanner/oracle/oracle_login```
- [ ] Set ```RHOSTS``` to something valid
- [ ] Set ```RPORTS``` to something invalid
- [ ] Run the module
- [ ] See the correct ```RuntimeError```

**Sample run**:

Pre-fix:

```
msf > use auxiliary/scanner/oracle/oracle_login
msf auxiliary(oracle_login) > set RHOSTS 172.168.126.129
RHOSTS => 172.168.126.129
msf auxiliary(oracle_login) > set RPORTS help computer
RPORTS => help computer
msf auxiliary(oracle_login) > run

[*] Nmap: Setting up credential file...
[*] Nmap: Starting Oracle bruteforce with 568 credentials against SID 'XE'...
[-] Auxiliary failed: NameError undefined local variable or method `r' for #
[-] Call stack:
[-] /home/wvu/metasploit-framework/lib/msf/core/auxiliary/nmap.rb:201:in `nmap_validate_rports'
[-] /home/wvu/metasploit-framework/lib/msf/core/auxiliary/nmap.rb:161:in `nmap_add_ports'
[-] /home/wvu/metasploit-framework/lib/msf/core/auxiliary/nmap.rb:48:in `set_nmap_cmd'
[-] /home/wvu/metasploit-framework/lib/msf/core/auxiliary/nmap.rb:91:in `nmap_run'
[-] /home/wvu/metasploit-framework/modules/auxiliary/scanner/oracle/oracle_login.rb:62:in `run'
[*] Auxiliary module execution completed
msf auxiliary(oracle_login) >
```

Post-fix:

```
msf > use auxiliary/scanner/oracle/oracle_login
msf auxiliary(oracle_login) > set RHOSTS 172.16.126.129
RHOSTS => 172.16.126.129
msf auxiliary(oracle_login) > set RPORTS help computer
RPORTS => help computer
msf auxiliary(oracle_login) > run

[*] Nmap: Setting up credential file...
[*] Nmap: Starting Oracle bruteforce with 568 credentials against SID 'XE'...
[-] Malformed nmap port: help computer
[-] Auxiliary failed: RuntimeError Cannot continue without a valid port list.
[-] Call stack:
[-] /home/wvu/metasploit-framework/lib/msf/core/auxiliary/nmap.rb:162:in `nmap_add_ports'
[-] /home/wvu/metasploit-framework/lib/msf/core/auxiliary/nmap.rb:48:in `set_nmap_cmd'
[-] /home/wvu/metasploit-framework/lib/msf/core/auxiliary/nmap.rb:91:in `nmap_run'
[-] /home/wvu/metasploit-framework/modules/auxiliary/scanner/oracle/oracle_login.rb:62:in `run'
[*] Auxiliary module execution completed
msf auxiliary(oracle_login) >
```