From e744979ca8e5f3d0ff9af98e338c4636926c1f34 Mon Sep 17 00:00:00 2001 From: L1ghtn1ng Date: Tue, 19 Jan 2021 18:59:40 +0000 Subject: [PATCH] a few tidy ups --- lib/commands/cat.py | 9 +++++---- lib/commands/elevate.py | 1 + lib/commands/help.py | 3 ++- lib/commands/ls.py | 7 ++++--- lib/commands/psh.py | 3 ++- lib/commands/pwd.py | 2 +- lib/commands/rm.py | 7 ++++--- lib/commands/rubeus.py | 4 ++-- 8 files changed, 21 insertions(+), 15 deletions(-) diff --git a/lib/commands/cat.py b/lib/commands/cat.py index cc9cf09..ee59f27 100644 --- a/lib/commands/cat.py +++ b/lib/commands/cat.py @@ -17,7 +17,7 @@ ERROR = False error_list = "" -# let argparse error and exit nice + def error(message): global ERROR, error_list ERROR = True @@ -25,7 +25,8 @@ def error(message): def exit(status=0, message=None): - if message != None: print(message) + if message != None: + print(message) return @@ -53,8 +54,8 @@ def main(shad0w, args): # init the parser parse = argparse.ArgumentParser(prog='cat', - formatter_class=argparse.RawDescriptionHelpFormatter, - epilog=usage_examples) + formatter_class=argparse.RawDescriptionHelpFormatter, + epilog=usage_examples) # keep it behaving nice parse.exit = exit diff --git a/lib/commands/elevate.py b/lib/commands/elevate.py index de949cf..c9fdb85 100644 --- a/lib/commands/elevate.py +++ b/lib/commands/elevate.py @@ -172,3 +172,4 @@ def main(shad0w, args): if RAN_COMMAND == False: parse.print_help() + return \ No newline at end of file diff --git a/lib/commands/help.py b/lib/commands/help.py index fab2688..d705ebc 100644 --- a/lib/commands/help.py +++ b/lib/commands/help.py @@ -25,7 +25,8 @@ def usage(shad0w): for num, command in enumerate(cmd.Shad0wLexer.commands): mod = importlib.import_module("lib.commands." + command) - if shad0w.debugv: importlib.reload(mod) + if shad0w.debugv: + importlib.reload(mod) try: description = mod.__description__ diff --git a/lib/commands/ls.py b/lib/commands/ls.py index 2b314d1..03b3ee9 100644 --- a/lib/commands/ls.py +++ b/lib/commands/ls.py @@ -9,7 +9,7 @@ __author__ = "@_batsec_" __type__ = "file system" -EXEC_ID = 0x4000 +EXEC_ID = 0x4000 OPCODE_LS = 0x1000 ERROR = False @@ -23,7 +23,8 @@ def error(message): def exit(status=0, message=None): - if message != None: print(message) + if message is not None: + print(message) return @@ -97,7 +98,7 @@ def main(shad0w, args): dir = get_list_directory(raw_args, args) # make the json - data = {"op" : OPCODE_LS, "args": dir} + data = {"op": OPCODE_LS, "args": dir} data = json.dumps(data) # set a task for the current beacon to do diff --git a/lib/commands/psh.py b/lib/commands/psh.py index 085e11c..bd8e5b7 100644 --- a/lib/commands/psh.py +++ b/lib/commands/psh.py @@ -36,7 +36,8 @@ def error(message): def exit(status=0, message=None): - if message != None: print(message) + if message is not None: + print(message) return diff --git a/lib/commands/pwd.py b/lib/commands/pwd.py index 52cc3e6..3f5f355 100644 --- a/lib/commands/pwd.py +++ b/lib/commands/pwd.py @@ -25,7 +25,7 @@ def main(shad0w, args): return # make the json - data = {"op" : OPCODE_PWD, "args": "null"} + data = {"op": OPCODE_PWD, "args": "null"} data = json.dumps(data) # set a task for the current beacon to do diff --git a/lib/commands/rm.py b/lib/commands/rm.py index 528a83b..5b45e36 100644 --- a/lib/commands/rm.py +++ b/lib/commands/rm.py @@ -9,7 +9,7 @@ __author__ = "@_batsec_" __type__ = "file system" -EXEC_ID = 0x4000 +EXEC_ID = 0x4000 OPCODE_RM = 0x4000 ERROR = False @@ -23,7 +23,8 @@ def error(message): def exit(status=0, message=None): - if message != None: print(message) + if message is not None: + print(message) return @@ -75,7 +76,7 @@ def main(shad0w, args): del_file = ' '.join(args.name).replace('\\', "\\\\").replace('"', '') # make the json - data = {"op" : OPCODE_RM, "args": del_file} + data = {"op": OPCODE_RM, "args": del_file} data = json.dumps(data) # set a task for the current beacon to do diff --git a/lib/commands/rubeus.py b/lib/commands/rubeus.py index 07f7efb..6ed0c34 100644 --- a/lib/commands/rubeus.py +++ b/lib/commands/rubeus.py @@ -52,8 +52,8 @@ def run(self, shad0w): def rubeus_callback(shad0w, data): - print(data) - return "" + print(data) + return "" def main(shad0w, args):