Skip to content

Instantly share code, notes, and snippets.

@thefinn93
Created December 31, 2011 06:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thefinn93/1543082 to your computer and use it in GitHub Desktop.
Save thefinn93/1543082 to your computer and use it in GitHub Desktop.
Python Omegle Bot v0.1
#! /usr/bin/env python
# Omegle Bot v0.1
# Copyleft 2012 thefinn93
# Do not run with author permission
# Do not legally obtain this file. It is illegal
# If I catch you with a legal copy of this file I will sue you.
# Dependencies:
# - requests (python-requests.org)
import requests
import sys
import json
import urllib
import random
import time
server = "odo-bucket.omegle.com"
debug_log = open("debug.log","a") # Set to FALSE to disable excessive messages
config = {'verbose': open("/dev/null","w")}
headers = {}
headers['Referer'] = 'http://odo-bucket.omegle.com/'
headers['Connection'] = 'keep-alive'
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'
headers['Content-type'] = 'application/x-www-form-urlencoded; charset=UTF-8'
headers['Accept'] = 'application/json'
headers['Accept-Encoding'] = 'gzip,deflate,sdch'
headers['Accept-Language'] = 'en-US'
headers['Accept-Charset'] = 'ISO-8859-1,utf-8;q=0.7,*;q=0.3'
if debug_log:
config['verbose'] = debug_log
def debug(msg):
if debug_log:
print "DEBUG: " + str(msg)
debug_log.write(str(msg) + "\n")
def getcookies():
r = requests.get("http://" + server + "/",config=config)
debug(r.cookies)
return r.cookies
def start():
r = requests.request("POST", "http://" + server + "/start?rcs=1&spid=", data="rcs=1&spid=", config=config, headers=headers)
omegle_id = r.content.strip("\"")
debug("Got ID: " + str(omegle_id))
cookies = getcookies()
event(omegle_id, cookies)
def send(omegle_id, cookies, msg):
r = requests.request("POST","http://" + server + "/send", data="msg=" + urllib.quote_plus(msg) + "&id=" + omegle_id, config=config, headers=headers, cookies=cookies)
if r.content == "win":
print "You: " + msg
else:
print "Error sending message, check the log"
debug(r.content)
def event(omegle_id, cookies):
captcha = False
next = False
r = requests.request("POST","http://" + server + "/events",data="id=" + omegle_id, cookies=cookies, config=config, headers=headers)
try:
parsed = json.loads(r.content)
for e in parsed:
if e[0] == "waiting":
print "Waiting for a connection..."
elif e[0] == "count":
print "There are " + str(e[1]) + " people connected to Omegle"
elif e[0] == "connected":
print "Connection established!"
send(omegle_id, cookies, "dicks")
elif e[0] == "typing":
print "Stranger is typing..."
elif e[0] == "stoppedTyping":
print "Stranger stopped typing"
elif e[0] == "gotMessage":
print "Stranger: " + e[1]
try:
time.sleep(random.randint(1,5))
send(omegle_id, cookies, "What do you mean?")
except:
debug("Send errors!")
elif e[0] == "strangerDisconnected":
print "Stranger Disconnected"
next = True
elif e[0] == "suggestSpyee":
print "Omegle thinks you should be a spy. Fuck omegle."
elif e[0] == "recaptchaRequired":
print "Omegle think's you're a bot (now where would it get a silly idea like that?). Fuckin omegle. Recaptcha code: " + e[1]
captcha = True
else:
print "Some shit is fucked up. Stay tuned for debugging information:"
print json.dumps(parsed)
except:
print "Derka derka derka"
if next:
print "Reconnecting..."
start()
elif not captcha:
event(omegle_id, cookies)
start()
@twrnz
Copy link

twrnz commented Mar 21, 2017

why would you sue anybody bro??

@twrnz
Copy link

twrnz commented Mar 21, 2017

im never gonna download this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment