From 521d90598cd3a85fd085025699d41b17f88fabc1 Mon Sep 17 00:00:00 2001 From: Imanol-Mikel Barba Sabariego Date: Tue, 25 Oct 2016 09:36:05 +0200 Subject: [PATCH] Progress on various modules --- .idea/workspace.xml | 182 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++----------------------------------------------------------------------------- __pycache__/tomb.cpython-34.pyc | Bin 490 -> 0 bytes digger.py | 57 +++++++++++++++++++++++++++++++++++---------------------- modules/__pycache__/info.cpython-34.pyc | Bin 0 -> 929 bytes modules/__pycache__/mft.cpython-34.pyc | Bin 1107 -> 0 bytes modules/__pycache__/winreg.cpython-34.pyc | Bin 0 -> 1002 bytes modules/info.py | 20 ++++++++++++++++++++ modules/mft.py | 5 +++-- modules/winreg.py | 23 +++++++++++++++++++++++ tomb.py | 3 ++- 10 files changed, 188 insertions(+), 102 deletions(-) create mode 100644 modules/__pycache__/info.cpython-34.pyc create mode 100644 modules/__pycache__/winreg.cpython-34.pyc create mode 100644 modules/info.py create mode 100644 modules/winreg.py diff --git a/.idea/workspace.xml b/.idea/workspace.xml index cbae5a7..e165abe 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -2,7 +2,12 @@ + + + + + @@ -27,21 +32,11 @@ - - - - - - - - - - - + - - + + @@ -62,8 +57,8 @@ - - + + @@ -72,7 +67,7 @@ - + @@ -91,11 +86,11 @@ - + - - + + @@ -103,31 +98,45 @@ - - + + - - - + + + + + - - + + + + + + + + + + + + + + - + - - + + - - + + @@ -152,7 +161,6 @@ @@ -170,10 +181,10 @@ DEFINITION_ORDER - @@ -244,20 +255,6 @@ \ No newline at end of file diff --git a/__pycache__/tomb.cpython-34.pyc b/__pycache__/tomb.cpython-34.pyc index 4e8a3e4..9e5e46e 100644 Binary files a/__pycache__/tomb.cpython-34.pyc and b/__pycache__/tomb.cpython-34.pyc differ diff --git a/digger.py b/digger.py index 48e399a..6d3f122 100644 --- a/digger.py +++ b/digger.py @@ -6,6 +6,7 @@ import glob import os import sys import subprocess as sp +import tomb sys.path.append('modules') sys.path.append('vars') @@ -27,8 +28,6 @@ def getModules(): sys.modules.pop(modname) except Exception as e: print("Exception raised while importing " + modname) - - choiceList.append(("all","Execute all modules",False)) return choiceList def prepareModule(moduleName): @@ -41,29 +40,43 @@ d = Dialog(dialog="dialog",autowidgetsize=True) d.set_background_title("Gravedigger") moduleList = getModules() -code, tags = d.checklist("Select modules to execute", - choices=moduleList, - title="Module selection") +code,value = d.inputbox("Input computer's name") if code == d.OK: - runlist = [] - try: - if "All" in tags: - for module in moduleList: - runlist.append(prepareModule(module)) - else: - for tag in tags: - runlist.append(prepareModule(tag)) + tomb.__MACHINE_NAME__ = value + d.set_background_title("Gravedigger - " + value) + code, tags = d.checklist("Select modules to execute", + choices=moduleList + [("all","Execute all modules",False)], + title="Module selection") + if code == d.OK: + runlist = [] + try: + if "all" in tags: + for module in moduleList: + runlist.append(prepareModule(module[0])) + else: + for tag in tags: + runlist.append(prepareModule(tag)) - sp.call('clear', shell=True) + sp.call('clear', shell=True) - for module in runlist: - print("Running " + module.name + "...") - try: - module.run() - except Exception as e: - print("Exception raised while running " + module.name + ": " + str(e)) + for module in runlist: + print("Running " + module.name + "...") + try: + module.run() + except Exception as e: + print("Exception raised while running " + module.name + ": " + str(e)) - except Exception as e: - print("Exception raised while preparing module: " + str(e)) + code, tag = d.menu("All modules finished execution",choices=[("Poweroff","Shutdown the computer"), + ("Reboot","Reboot the computer"), + ("Restart","Run Gravedigger again")]) + if(code == d.OK): + if tag == "Poweroff": + sp.call("poweroff",shell=True) + elif tag == "Reboot": + sp.call("reboot", shell=True) + + + except Exception as e: + print("Exception raised while preparing module: " + str(e)) diff --git a/modules/__pycache__/info.cpython-34.pyc b/modules/__pycache__/info.cpython-34.pyc new file mode 100644 index 0000000..b7b63fa Binary files /dev/null and b/modules/__pycache__/info.cpython-34.pyc differ diff --git a/modules/__pycache__/mft.cpython-34.pyc b/modules/__pycache__/mft.cpython-34.pyc index a0f6321..d021b14 100644 Binary files a/modules/__pycache__/mft.cpython-34.pyc and b/modules/__pycache__/mft.cpython-34.pyc differ diff --git a/modules/__pycache__/winreg.cpython-34.pyc b/modules/__pycache__/winreg.cpython-34.pyc new file mode 100644 index 0000000..2c4d4be Binary files /dev/null and b/modules/__pycache__/winreg.cpython-34.pyc differ diff --git a/modules/info.py b/modules/info.py new file mode 100644 index 0000000..a0b25ba --- /dev/null +++ b/modules/info.py @@ -0,0 +1,20 @@ +from module import Module +from runcmd import runProcess +import tomb +import os + +def getInstance(): + return INFOModule() + +class INFOModule(Module): + + def __init__(self): + self.name = "info" + self.description = "Extracts information about this machine" + self.requiredVars = [] + self.vars = {} + + def run(self): + path = tomb.getPath() + self.name + "/" + os.mkdir(path) + #getinfo diff --git a/modules/mft.py b/modules/mft.py index 57ca2f5..ed471d4 100644 --- a/modules/mft.py +++ b/modules/mft.py @@ -15,10 +15,11 @@ class MFTModule(Module): self.vars = {} def run(self): - os.mkdir(tomb.getPath() + "mft/") + path = tomb.getPath() + self.name + "/" + os.mkdir(path) for vol in self.vars['ntfsvol'].value: result = runProcess(["icat","/dev/" + vol,"0"]) - mftbin = open(tomb.getPath() + "mft/" + vol + ".bin",'wb') + mftbin = open(path + vol + ".bin",'wb') mftbin.write(result[0]) mftbin.close() diff --git a/modules/winreg.py b/modules/winreg.py new file mode 100644 index 0000000..b55581f --- /dev/null +++ b/modules/winreg.py @@ -0,0 +1,23 @@ +from module import Module +from runcmd import runProcess +import tomb +import os + +def getInstance(): + return RegistryModule() + +class RegistryModule(Module): + + def __init__(self): + self.name = "winreg" + self.description = "Extracts Windows Registry files" + self.requiredVars = ["ntfsvol"] + self.vars = {} + + def run(self): + path = tomb.getPath() + self.name + "/" + os.mkdir(path) + for vol in self.vars['ntfsvol'].value: + pass + #runstuff + diff --git a/tomb.py b/tomb.py index df3276a..f8d04ac 100644 --- a/tomb.py +++ b/tomb.py @@ -1,9 +1,10 @@ import os __ROOT_PATH__ = "/bones/" +__MACHINE_NAME__ = "JOHN_DOE" def __getTomb__(): - return "test" + return __MACHINE_NAME__ def getPath(): path = __ROOT_PATH__ + __getTomb__() + "/" -- libgit2 0.22.2