from
boofuzz
import
*
IP
=
"10.10.10.1"
PORT
=
80
def
check_response(target, fuzz_data_logger, session,
*
args,
*
*
kwargs):
fuzz_data_logger.log_info(
"Checking test case response..."
)
try
:
response
=
target.recv(
512
)
except
:
fuzz_data_logger.log_fail(
"Unable to connect to target. Closing..."
)
target.close()
return
if
not
response:
fuzz_data_logger.log_fail(
"Empty response, target may be hung. Closing..."
)
target.close()
return
fuzz_data_logger.log_info(
"response check...\n"
+
response.decode())
target.close()
return
def
main():
session
=
Session(
target
=
Target(
connection
=
SocketConnection(IP, PORT, proto
=
"tcp"
),
),
post_test_case_callbacks
=
[check_response],
)
s_initialize(name
=
"Request"
)
with s_block(
"Request-Line"
):
s_group(
"Method"
, [
"GET"
])
s_delim(
" "
, fuzzable
=
False
, name
=
"space-1-1"
)
s_string(
"/goform/123"
, fuzzable
=
False
)
s_delim(
" "
, fuzzable
=
False
, name
=
"space-1-2"
)
s_static(
"HTTP/1.1"
, name
=
"HTTP_VERSION"
)
s_static(
"\r\n"
, name
=
"Request-Line-CRLF-1"
)
s_static(
"Host"
)
s_delim(
": "
, fuzzable
=
False
, name
=
"space-2-1"
)
s_string(
"10.10.10.1"
, fuzzable
=
False
, name
=
"IP address"
)
s_static(
"\r\n"
, name
=
"Request-Line-CRLF-2"
)
s_static(
"Connection"
)
s_delim(
": "
, fuzzable
=
False
, name
=
"space-3-1"
)
s_string(
"keep-alive"
, fuzzable
=
False
, name
=
"Connection state"
)
s_static(
"\r\n"
, name
=
"Request-Line-CRLF-3"
)
s_static(
"Cookie"
)
s_delim(
": "
, fuzzable
=
False
, name
=
"space-4-1"
)
s_string(
"bLanguage"
, fuzzable
=
False
, name
=
"key-bLanguage"
)
s_delim(
"="
, fuzzable
=
False
)
s_string(
"en"
, fuzzable
=
False
, name
=
"value-bLanguage"
)
s_delim(
"; "
, fuzzable
=
False
)
s_string(
"password"
, fuzzable
=
False
, name
=
"key-password"
)
s_delim(
"="
, fuzzable
=
False
)
s_string(
"ce24124987jfjekfjlasfdjmeiruw398r"
, fuzzable
=
True
)
s_static(
"\r\n"
, name
=
"Request-Line-CRLF-4"
)
s_static(
"\r\n"
)
s_static(
"\r\n"
)
session.connect(s_get(
"Request"
))
session.fuzz()
if
__name__
=
=
"__main__"
:
main()