-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathclickbot.py
More file actions
67 lines (56 loc) · 2.23 KB
/
clickbot.py
File metadata and controls
67 lines (56 loc) · 2.23 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
import urllib.request
import random
import time
# Proxy configuration
proxy_url = "https:/user_name:password@proxyprovider.com:port_number"
proxy_handler = urllib.request.ProxyHandler({
'http': proxy_url,
'https': proxy_url
})
opener = urllib.request.build_opener(proxy_handler)
urllib.request.install_opener(opener)
# User agents (modern desktop & mobile devices)
user_agents = [
# Desktop
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/125.0.0.0 Safari/537.36",
"Mozilla/5.0 (Macintosh; Intel Mac OS X 12_6) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.0 Safari/605.1.15",
"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/125.0.0.0 Safari/537.36",
# Mobile
"Mozilla/5.0 (iPhone; CPU iPhone OS 17_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.0 Mobile/15E148 Safari/604.1",
"Mozilla/5.0 (Linux; Android 13; Pixel 7 Pro) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/125.0.0.0 Mobile Safari/537.36",
"Mozilla/5.0 (Linux; Android 12; SM-G991B) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/125.0.0.0 Mobile Safari/537.36"
]
# Browser languages
languages = ["en-US", "en-CA", "es-ES"]
# Referrers
referrers = [
"https://www.google.com/",
"https://www.facebook.com/",
"https://www.youtube.com/",
"https://twitter.com/",
"https://www.instagram.com/"
]
# Target URL
target_url = "https://example.com"
def make_request():
user_agent = random.choice(user_agents)
accept_language = random.choice(languages)
referer = random.choice(referrers)
headers = {
"User-Agent": user_agent,
"Accept-Language": accept_language,
"Referer": referer
}
req = urllib.request.Request(url=target_url, headers=headers)
try:
with urllib.request.urlopen(req, timeout=10) as response:
content = response.read()
print(f"Request successful, status: {response.status}, length: {len(content)} bytes")
except Exception as e:
print(f"Request failed: {e}")
if __name__ == "__main__":
while True:
make_request()
pause = random.uniform(1, 10)
print(f"Waiting {pause:.2f} seconds before next request...")
time.sleep(pause)