Skip to content

Commit

Permalink
Merge pull request #6 from j91321/devel
Browse files Browse the repository at this point in the history
Release 1.0.0 pull request
  • Loading branch information
j91321 authored Dec 24, 2016
2 parents 4e263e4 + 2920004 commit 5f0f626
Show file tree
Hide file tree
Showing 60 changed files with 2,135 additions and 420 deletions.
8 changes: 8 additions & 0 deletions CONTRIBUTORS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Contributors to REXT in (alphabetical order)
============================================

* **[Marcos Nesster](https://github.com/mh4x0f)**

* autocomplete for show and load commands
* **[Bernardo Rodrigues](https://github.com/bmaia)**
* fixing Arris Password of the day exploit
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ Requirements
I am trying to keep the requirements minimal:

- requests
- paramiko
- beautifulsoup4

License
=======
Expand Down
14 changes: 10 additions & 4 deletions core/Decryptor.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import core.globals
import interface.utils
from interface.messages import print_error, print_help
from interface.messages import print_error, print_help, print_info


class RextDecryptor(cmd.Cmd):
Expand All @@ -18,7 +18,7 @@ def __init__(self):
interface.utils.change_prompt(self, core.globals.active_module_path + core.globals.active_script)
self.cmdloop()

def do_exit(self, e):
def do_back(self, e):
return True

def do_info(self, e):
Expand All @@ -38,10 +38,16 @@ def do_set(self, e):
except IndexError:
print_error("please specify value for variable")

def complete_set(self, text, line, begidx, endidx):
modules = ["file"]
module_line = line.partition(' ')[2]
igon = len(module_line) - len(text)
return [s[igon:] for s in modules if s.startswith(module_line)]

def do_file(self, e):
print(self.input_file)
print_info(self.input_file)

def help_exit(self):
def help_back(self):
print_help("Exit script")

def help_run(self):
Expand Down
16 changes: 11 additions & 5 deletions core/Exploit.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import core.globals
import interface.utils
from interface.messages import print_error, print_help
from interface.messages import print_error, print_help, print_info


class RextExploit(cmd.Cmd):
Expand All @@ -19,7 +19,7 @@ def __init__(self):
interface.utils.change_prompt(self, core.globals.active_module_path + core.globals.active_script)
self.cmdloop()

def do_exit(self, e):
def do_back(self, e):
return True

def do_run(self, e):
Expand All @@ -41,16 +41,22 @@ def do_set(self, e):
except IndexError:
print_error("please specify value for variable")

def complete_set(self, text, line, begidx, endidx):
modules = ["host", "port"]
module_line = line.partition(' ')[2]
igon = len(module_line) - len(text)
return [s[igon:] for s in modules if s.startswith(module_line)]

def do_info(self, e):
print(self.__doc__)

def do_host(self, e):
print(self.host)
print_info(self.host)

def do_port(self, e):
print(self.port)
print_info(self.port)

def help_exit(self):
def help_back(self):
print_help("Exit script")

def help_run(self):
Expand Down
13 changes: 11 additions & 2 deletions core/Harvester.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def __init__(self):
interface.utils.change_prompt(self, core.globals.active_module_path + core.globals.active_script)
self.cmdloop()

def do_exit(self, e):
def do_back(self, e):
return True

def do_info(self, e):
Expand All @@ -44,7 +44,16 @@ def do_set(self, e):
except IndexError:
print_error("please specify value for variable")

def help_exit(self):
def complete_set(self, text, line, begidx, endidx):
modules = ["host", "port"]
module_line = line.partition(' ')[2]
igon = len(module_line) - len(text)
return [s[igon:] for s in modules if s.startswith(module_line)]

def help_set(self):
print_help("Set value of variable: \"set host 192.168.1.1\"")

def help_back(self):
print_help("Exit script")

def help_run(self, e):
Expand Down
4 changes: 2 additions & 2 deletions core/Misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@ def __init__(self):
def do_info(self, e):
print(self.__doc__)

def do_exit(self, e):
def do_back(self, e):
return True

def do_run(self, e):
pass

def help_exit(self):
def help_back(self):
print_help("Exit script")

def help_run(self):
Expand Down
47 changes: 28 additions & 19 deletions core/Scanner.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
#This file is part of REXT
#core.Scanner.py - super class for scanner scripts
#Author: Ján Trenčanský
#License: GNU GPL v3
# This file is part of REXT
# core.Scanner.py - super class for scanner scripts
# Author: Ján Trenčanský
# License: GNU GPL v3

import cmd

import core.globals
import interface.utils
from interface.messages import print_help, print_error
from interface.messages import print_help, print_error, print_info


class RextScanner(cmd.Cmd):
Expand All @@ -22,32 +22,41 @@ def __init__(self):
def do_info(self, e):
print(self.__doc__)

def do_exit(self, e):
def do_back(self, e):
return True

def do_run(self, e):
pass

def do_set(self, e):
args = e.split(' ')
if args[0] == "host":
if interface.utils.validate_ipv4(args[1]):
self.host = args[1]
else:
print_error("please provide valid IPv4 address")
elif args[0] == "port":
if str.isdigit(args[1]):
self.port = args[1]
else:
print_error("port value must be integer")
try:
if args[0] == "host":
if interface.utils.validate_ipv4(args[1]):
self.host = args[1]
else:
print_error("please provide valid IPv4 address")
elif args[0] == "port":
if str.isdigit(args[1]):
self.port = args[1]
else:
print_error("port value must be integer")
except IndexError:
print_error("please specify value for variable")

def complete_set(self, text, line, begidx, endidx):
modules = ["host", "port"]
module_line = line.partition(' ')[2]
igon = len(module_line) - len(text)
return [s[igon:] for s in modules if s.startswith(module_line)]

def do_host(self, e):
print(self.host)
print_info(self.host)

def do_port(self, e):
print(self.port)
print_info(self.port)

def help_exit(self):
def help_back(self):
print_help("Exit script")

def help_run(self):
Expand Down
20 changes: 10 additions & 10 deletions core/compression/lzs.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def getBit(self):

def getBits(self, num):
res = 0
for i in range(num): # TODO I think here is the main culprit
for i in range(num):
res += self.getBit() << num-1-i
return res

Expand Down Expand Up @@ -97,13 +97,13 @@ def LZSDecompress(data, window=RingList(2048)):
string and the final dictionary
"""
reader = BitReader(data)
result = b''
result = bytearray()

while True:
bit = reader.getBit()
if not bit:
char = reader.getByte()
result += bytes([char])
result.append(char)
window.append(char) # ERR: Something is wrong in this ring list
else:
bit = reader.getBit()
Expand Down Expand Up @@ -131,14 +131,14 @@ def LZSDecompress(data, window=RingList(2048)):
lenCounter += 1
lenght = 15*lenCounter + 8 + lenField

for i in range(lenght): # TODO Fix this shit
print(window.size())
print("Length:", lenght)
print("i:", i)
print("deq:", window.get())
print("size:", window.size())
for i in range(lenght):
#print(window.size())
#print("Length:", lenght)
#print("i:", i)
#print("deq:", window.get())
#print("size:", window.size())
char = window[-offset]
result += char
result.append(char)
window.append(char)

return result, window
6 changes: 3 additions & 3 deletions core/io.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import datetime
import os
import core.globals
from interface.messages import print_error, print_yellow, print_red
from interface.messages import print_error, print_info


# FIXME: If minute changes between two writes of one module, this will create two directories
Expand Down Expand Up @@ -55,11 +55,11 @@ def query_yes_no(question, default="yes"):
raise ValueError("invalid default answer: '%s'" % default)

while True:
print_yellow(question + prompt)
print_info(question + prompt)
choice = input().lower()
if default is not None and choice == '':
return valid[default]
elif choice in valid:
return valid[choice]
else:
print_red("Please respond with 'yes' or 'no' " "(or 'y' or 'n').\n")
print_error("Please respond with 'yes' or 'no' " "(or 'y' or 'n').\n")
14 changes: 13 additions & 1 deletion core/loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import importlib.util
import sqlite3
import interface.utils
import os
from interface.messages import print_error, print_warning


Expand Down Expand Up @@ -55,13 +56,24 @@ def check_dependencies():
dependency = dependency_list.readline()
if not dependency:
break
dependency = dependency[:dependency.find('==')]
# FIXME this is not the best way to parse dependencies probably, may break rext if == is used
dependency = dependency[:dependency.find('>=')]
# FIXME beautifulsoup4 is imported as bs4
if dependency == 'beautifulsoup4':
dependency = 'bs4'
found = importlib.util.find_spec(dependency)
if found is None:
print_warning(dependency + " not found some modules may not work!")
dependency_list.close()


def check_create_dirs():
directories = ['./output']
for dir in directories:
if not os.path.exists(dir):
os.makedirs(dir)


def open_database(path):
if interface.utils.file_exists(path):
connection = sqlite3.connect(path)
Expand Down
6 changes: 3 additions & 3 deletions core/updater.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

import interface.utils
import core.globals
from interface.messages import print_blue, print_error
from interface.messages import print_error, print_info


# Pull REXT from git repo
Expand All @@ -33,7 +33,7 @@ def update_oui():
connection = core.globals.ouidb_conn
cursor = connection.cursor()
# Truncate database
print_blue("Truncating oui table")
print_info("Truncating oui table")
cursor.execute("""DROP TABLE oui""")
cursor.execute("""CREATE TABLE oui (
id INTEGER PRIMARY KEY NOT NULL,
Expand All @@ -44,7 +44,7 @@ def update_oui():
# BEGIN guarantees that only one transaction will be used.
# Now the DB rebuild should take only seconds
cursor.execute('begin')
print_blue("Downloading new OUI file")
print_info("Downloading new OUI file")
path = interface.utils.wget("http://standards.ieee.org/regauth/oui/oui.txt", "./output/tmp_oui.txt")
if not path:
print_error('Failed to download')
Expand Down
Binary file added databases/bad_keys.db
Binary file not shown.
2 changes: 1 addition & 1 deletion interface/banner.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ REXT:Router EXploitation Toolkit
Author:Ján Trenčanský
Email:jan.trencansky(at)gmail.com
Twitter:@j91321
Version:0.0
Version:1.0.0
License:GNU GPL v3
================================
Loading

0 comments on commit 5f0f626

Please sign in to comment.