forked from qtc-de/quickfuzz
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.py
More file actions
160 lines (123 loc) · 4.5 KB
/
setup.py
File metadata and controls
160 lines (123 loc) · 4.5 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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
import os
import shutil
import setuptools
from setuptools.command.develop import develop
from setuptools.command.install import install
def create_payloads_folder():
'''
quickfuzz ships a directory of payloads with the installation. This has to be
copied into a path that is known by the quickfuzz executable. This is done by
this function.
Paramaters:
None
Returns:
None
Side-Effects:
Creates a new shared folder inside ~/.local/share/
'''
user_home = os.path.expanduser("~")
module_path = os.path.abspath(os.path.dirname(__file__)) + "/quickfuzz/"
#creating the .local/share/quickfuzz folder
share_dir = ".local/share/quickfuzz"
if not os.path.isdir(f'{user_home}/{share_dir}'):
os.makedirs(f'{user_home}/{share_dir}', exist_ok=True)
#copying payloads_folder
payloads_folder = f'{share_dir}/payloads'
if not os.path.isdir(f'{user_home}/{payloads_folder}'):
shutil.copytree(f'{module_path}/resources/payloads', f'{user_home}/{payloads_folder}')
def create_completion_folders():
'''
quickfuzz ships scripts for bash and zsh auto completion. These were copied to the
desired locations in the users home by this function.
Paramaters:
None
Returns:
None
Side-Effects:
Creates completion files in the users home folder
'''
user_home = os.path.expanduser("~")
module_path = os.path.abspath(os.path.dirname(__file__))
#creating a .bash_completion.d directory
config_dir = "/.bash_completion.d/"
if not os.path.isdir(user_home + config_dir):
os.makedirs(user_home + config_dir, exist_ok=True)
#creating a .bash_completion file
config_file = "/.bash_completion"
if not os.path.isfile(user_home + config_file):
shutil.copy(module_path + "/quickfuzz/resources/bash_completion", user_home + config_file)
#creating bash autocomplete script
config_file = config_dir + "quickfuzz"
if not os.path.isfile(user_home + config_file):
shutil.copy(module_path + "/quickfuzz/resources/bash_completion.d/quickfuzz", user_home + config_file)
#creating a .zsh directory
config_dir = "/.zsh/"
if not os.path.isdir(user_home + config_dir):
os.makedirs(user_home + config_dir, exist_ok=True)
#creating zsh autocomplete script
config_file = config_dir + "_quickfuzz"
if not os.path.isfile(user_home + config_file):
shutil.copy(module_path + "/quickfuzz/resources/zsh_completion.d/_quickfuzz", user_home + config_file)
class post_develop_command(develop):
"""
Simple hook to do some additional stuff during installation
Parameters:
develop (Unkown) Some argument provided by setup.py
Returns:
None
Side Effects:
None
"""
def run(self):
create_payloads_folder()
create_completion_folders()
develop.run(self)
class post_install_command(install):
"""
Simple hook to do some additional stuff during installation
Parameters:
install (Unkown) Some argument provided by setup.py
Returns:
None
Side Effects:
None
"""
def run(self):
create_payloads_folder()
create_completion_folders()
install.run(self)
with open("README.md", "r") as fh:
long_description = fh.read()
setuptools.setup(
name = "quickfuzz",
author = "Tobias Neitzel",
author_email = "",
version = "1.0.0",
url = f"https://github.com/qtc-de/quickfuzz",
description = f"quickfuzz - quick service identification",
long_description = long_description,
long_description_content_type = "text/markdown",
install_requires = [
"termcolor",
],
scripts = [
'bin/quickfuzz',
],
cmdclass={
'develop': post_develop_command,
'install': post_install_command,
},
packages = setuptools.find_packages(),
package_data = {
'quickfuzz': [
'resources/*',
'resources/payloads/*',
'resources/bash_completion.d/*',
'resources/zsh_completion.d/*',
],
},
classifiers = [
"Programming Language :: Python :: 3",
"Operating System :: Unix",
],
)