33 lines
867 B
Python
33 lines
867 B
Python
import sys, os
|
|
try:
|
|
from .generator import generate
|
|
except ImportError:
|
|
from generator import generate
|
|
|
|
def main():
|
|
if len(sys.argv) < 2:
|
|
print(f"usage: python -m dropper <input.exe> [output.bat]")
|
|
sys.exit(1)
|
|
|
|
input_path = sys.argv[1]
|
|
output_path = sys.argv[2] if len(sys.argv) >= 3 else os.path.splitext(os.path.basename(input_path))[0] + '_dropper.bat'
|
|
|
|
if not os.path.exists(input_path):
|
|
print(f"file not found: {input_path}")
|
|
sys.exit(1)
|
|
|
|
with open(input_path, 'rb') as f:
|
|
exe_data = f.read()
|
|
|
|
if not exe_data:
|
|
print("empty file")
|
|
sys.exit(1)
|
|
|
|
print(f"in: {input_path}")
|
|
print(f"out: {output_path}")
|
|
|
|
if generate(exe_data, output_path):
|
|
print(f"\ndone: {output_path}")
|
|
else:
|
|
print("failed")
|
|
sys.exit(1) |