A powerful Python tool designed to help penetration testers and security professionals maintain active web sessions during testing. This tool allows users to send automated web requests at specified intervals, read request details from a file, and optionally use a proxy to route the requests.
This tool simplifies the process of keeping sessions active while performing security audits and penetration testing on web applications.
- Automated Web Requests: Send HTTP/HTTPS requests at a specified interval to maintain active sessions.
- Customizable Request Input: Parse HTTP request details from a text file, including headers, method, URL, and data.
- Proxy Support: Option to route web requests through a proxy (HTTP/HTTPS).
- Verbose Logging: Provides detailed logs of each request and response for transparency during testing.
To install the tool, you’ll need Python 3.x and the requests library. You can install the required dependencies by running:
pip install requestsAlternatively, you can set up a virtual environment to avoid conflicts with global dependencies:
python3 -m venv env
source env/bin/activate
pip install requestsThe tool reads request details from a specified file, sends the requests at the desired interval, and optionally routes the requests through a proxy.
python session_keepalive.py <request_file> <interval_in_seconds> [--proxy <proxy_url>]request_file: Path to the file containing the HTTP request details (required).interval_in_seconds: The time interval (in seconds) between each request (required).--proxy: The URL of the proxy to use (optional).
Here’s an example of a properly formatted request file:
GET /api/keepalive?SessionId=12345678 HTTP/2
Host: testing.host.com
Accept-Language: en,en-gb;q=0.5
Accept-Charset: UTF-8;q=0.7,*;q=0.7
Pragma: no-cache
Cache-Control: no-store, no-cache, must-revalidate, pre-check=0, post-check=0, max-age=0
Expires: Sat, 1 Jan 2000 00:00:00 GMT
Hmactype: SHA256
Securityversion: 1.1
User-Agent: Mozilla/5.0 (Linux; Android 13; SM-S134DL Build/TP1A.220624.014; wv)
Authorization: <your_auth_token>
Sentry-Trace: <trace_id>
...
To send a simple GET request at 60-second intervals:
python session_keepalive.py request.txt 60If your request file includes data for a POST request, the tool will automatically include it in the body of the request.
python session_keepalive.py request_with_post.txt 30To route the web requests through a proxy server, specify the proxy using the --proxy option:
python session_keepalive.py request.txt 60 --proxy http://proxy.example.com:8080We welcome contributions from the community. To contribute:
- Fork the repository.
- Create a new branch for your feature or bug fix.
- Make your changes and submit a pull request.
Feel free to open issues for bug reports, feature requests, or general feedback.
This project is licensed under the MIT License. See the LICENSE file for more information.