-
Notifications
You must be signed in to change notification settings - Fork 449
/
setup.py
59 lines (52 loc) · 1.68 KB
/
setup.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
import os
import getpass
import subprocess
from setuptools import setup, find_packages
from lib.settings import VERSION
from lib.formatter import fatal, error
from lib.firewall_found import request_issue_creation
try:
raw_input
except:
raw_input = input
needs_username_fix = os.getuid() == 0
try:
if needs_username_fix:
username = raw_input("what is your username (needed for directory fixes): ")
else:
username = getpass.getuser()
subprocess.call(["bash", "install_helper.sh"])
setup(
name='whatwaf',
version=VERSION,
packages=find_packages(),
url='https://github.com/ekultek/whatwaf',
license='GPLv3',
author='ekultek',
author_email='[email protected]',
description='Detect and bypass web application firewalls and protection systems',
scripts=["whatwaf"],
install_requires=open("requirements.txt").read().split("\n")
)
if needs_username_fix:
if "root" == username:
# fixes weird docker issues
path = "/root/.whatwaf"
else:
path = "/home/{}/.whatwaf".format(os.path.expanduser(username))
subprocess.call(["chown", "-R", "{u}:{u}".format(u=username), path])
except Exception as e:
import sys, traceback
sep = "-" * 30
fatal(
"WhatWaf has caught an unhandled exception with the error message: '{}'.".format(str(e))
)
exception_data = "Traceback (most recent call):\n{}{}".format(
"".join(traceback.format_tb(sys.exc_info()[2])), str(e)
)
error(
"\n{}\n{}\n{}".format(
sep, exception_data, sep
)
)
request_issue_creation(exception_data)