-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathConnect.py
More file actions
83 lines (83 loc) · 2.74 KB
/
Copy pathConnect.py
File metadata and controls
83 lines (83 loc) · 2.74 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
import requests
import time
from time import sleep
import json
import random
class omegle():
def __init__(self,server):
self.server=server
if old=="yes":
self.headers={
"Origin": "https://www.omegle.com",
"Referer": "https://www.omegle.com/",
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.169 Safari/537.36"
}
self.id=json.loads(open("key.json").read())
if old=="no":
url='https://{}.omegle.com/start?caps=recaptcha2&firstevents=1&spid=&randid=TG2AKZQA&topics=["friends"]&lang=en'.format(self.server)
self.headers={
"Origin": "https://www.omegle.com",
"Referer": "https://www.omegle.com/",
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.169 Safari/537.36"
}
data={
"caps": "recaptcha2",
"firstevents": 1,
"spid": "",
"randid": "TG2AKZQA",
"topics": '["friends"]',
"lang": "en"
}
r=requests.post(url,headers=self.headers,data=data)
#print(r.json())
self.id=r.json()["clientID"]
def Connect(self):
data1={}
dumb={}
data1["id"]=self.id
dumb["id"]=self.id
dumb["server"]=self.server
if self.id:
print("CONNECTED")
with open("key.json","w") as f:
json.dump(dumb, f)
web="https://{}.omegle.com/events".format(self.server)
running = True
while running:
r=requests.post(web,headers=self.headers,data=data1)
data=json.loads(r.text)
try:
for n in data:
if n[0] == "typing":
print("[{}]Stranger: Typing".format(time.strftime("%d-%b %I:%M:%S %p")))
sleep(2)
if n[0] == "stoppedTyping":
continue
sleep(2)
if n[0] == "gotMessage":
print("[{}]Stranger: {}".format(time.strftime("%d-%b %I:%M:%S %p"),n[1]))
sleep(2)
if n[0] == "strangerDisconnected":
print("[{}]Stranger: Disconnected".format(time.strftime("%d-%b %I:%M:%S %p")))
running = False
else:
continue
sleep(2)
except:
s=1
print("==================================")
if __name__ == '__main__':
servers = ["front1", "front2", "front3", "front4","front5", "front6", "front7", "front8","front9", "front10", "front11", "front12","front13", "front14", "front15", "front16","front17", "front18", "front19", "front20","front21", "front22", "front23", "front24","front25", "front26", "front27", "front28","front29", "front30", "front31", "front32"]
server=random.choice(servers)
while True:
if input("Type Y or N: ").lower()[0] =="y":
if input("Type Old or New: ").lower()[0] =="o":
old="yes"
om=omegle(server=server)
om.Connect()
else:
old="no"
om=omegle(server=server)
om.Connect()
else:
break