Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
hak5
GitHub Repository: hak5/usbrubberducky-payloads
Path: blob/master/payloads/library/prank/Change Wallpaper With Screenshot/script.py
2968 views
1
import os
2
3
try:
4
import pyautogui
5
except:
6
os.system("pip install pyautogui")
7
import pyautogui
8
9
from time import sleep
10
11
from PIL import Image
12
import ctypes
13
14
15
# Edit this time as you want...
16
sleep(30)
17
screenshot = pyautogui.screenshot()
18
screenshot.save("screenshot.png")
19
20
img = Image.open('screenshot.png')
21
22
# Resize the screenshot as the desktop resolution
23
user32 = ctypes.windll.user32
24
screensize = user32.GetSystemMetrics(0), user32.GetSystemMetrics(1)
25
img = img.resize(screensize)
26
27
# Set the new wallpaper
28
image_path = os.path.abspath('screenshot.png')
29
ctypes.windll.user32.SystemParametersInfoW(20, 0, image_path, 0)
30