Skip to content

Commit

Permalink
creates a setup.py installer and starts deprecation of setup.sh (issue
Browse files Browse the repository at this point in the history
  • Loading branch information
Ekultek committed Dec 1, 2019
1 parent c06dcbf commit 133274c
Show file tree
Hide file tree
Showing 7 changed files with 52 additions and 9 deletions.
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,7 @@ payloads.txt
traffic*.txt
firewalls/*
test-*.json
test_env.sh
test_env.sh
whatwaf.egg-info/*
build/*
dist/*
1 change: 1 addition & 0 deletions content/files/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# have to make it a package...
4 changes: 2 additions & 2 deletions lib/cmd.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ def __init__(self):

@staticmethod
def cmd_parser():
parser = ArgumentParser(prog="whatwaf.py", add_help=True, usage=(
"./whatwaf.py -[u|l|b|g] VALUE|PATH|PATH|PATH [-p|--pl] PAYLOAD,..|PATH [--args]"
parser = ArgumentParser(prog="whatwaf", add_help=True, usage=(
"./whatwaf -[u|l|b|g] VALUE|PATH|PATH|PATH [-p|--pl] PAYLOAD,..|PATH [--args]"
))

mandatory = parser.add_argument_group("mandatory arguments",
Expand Down
2 changes: 1 addition & 1 deletion lib/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
pass

# version number <major>.<minor>.<commit>
VERSION = "1.7.1"
VERSION = "1.8"

# version string
VERSION_TYPE = "($dev)" if VERSION.count(".") > 1 else "($stable)"
Expand Down
36 changes: 36 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
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:
setup(
name='whatwaf',
version=VERSION,
packages=find_packages(),
url='https://github.com/ekultek/whatwaf',
license='GPLv3',
author='ekultek',
author_email='god_lok1@protonmail.com',
description='Detect and bypass web application firewalls and protection systems',
scripts=["whatwaf"],
install_requires=open("requirements.txt").read().split("\n")
)
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)
7 changes: 5 additions & 2 deletions setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ function install {
mkdir $home/.install
mkdir $exec_dir;
mkdir $copy_dir;
chmod +x ./whatwaf.py
chmod +x ./trigger.py
echo "copying files over..";
rsync -drq . $copy_dir
echo "creating executable";
Expand All @@ -51,11 +51,14 @@ EOF
}

function uninstall {
rm -rf ~/.whatwaf
rm -rf ~/.trigger
echo "home directory removed, manually remove the export PATH pertaining to $HOME/.whatwaf/bin"
}

function main {
echo "deprecated in favor of setup.py (USAGE: python setup.py install) this script will be removed by version 3.0";
echo "to continue with this type of installation press enter, otherwise CNTRL-C";
read;
banner;
if [[ "$1" == "install" ]]; then
echo -e " Installing:";
Expand Down
6 changes: 3 additions & 3 deletions trigger/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ def main():
if not len(sys.argv) > 1:
error("you failed to provide an option, redirecting to help menu")
time.sleep(2)
cmd = "python whatwaf.py --help"
cmd = "whatwaf --help"
subprocess.call(shlex.split(cmd))
exit(0)

Expand Down Expand Up @@ -97,7 +97,7 @@ def main():
warn(
"there appears to be no payloads stored in the database, to create payloads use the following options:"
)
proc = subprocess.check_output(["python", "whatwaf.py", "--help"])
proc = subprocess.check_output(["python", "whatwaf", "--help"])
parsed_help = parse_help_menu(str(proc), "encoding options:", "output options:")
print(parsed_help)
exit(1)
Expand All @@ -116,7 +116,7 @@ def main():
warn(
"there appears to be no payloads stored in the database, to create payloads use the following options:"
)
proc = subprocess.check_output(["python", "whatwaf.py", "--help"])
proc = subprocess.check_output(["python", "whatwaf", "--help"])
parsed_help = parse_help_menu(proc, "encoding options:", "output options:")
print(parsed_help)
exit(0)
Expand Down

0 comments on commit 133274c

Please sign in to comment.