mirror of
https://github.com/dobin/SuperMega
synced 2026-06-02 17:27:10 +00:00
refactor: make project not singleton
This commit is contained in:
@@ -7,6 +7,7 @@ CONFIG_FILE = os.path.join(os.path.dirname(__file__), "config.yaml")
|
||||
class Config(object):
|
||||
def __init__(self):
|
||||
self.data = {}
|
||||
self.ShowCommandOutput: bool = False
|
||||
|
||||
def getConfigPath(self):
|
||||
return CONFIG_FILE
|
||||
|
||||
@@ -7,8 +7,6 @@ class FilePath(str):
|
||||
# with shellcodes/createfile.bin
|
||||
VerifyFilename: FilePath = r'C:\Temp\a'
|
||||
|
||||
ShowCommandOutput: bool = False
|
||||
|
||||
# Correlated with real template files
|
||||
# in plugins/
|
||||
|
||||
|
||||
@@ -5,7 +5,6 @@ import glob
|
||||
import logging
|
||||
|
||||
from config import config
|
||||
from project import project
|
||||
from defs import *
|
||||
|
||||
logger = logging.getLogger("Helper")
|
||||
@@ -54,7 +53,7 @@ def run_process_checkret(args, check=True):
|
||||
if ret.stderr != None:
|
||||
logger.info(ret.stderr.decode('utf-8'))
|
||||
raise Exception("Command failed: " + " ".join(args))
|
||||
if ShowCommandOutput:
|
||||
if config.ShowCommandOutput:
|
||||
logger.info("> " + " ".join(args))
|
||||
if ret.stdout != None:
|
||||
logger.info(ret.stdout.decode('utf-8'))
|
||||
|
||||
@@ -48,5 +48,3 @@ class Project():
|
||||
self.exe_info = ExeInfo()
|
||||
self.exe_info.parse_from_exe(self.inject_exe_in)
|
||||
|
||||
|
||||
project = Project()
|
||||
|
||||
+5
-4
@@ -15,7 +15,7 @@ import phases.compiler
|
||||
import phases.assembler
|
||||
import phases.injector
|
||||
from observer import observer
|
||||
from project import project
|
||||
from project import Project
|
||||
|
||||
|
||||
log_messages = []
|
||||
@@ -24,6 +24,7 @@ log_messages = []
|
||||
def main():
|
||||
logger.info("Super Mega")
|
||||
config.load()
|
||||
project = Project()
|
||||
|
||||
parser = argparse.ArgumentParser(description='SuperMega shellcode loader')
|
||||
parser.add_argument('--shellcode', type=str, help='The path to the file of your payload shellcode')
|
||||
@@ -40,7 +41,7 @@ def main():
|
||||
args = parser.parse_args()
|
||||
|
||||
if args.show:
|
||||
ShowCommandOutput = True
|
||||
config.ShowCommandOutput = True
|
||||
|
||||
if args.verify:
|
||||
project.payload_path = "shellcodes/createfile.bin"
|
||||
@@ -106,10 +107,10 @@ def main():
|
||||
project.inject_exe_in = args.inject
|
||||
project.inject_exe_out = args.inject.replace(".exe", ".infected.exe")
|
||||
|
||||
start()
|
||||
start(project)
|
||||
|
||||
|
||||
def start():
|
||||
def start(project: Project):
|
||||
# Delete: all old files
|
||||
if project.cleanup_files_on_start:
|
||||
clean_files()
|
||||
|
||||
Reference in New Issue
Block a user