Advertisement
Aha2Y

Untitled

Apr 5th, 2012
325
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 3.56 KB | None | 0 0
  1. # - requests (python-requests.org)
  2.  
  3. import requests
  4. import sys
  5. import json
  6. import urllib
  7. import random
  8. import time
  9.  
  10. server = "odo-bucket.omegle.com"
  11.  
  12. debug_log = open("debug.log","a")   # Set to FALSE to disable excessive messages
  13. config = {'verbose': open("/dev/null","w")}
  14. headers = {}
  15. headers['Referer'] = 'http://odo-bucket.omegle.com/'
  16. headers['Connection'] = 'keep-alive'
  17. headers['User-Agent'] = 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/535.2 (KHTML, like Gecko) Ubuntu/11.10 Chromium/15.0.874.106 Chrome/15.0.874.106 Safari/535.2'
  18. headers['Content-type'] = 'application/x-www-form-urlencoded; charset=UTF-8'
  19. headers['Accept'] = 'application/json'
  20. headers['Accept-Encoding'] = 'gzip,deflate,sdch'
  21. headers['Accept-Language'] = 'en-US'
  22. headers['Accept-Charset'] = 'ISO-8859-1,utf-8;q=0.7,*;q=0.3'
  23.  
  24. if debug_log:
  25.     config['verbose'] = debug_log
  26.  
  27. def debug(msg):
  28.     if debug_log:
  29.         print "DEBUG: " + str(msg)
  30.         debug_log.write(str(msg) + "\n")
  31.  
  32. def getcookies():
  33.     r = requests.get("http://" + server + "/",config=config)
  34.     debug(r.cookies)
  35.     return r.cookies
  36.  
  37. def start():
  38.     r = requests.request("POST", "http://" + server + "/start?rcs=1&spid=", data="rcs=1&spid=", config=config, headers=headers)
  39.     omegle_id = r.content.strip("\"")
  40.     debug("Got ID: " + str(omegle_id))
  41.     cookies = getcookies()
  42.     event(omegle_id, cookies)
  43.  
  44. def send(omegle_id, cookies, msg):
  45.     r = requests.request("POST","http://" + server + "/send", data="msg=" + urllib.quote_plus(msg) + "&id=" + omegle_id, config=config, headers=headers, cookies=cookies)
  46.     if r.content == "win":
  47.         print "You: " + msg
  48.     else:
  49.         print "Error sending message, check the log"
  50.         debug(r.content)
  51.  
  52. def event(omegle_id, cookies):
  53.     captcha = False
  54.     next = False
  55.     r = requests.request("POST","http://" + server + "/events",data="id=" + omegle_id, cookies=cookies, config=config, headers=headers)
  56.     try:
  57.         parsed = json.loads(r.content)
  58.         for e in parsed:
  59.             if e[0] == "waiting":
  60.                 print "Waiting for a connection..."
  61.             elif e[0] == "count":
  62.                 print "There are " + str(e[1]) + " people connected to Omegle"
  63.             elif e[0] == "connected":
  64.                 print "Connection established!"
  65.                 send(omegle_id, cookies, "dicks")
  66.             elif e[0] == "typing":
  67.                 print "Stranger is typing..."
  68.             elif e[0] == "stoppedTyping":
  69.                 print "Stranger stopped typing"
  70.             elif e[0] == "gotMessage":
  71.                 print "Stranger: " + e[1]
  72.                 try:
  73.                     time.sleep(random.randint(1,5))
  74.                     send(omegle_id, cookies, "What do you mean?")
  75.                 except:
  76.                     debug("Send errors!")
  77.             elif e[0] == "strangerDisconnected":
  78.                 print "Stranger Disconnected"
  79.                 next = True
  80.             elif e[0] == "suggestSpyee":
  81.                 print "Omegle thinks you should be a spy. Fuck omegle."
  82.             elif e[0] == "recaptchaRequired":
  83.                 print "Omegle think's you're a bot (now where would it get a silly idea like that?). Fuckin omegle. Recaptcha code: " + e[1]
  84.                 captcha = True
  85.             else:
  86.                 print "Some shit is fucked up. Stay tuned for debugging information:"
  87.                 print json.dumps(parsed)
  88.     except:
  89.         print "Derka derka derka"
  90.     if next:
  91.         print "Reconnecting..."
  92.         start()
  93.     elif not captcha:
  94.         event(omegle_id, cookies)
  95.  
  96. start()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement