cookies.py 文件源码

python
阅读 27 收藏 0 点赞 0 评论 0

项目:simplewebscraper 作者: alexanderward 项目源码 文件源码
def decrypt_cookie_db(self):
        if self.platform == OperatingSystem.LINUX:
            import keyring
            from Crypto.Protocol.KDF import PBKDF2
            salt = b'saltysalt'
            length = 16
            # If running Chrome on OSX
            if sys.platform == 'darwin':
                my_pass = keyring.get_password('Chrome Safe Storage', 'Chrome')
                my_pass = my_pass.encode('utf8')
                iterations = 1003
                self.cookie_file = os.path.expanduser('~/Library/Application Support/Google/Chrome/Default/Cookies')

            # If running Chromium on Linux
            elif 'linux' in sys.platform:
                my_pass = 'peanuts'.encode('utf8')
                iterations = 1
                self.cookie_file = os.path.expanduser('~/.config/chromium/Default/Cookies')
            self.key = PBKDF2(my_pass, salt, length, iterations)
            return self.linux_decrypt_value

        elif self.platform == OperatingSystem.WINDOWS:
            return self.windows_decrypt_value
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号