-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
34 lines (29 loc) · 910 Bytes
/
main.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
import re
import sys
from inputHelper import getFilePath, getHttpMethods, getResponseCodes, getHelp, printHelp
from regexHelper import buildResponseCodeRegex, buildHttpMethodRegex
if getHelp(sys.argv):
printHelp()
quit(1)
pathToFile = getFilePath(sys.argv)
httpMethods = getHttpMethods(sys.argv)
responseCodes = getResponseCodes(sys.argv)
httpMethodReg = ""
responseCodeReg = ""
if not pathToFile:
print("no file path, use -f to specify a path file")
quit(1)
if httpMethods:
httpMethodReg = buildHttpMethodRegex(httpMethods)
file = open(pathToFile, "r")
for line in file:
if re.findall(httpMethodReg, line):
print(line)
file.close()
if responseCodes:
responseCodeReg = buildResponseCodeRegex(responseCodes)
file = open(pathToFile, "r")
for line in file:
if re.findall(responseCodeReg, line):
print(line)
file.close()