Skip to content

Instantly share code, notes, and snippets.

@andy0130tw
Created May 30, 2014 00:13
Show Gist options
  • Save andy0130tw/07c9416a81b490e6d72d to your computer and use it in GitHub Desktop.
Save andy0130tw/07c9416a81b490e6d72d to your computer and use it in GitHub Desktop.
Learn Mode Account Generator
#-*- coding: utf-8 -*-
import pycurl
import json
import time
import datetime
import sys
import signal
import urllib
# IMPORTANT
# The API has been removed due to my abuse, thus, the code below can't be executed successfully.
# You can modify the UserAgent here just for fun.
CONST_USER_AGENT="Allizom/123.456 (Windows NT 12.96; MOM2048; rv:1296.0) Gecko/20990101 Firefox/999.0"
# Wrap JSON into Javascript-like form
class JSON:
def stringify(self,str):
return json.dumps(str)
def parse(self,str):
return json.loads(str)
stringify=classmethod(stringify)
parse=classmethod(parse)
# Custom object for curl's callback
class pageUtil():
def __init__(self,url):
self.contents=""
self.url=url
def read_page (self, buf):
self.contents=self.contents+buf
def flush (self):
try:
self.data=JSON.parse(self.contents)
except:
self.data=False
#
class curlObject(pageUtil):
def __init__ (self,url):
self.curl=pycurl.Curl()
self.contents=""
self.url=url
self.setopt("URL",url)
self.setopt("USERAGENT",CONST_USER_AGENT)
self.setopt("WRITEFUNCTION",self.read_page)
def setopt(self,key,value):
_=self.curl
_.setopt(getattr(_,key.upper()),value)
URL="https://apollo.omcompany.com:5443/api/profile/create"
# You can set the range at which the process will create account
for x in range(0,524288):
print "x is now "+str(x)
serial=[
hex(int(x/65536)%256)[2:].upper().rjust(2,"0"),
hex(int(x/256)%256)[2:].upper().rjust(2,"0"),
hex(x%256)[2:].upper().rjust(2,"0")
]
print "serial is now "+":".join(serial)
curlo=curlObject(URL)
fields={
# Device is a MAC address
"device":"AA:BB:CC:"+":".join(serial),
"uid":"ymmud"+"".join(serial),
"username":"ymmud6921"+"".join(serial),
"name":"#Yummy#"+"-".join(serial),
"email":"yummy"+str(x)+"@ggt.tw",
"web":"http://ggt.tw/",
"location":"nil",
"desc":"HAHA!"
}
curlo.setopt("POSTFIELDS",urllib.urlencode(fields))
# print urllib.urlencode(fields)
curlo.curl.perform()
curlo.flush()
curlo.curl.close()
if not curlo.data:
print "Request failed or response is not JSON..."
else:
print curlo.data
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment