-
-
Notifications
You must be signed in to change notification settings - Fork 271
fingerprint camouflage #129
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Codecov Report❌ Patch coverage is 📢 Thoughts on this report? Let us know! |
这些代码风格问题(空行空格、文件末尾换行等)不影响功能实现。考虑到当前 PR 的主要目的是添加指纹伪装功能,建议先审查功能有效性,这些微小的格式问题可以在后续优化。 |
只是测试分支没有测试到,但是不影响使用 |
Hi @3-Tokisaki-Kurumi , thank you so much for you contribution! To maintain consistency with the rest of the code, we only need to translate what's necessary into English |
Thank you for your attention. I will translate the necessary content into English |
现在我已经将必要的内容和注释翻译成英语,您可以审阅一下,之后我会继续贡献更优化的代码 Now I have translated the necessary content and comments into English, you can review them, and I will continue to contribute more optimized code afterwards |
Sorry for the delay. I'm currently finalizing version 2 of Pydoll, which will introduce breaking changes. Once it's done, we can move forward with your contribution, as a few more adjustments will be needed. I appreciate your understanding |
OK,期待你的Pydoll v2,感谢您带来了一个强大的自动化工具,等待你的更改之后我们可以继续处理此贡献 OK, Looking forward to your Pydoll v2. Thank you for bringing us a powerful automation tool. We are waiting for your changes before we can proceed with this contribution |
占位,准备继续完成该贡献 Position occupied, ready to continue completing the contribution |
现在是最新的指纹伪装功能,你可以查看一下代码,如果需要,之后我会继续贡献 Now it's the latest fingerprint camouflage feature. You can review the code and if needed, I will continue to contribute in the future |
Hello! Once again, thank you very much for your efforts, I truly appreciate your contribution. However, I just noticed one thing: you didn't follow the Commitizen convention, which is required for release generation. Before I can review your PR, could you please update your commit history to follow the guidelines described in this link? You can do that by running the following commands: git rebase -i HEAD~<number_of_commits_to_edit>
# Replace 'pick' with 'reword' for each commit
# Then rewrite each commit message using the Commitizen format After that, force-push your changes. Also, everything must be in english. Thank you! |
80025f8
to
93ef99b
Compare
@thalissonvs 您好,感谢您的纠正,我已经更新了我的的提交历史记录以遵循此链接中描述的指南并且进行了强制推送,接下来您可以审查我的PR,感谢您的审查 |
Hi @3-Tokisaki-Kurumi, I left some RC's that need to be resolved. Also, it seems that your PR doesn’t reflect the new file structure introduced in the second version. If you need any help, I can implement some of the changes for you. |
Hello, thank you for your correction. If you could provide some help, I would be extremely grateful. Thank you very much |
@thalissonvs This is a clean and compliant submission history record |
Okay, thank you for your suggestion. I will consider making revisions
…----------Reply to Message----------
On Mon, Jul 14, 2025 01:58 AM Thalison ***@***.***> wrote:
@thalissonvs requested changes on this pull request.
In pydoll/browser/chromium/base.py:
> +from pydoll.browser.managers.browser_options_manager import BrowserOptionsManager +from pydoll.browser.managers.browser_process_manager import BrowserProcessManager +from pydoll.browser.managers.proxy_manager import ProxyManager +from pydoll.browser.managers.temp_dir_manager import TempDirectoryManager
You can leave the imports as it was before. I've added the classes in the init file of the module
In pydoll/browser/chromium/base.py:
> + tab = Tab(self, self._connection_port, valid_tab_id) + + # Inject fingerprint spoofing JavaScript if enabled + if self.enable_fingerprint_spoofing and self.fingerprint_manager: + await self._inject_fingerprint_script(tab) + + return tab
This code is duplicated in the lines 222-228. You can abstract it to a method
In pydoll/browser/chromium/base.py:
> + try: + # Get the JavaScript injection code + assert self.fingerprint_manager is not None + script = self.fingerprint_manager.get_fingerprint_js() + + # Inject the script using Page.addScriptToEvaluateOnNewDocument + # This ensures the script runs before any page scripts + await tab._execute_command( + PageCommands.add_script_to_evaluate_on_new_document(script) + ) + + # Also evaluate immediately for current page if it exists + try: + await tab.execute_script(script) + except Exception: + # Ignore errors for immediate execution as page might not be ready + pass + + except Exception as e: + # Don't let fingerprint injection failures break the browser + print(f"Warning: Failed to inject fingerprint spoofing script: {e}")
Try to not use print statements, there's an open issue to add proper logging across the codebase. Also, using broad exceptions like Exception isn't a good practice. Is there a specific exception that could be raised here?
In pydoll/browser/chromium/base.py:
> + if self.fingerprint_manager: + return self.fingerprint_manager.get_fingerprint_summary() + return None ⬇️ Suggested change - if self.fingerprint_manager: - return self.fingerprint_manager.get_fingerprint_summary() - return None + return self.fingerprint_manager.get_fingerprint_summary() if self.fingerprint_manager else None
In pydoll/browser/chromium/chrome.py:
> + enable_fingerprint_spoofing: bool = False, + fingerprint_config=None,
I think we should centralize the fingerprint-related options in the Options class to avoid duplication.
For example, we could set an option like this:
options = Options() options.enable_fingerprint_spoofing() options.fingerprint_config = {}
Then, in the browser classes, we would just use the options object to retrieve these values.
Would you be able to take care of that?
I can do that too.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you modified the open/close state.Message ID: ***@***.***>
|
…d FingerprintConfig fields
There may have been some ambiguity in the translation of the conversation, so I have roughly revised it once. If possible, please help me. Thank you very much @thalissonvs @thalissonvs |
🔐 Browser Fingerprint Spoofing Feature / 浏览器指纹伪造功能
📋 Summary
This PR introduces a comprehensive browser fingerprint spoofing system that prevents browser fingerprint tracking by generating random but realistic browser fingerprints and injecting them into the browser runtime. The implementation has been updated to use the new centralized options configuration pattern.
🎯 Key Features
Core Components
Browser Support
Fingerprint Properties
Advanced Features
🚀 Usage Examples
Basic Usage (New API)
Advanced Configuration
Persistent Fingerprints
Edge Browser Support
🛡️ Security Benefits
🔧 Recent Technical Updates
API Migration
ChromiumOptions
configurationBug Fixes Applied
constants.py
tab.py
https://fingerprintjs.github.io/fingerprintjs/
Enhanced Testing
🧪 Testing & Quality Assurance
📁 File Structure
🔧 Technical Implementation Details
ChromiumOptions.enable_fingerprint_spoofing_mode()
APIChromiumOptionsManager
🎯 Migration Guide
From Old API to New API:
📋 概述
此PR引入了一个全面的浏览器指纹伪造系统,通过生成随机但真实的浏览器指纹并将其注入到浏览器运行时来防止浏览器指纹跟踪。实现已更新为使用新的集中式选项配置模式。
🎯 核心功能
核心组件
🚀 使用示例
基础用法(新API)
高级配置
🔧 最新技术更新
API迁移
ChromiumOptions
配置应用的错误修复
constants.py
中的字符串格式错误tab.py
中过于宽泛的参数检查https://fingerprintjs.github.io/fingerprintjs/
🎯 迁移指南
从旧API到新API:
🏷️ Labels
feature
- New featuresecurity
- Security enhancementprivacy
- Privacy protectionbrowser
- Browser automationfingerprint
- Fingerprint spoofingapi-migration
- API modernization📊 Metrics
🎉 Summary
This feature adds comprehensive browser fingerprint protection capabilities to pydoll, enabling users to easily prevent fingerprint tracking while maintaining natural and consistent browser behavior. The updated API provides better modularity and easier integration, supporting both simple one-click enabling and complex custom configurations to meet different user needs.