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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
|
#!/usr/bin/python
# -*- vim: encoding: utf-8 -*-
# Yves Fischer, xapek.org 2009
import sys
import random
from twisted.words.protocols import oscar
from twisted.internet import reactor
from twisted.python import log
from omegle import OmegleChat
from icq import ExtendedBOSConnection, ReconnectingOSCARLoginFactory
ICQ_UIN, ICQ_PASSWORD = ('446323989', 'gagaga')
def random_greetings():
gr = (
"Sup dawg, we heard u need some stranger in ur chatroom, so we put a Stranger in ur chatroom so u can chat with him while u chat with others (until you type %disconnect% anywhere)",
"Connected with Omegle, be retarted with strangers!",
"Omegle ... its like pedo-roulette",
"Under law 153:276:935 section 864, Omegle is required to inform you that the person you are currently chatting with owns the IP address of a registered sex offender. Please be careful when chatting with this person, and remember never to give out your personal information. The person you are chatting with cannot see this message.",
"You're Now On Omegle, Note: In China Too Young Is Just a Name",
)
return "==== %s" % gr[random.randint(0,len(gr)-1)]
class OmegleICQChat(OmegleChat):
def __init__(self,icqconn,user):
self.user = user
self.icqconn = icqconn
OmegleChat.__init__(self,name="omegle")
def on_message(self,message):
self.send_icqconn( message )
def send_icqconn(self,message):
#send stopped typing snac
reactor.callFromThread(self.icqconn.sendSNAC, 0x04, 0x14, '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01'+chr(len(self.user))+self.user+"\x00\x00")
#von omegle kommt immer unicode, icq sendet latin1/iso-8859-1
message = unicode(message)
message = message.encode("iso-8859-1","replace")
print "Omegle->%s: %s" % (self.user,message.__repr__())
reactor.callFromThread(self.icqconn.sendMessage, self.user, message )
def on_typing(self):
"""
0x02 begin
0x01 idle
0x00 finish
"""
reactor.callFromThread(self.icqconn.sendSNAC, 0x04, 0x14, '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01'+chr(len(self.user))+self.user+"\x00\x02")
print "Omegle->%s: (begin typing)" % self.user
def on_stopped_typing(self):
reactor.callFromThread(self.icqconn.sendSNAC, 0x04, 0x14, '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01'+chr(len(self.user))+self.user+"\x00\x01")
def on_connect(self):
print "Omegle->%s: (connected)" % self.user
self.send_icqconn( random_greetings() )
def on_disconnect(self):
print "Omegle->%s: (disconnected)" % self.user
self.send_icqconn( "==Stranger Disconnected ==" )
class ICQBuddy( ExtendedBOSConnection ):
def initDone( self ):
ExtendedBOSConnection.initDone( self )
self.omegleConns = {}
def shutdown( self ):
for k in self.omegleConns.keys():
conn = self.omegleConns[k]
if conn.is_connected:
conn.disconnect()
def receiveTyping(self, user, state):
try:
if state == "finish":
self.omegleConns[user].stopped_typing()
elif state == "idle":
pass
elif state == "begin":
self.omegleConns[user].typing()
except:
pass
def receiveCleanMessage( self, user, message, flags ):
print "receiveCleanMessage"
if not self.omegleConns.has_key(user.name):
self.omegleConns[user.name] = OmegleICQChat(self,user.name)
if not self.omegleConns[user.name].is_connected:
if u"%connect%" in message:
self.omegleConns[user.name].start()
self.sendMessage(user.name, "Please stand by.....")
if client_sucks:
self.sendMessage(user.name, "Hey, dein ICQ-Client sendet scheiss")
else:
print "Not connected"
# self.sendMessage(user.name, "Not connected, type >connect<")
elif self.omegleConns[user.name].is_connected and u"%disconnect%" in message:
try:
self.omegleConns[user.name].disconnect()
except Exception,e:
self.sendMessage(user.name, str(e))
self.sendMessage(user.name, "Disconnecting")
elif self.omegleConns[user.name].is_connected and not self.omegleConns[user.name].is_confirmed:
self.sendMessage(user.name, "Wait for connection confirm from omegle")
else:
try:
print "%s->Omegle: %s" % (user.name, message.__repr__())
self.omegleConns[user.name].send(message)
except Exception,e:
print "icq(%s): Error %s" % (user.name,e)
if __name__ == '__main__':
import logging
logging.basicConfig(level=logging.INFO)
log.startLogging(sys.stdout)
f = ReconnectingOSCARLoginFactory(ICQ_UIN, ICQ_PASSWORD)
f.BOSClass = ICQBuddy
reactor.connectTCP('login.icq.com', 5238, f)
reactor.run()
|