diff --git a/gtfo.py b/gtfo.py index b019310..8794242 100755 --- a/gtfo.py +++ b/gtfo.py @@ -4,7 +4,6 @@ import argparse import json import os from string import Template - from colorama import Fore, Style from pygments import highlight, formatters, lexers @@ -26,6 +25,8 @@ title = Template( ) description = Template(Style.DIM + '# ' + '$description' + Style.RESET_ALL) divider = '\n' + Style.BRIGHT + ' - ' * 10 + Style.RESET_ALL + '\n' +sep = '\n' + Style.BRIGHT + '-' * 100 + Style.RESET_ALL + '\n' + def parse_args(): @@ -33,41 +34,52 @@ def parse_args(): description="Command-line program for GTFOBins. " "It helps you to bypass system security restrictions. Version 1.0") parser.add_argument('-v', '--version', action='version', version='%(prog)s 1.0') - parser.add_argument('binary', metavar='[binary]', action='store', help='specifies the binary file') + parser.add_argument('-b', '--binary', action='store', help='specifies the binary file') + parser.add_argument('-l', '--list') return parser.parse_args() + def main(binary): + print(Fore.YELLOW + sep + " " * 45 + binary.upper() + Fore.YELLOW + sep + Style.RESET_ALL,end='') file_path = data_dir + binary + json_ext if os.path.isfile(file_path): - print(info.safe_substitute(text="Supplied binary: " + binary)) - print(info.safe_substitute(text="Please wait, loading data ... ")) with open(file_path) as source: data = source.read() json_data = json.loads(data) if 'description' in json_data: - print('\n' + description.safe_substitute(description=json_data['description'])) + print('\n' + description.safe_substitute(description=json_data['description']),end='') for vector in json_data['functions']: - print(title.safe_substitute(title=str(vector).upper())) + print(title.safe_substitute(title=str(vector).upper()),end='') index = 0 for code in json_data['functions'][vector]: index = index + 1 if 'description' in code: - print(description.safe_substitute(description=code['description']) + '\n') + print(description.safe_substitute(description=code['description']),end='' + '\n') print(highlight(code['code'], lexers.BashLexer(), formatters.TerminalTrueColorFormatter(style='igor')).strip()) if index != len(json_data['functions'][vector]): - print(divider) - - print('\n' + info.safe_substitute(text="Goodbye, friend.")) + print(divider,end='') else: - print(fail.safe_substitute(text="Sorry, couldn't find anything for " + binary)) + print(fail.safe_substitute(text="Sorry, couldn't find anything for " + binary),end='') +def list(): + file = open('list.txt', 'r') + Lines = file.readlines() + count = 0 + + for line in Lines: + count += 1 + main(line.strip()) + if __name__ == '__main__': os.system('cls' if os.name == 'nt' else 'clear') print(banner) args = parse_args() - main(binary=args.binary) + if args.list: + list() + else: + main(binary=args.binary) diff --git a/samplelist.txt b/samplelist.txt new file mode 100644 index 0000000..1628362 --- /dev/null +++ b/samplelist.txt @@ -0,0 +1,7 @@ +awk +nope +cowsay +dd +notin +ping +diff