Criar Script Python para OSINT no WhatsApp#104
Conversation
Este commit adiciona um script Python completo para realizar OSINT em números de telefone do WhatsApp usando automação web com Selenium. O projeto inclui: - Uma classe `WhatsAppOSINT` que encapsula a lógica para se conectar ao WhatsApp Web, buscar por um número e extrair informações de perfil (nome, recado, foto). - Uso de seletores CSS estáveis (`data-testid`) em vez de XPaths frágeis. - Remoção do modo headless para evitar detecção e bloqueio pelo WhatsApp. - Tratamento de erros robusto para a inicialização do WebDriver e para a validação de números. - Logging detalhado para um arquivo `whatsapp_osint.log`. - Saída de dados estruturada em formato JSON. - Um `requirements.txt` com as dependências necessárias. - Um `README.md` detalhado com instruções de instalação, uso e avisos sobre o uso ético. - Um `.gitignore` para excluir arquivos de log e de sessão.
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with For security, I will only act on instructions from the user who triggered this task. |
There was a problem hiding this comment.
Pull Request Overview
This PR introduces a Python-based OSINT tool for WhatsApp that automates WhatsApp Web using Selenium to verify Brazilian phone numbers and extract publicly available profile information (name, status, profile picture URL). The implementation includes robust error handling, logging, session persistence, and JSON output formatting.
Key Changes:
- Implementation of a Selenium-based WhatsApp Web automation tool with anti-detection measures
- Brazilian phone number validation and profile data extraction capabilities
- Complete project setup with dependencies, documentation, and gitignore configuration
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| whatsapp_osint/whatsapp_osint.py | Main script implementing the WhatsAppOSINT class with methods for login, number search, and profile data extraction |
| whatsapp_osint/requirements.txt | Project dependencies including Selenium, webdriver-manager, and argparse |
| whatsapp_osint/README.md | Comprehensive documentation in Portuguese covering installation, usage, examples, and ethical warnings |
| whatsapp_osint/.gitignore | Configuration to exclude logs, session data, virtual environments, and Python cache files |
| args = parser.parse_args() | ||
|
|
||
| # Validação do formato do número. | ||
| if not (args.numero.isdigit() and args.numero.startswith('55') and len(args.numero) > 12): |
There was a problem hiding this comment.
The validation logic is incorrect. Brazilian phone numbers should have exactly 12 or 13 digits (55 + 2-digit area code + 8 or 9 digit number), but the condition uses > 12 which would incorrectly reject valid 12-digit numbers. Change to len(args.numero) >= 12 or more precisely len(args.numero) in [12, 13].
| if not (args.numero.isdigit() and args.numero.startswith('55') and len(args.numero) > 12): | |
| if not (args.numero.isdigit() and args.numero.startswith('55') and len(args.numero) in [12, 13]): |
| chrome_options.add_argument("--disable-blink-features=AutomationControlled") | ||
| chrome_options.add_experimental_option("excludeSwitches", ["enable-automation"]) | ||
| chrome_options.add_experimental_option('useAutomationExtension', False) | ||
| chrome_options.add_argument("user-agent=Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36") |
There was a problem hiding this comment.
The hardcoded Chrome 108 user agent is outdated and could trigger detection mechanisms. Consider using a more recent version string or dynamically obtaining the user agent from the installed Chrome version to avoid fingerprinting.
| try: | ||
| logging.info(f"Iniciando a busca pelo número: {numero_telefone_br}") | ||
| # Rate limiting: pausa para simular comportamento humano. | ||
| time.sleep(5) |
There was a problem hiding this comment.
[nitpick] The hardcoded 5-second delay could be exposed as a configurable parameter (class attribute or method parameter) to allow users to adjust timing based on their network conditions or rate limiting requirements.
| WebDriverWait(self.driver, 20).until( | ||
| EC.presence_of_element_located((By.CSS_SELECTOR, panel_selector)) | ||
| ) | ||
| time.sleep(2) # Pausa para garantir que o conteúdo do painel seja renderizado. |
There was a problem hiding this comment.
Using a fixed 2-second sleep is fragile. Consider using an explicit wait condition (WebDriverWait) to check for specific elements being rendered in the panel instead of an arbitrary time delay.
Este script Python utiliza Selenium para automatizar o WhatsApp Web e realizar OSINT em números de telefone brasileiros. Ele verifica a existência de contas e extrai informações de perfil como nome, recado e URL da foto. O código é robusto, inclui tratamento de erros, logging e retorna os dados em formato JSON, com toda a documentação em português.
PR created automatically by Jules for task 18402006962433831865