A Cloudflare IUAM session grabber
Project description
CFSession
A python script utilizing undetected-chromedriver to collect session cookies in a cloudflare IUAM protected site
How it works
It relies on a modified selenium (undetected-chromedriver) to cloak on sites that block selenium based sessions. When a program is able to pass through the IAUM or Captcha verification the program immedietely saves the session token to cache to be able to access to the site right away without needing to verify again when program closes(until the token expires).
The library wraps around requests library.
Tested request types:
- GET
- POST
Untested request types: but functionally implemented:
- PUT
- PATCH
- DELETE
Usage:
Normal Usage:
import CFSession
if __name__ == "__main__":
session = CFSession.cfSession()
res = session.get("https://nowsecure.nl") #A Cloudflare protected site
print(res.content)
#Context Manager
with CFSession.cfSession() as session:
res = session.get("https://nowsecure.nl")
print(res.content)
Installation:
python3 -m pip install CFSession
or
pip3 install CFSession
Question:
Why not just scrape fully on selenium? There are some use cases that selenium might potentially cause more workloads than using requests directly, as selenium is a programmable browser, the output as well are dynamic and often not consistent. This does not say that requests
does not apply to this problem. There are also some uses like, IUAM sites completely blocks requests
library and your program is heavily written soley for requests
then this might be for you.
Is this just a requests wrapper? not fully. I havent implemented the entire requests
functions and will probably will not be adding until I have certain understanding on how they work. So I rely on people accessing the 'deep level' code that I have intentionally kept open incase there are some specific use cases
for example you can directly access the requests.Session
object directly in the cfSession
object
from CFSession import cfSession
cfs = cfSession()
cfs.session #<--- A requests.Session object
Disclaimer:
This library was created with the sole purpose of educational purposes only, any rules/laws/ToS broken should only be held at the sole responsibility of the user.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for CFSession-0.2.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | cc9f8b6fa86b3c0075ee72e902f1ec1c006c72b925884e4a10b22fda9daeaf18 |
|
MD5 | 0131280ef0d9c769c59deac2f6267b8a |
|
BLAKE2b-256 | fc564664f93642fc5a0d26fb593a17c9f2eb53370f558488d48e2fdd4e5564ed |