Jump to content

[FREE] Python User Agent Scraper Script


  • Reply to this topic
  • Start new topic

Recommended Posts

🕵️♂️ User Agent Collector – Web Scraper für echte Browser-Strings

🔍 Was macht dieses Tool?

Dieses Python-Skript sammelt automatisch eine Vielzahl echter User-Agent-Strings von verschiedenen vertrauenswürdigen Websites und speichert sie gesammelt in einer Datei namens user_agents.txt.

User-Agent-Strings sind ein fester Bestandteil jeder HTTP-Anfrage und enthalten Informationen über Browser, Betriebssystem, Gerätetyp etc. Dieses Tool kann hilfreich sein für:

  • Web Scraping (z.B. Rotation echter User Agents)

  • Penetration Testing / OSINT

  • Crawler-Masking oder Anti-Bot-Bypassing

  • Testing von Webanwendungen mit verschiedenen Clients


🌐 Datenquellen

Das Tool extrahiert User Agents von:

  1. WhatIsMyBrowser – Umfangreiche Liste aktueller Browser-Agents

  2. UserAgentString.com – Große Sammlung verschiedenster User-Agent-Typen

  3. TechPatterns.com – Spezialisierte Firefox-User-Agent-Liste

  4. DeviceAtlas.com – Bekannte Sammlung realer User-Agents (Desktop, Mobile, Tablets)


⚙️ Features

  • Mehrere Webseiten werden automatisch gecrawlt

  • Automatisches Entfernen von Duplikaten

  • Speicherung als sortierte Liste in user_agents.txt

  • Einfache Erweiterbarkeit (weitere Seiten können leicht ergänzt werden)

  • Verwendet requests & BeautifulSoup zur HTML-Verarbeitung


🚀 Ausführen

  1. Stelle sicher, dass requests und beautifulsoup4 installiert sind:

 
bash
pip install requests beautifulsoup4
  1. Starte das Skript:

 
bash
python user_agent_collector.py
  1. Die Datei user_agents.txt wird im selben Verzeichnis erstellt.


📁 Ausgabe

Die Datei user_agents.txt enthält eine sortierte Liste echter, aktueller User-Agent-Strings. Jeder String steht in einer neuen Zeile und kann direkt in Scraping- oder Testtools eingebunden werden.

 

Spoiler
import requests
from bs4 import BeautifulSoup
import time
 
def get_whatismybrowser():
    url = 'https://developers.whatismybrowser.com/useragents/explore/software_type_specific/web-browser/'
    user_agents = []
    try:
        response = requests.get(url)
        soup = BeautifulSoup(response.text, 'html.parser')
        table = soup.find('table', {'class': 'table-useragents'})
        if table:
            rows = table.find_all('tr')
            for row in rows[1:]:
                cols = row.find_all('td')
                if cols:
                    ua = cols[0].text.strip()
                    user_agents.append(ua)
    except Exception as e:
        print(f'Error at WhatIsMyBrowser: {e}')
    return user_agents
 
def get_useragentstring():
    url = 'https://useragentstring.com/pages/useragentstring.php?name=All'
    user_agents = []
    try:
        response = requests.get(url)
        soup = BeautifulSoup(response.text, 'html.parser')
        ul = soup.find('div', {'id': 'liste'})
        if not ul:
            ul = soup.find('ul')
        if ul:
            links = ul.find_all('a')
            for link in links:
                ua = link.text.strip()
                user_agents.append(ua)
    except Exception as e:
        print(f'Error at UserAgentString: {e}')
    return user_agents
 
def get_techpatterns():
    url = 'https://techpatterns.com/downloads/firefox_useragent_list.txt'
    user_agents = []
    try:
        response = requests.get(url)
        if response.status_code == 200:
            lines = response.text.splitlines()
            for line in lines:
                line = line.strip()
                if line and not line.startswith('#'):
                    user_agents.append(line)
    except Exception as e:
        print(f'Error at TechPatterns: {e}')
    return user_agents
 
def get_deviceatlas():
    url = 'https://deviceatlas.com/blog/list-of-user-agent-strings'
    user_agents = []
    try:
        response = requests.get(url)
        soup = BeautifulSoup(response.text, 'html.parser')
        pre_tags = soup.find_all('pre')
        for pre in pre_tags:
            lines = pre.text.splitlines()
            for line in lines:
                line = line.strip()
                if line and len(line) > 20:  # filter kurz und irrelevant
                    user_agents.append(line)
    except Exception as e:
        print(f'Error at DeviceAtlas: {e}')
    return user_agents
 
def main():
    all_user_agents = set()
 
    print("Sammle User Agents von WhatIsMyBrowser...")
    all_user_agents.update(get_whatismybrowser())
    time.sleep(1)
 
    print("Sammle User Agents von UserAgentString...")
    all_user_agents.update(get_useragentstring())
    time.sleep(1)
 
    print("Sammle User Agents von TechPatterns...")
    all_user_agents.update(get_techpatterns())
    time.sleep(1)
 
    print("Sammle User Agents von DeviceAtlas...")
    all_user_agents.update(get_deviceatlas())
    time.sleep(1)
 
    print(f"Gesamtanzahl gesammelter User Agents: {len(all_user_agents)}")
 
    with open('user_agents.txt', 'w', encoding='utf-8') as f:
        for ua in sorted(all_user_agents):
            f.write(ua + '\n')
 
    print("Alle User Agents in user_agents.txt gespeichert.")
 
if __name__ == "__main__":
    main()

 

:banned::banned::banned:IPTV PREIS 2,50mon :banned::banned::banned:

  :banned::banned::banned: ready to resell pm me :banned::banned::banned:

„Alles, was du liebst – an einem Ort.“

„4K, HDR, Dolby Atmos – wie im Kino, nur besser.“ - Ein Login. Unendliche Welten.

Kein Hin-und-Her. Nur Hier.

wunschfilme und Serien werden umgehend eingefügt!

sky-logo-roter-himmel.jpg?class=1200x900  logo-dazn_-720x405.jpg hollywood-sign.webp?s=1024x1024&w=is&k=2

 

und soviel mehr.......xxx usw usw usw,All-in-One. All-for-You.

  • 2 months later...
Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...