Skip to content

Function that replaces the socket of a requests.Session

Notifications You must be signed in to change notification settings

MaxDerDeveloper/hookSession.py

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 

Repository files navigation

hookSession.py

This simple python script introduces a function to exchange a requests.Session-object's socket for another socket
This is very useful in combination with wrapped sockets (TLS, Socks, Torpy, etc.)

Usage

Rather self-explanatory usage:

# Take an existing requests.Session object,
old_session: requests.Session

# ... an existing (wrapped) socket to be inserted
new_socket: socket.socket

# and lastly, retrieve the newly created Session from the method
new_session = hookSession(old_session, new_socket)

Credits

The base for this script was provided by this post on pretagteam.com.
However, the code was outdated, so I considered it my duty to restore and partially improve some of the code.

Contribution

Feel free to open an issue and suggest improvements.

Donation

If this little projected helps you in any way, I'd be pleased by a donation.

  • ETH/BSC @ 0xbdecadb203d6950a5787e05250883c456c267fd5

About

Function that replaces the socket of a requests.Session

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages