From f6cf61cc42fcc07930a06891b6c4a2653bfbf47f Mon Sep 17 00:00:00 2001 From: Naga Praneeth Date: Sat, 18 Oct 2025 00:25:14 +0530 Subject: [PATCH] Replace abandoned random-user-agent with fake-useragent random-user-agent has been unmaintained since 2018. This PR switches to fake-useragent, which provides equivalent functionality and is actively maintained. Changes: - Updated requirements.txt and setup.py dependencies - Updated imports in conkeyscan.py - Simplified UserAgent usage per fake-useragent API Closes nixpkgs issue: NixOS/nixpkgs#410837 --- README.md | 2 +- requirements.txt | 2 +- setup.py | 2 +- src/conkeyscan/conkeyscan.py | 7 ++----- 4 files changed, 5 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 08910bc..b459f0d 100644 --- a/README.md +++ b/README.md @@ -43,7 +43,7 @@ The default `dict.txt` file was taken from from [Conf-Thief](https://raw.githubu * Search for provided keywords * Handle rate limiting by itself, as long as the returned status code equals `HTTP 429`, or specify max requests per second in CLI -* The user agent is randomized +* The user agent is randomized using fake-useragent * Proxying is supported either via HTTP or socks. See cli help for examples * Custom CQL * SSL/TLS checks are disabled by default diff --git a/requirements.txt b/requirements.txt index 60ea7b9..78ec0bb 100644 --- a/requirements.txt +++ b/requirements.txt @@ -3,6 +3,6 @@ atlassian-python-api==3.41.3 beautifulsoup4==4.12.2 requests-ratelimiter==0.4.2 clize==5.0.2 -random-user-agent==1.0.1 +fake-useragent readchar==0.7 PySocks==1.7.1 \ No newline at end of file diff --git a/setup.py b/setup.py index f9cfbe8..bca1ab2 100644 --- a/setup.py +++ b/setup.py @@ -16,7 +16,7 @@ "beautifulsoup4>=4", "requests-ratelimiter", "clize>=5", - "random-user-agent>=1", + "fake-useragent", "readchar", "PySocks>=1", ], diff --git a/src/conkeyscan/conkeyscan.py b/src/conkeyscan/conkeyscan.py index 5afb8f2..cf4745b 100644 --- a/src/conkeyscan/conkeyscan.py +++ b/src/conkeyscan/conkeyscan.py @@ -15,8 +15,7 @@ from bs4 import BeautifulSoup from requests_ratelimiter import LimiterSession from requests.packages.urllib3.exceptions import InsecureRequestWarning -from random_user_agent.user_agent import UserAgent -from random_user_agent.params import SoftwareName, OperatingSystem +from fake_useragent import UserAgent # disable annoying insecure requests warnings requests.packages.urllib3.disable_warnings(InsecureRequestWarning) @@ -168,9 +167,7 @@ def main( rate_limited_session = LimiterSession(per_second=rate_limit) if not user_agent: - user_agent = UserAgent( - software_names=SoftwareName.CHROME.value, limit=100 - ).get_random_user_agent() + user_agent = UserAgent().random logger.debug("Using User Agent: " + user_agent) rate_limited_session.headers.update({"User-Agent": user_agent})