Skip to content

Commit 257cc7e

Browse files
committed
Remove @before wrapper in favour of parsing args,kwargs
1 parent e2d2f92 commit 257cc7e

1 file changed

Lines changed: 3 additions & 11 deletions

File tree

aikido_zen/sinks/http_client.py

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,22 +3,16 @@
33
"""
44

55
from aikido_zen.helpers.get_argument import get_argument
6-
from aikido_zen.sinks import before, after, patch_function, on_import
6+
from aikido_zen.sinks import after, patch_function, on_import
77
from aikido_zen.vulnerabilities.ssrf.handle_http_response import (
88
handle_http_response,
99
)
1010
from aikido_zen.helpers.try_parse_url import try_parse_url
1111

1212

13-
@before
14-
def _putrequest(func, instance, args, kwargs):
15-
path = get_argument(args, kwargs, 1, "path")
16-
setattr(instance, "_aikido_var_path", path)
17-
18-
1913
@after
2014
def _getresponse(func, instance, args, kwargs, return_value):
21-
path = getattr(instance, "_aikido_var_path")
15+
path = get_argument(args, kwargs, 1, "path")
2216
source_url = try_parse_url(f"http://{instance.host}:{instance.port}{path}")
2317
handle_http_response(http_response=return_value, source=source_url)
2418

@@ -27,8 +21,6 @@ def _getresponse(func, instance, args, kwargs, return_value):
2721
def patch(m):
2822
"""
2923
patching module http.client
30-
- patches HTTPConnection.putrequest -> stores path
31-
- patches HTTPConnection.getresponse -> handles response object
24+
- patches HTTPConnection.getresponse
3225
"""
33-
patch_function(m, "HTTPConnection.putrequest", _putrequest)
3426
patch_function(m, "HTTPConnection.getresponse", _getresponse)

0 commit comments

Comments
 (0)