FauvidoTechnologies/pyba
GitHub: FauvidoTechnologies/pyba
一款面向 OSINT 的浏览器自动化工具,通过 LLM 自主完成网页操作并导出为可永久运行的 Playwright 脚本。
Stars: 28 | Forks: 3
PyBA
只需告诉 AI 要做什么。即可获得一个可永久运行的 Python 脚本。
PyBA 使用 LLM 自主浏览任何网站,然后将操作过程导出为独立的 Playwright 脚本——在重复运行时无需任何 API 开销。
# Pyba 一款专为 OSINT 目的设计的浏览器自动化软件。 ### 简短演示: https://github.com/user-attachments/assets/ab258c0d-760d-4994-ada7-6002d46fe8ff ### 第二部分: https://github.com/user-attachments/assets/a34d53af-9896-4435-8778-274ec9f204e3 ### 获取脚本 ``` from pyba import Engine engine = Engine(openai_api_key="sk-...") # 步骤 1: AI 自主导航 engine.sync_run( prompt="Go to Hacker News, click the top story, extract all comments" ) # 步骤 2: 导出为独立的 Playwright 脚本 engine.generate_code(output_path="hacker_news_scraper.py") ``` 现在可以永久运行 `python hacker_news_scraper.py`。不需要 AI。不需要 API 开销。 ## 安装说明 ``` pip install py-browser-automation ``` 或通过 brew 安装 ``` brew tap fauvidotechnologies/pyba brew install pyba ``` ## 你能做什么? ### 自动化重复的浏览器任务 ``` engine.sync_run( prompt="Login to my bank, download this month's statement as PDF", automated_login_sites=["swissbank"] ) engine.generate_code("download_statement.py") ``` ### OSINT 与侦察 ``` from pyba import DFS dfs = DFS(openai_api_key="sk-...") dfs.sync_run( prompt="Find all social media accounts linked to username 'targetuser123'" ) ``` ### 结构化数据提取 ``` from pydantic import BaseModel class Product(BaseModel): name: str price: float rating: float engine.sync_run( prompt="Scrape all products from the first 3 pages", extraction_format=Product ) # 在导航期间提取数据,存储到您的数据库中 ``` ### 带身份验证的工作流 ``` engine.sync_run( prompt="Go to my Instagram DMs and message john Paula 'Running 10 mins late'", automated_login_sites=["instagram"] ) # 凭据来自环境变量 - 绝不暴露给 LLM ``` ## 四种探索模式 | 模式 | 使用场景 | 示例 | |------|----------|---------| | **Normal** | 直接执行任务 | "填写此表单并提交" | | **Step** | 交互式逐步控制 | "点击这里" → "现在搜索 X" → "提取该信息" | | **DFS** | 深度调查 | "分析此 GitHub 用户的贡献模式" | | **BFS** | 广度发现 | "映射此主页上的所有链接页面" | ``` from pyba import Engine, Step, DFS, BFS # Normal mode (默认) engine = Engine(openai_api_key="...") # Step-by-step interactive mode step = Step(openai_api_key="...") # Deep-first 探索 dfs = DFS(openai_api_key="...") # Breadth-first 发现 bfs = BFS(openai_api_key="...") ``` ### 交互式逐步自动化 ``` from pyba import Step step = Step(openai_api_key="sk-...") await step.start() await step.step("Go to google.com and search for 'playwright python'") await step.step("Click the first result") output = await step.step("Extract the installation instructions") await step.stop() ``` ## 核心功能 ### 代码生成 将任何成功的运行导出为独立的 Python 脚本。无需 AI 即可永久运行。 ### 追踪文件 每次运行都会生成一个 Playwright trace.zip —— 可在 [Trace Viewer](https://trace.playwright.dev/) 中精准回放操作过程。 ### 低内存模式 通过延迟加载较重的 Python 依赖项(oxymouse、google-genai、openai)来节省约 120MB 的空闲 RAM。Chromium 标志位可提升容器稳定性。专为 CI 服务器、容器和低配置机器打造。 ``` engine = Engine(openai_api_key="sk-...", low_memory=True) ``` ### 隐身模式 反浏览器指纹、随机鼠标移动、拟人化延迟。绕过常见的机器人检测。 ### 多提供商支持 兼容 OpenAI、Google VertexAI 或 Gemini。 ### 数据库日志记录 将每一个操作存储在 SQLite、PostgreSQL 或 MySQL 中。支持审计追踪和回放功能。 ### 平台登录 内置针对 Instagram、Gmail、Facebook 的登录处理器。凭据安全保留在环境变量中。 ## 快速示例 ### 提取 YouTube 视频元数据 ``` engine.sync_run( prompt="Go to this YouTube video and extract: title, view count, like count, channel name, upload date" ) ``` ### 填写多页表单 ``` engine.sync_run( prompt="Fill out the job application: Name='John Doe', Email='john@email.com', upload resume from ~/resume.pdf, submit" ) engine.generate_code("job_application.py") # Replay anytime ``` ### 调研一家公司 ``` dfs = DFS(openai_api_key="...") dfs.sync_run( prompt="Find the leadership team, recent news, and funding history for Acme Corp" ) ``` ## 配置说明 ``` from pyba import Engine, Database # 启用数据库日志记录 db = Database(engine="sqlite", name="runs.db") engine = Engine( openai_api_key="sk-...", headless=False, # Watch it work enable_tracing=True, # Generate trace.zip max_depth=20, # Max actions per run database=db # Log everything ) ``` 请参阅文档中的[完整配置选项](https://pyba.readthedocs.io/)。 ## 项目起源 PyBA 专为自动化情报收集和 OSINT 而构建——能够复制人类分析师在浏览器中可执行的所有操作,同时兼具可复现性和高速度。 如果你正在进行安全研究、竞争情报收集,或者仅仅是想自动化繁琐的浏览器任务,这款工具就是为你准备的。 ## 当前状态 可能会发生破坏性更新。请在生产环境中固定您的版本。如果 PyBA 为您节省了时间,请考虑给它一个 ⭐
标签:DLL 劫持, ESC4, Hacker News, LLM, OpenAI, OSINT, Petitpotam, Playwright, PyPI, Python, RPA, Unmanaged PE, URL抓取, Web自动化, 人工智能, 代码生成, 低内存, 内存规避, 大语言模型, 安全研发, 实时处理, 数字取证, 数据抓取, 数据泄露, 无代码自动化, 无后门, 测试用例, 浏览器自动化, 渗透测试工具, 特征检测, 用户模式Hook绕过, 网络情报, 脚本导出, 自动化脚本, 自动导航, 逆向工具, 高效自动化