Update proxy tester script with enhanced functionality and dependencies#20
Open
5h4kun1 wants to merge 6 commits intoTheSpeedX:masterfrom
Open
Update proxy tester script with enhanced functionality and dependencies#205h4kun1 wants to merge 6 commits intoTheSpeedX:masterfrom
5h4kun1 wants to merge 6 commits intoTheSpeedX:masterfrom
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.
Author
|
Update ?????! |
TheSpeedX
requested changes
Jun 25, 2023
|
|
||
| ## 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. |
Owner
There was a problem hiding this comment.
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}" |
Owner
There was a problem hiding this comment.
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?
|
|
||
| output_file = "output.txt" | ||
| domain = get_domain_choice() | ||
| print(f"Using domain: {domain}") |
Owner
There was a problem hiding this comment.
You can display the domain you are using to test.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.