Unverified Commit f61d9eb8 by Marcin Bury Committed by GitHub

Fixing boolean options (#465)

parent 759d0630
...@@ -62,6 +62,17 @@ class OptPort(Option): ...@@ -62,6 +62,17 @@ class OptPort(Option):
class OptBool(Option): class OptBool(Option):
""" Option Bool attribute """ """ Option Bool attribute """
def __init__(self, default, description=""):
self.label = None
self.description = description
if default:
self.display_value = "true"
else:
self.display_value = "false"
self.value = default
def _apply_widget(self, value): def _apply_widget(self, value):
if value in ["true", "false"]: if value in ["true", "false"]:
return value return value
......
...@@ -16,8 +16,8 @@ class FTPClient(Exploit): ...@@ -16,8 +16,8 @@ class FTPClient(Exploit):
target_protocol = Protocol.FTP target_protocol = Protocol.FTP
ssl = OptBool("false", "SSL enabled: true/false") ssl = OptBool(False, "SSL enabled: true/false")
verbosity = OptBool("true", "Enable verbose output: true/false") verbosity = OptBool(True, "Enable verbose output: true/false")
def ftp_create(self): def ftp_create(self):
if self.ssl: if self.ssl:
......
...@@ -18,8 +18,8 @@ class HTTPClient(Exploit): ...@@ -18,8 +18,8 @@ class HTTPClient(Exploit):
target_protocol = Protocol.HTTP target_protocol = Protocol.HTTP
verbosity = OptBool("true", "Verbosity enabled: true/false") verbosity = OptBool(True, "Verbosity enabled: true/false")
ssl = OptBool("false", "SSL enabled: true/false") ssl = OptBool(False, "SSL enabled: true/false")
def http_request(self, method, path, session=requests, **kwargs): def http_request(self, method, path, session=requests, **kwargs):
if self.ssl: if self.ssl:
......
...@@ -15,7 +15,7 @@ class SNMPClient(Exploit): ...@@ -15,7 +15,7 @@ class SNMPClient(Exploit):
target_protocol = Protocol.SNMP target_protocol = Protocol.SNMP
verbosity = OptBool("true", "Enable verbose output: true/false") verbosity = OptBool(True, "Enable verbose output: true/false")
def snmp_get(self, community_string, oid, version=1, retries=0): def snmp_get(self, community_string, oid, version=1, retries=0):
cmdGen = cmdgen.CommandGenerator() cmdGen = cmdgen.CommandGenerator()
......
...@@ -22,7 +22,7 @@ class SSHClient(Exploit): ...@@ -22,7 +22,7 @@ class SSHClient(Exploit):
target_protocol = Protocol.SSH target_protocol = Protocol.SSH
verbosity = OptBool("true", "Enable verbose output: true/false") verbosity = OptBool(True, "Enable verbose output: true/false")
def ssh_create(self): def ssh_create(self):
ssh_client = paramiko.SSHClient() ssh_client = paramiko.SSHClient()
......
...@@ -17,7 +17,7 @@ class TCPClient(Exploit): ...@@ -17,7 +17,7 @@ class TCPClient(Exploit):
target_protocol = Protocol.TCP target_protocol = Protocol.TCP
verbosity = OptBool("true", "Enable verbose output: true/false") verbosity = OptBool(True, "Enable verbose output: true/false")
def tcp_create(self): def tcp_create(self):
if is_ipv4(self.target): if is_ipv4(self.target):
......
...@@ -15,7 +15,7 @@ class TelnetClient(Exploit): ...@@ -15,7 +15,7 @@ class TelnetClient(Exploit):
target_protocol = Protocol.TELNET target_protocol = Protocol.TELNET
verbosity = OptBool("true", "Enable verbose output: true/false") verbosity = OptBool(True, "Enable verbose output: true/false")
def telnet_connect(self, target=None, port=None): def telnet_connect(self, target=None, port=None):
if not target: if not target:
......
...@@ -16,7 +16,7 @@ class UDPClient(Exploit): ...@@ -16,7 +16,7 @@ class UDPClient(Exploit):
target_protocol = Protocol.UDP target_protocol = Protocol.UDP
verbosity = OptBool("true", "Enable verbose output: true/false") verbosity = OptBool(True, "Enable verbose output: true/false")
def udp_create(self): def udp_create(self):
if is_ipv4(self.target): if is_ipv4(self.target):
......
...@@ -20,8 +20,8 @@ class Exploit(HTTPClient): ...@@ -20,8 +20,8 @@ class Exploit(HTTPClient):
threads = OptInteger(1, "Number of threads") threads = OptInteger(1, "Number of threads")
defaults = OptWordlist("admin:12345,admin:123456,Admin:12345,Admin:123456", "User:Pass or file with default ccredentials (file://)") defaults = OptWordlist("admin:12345,admin:123456,Admin:12345,Admin:123456", "User:Pass or file with default ccredentials (file://)")
stop_on_success = OptBool("false", "Stop on first valid authentication attempt") stop_on_success = OptBool(False, "Stop on first valid authentication attempt")
verbosity = OptBool("true", "Display authentication attempts") verbosity = OptBool(True, "Display authentication attempts")
def run(self): def run(self):
self.credentials = [] self.credentials = []
......
...@@ -21,8 +21,8 @@ class Exploit(HTTPClient): ...@@ -21,8 +21,8 @@ class Exploit(HTTPClient):
threads = OptInteger(1, "Number of threads") threads = OptInteger(1, "Number of threads")
defaults = OptWordlist("admin:admin", "User:Pass or file with default credentials (file://)") defaults = OptWordlist("admin:admin", "User:Pass or file with default credentials (file://)")
stop_on_success = OptBool("false", "Stop on first valid authentication attempt") stop_on_success = OptBool(False, "Stop on first valid authentication attempt")
verbosity = OptBool("true", "Display authentication attempts") verbosity = OptBool(True, "Display authentication attempts")
def run(self): def run(self):
self.credentials = [] self.credentials = []
......
...@@ -24,8 +24,8 @@ class Exploit(FTPClient): ...@@ -24,8 +24,8 @@ class Exploit(FTPClient):
usernames = OptWordlist("admin", "Username or file with usernames (file://)") usernames = OptWordlist("admin", "Username or file with usernames (file://)")
passwords = OptWordlist(wordlists.passwords, "Password or file with passwords (file://)") passwords = OptWordlist(wordlists.passwords, "Password or file with passwords (file://)")
verbosity = OptBool("true", "Display authentication attempts") verbosity = OptBool(True, "Display authentication attempts")
stop_on_success = OptBool("true", "Stop on first valid authentication attempt") stop_on_success = OptBool(True, "Stop on first valid authentication attempt")
def run(self): def run(self):
self.credentials = [] self.credentials = []
......
...@@ -22,8 +22,8 @@ class Exploit(FTPClient): ...@@ -22,8 +22,8 @@ class Exploit(FTPClient):
threads = OptInteger(8, "Number of threads") threads = OptInteger(8, "Number of threads")
defaults = OptWordlist(wordlists.defaults, "User:Pass pair or file with default credentials (file://)") defaults = OptWordlist(wordlists.defaults, "User:Pass pair or file with default credentials (file://)")
verbosity = OptBool("true", "Display authentication attempts") verbosity = OptBool(True, "Display authentication attempts")
stop_on_success = OptBool("true", "Stop on first valid authentication attempt") stop_on_success = OptBool(True, "Stop on first valid authentication attempt")
def run(self): def run(self):
self.credentials = [] self.credentials = []
......
...@@ -29,8 +29,8 @@ class Exploit(HTTPClient): ...@@ -29,8 +29,8 @@ class Exploit(HTTPClient):
path = OptString("/", "URL Path") path = OptString("/", "URL Path")
verbosity = OptBool("true", "Display authentication attempts") verbosity = OptBool(True, "Display authentication attempts")
stop_on_success = OptBool("true", "Stop on first valid authentication attempt") stop_on_success = OptBool(True, "Stop on first valid authentication attempt")
def run(self): def run(self):
self.credentials = [] self.credentials = []
......
...@@ -27,8 +27,8 @@ class Exploit(HTTPClient): ...@@ -27,8 +27,8 @@ class Exploit(HTTPClient):
path = OptString("/", "URL Path") path = OptString("/", "URL Path")
verbosity = OptBool("true", "Display authentication attempts") verbosity = OptBool(True, "Display authentication attempts")
stop_on_success = OptBool("true", "Stop on first valid authentication attempt") stop_on_success = OptBool(True, "Stop on first valid authentication attempt")
def run(self): def run(self):
self.credentials = [] self.credentials = []
......
...@@ -24,8 +24,8 @@ class Exploit(SNMPClient): ...@@ -24,8 +24,8 @@ class Exploit(SNMPClient):
defaults = OptWordlist(wordlists.snmp, "SNMP community string or file with default communit stryings (file://)") defaults = OptWordlist(wordlists.snmp, "SNMP community string or file with default communit stryings (file://)")
verbosity = OptBool("true", "Display authentication attempts") verbosity = OptBool(True, "Display authentication attempts")
stop_on_success = OptBool("true", "Stop on first valid authentication attempt") stop_on_success = OptBool(True, "Stop on first valid authentication attempt")
def run(self): def run(self):
self.strings = [] self.strings = []
......
...@@ -25,8 +25,8 @@ class Exploit(SSHClient): ...@@ -25,8 +25,8 @@ class Exploit(SSHClient):
usernames = OptWordlist("admin", "Username or file with usernames (file://)") usernames = OptWordlist("admin", "Username or file with usernames (file://)")
passwords = OptWordlist(wordlists.passwords, "Password or file with passwords (file://)") passwords = OptWordlist(wordlists.passwords, "Password or file with passwords (file://)")
verbosity = OptBool("true", "Display authentication attempts") verbosity = OptBool(True, "Display authentication attempts")
stop_on_success = OptBool("true", "Stop on first valid authentication attempt") stop_on_success = OptBool(True, "Stop on first valid authentication attempt")
def run(self): def run(self):
self.credentials = [] self.credentials = []
......
...@@ -23,8 +23,8 @@ class Exploit(SSHClient): ...@@ -23,8 +23,8 @@ class Exploit(SSHClient):
defaults = OptWordlist(wordlists.defaults, "User:Pass or file with default credentials (file://)") defaults = OptWordlist(wordlists.defaults, "User:Pass or file with default credentials (file://)")
verbosity = OptBool("true", "Display authentication attempts") verbosity = OptBool(True, "Display authentication attempts")
stop_on_success = OptBool("true", "Stop on first valid authentication attempt") stop_on_success = OptBool(True, "Stop on first valid authentication attempt")
def run(self): def run(self):
self.credentials = [] self.credentials = []
......
...@@ -25,8 +25,8 @@ class Exploit(TelnetClient): ...@@ -25,8 +25,8 @@ class Exploit(TelnetClient):
usernames = OptWordlist("admin", "Username or file with usernames (file://)") usernames = OptWordlist("admin", "Username or file with usernames (file://)")
passwords = OptWordlist(wordlists.passwords, "Password or file with passwords (file://)") passwords = OptWordlist(wordlists.passwords, "Password or file with passwords (file://)")
verbosity = OptBool("true", "Display authentication attempts") verbosity = OptBool(True, "Display authentication attempts")
stop_on_success = OptBool("true", "Stop on first valid authentication attempt") stop_on_success = OptBool(True, "Stop on first valid authentication attempt")
def run(self): def run(self):
self.credentials = [] self.credentials = []
......
...@@ -23,8 +23,8 @@ class Exploit(TelnetClient): ...@@ -23,8 +23,8 @@ class Exploit(TelnetClient):
defaults = OptWordlist(wordlists.defaults, "User:Pass or file with default credentials (file://)") defaults = OptWordlist(wordlists.defaults, "User:Pass or file with default credentials (file://)")
verbosity = OptBool("true", "Display authentication attempts") verbosity = OptBool(True, "Display authentication attempts")
stop_on_success = OptBool("true", "Stop on first valid authentication attempt") stop_on_success = OptBool(True, "Stop on first valid authentication attempt")
def run(self): def run(self):
self.credentials = [] self.credentials = []
......
...@@ -20,8 +20,8 @@ class Exploit(TCPClient): ...@@ -20,8 +20,8 @@ class Exploit(TCPClient):
threads = OptInteger(1, "Number of threads") threads = OptInteger(1, "Number of threads")
defaults = OptWordlist("admin:admin", "User:Pass or file with default credentials (file://)") defaults = OptWordlist("admin:admin", "User:Pass or file with default credentials (file://)")
stop_on_success = OptBool("true", "Stop on first valid authentication attempt") stop_on_success = OptBool(True, "Stop on first valid authentication attempt")
verbosity = OptBool("true", "Display authentication attempts") verbosity = OptBool(True, "Display authentication attempts")
def run(self): def run(self):
self.credentials = [] self.credentials = []
......
...@@ -17,12 +17,12 @@ class Exploit(HTTPClient): ...@@ -17,12 +17,12 @@ class Exploit(HTTPClient):
target = OptIP("", "Target IPv4, IPv6 address or file with ip:port (file://)") target = OptIP("", "Target IPv4, IPv6 address or file with ip:port (file://)")
port = OptPort(443, "Target Web Interface port") port = OptPort(443, "Target Web Interface port")
ssl = OptBool("true", "SSL enabled: true/false") ssl = OptBool(True, "SSL enabled: true/false")
threads = OptInteger(1, "Number of threads") threads = OptInteger(1, "Number of threads")
defaults = OptWordlist("admin:pfsense", "User:Pass or file with default credentials (file://)") defaults = OptWordlist("admin:pfsense", "User:Pass or file with default credentials (file://)")
stop_on_success = OptBool("false", "Stop on first valid authentication attempt") stop_on_success = OptBool(False, "Stop on first valid authentication attempt")
verbosity = OptBool("true", "Displaye authentication attempts") verbosity = OptBool(True, "Displaye authentication attempts")
def run(self): def run(self):
self.credentials = [] self.credentials = []
......
...@@ -25,7 +25,7 @@ class Exploit(HTTPClient, SSHClient): ...@@ -25,7 +25,7 @@ class Exploit(HTTPClient, SSHClient):
target = OptIP("", "Target IPv4 or IPv6 address") target = OptIP("", "Target IPv4 or IPv6 address")
port = OptPort(443, "Target HTTP port") port = OptPort(443, "Target HTTP port")
ssl = OptBool("true", "SSL enabled: true/false") ssl = OptBool(True, "SSL enabled: true/false")
ssh_port = OptPort(22, "Target SSH Port") ssh_port = OptPort(22, "Target SSH Port")
......
...@@ -25,7 +25,7 @@ class Exploit(HTTPClient): ...@@ -25,7 +25,7 @@ class Exploit(HTTPClient):
target = OptIP("", "Target IPv4 or IPv6 address") target = OptIP("", "Target IPv4 or IPv6 address")
port = OptPort(443, "Target HTTP port") port = OptPort(443, "Target HTTP port")
ssl = OptBool("true", "SSL enabled: true/false") ssl = OptBool(True, "SSL enabled: true/false")
path = OptString("/PI/services/UCP/", "Path to UCP WebService") path = OptString("/PI/services/UCP/", "Path to UCP WebService")
username = OptString("", "Username to use") username = OptString("", "Username to use")
......
...@@ -22,7 +22,7 @@ class Exploit(HTTPClient): ...@@ -22,7 +22,7 @@ class Exploit(HTTPClient):
target = OptIP("", "Target IPv4 or IPv6 address") target = OptIP("", "Target IPv4 or IPv6 address")
port = OptPort(444, "Target HTTP port") port = OptPort(444, "Target HTTP port")
ssl = OptBool("true", "SSL enabled: true/false") ssl = OptBool(True, "SSL enabled: true/false")
username = OptString("admin", "Username to log in with") username = OptString("admin", "Username to log in with")
password = OptString("admin", "Password to log in with") password = OptString("admin", "Password to log in with")
......
...@@ -21,7 +21,7 @@ class Exploit(SNMPClient): ...@@ -21,7 +21,7 @@ class Exploit(SNMPClient):
target = OptIP("", "Target IPv4 or IPv6 address") target = OptIP("", "Target IPv4 or IPv6 address")
port = OptPort(161, "Target SNMP port") port = OptPort(161, "Target SNMP port")
verbosity = OptBool("false", "Enable verbose output: true/false") verbosity = OptBool(False, "Enable verbose output: true/false")
def __init__(self): def __init__(self):
self.oids = { self.oids = {
......
...@@ -26,7 +26,7 @@ class Exploit(HTTPClient, SSHClient): ...@@ -26,7 +26,7 @@ class Exploit(HTTPClient, SSHClient):
target = OptIP("", "Target IPv4 or IPv6 address") target = OptIP("", "Target IPv4 or IPv6 address")
port = OptPort(443, "Target HTTP port") port = OptPort(443, "Target HTTP port")
ssl = OptBool("true", "SSL enabled: true/false") ssl = OptBool(True, "SSL enabled: true/false")
ssh_port = OptPort(22, "Target SSH Port") ssh_port = OptPort(22, "Target SSH Port")
......
...@@ -29,7 +29,7 @@ class Exploit(HTTPClient): ...@@ -29,7 +29,7 @@ class Exploit(HTTPClient):
} }
target = OptIP("", "Target IPv4 or IPv6 address") target = OptIP("", "Target IPv4 or IPv6 address")
port = OptPort(443, "Target HTTP port") port = OptPort(443, "Target HTTP port")
ssl = OptBool("true", "SSL enabled: true/false") ssl = OptBool(True, "SSL enabled: true/false")
def __init__(self): def __init__(self):
self.credentials = [] self.credentials = []
......
...@@ -14,8 +14,8 @@ class Exploit(BTLEClient): ...@@ -14,8 +14,8 @@ class Exploit(BTLEClient):
), ),
} }
enum = OptBool("false", "Automatically enumerate services: true/false") enum = OptBool(False, "Automatically enumerate services: true/false")
buffering = OptBool("true", "Buffering enabled: true/false. Results in real time.") buffering = OptBool(False, "Buffering enabled: true/false. Results in real time.")
def run(self): def run(self):
devices = self.btle_scan() devices = self.btle_scan()
......
...@@ -18,7 +18,7 @@ class Exploit(BTLEClient): ...@@ -18,7 +18,7 @@ class Exploit(BTLEClient):
target = OptMAC("", "Target MAC address") target = OptMAC("", "Target MAC address")
char = OptString("", "Characteristic") char = OptString("", "Characteristic")
data = OptString("41424344", "Data (in hex format)") data = OptString("41424344", "Data (in hex format)")
buffering = OptBool("true", "Buffering enabled: true/false. Results in real time.") buffering = OptBool(True, "Buffering enabled: true/false. Results in real time.")
def run(self): def run(self):
try: try:
......
...@@ -20,10 +20,10 @@ class Exploit(Exploit): ...@@ -20,10 +20,10 @@ class Exploit(Exploit):
target = OptIP("", "Target IPv4 or IPv6 address") target = OptIP("", "Target IPv4 or IPv6 address")
http_port = OptPort(80, "Target Web Interface Port") http_port = OptPort(80, "Target Web Interface Port")
http_ssl = OptBool("false", "HTTPS enabled: true/false") http_ssl = OptBool(False, "HTTPS enabled: true/false")
ftp_port = OptPort(21, "Target FTP port (default: 21)") ftp_port = OptPort(21, "Target FTP port (default: 21)")
ftp_ssl = OptBool("false", "FTPS enabled: true/false") ftp_ssl = OptBool(False, "FTPS enabled: true/false")
ssh_port = OptPort(22, "Target SSH port (default: 22)") ssh_port = OptPort(22, "Target SSH port (default: 22)")
telnet_port = OptPort(23, "Target Telnet port (default: 23)") telnet_port = OptPort(23, "Target Telnet port (default: 23)")
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment