-
Notifications
You must be signed in to change notification settings - Fork 61
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update proxy tester script with enhanced functionality and dependencies #20
base: master
Are you sure you want to change the base?
Conversation
In this updated code: - The `test_ip_addresses` function now utilizes the `concurrent.futures.ThreadPoolExecutor` for multi-threading. It creates a thread pool with a maximum number of workers specified by the `num_threads` parameter. Each IP address is submitted as a task to the executor, and the results are collected as they complete. - The `get_num_threads` function is added to allow the user to specify the number of threads to use for testing. It validates the user input and uses a default value of 10 if an invalid input is provided. - The `main` function prompts the user to enter the number of threads to use during testing. - The script provides additional configurability by allowing the user to specify the number of threads and the domain to test the proxies on.
The `argparse` library is used to handle command-line arguments. It allows specifying the input file, output file, domain, number of threads, and the option to use the `ftreq` library for faster HTTP requests. - The `test_proxy` function now uses the `urllib` library to make HTTP requests with the specified proxy. It builds an opener with the proxy URL and attempts to open the target URL. If an error occurs, it returns `False`, indicating an inactive proxy. - The `test_ip_addresses` function and the `main` function are modified to use the command-line arguments passed through `args`. - The `check_input_file` function is added to validate the input file's existence before starting the testing.
Update ?????! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, @5h4kun1, for contributing again !!
I have requested a few changes, kindly check those
|
||
## Proxy Tester | ||
|
||
The Proxy Tester script is designed to test the validity and response time of HTTP/HTTPS proxies. It uses the `faster_than_requests` library for faster proxy testing. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The code does not seem like you are using faster_than_requests library, rather you are using concurrent threads for making requests which is not an issue but update the README accordingly
|
||
try: | ||
# Use subprocess to make requests using cURL | ||
command = f"curl --connect-timeout 5 --max-time 5 --proxy {proxy_url} {url}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using curl command line limits it only to system that have curl installed, mostly Linux and Mac systems.
Can you utilize urllib or http.client which comes with python in built library?
domain = get_domain_choice() | ||
print(f"Using domain: {domain}") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can display the domain you are using to test.
No description provided.