rapid7/metasploit-framework — pull request #3185 by FireFart (2014-04-03 17:30:18+00:00)
Title: Added regex option to validate options

This PR adds the ability to add a regex to validate an option.
I modified the `modules/auxiliary/fuzzers/ftp/client_ftp` module as a sample.

Sample output:
Invalid regex in module:
```
firefart@LinuxMint ~/Coding/metasploit-framework $ ./msfcli auxiliary/fuzzers/ftp/client_ftp E
[*] Initializing modules...
/home/firefart/Coding/metasploit-framework/lib/msf/core/option_container.rb:43:in `rescue in initialize': Invalid Regex ^((?:[A-Z]+,?)+$: end pattern with unmatched parenthesis: /^((?:[A-Z]+,?)+$/ (RuntimeError)
from /home/firefart/Coding/metasploit-framework/lib/msf/core/option_container.rb:39:in `initialize'
from /home/firefart/Coding/metasploit-framework/modules/auxiliary/fuzzers/ftp/client_ftp.rb:33:in `new'
from /home/firefart/Coding/metasploit-framework/modules/auxiliary/fuzzers/ftp/client_ftp.rb:33:in `initialize'
from /home/firefart/Coding/metasploit-framework/lib/msf/core/module_set.rb:55:in `new'
from /home/firefart/Coding/metasploit-framework/lib/msf/core/module_set.rb:55:in `create'
from ./msfcli:314:in `init_modules'
from ./msfcli:538:in `run!'
from ./msfcli:560:in `

'
```
Invalid value (only lowercase):
```
firefart@LinuxMint ~/Coding/metasploit-framework $ ./msfcli auxiliary/fuzzers/ftp/client_ftp FUZZCMDS=asdf E
[*] Initializing modules...
FUZZCMDS => asdf
[-] Auxiliary failed: Msf::OptionValidateError The following options failed to validate: FUZZCMDS.
```