Skip to content

Commit

Permalink
Merge pull request #4 from L1ghtn1ng/dev
Browse files Browse the repository at this point in the history
few tidy ups
  • Loading branch information
leebaird committed Jan 19, 2021
2 parents e506720 + e744979 commit 2cfd45b
Show file tree
Hide file tree
Showing 8 changed files with 21 additions and 15 deletions.
9 changes: 5 additions & 4 deletions lib/commands/cat.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,16 @@
ERROR = False
error_list = ""

# let argparse error and exit nice

def error(message):
global ERROR, error_list
ERROR = True
error_list += f"\033[0;31m{message}\033[0m\n"


def exit(status=0, message=None):
if message != None: print(message)
if message != None:
print(message)
return


Expand Down Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions lib/commands/elevate.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,3 +172,4 @@ def main(shad0w, args):

if RAN_COMMAND == False:
parse.print_help()
return
3 changes: 2 additions & 1 deletion lib/commands/help.py
Original file line number Diff line number Diff line change
Expand Up @@ -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__
Expand Down
7 changes: 4 additions & 3 deletions lib/commands/ls.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
__author__ = "@_batsec_"
__type__ = "file system"

EXEC_ID = 0x4000
EXEC_ID = 0x4000
OPCODE_LS = 0x1000

ERROR = False
Expand All @@ -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


Expand Down Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion lib/commands/psh.py
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down
2 changes: 1 addition & 1 deletion lib/commands/pwd.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 4 additions & 3 deletions lib/commands/rm.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
__author__ = "@_batsec_"
__type__ = "file system"

EXEC_ID = 0x4000
EXEC_ID = 0x4000
OPCODE_RM = 0x4000

ERROR = False
Expand All @@ -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


Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions lib/commands/rubeus.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ def run(self, shad0w):


def rubeus_callback(shad0w, data):
print(data)
return ""
print(data)
return ""


def main(shad0w, args):
Expand Down

0 comments on commit 2cfd45b

Please sign in to comment.