forked from xmendez/wfuzz
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconftest.py
117 lines (89 loc) · 3.03 KB
/
conftest.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
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
import pytest
from wfuzz.fuzzrequest import FuzzRequest
from wfuzz.fuzzobjects import FuzzResult
from wfuzz.fuzzobjects import FPayloadManager
from wfuzz.filters.ppfilter import FuzzResFilter
from wfuzz.facade import Facade
@pytest.fixture
def full_fuzzres(request):
raw_req, raw_resp = request.param
fr = FuzzRequest()
fr.update_from_raw_http(raw_req, "http", raw_resp, None)
return FuzzResult(history=fr)
@pytest.fixture
def full_fuzzreq(request):
raw_req, raw_resp = request.param
fr = FuzzRequest()
fr.update_from_raw_http(raw_req, "http", raw_resp, None)
return fr
@pytest.fixture
def fuzzres_from_url(request):
fr = FuzzRequest()
fr.url = request.param
return FuzzResult(history=fr)
@pytest.fixture
def filter_obj():
return FuzzResFilter()
@pytest.fixture
def example_full_fuzzres():
raw_req, raw_resp = (
"GET /path?param1=1¶m2=2 HTTP/1.1\n"
"Host: www.wfuzz.org\n"
"User-Agent: curl/7.58.0\n"
"Accept: */*\n"
"Cookie: cookie1=1\n",
"HTTP/1.1 302 Found\n"
"Content-Type: text/html; charset=utf-8\n"
"Content-Language: en\n"
"Location: https://wfuzz.readthedocs.io/en/latest/\n"
"Vary: Accept-Language, Cookie\n"
"Server: nginx/1.14.0 (Ubuntu)\n"
"X-Fallback: True\n"
"X-Served: Django\n"
"X-Deity: web01\n"
"Date: Wed, 23 Jan 2019 21:43:59 GMT\n"
"Content-Length: 0\n"
"Set-Cookie: name=Nicholas; expires=Sat, 02 May 2009 23:38:25 GMT\n",
)
fr = FuzzRequest()
fr.update_from_raw_http(
raw_req, "http", raw_resp, b"Some line\n and words\nasdsdas"
)
return FuzzResult(history=fr)
@pytest.fixture
def example_full_fuzzres_content(request):
raw_content = request.param
raw_req, raw_resp = (
"GET /path?param1=1¶m2=2 HTTP/1.1\n"
"Host: www.wfuzz.org\n"
"User-Agent: curl/7.58.0\n"
"Accept: */*\n"
"Cookie: cookie1=1\n",
"HTTP/1.1 200 OK\n"
"Content-Type: text/html; charset=utf-8\n"
"Content-Language: en\n"
"Vary: Accept-Language, Cookie\n"
"Server: nginx/1.14.0 (Ubuntu)\n"
"X-Fallback: True\n"
"X-Served: Django\n"
"X-Deity: web01\n"
"Date: Wed, 23 Jan 2019 21:43:59 GMT\n"
"Content-Length: 0\n"
"Set-Cookie: name=Nicholas; expires=Sat, 02 May 2009 23:38:25 GMT\n",
)
fr = FuzzRequest()
fr.update_from_raw_http(raw_req, "http", raw_resp, raw_content)
fuzzres = FuzzResult(history=fr)
fuzzres.payload_man = FPayloadManager()
return fuzzres
@pytest.fixture
def example_full_fuzzres_no_response():
raw_req = "GET /path?param1=1¶m2=2 HTTP/1.1\nHost: www.wfuzz.org\nUser-Agent: curl/7.58.0\nAccept: */*\n"
fr = FuzzRequest()
fr.update_from_raw_http(raw_req, "http", None, None)
return FuzzResult(history=fr)
@pytest.fixture
def get_plugin():
def _get_customer_plugin(name):
return [x() for x in Facade().scripts.get_plugins(name)]
return _get_customer_plugin