-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinit.py
executable file
·31 lines (25 loc) · 893 Bytes
/
init.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
#!/usr/bin/env python
import time, argparse, settings, logging, os
from actions.bootstrap import *
from actions.dropdb import *
from actions.initdb import *
# Change directory
absolutePath = os.path.realpath(__file__)
directoryName = os.path.dirname(absolutePath)
os.chdir(directoryName)
# Enable logging
logging.basicConfig(filename='./bhas.log', level=logging.DEBUG)
# Parse program arguments
USAGE = '{1}.py [-dhi]\n\n\
BGP Hijack Alerting System, version {0} \
'.format(settings.VERSION, settings.APPNAME_SHORT)
parser = argparse.ArgumentParser(description=USAGE)
parser.add_argument('-d', '--dropdb', action="store_true", help='Drop the database tables and their contents')
parser.add_argument('-i', '--initialize', action="store_true", help='Initialize the database')
args = parser.parse_args()
if args.initialize:
initDb()
elif args.dropdb:
dropDb()
else:
bootstrap()