Skip to content

Commit bbb0c60

Browse files
committed
fixed bugs
1 parent 14e03bf commit bbb0c60

File tree

3 files changed

+46
-21
lines changed

3 files changed

+46
-21
lines changed

csharp_ini_maker.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@
22
import argparse
33

44
from antlr4 import *
5-
from CSharpLexer import CSharpLexer
6-
from CSharpParser import CSharpParser
7-
from CSharpParserListener import CSharpParserListener
5+
from module_maker.CSharpLexer import CSharpLexer
6+
from module_maker.CSharpParser import CSharpParser
7+
from module_maker.CSharpParserListener import CSharpParserListener
88

99

10-
from symbol_ini import SymbolINI
10+
from module_maker.symbol_ini import SymbolINI
1111

1212

1313
OMODULE_TYPES = [

csharp_module_maker.py

Lines changed: 42 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -145,14 +145,14 @@ def cli():
145145
template_vars_group.add_argument('--class-name',
146146
dest='mclass_name',
147147
type=str,
148-
required=True,
148+
required=False,
149149
default=None,
150150
help='Specify the class name of your template code.')
151151

152152
template_vars_group.add_argument('--func-name',
153153
dest='mfunc_name',
154154
type=str,
155-
required=True,
155+
required=False,
156156
default=None,
157157
help='Specify the entrypoint function to your code.')
158158

@@ -233,6 +233,23 @@ def cli():
233233

234234
sys.exit(1)
235235

236+
if args.mclass_name is None:
237+
238+
print()
239+
print(f'[!] The --class-name flag must be used with all output modules.')
240+
print()
241+
242+
sys.exit(1)
243+
244+
if args.mfunc_name is None:
245+
246+
print()
247+
print(f'[!] The --func-name flag must be used with all output modules.')
248+
print()
249+
250+
sys.exit(1)
251+
252+
236253
if args.mtype == 'decrypter' and args.validate_compatibility:
237254

238255
for m in args.mcompatible_imodules:
@@ -364,26 +381,28 @@ def cli():
364381
sys.exit(1)
365382

366383
# ensure input files actually exist and are not directories
384+
385+
if args.mtype in OMODULE_TYPES:
367386

368-
if not os.path.exists(args.source_file):
387+
if not os.path.exists(args.source_file):
369388

370-
print(f'[!] Error: source file {args.source_file} does not exist')
371-
sys.exit(1)
389+
print(f'[!] Error: source file {args.source_file} does not exist')
390+
sys.exit(1)
372391

373-
if not os.path.isfile(args.source_file):
392+
if not os.path.isfile(args.source_file):
374393

375-
print(f'[!] Error: source file {args.source_file} is a directory')
376-
sys.exit(1)
394+
print(f'[!] Error: source file {args.source_file} is a directory')
395+
sys.exit(1)
377396

378-
if not os.path.exists(args.symbol_file):
397+
if not os.path.exists(args.symbol_file):
379398

380-
print(f'[!] Error: symbol file {args.symbol_file} does not exist')
381-
sys.exit(1)
399+
print(f'[!] Error: symbol file {args.symbol_file} does not exist')
400+
sys.exit(1)
382401

383-
if not os.path.isfile(args.symbol_file):
402+
if not os.path.isfile(args.symbol_file):
384403

385-
print(f'[!] Error: symbol file {args.symbol_file} is a directory')
386-
sys.exit(1)
404+
print(f'[!] Error: symbol file {args.symbol_file} is a directory')
405+
sys.exit(1)
387406

388407
return args
389408

@@ -562,6 +581,8 @@ def create(args):
562581
with open(output_py_template_path, 'w') as output_handle:
563582
output_handle.write(rendered_template+'\n')
564583

584+
print(f'[*] Saved new module to path: {output_py_template_path}')
585+
565586
if source_file is not None:
566587

567588
with open(source_file) as input_handle:
@@ -579,6 +600,9 @@ def create(args):
579600
with open(output_file, 'w') as output_handle:
580601
output_handle.write(raw_output)
581602

603+
print(f'[*] Saved new template to path: {output_file}')
604+
605+
582606
else:
583607

584608
module_direction = 'input'
@@ -601,10 +625,13 @@ def create(args):
601625
description=mdescription,
602626
compatible_interfaces=compatible_interfaces,
603627
compatible_xmodules=compatible_xmodules)
604-
628+
605629
with open(output_py_template_path, 'w') as output_handle:
606630
output_handle.write(rendered_template+'\n')
607631

632+
print(f'[*] Saved new module to path: {output_py_template_path}')
633+
634+
608635
def main():
609636

610637
args = cli()

templates/module_maker/mm_crypter.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@
77

88
from Crypto.Cipher import AES
99

10-
# TODO: NEED TO FILL OUT DKEY FUNCTIONS / TEMPLATE RENDERING BECAUSE I FORGOT
11-
1210
class MCrypter(Crypter):
1311

1412
def __init__(self):

0 commit comments

Comments
 (0)