forked from zenixbot0101/FIX-SHUTDOWN-RDP
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsleep.py
More file actions
103 lines (96 loc) · 3.39 KB
/
sleep.py
File metadata and controls
103 lines (96 loc) · 3.39 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
import os
import time
import subprocess
import textwrap
import ctypes
import urllib.request
def set_wallpaper(image_path):
ctypes.windll.user32.SystemParametersInfoW(20, 0, image_path, 3)
choice = input("Bạn có muốn đổi mật khẩu user RDP không? (y/n): ").strip().lower()
if choice == "y":
user = os.getlogin()
old_pass = input("Nhập mật khẩu hiện tại: ")
new_pass = input("Nhập mật khẩu mới: ")
cmd = f'net user "{user}" "{new_pass}"'
result = subprocess.run(cmd, shell=True, capture_output=True, text=True)
if result.returncode == 0:
print("[+] Đổi mật khẩu thành công.")
else:
print("[-] Đổi mật khẩu thất bại. Có thể sai quyền hoặc sai mật khẩu cũ.")
time.sleep(2)
print("[*] Đang tải wallpaper...")
url = "https://github.com/zenixbot0101/FIX-SHUTDOWN-RDP/raw/main/wallpaper/10860875.png"
wallpaper_path = r"C:\wallpaper.png"
try:
urllib.request.urlretrieve(url, wallpaper_path)
set_wallpaper(wallpaper_path)
print(f"[+] Wallpaper đã được đổi: {wallpaper_path}")
except Exception as e:
print(f"[-] Lỗi tải wallpaper: {e}")
time.sleep(1)
ps1_code = textwrap.dedent(r'''
Add-Type -AssemblyName System.Windows.Forms
Add-Type -AssemblyName System.Drawing
Add-Type @"
using System;
using System.Runtime.InteropServices;
public class KeepAlive {
[DllImport("kernel32.dll", SetLastError = true)]
public static extern uint SetThreadExecutionState(uint esFlags);
}
"@
$form = New-Object System.Windows.Forms.Form
$form.Text = "AFK MODE"
$form.Size = New-Object System.Drawing.Size(300,150)
$form.StartPosition = "CenterScreen"
$form.TopMost = $true
$form.FormBorderStyle = "FixedDialog"
$form.MaximizeBox = $false
$form.MinimizeBox = $false
$form.BackColor = [System.Drawing.Color]::FromArgb(25,25,25)
$label = New-Object System.Windows.Forms.Label
$label.Text = "AFK MODE"
$label.ForeColor = [System.Drawing.Color]::LimeGreen
$label.Font = New-Object System.Drawing.Font("Segoe UI",24,[System.Drawing.FontStyle]::Bold)
$label.AutoSize = $true
$label.Dock = "Fill"
$label.TextAlign = "MiddleCenter"
$form.Controls.Add($label)
$job = Start-Job {
Add-Type @"
using System;
using System.Runtime.InteropServices;
public class KeepAlive {
[DllImport("kernel32.dll", SetLastError = true)]
public static extern uint SetThreadExecutionState(uint esFlags);
}
"@
while ($true) {
[KeepAlive]::SetThreadExecutionState([uint32]0x80000002) | Out-Null
Start-Sleep -Seconds 60
}
}
$form.Add_FormClosing({
Stop-Job $job -ErrorAction SilentlyContinue
Remove-Job $job -ErrorAction SilentlyContinue
[KeepAlive]::SetThreadExecutionState([uint32]0x80000000) | Out-Null
})
[System.Windows.Forms.Application]::Run($form)
''')
ps1_path = r"C:\keepalive.ps1"
with open(ps1_path, "w", encoding="utf-8") as f:
f.write(ps1_code)
print(f"[+] Đã tạo {ps1_path}")
subprocess.Popen(
["powershell", "-ExecutionPolicy", "Bypass", "-File", ps1_path],
creationflags=subprocess.CREATE_NO_WINDOW
)
start_time = time.time()
while True:
elapsed = int(time.time() - start_time)
h, m, s = elapsed // 3600, (elapsed % 3600) // 60, elapsed % 60
os.system("cls" if os.name == "nt" else "clear")
print("==== AFK MODE ĐANG HOẠT ĐỘNG ====")
print(f"Thời gian hoạt động: {h:02d}:{m:02d}:{s:02d}")
print("(Đóng cửa sổ này để dừng)")
time.sleep(1)