def __init__(self): # Parameters for the connection asyncore.dispatcher.__init__(self) # Overload the previous definition self.config = ConfigReader.ReadConf('bot.conf') # Get the configuration self.create_socket(socket.AF_INET, socket.SOCK_STREAM) # Create the sock_stream socket self.connect((self.config.get("realmadress", "127.0.0.1"), 3724)) # Connect to the realm_server self.buffer = '' # Init the data to send buffer self.packethandler = { # Dictionnary with received opcode and function to call 0x00 : self.SS_AUTH_LOGON_CHALLENGE, 0x01 : self.SS_AUTH_LOGON_PROOF, 0x10 : self.SS_REALM_LIST, 0xFF : self.SS_UNKNOWN, }
import AsyncRealm import ConfigReader import asyncore import socket config = ConfigReader.ReadConf("bot.conf") request = AsyncRealm.RealmHandler( config.get("realmaddress", "127.0.0.1"), config.get("username", ""), config.get("password", ""), ) asyncore.loop() print request.realms sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) # Create the sock_stream socket sock.connect(("91.121.11.217", 8085)) # Connect to the world_server data = sock.recv(1024) print data.encode("hex")