A preserved archive of the Logical Gamers community forums, 2009-2025. The original threads and posts, served read-only. Registration, posting and private messages are gone for good.

Python 3.1 Gaiaonline Class

936 views · started by Riddle ·
#1
Python 3.1 Gaiaonline Class
This is my old Gaiaonline Class. I believe it should work. Python 3.1.

Feel free to translate to other languages.


#!/usr/bin/env python

#Gaiaonline Class
#Author: Riddle
#E-mail: NONE

#General Gaiaonline Functions

import General
import HTTP
import time
import random
import urllib.parse

class Gaiaonline:
def __init__(self, Session):
"""Gaiaonline Class:
Login(User, Pass): Logs into Gaiaonline with username and password
Encrypt_Password(): Used by Login()
Get_Username(): Returns Username for Session
Get_Password(): Returns Password for Session
Get_HTTP(): Returns HTTP Wrapper session
"""
self.HTTP = Session

self.User = None
self.Pass = None

self.PASS_SALT = "Go-Gaia-XD-72squared"

def Login(self, User, Pass):
"""Login to Gaiaonline
Returns True on success"""

self.User = User
self.Pass = Pass

if self.User.find(" "):
TmpUser = self.User.replace(' ', '+')

TmpPass = self.Encrypt_Password() #Obtain salted password...

#URL to Post to
URL = "http://www.gaiaonline.com/chat/gsi/gateway.php"

randTime = str(int(time.time())) + str(random.randrange(100, 999))
#Post data
pData = 'X=;' + randTime + '&v=phpobject&m=' + 'a:1:{i:0;a:2:{i:0;s:3:"108";i:1;a:2:{i:0;s:' + str(len(TmpUser)) + ':"' + TmpUser + '";i:1;s:32:"' + TmpPass +'";}}}'

#Set the referer in the HTTP Headers
self.HTTP.Set_Referer("http://s2.cdn.gaiaonline.com/images/Gaia_Flash/FISHING/bassken_game4.15.swf")

#Send the HTTP Request
HTML = self.HTTP.GET(URL, pData)

if HTML != "__ERROR__":
#HTML = str(HTML, 'utf-8')
HTML = urllib.parse.unquote_plus(HTML)

if HTML.find('b:1;i:2') > 0: #Logged in
return True

else:
return False

return False

def Encrypt_Password(self):
"""Returns Salted MD5"""
g = General.General()
a = g.md5Digest(self.Pass)
Enc_Password = g.md5Digest(a+self.PASS_SALT)
return Enc_Password

def Get_Password(self):
return self.Pass

def Get_Username(self):
return self.User

def Get_HTTP(self):
return self.HTTP

def New_HTTP(self):
self.HTTP.Clear_Cookies()

def Get_Nonce(self, HTML):
pattern = 'name="nonce" value="(.*)">'
nonce = General.General().Find_All(pattern, HTML)
return nonce[0]
[/0]
#2
Nice riddle :)

Im going to release the class im working on soon.