forked from dimkarakostas/breach
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbreach.py
More file actions
65 lines (57 loc) · 1.89 KB
/
Copy pathbreach.py
File metadata and controls
65 lines (57 loc) · 1.89 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
'''
File: breach.py
Author: Dimitris Karakostas
Description: BREACH main execution script.
'''
import sys
import signal
import datetime
import logging
import parse
import traceback
import yaml
from iolibrary import kill_signal_handler, get_arguments_dict, setup_logger, setup_command_and_control
signal.signal(signal.SIGINT, kill_signal_handler)
class Breach():
'''
Start and execute breach attack.
'''
def __init__(self, args):
self.args = args
if 'debug_logger' not in args:
if args['verbose'] < 2:
setup_logger('debug_logger', 'debug.log', args, logging.ERROR)
else:
setup_logger('debug_logger', 'debug.log', args)
self.debug_logger = logging.getLogger('debug_logger')
self.args['debug_logger'] = self.debug_logger
else:
self.debug_logger = args['debug_logger']
return
def execute_parser(self):
self.parser = parse.Parser(self.args)
args = self.parser.parse_input()
return args
if __name__ == '__main__':
args = {}
with open('config.yml', 'r') as ymlconf:
cfg = yaml.load(ymlconf, Loader=yaml.FullLoader)
args.update(cfg['execution'])
args.update(cfg['endpoint'])
args.update(cfg['local'])
args.update(cfg['logging'])
setup_command_and_control(args)
args.update(get_arguments_dict(sys.argv))
args.update({'start_time': datetime.datetime.now(),
'win_count': {},
'point_count': {},
'history_folder': 'history/'})
try:
while 1:
args['illegal_iterations'] = []
breach = Breach(args)
args = breach.execute_parser()
breach.debug_logger.debug('Found the following illegal iterations: ' + str(args['illegal_iterations']) + '\n')
except Exception as e:
print(e)
traceback.print_exc()