summaryrefslogtreecommitdiff
path: root/omegle_icq.py
diff options
context:
space:
mode:
Diffstat (limited to 'omegle_icq.py')
-rw-r--r--omegle_icq.py50
1 files changed, 42 insertions, 8 deletions
diff --git a/omegle_icq.py b/omegle_icq.py
index 1ec7f7c..6100e7b 100644
--- a/omegle_icq.py
+++ b/omegle_icq.py
@@ -9,7 +9,7 @@ from twisted.python import log
from omegle import OmegleChat
-
+# TEST RUN
randoms = [['370496181', 'megahal123'], ['446323989','gagaga']]
i=1
uin = randoms[i][0]
@@ -56,6 +56,10 @@ CAP_TYPING = '\x56\x3f\xc8\x09\x0b\x6f\x41\xbd\x9f\x79\x42\x26\x09\xdf\xa2\xf3'
class icqBot( oscar.BOSConnection ):
capabilities = [oscar.CAP_CHAT,CAP_TYPING]
+
+ def __init__(self,s,p,factory,**kwargs):
+ self.factory = factory
+ oscar.BOSConnection.__init__(self, s, p,**kwargs)
def oscar_04_14(self,snac):
data = snac[3]
@@ -98,7 +102,7 @@ class icqBot( oscar.BOSConnection ):
def gotBuddyList( self, buddylist ):
self.activateSSI()
- self.setProfile("Forget ICQ, MSN, Yahoo and the other shitty protocols! Use Jabber!")
+ self.setProfile("Forget ICQ, MSN, Yahoo and the other shitty protocols! Use XMPP/Jabber!")
self.setIdleTime( 0 )
self.clientReady()
for user in buddylist[0][0].users:
@@ -162,10 +166,35 @@ class icqBot( oscar.BOSConnection ):
class OscarCrap( oscar.OscarAuthenticator ):
BOSClass = icqBot
+ # override this to connect our factory to our clients
+ def connectToBOS(self, server, port):
+ c = protocol.ClientCreator(reactor, OscarCrap.BOSClass,
+ self.username, self.cookie, self.factory)
+ return c.connectTCP(server, port)
+
+
+
+from twisted.internet.protocol import Protocol, ReconnectingClientFactory, ClientFactory
-from twisted.internet.protocol import Protocol, ReconnectingClientFactory
+class OscarFactory(ClientFactory):
+ OAClass=OscarCrap
+ def __init__(self, uid,password,icq=1):
+ self.uid = uid
+ self.password = password
+ self.icq = icq
+
+ def buildProtocol(self, addr):
+ p = OscarFactory.OAClass(self.uid,password,icq=self.icq)
+ p.factory = self
+ return p
+
+ def startedConnecting(self, connector):
+ print 'Started to connect to oscar'
+
+ def connectionLost(self,reason):
+ print "CONECTION LOST"
class OscarClientFactory(ReconnectingClientFactory):
def startedConnecting(self, connector):
@@ -175,22 +204,27 @@ class OscarClientFactory(ReconnectingClientFactory):
print 'Connected.'
print 'Resetting reconnection delay'
self.resetDelay()
- return protocol.ClientCreator( reactor, OscarCrap, uin, password, icq=1 ).connectTCP( 'login.icq.com', 5238 )
+ #return protocol.ClientCreator( reactor, OscarCrap, uin, password, icq=1 )
+ p=OscarCrap(uin, password, icq=1 )
+ p.factory = self
+ return p
def clientConnectionLost(self, connector, reason):
print 'Lost connection. Reason:', reason
- ReconnectingClientFactory.clientConnectionLost(self, connector, reason)
+# ReconnectingClientFactory.clientConnectionLost(self, connector, reason)
def clientConnectionFailed(self, connector, reason):
print 'Connection failed. Reason:', reason
- ReconnectingClientFactory.clientConnectionFailed(self, connector,
- reason)
+# ReconnectingClientFactory.clientConnectionFailed(self, connector,
+# reason)
+
log.startLogging(sys.stdout)
#protocol.ClientCreator( reactor, OscarCrap, uin, password, icq=1 ).connectTCP( 'login.icq.com', 5238 )
-reactor.connectTCP('login.icq.com', 5238, OscarClientFactory())
+reactor.connectTCP('login.icq.com', 5238, OscarFactory(uin,password,icq=1))
+#.connectTCP( 'login.icq.com', 5238 )
reactor.run()