rapid7/metasploit-framework — pull request #3183 by zeroSteiner (2014-04-03 14:03:13+00:00)
Title: Set command tab completion improvements

This PR adds some new tab completion features for msfconsole's set command.

The datastore options are not case sensitive when being set so this tries to tab complete options which do not begin with the correct case. This tries to be more forgiving on the user.

```
msf4-git (S:0 J:0)> use exploit/windows/smb/psexec
msf4-git (S:0 J:0) exploit(psexec) > set rhost 192.168.90.160
rhost => 192.168.90.160
msf4-git (S:0 J:0) exploit(psexec) > set payload windows/meterpreter/reverse_tcp
payload => windows/meterpreter/reverse_tcp
msf4-git (S:0 J:0) exploit(psexec) > set lhost 192.168.90.1
lhost => 192.168.90.1
msf4-git (S:0 J:0) exploit(psexec) >
```

This also adds support for tab completing boolean options, valid values are true and false.

```
msf4-git (S:0 J:0)> use auxiliary/scanner/http/http_version
msf4-git (S:0 J:0) auxiliary(http_version) > set RPORT 443
RPORT => 443
msf4-git (S:0 J:0) auxiliary(http_version) > set SSL
set SSL false set SSL true
msf4-git (S:0 J:0) auxiliary(http_version) > set SSL true
SSL => true
msf4-git (S:0 J:0) auxiliary(http_version) > run

[*] 192.168.90.15:443 Apache
[*] Scanned 1 of 1 hosts (100% complete)
[*] Auxiliary module execution completed
msf4-git (S:0 J:0) auxiliary(http_version) >
```

And finally this adds tab support for options that support files via "file:", specifically OptString and OptAddressRange.
```
msf4-git (S:0 J:0) auxiliary(http_version) > set RHOSTS file:
set RHOSTS file:.bundle set RHOSTS file:.ruby-version set RHOSTS file:Gemfile.lock set RHOSTS file:data set RHOSTS file:msfcli set RHOSTS file:msfpescan set RHOSTS file:scripts
set RHOSTS file:.git set RHOSTS file:.simplecov set RHOSTS file:HACKING set RHOSTS file:db set RHOSTS file:msfconsole set RHOSTS file:msfrop set RHOSTS file:spec
set RHOSTS file:.gitignore set RHOSTS file:.travis.yml set RHOSTS file:LICENSE set RHOSTS file:documentation set RHOSTS file:msfd set RHOSTS file:msfrpc set RHOSTS file:test
set RHOSTS file:.gitmodules set RHOSTS file:.yardopts set RHOSTS file:README.md set RHOSTS file:external set RHOSTS file:msfelfscan set RHOSTS file:msfrpcd set RHOSTS file:tools
set RHOSTS file:.mailmap set RHOSTS file:CONTRIBUTING.md set RHOSTS file:Rakefile set RHOSTS file:lib set RHOSTS file:msfencode set RHOSTS file:msfupdate
set RHOSTS file:.rspec set RHOSTS file:COPYING set RHOSTS file:config set RHOSTS file:modules set RHOSTS file:msfmachscan set RHOSTS file:msfvenom
set RHOSTS file:.ruby-gemset set RHOSTS file:Gemfile set RHOSTS file:coverage set RHOSTS file:msfbinscan set RHOSTS file:msfpayload set RHOSTS file:plugins
msf4-git (S:0 J:0) auxiliary(http_version) > set RHOSTS file:/home/steiner/super_awesome_targets_list.txt
RHOSTS => file:/home/steiner/super_awesome_targets_list.txt
msf4-git (S:0 J:0) auxiliary(http_version) >
```

Verification Steps:
- [ ] check new tab completion features for the set command
- [ ] make sure pre-existing tab completion features continue to work