mirror of
https://github.com/ysoftdevs/wapifuzz.git
synced 2026-03-26 03:11:15 +01:00
Folder removed
This commit is contained in:
21
fuzzer/fake_socket.py
Normal file
21
fuzzer/fake_socket.py
Normal file
@@ -0,0 +1,21 @@
|
||||
from http.client import HTTPResponse, HTTPException
|
||||
from typing import Union
|
||||
from io import BytesIO
|
||||
|
||||
|
||||
class FakeSocket:
|
||||
def __init__(self, response_str):
|
||||
self._file = BytesIO(response_str)
|
||||
|
||||
def makefile(self, *args, **kwargs):
|
||||
return self._file
|
||||
|
||||
|
||||
def get_response_object(data) -> Union[HTTPResponse, None]:
|
||||
try:
|
||||
source = FakeSocket(data)
|
||||
response = HTTPResponse(source)
|
||||
response.begin()
|
||||
return response
|
||||
except HTTPException:
|
||||
return None
|
||||
Reference in New Issue
Block a user