You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
2 months ago | |
---|---|---|
README.md | 2 months ago | |
hijack.py | 2 months ago |
README.md
ImportsLogger
It logs. That's it.
❯ cat f.py
import requests
r = requests.get("https://fsf.org")
print(r.status_code)
❯ python hijack.py f.py # Supports -m too
[INFO] In function hijacked_import@74 [root] => Imported name='requests', pkg='', fromlist=None
[INFO] In function __getattr__@42 [requests] => getattr(get) -> <function get at 0x7fde1ee669e0>
[INFO] In function _@26 [requests.get] => Called with ('https://fsf.org',), {}
[DEBUG] In function _new_conn@1003 [urllib3.connectionpool] => Starting new HTTPS connection (1): fsf.org:443
[DEBUG] In function _make_request@456 [urllib3.connectionpool] => https://fsf.org:443 "GET / HTTP/1.1" 301 185
[DEBUG] In function _new_conn@1003 [urllib3.connectionpool] => Starting new HTTPS connection (1): www.fsf.org:443
[DEBUG] In function _make_request@456 [urllib3.connectionpool] => https://www.fsf.org:443 "GET / HTTP/1.1" 200 13643
[INFO] In function __getattr__@42 [ret_requests.get] => getattr(status_code) -> 200
[DEBUG] In function getLogger@50 [root] => Returning real value 200
200
It also sucks and it's hacky.