From 8c85abda2bd8b0c70f79086634152b73034ebb3f Mon Sep 17 00:00:00 2001 From: m0rv4i Date: Tue, 30 Apr 2019 12:12:20 +0100 Subject: [PATCH] Fix pyreadline on Windows --- Core.py | 5 ++++- ImplantHandler.py | 5 ++++- PSHandler.py | 5 ++++- TabComplete.py | 5 ++++- Tasks.py | 3 --- 5 files changed, 16 insertions(+), 7 deletions(-) diff --git a/Core.py b/Core.py index e4a0a47..68c0b94 100644 --- a/Core.py +++ b/Core.py @@ -1,11 +1,14 @@ #!/usr/bin/python -import zlib, argparse, os, re, datetime, time, base64, string, random, codecs, glob, readline, pyreadline.rlmain +import zlib, argparse, os, re, datetime, time, base64, string, random, codecs, glob, readline from Config import HTTPResponses, POSHDIR, PayloadsDirectory from Utils import randomuri from TabComplete import tabCompleter from Help import COMMANDS +if os.name == 'nt': + import pyreadline.rlmain + def default_response(): return (random.choice(HTTPResponses)).replace("#RANDOMDATA#",randomuri()) diff --git a/ImplantHandler.py b/ImplantHandler.py index c6bee3b..adad6f2 100644 --- a/ImplantHandler.py +++ b/ImplantHandler.py @@ -1,6 +1,6 @@ #!/usr/bin/python -import sys, re, os, time, subprocess, traceback, signal, argparse, readline, pyreadline.rlmain +import sys, re, os, time, subprocess, traceback, signal, argparse, readline from sqlite3 import Error from Help import logopic, PRECOMMANDS, UXCOMMANDS, SHARPCOMMANDS, COMMANDS, pre_help from DB import update_item, get_c2server_all, get_implants_all, get_tasks, get_implantdetails, new_urldetails @@ -18,6 +18,9 @@ from PyHandler import handle_py_command from SharpHandler import handle_sharp_command from PSHandler import handle_ps_command +if os.name == 'nt': + import pyreadline.rlmain + def catch_exit(signum, frame): sys.exit(0) diff --git a/PSHandler.py b/PSHandler.py index f4d3b05..170bd09 100644 --- a/PSHandler.py +++ b/PSHandler.py @@ -1,4 +1,4 @@ -import base64, re, traceback, os, sys, readline, pyreadline.rlmain +import base64, re, traceback, os, sys, readline from Alias import ps_alias from Colours import Colours from Utils import randomuri, validate_sleep_time @@ -12,6 +12,9 @@ from Payloads import Payloads from Utils import argp, load_file, gen_key from TabComplete import tabCompleter +if os.name == 'nt': + import pyreadline.rlmain + def handle_ps_command(command, user, randomuri, startup, createdaisypayload, createproxypayload): try: check_module_loaded("Stage2-Core.ps1", randomuri, user) diff --git a/TabComplete.py b/TabComplete.py index 7430f67..a1e7bb5 100644 --- a/TabComplete.py +++ b/TabComplete.py @@ -1,6 +1,9 @@ #!/usr/bin/python -import os, sys, readline, pyreadline.rlmain, glob +import os, sys, readline, glob + +if os.name == 'nt': + import pyreadline.rlmain class tabCompleter(object): """ diff --git a/Tasks.py b/Tasks.py index e766a90..5835c69 100644 --- a/Tasks.py +++ b/Tasks.py @@ -82,6 +82,3 @@ def newTask(path): now = datetime.datetime.now() DB.update_implant_lastseen(now.strftime("%m/%d/%Y %H:%M:%S"),RandomURI) return default_response() - #else: - # return None -