-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinputHelper.py
43 lines (35 loc) · 1.25 KB
/
inputHelper.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
def getFilePath(user_arguments):
amountOfArgs = len(user_arguments)
fileFlag = "-f"
for i in range(amountOfArgs):
if user_arguments[i] == fileFlag:
return user_arguments[i + 1]
return 0
def getHelp(user_arugments):
helpFlag = "-h"
helpFlagv2 = "--help"
for arg in user_arugments:
if arg == helpFlag or arg == helpFlagv2:
return True
return False
def printHelp():
print('-f <path_output_file>\tspesifiy the file you want filtered\n')
print('-hm method1,method2,method3...\tfilters on HTTP methods (GET, POST etc.)\n')
print('-c code1,code2,code3...\tfilters on HTTP Reponse code (200,404,301 etc.)\n')
print('-h or --help prints this message\n')
def getHttpMethods(user_arguments):
amountOfArgs = len(user_arguments)
httpFlag = "-hm"
for i in range(amountOfArgs):
if user_arguments[i] == httpFlag:
arr = user_arguments[i + 1].split(",")
return arr
return False
def getResponseCodes(user_arguments):
amountOfArgs = len(user_arguments)
responseCodeFlag = "-c"
for i in range(amountOfArgs):
if user_arguments[i] == responseCodeFlag:
arr = user_arguments[i + 1].split(",")
return arr
return False