In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
Most people don't understand the knowledge points of this article "How Python realizes remote control of your own computer by mail", so Xiaobian summarizes the following contents for everyone. The contents are detailed, the steps are clear, and they have certain reference value. I hope everyone can gain something after reading this article. Let's take a look at this article "How Python realizes remote control of your own computer by mail".
development tools
Python version: 3.6.4
Related modules:
PIL module;
email module;
And some Python modules.
environment construction
Install Python and add it to the environment variables, pip install the relevant modules you need.
Brief Introduction of Principle
I. ideas
The computer checks whether a new mail has been received in the designated mailbox every once in a while. If it has not been received, no operation will be carried out. If it has been received, the identity of the sender will be judged. If the sender is a legal controller, the mail of the sender will be analyzed and the analysis result will be executed. Otherwise, the mail will be ignored.
II. specific implementation
(1) Send and receive mail
We use POP3 protocol to receive mail, SMTP protocol to send mail, python built-in support for both protocols, so the specific implementation is very simple and easy.
Note 1:
Here I recommend Liao Xuefeng's Python tutorial, which has a detailed introduction to sending and receiving emails, so I won't move bricks.
Note 2:
I used Sina mailbox on computer side and QQ mailbox on mobile phone side.
(2) Check the status of the computer
Directly use the ImageGrab.grab() function of the PIL module to take a screenshot of the computer, and then send the screenshot of the computer to the mobile phone via email.
If you want to see how the model works, just display the model training interface on the desktop before you go ~
3) Scalability
In addition to viewing the status of the computer, only cmd command is currently supported to control the computer. If you need to add other functions, you can add them at the position shown in the figure below:
(4) Ease of use
cmd command is too long to play on the phone is not convenient or remember how to do? You can set shortcut commands in word2cmd.json:
(5)FAQ
① Failed to send email at computer end?
Solution:
If the email sent by the computer is identified as spam and the mobile phone cannot check the computer status, you can log in to the mailbox used by the computer with your mobile phone to check the returned email, so that you can check the computer operating status on your mobile phone.
Note 3:
If you reject the email on the mobile phone, you can set up a white list.
② Unable to log in to the mailbox at the computer end?
Solution:
You need to enable SMTP and POP3 services:
Password should be client authorization password, not login password. Of course, the login password of Sina mailbox is the client authorization password.
That's All.
Complete source code, please refer to the relevant documents.
use the demo
Step1: Modify the configuration file
The configuration files that must be modified are:
config.json。
Function:
Set the information of computer and mobile mailbox. The information of the mobile phone mailbox is used to verify whether the sender is the legal controller of the computer, and the information of the computer mailbox is used to receive and send emails at the computer end.
If you need to encrypt SMTP sessions, set enable_ssl to true and set the correct port number.
Select the profile to modify as:
word2cmd.json。
Function:
Set shortcut command language.
Step2: Run Server.py file
Send command:
Execution instructions:
Results:
The above is the content of this article about "Python how to remotely control your own computer with email". I believe everyone has a certain understanding. I hope the content shared by Xiaobian will help everyone. If you want to know more relevant knowledge, please pay attention to the industry information channel.
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.