-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathworkpaper.py
executable file
·59 lines (48 loc) · 1.91 KB
/
workpaper.py
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
#!/usr/local/bin/python3
# -*- coding: utf-8 -*-
# Temp Stuff
import shutil
# Required Stuff
import warnings
import os
import logging
import argparse
import urllib3
from aurora.wp import WorkPaper
from aurora.misc import ConfigParser
from aurora.vault import VaultClient
from pprint import pprint
LOG_FORMAT = '%(asctime)-15s [%(levelname)s] [%(module)s.%(funcName)s] %(message)s'
LOG_FILE = '/tmp/vault/logs/workpaper.log'
LOG_LEVEL = logging.INFO
# Temp Stuff
warnings.simplefilter(action='ignore', category=FutureWarning)
urllib3.disable_warnings(urllib3.exceptions.SubjectAltNameWarning)
# Logging Configuration
logging.basicConfig(format=LOG_FORMAT, filename=LOG_FILE, level=LOG_LEVEL)
local_logger = logging.getLogger('workpaper')
local_logger.info("Starting...")
# Parsing of Arguments
parser = argparse.ArgumentParser(
description="Tool to read encrypted files, parse them and create Excel files to be used as workpapers\
to decrypt files, the tool will connect to vault using values taken from the OS environmental variables\
VHOST, VTOKEN and VCACERT")
parser.add_argument(
"clientid", help="Specify the clientid you will be generating WP for")
parser.add_argument(
"input_folder", help="Specify the path where the files will be taken from")
parser.add_argument(
"output_folder", help="Specify the path where the files will be written to")
args = parser.parse_args()
# Instantiate the super vault's client library
vault = VaultClient(os.environ.get('VURL'),
os.environ.get('VTOKEN'), local_logger, in_cacert=os.environ.get('VCACERT'))
# The Real Work Starts here
wp = WorkPaper(vault, args.clientid, args.input_folder,
args.output_folder, local_logger)
wp.load_full_data()
if wp.generate_wp_file('monthly'):
print("Monlthly Documents Generated Succesfully!")
if wp.generate_wp_file('yearly'):
print("Yearly Documents Generated Succesfully!")
local_logger.info("Done")