Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/python
- #----------------------------------------------------------
- #This script bypasses the idle time crap on Mortal Realms.
- #
- #The original closed source version was written around 1993.
- #
- #The script starts in non-interactive mode (aka bot mode).
- #Press ctrl-c to get into interactive mode and 'esc ^]' to
- #get back into non-interactive mode.
- #
- #And now a few comments...
- #
- #a)The script only works on the Linux Operating System.
- # This is because the program relies on the concept of
- # "psuedo terminal". As far as I know, the closest you
- # can get to a "psuedo terminal" in Windows is using something
- # like cygwin.
- #
- #b)Using something like 'esc ^]' to get back into non-interactive
- # mode is something that is mentioned python pexpect module,
- # but not in the actual pexpect document itself.
- #
- #c)I send the 'return key' every 20 second in non-interactive-mode
- # because I can't figure how how to make the pexpect 'timeout value'
- # play nicely with the Mortal Realms game site 'timeout value'. This
- # shouldn't be an issue since call to read() gets blocked the other 19
- # seconds, and hence, isn't jacking up the CPU usage (on either side
- # of the connection).
- #---------------------------------------------------------
- import pexpect, time, signal, getpass
- x = 1
- def mode(sig, data):
- global x
- x = x + 1
- def get_name():
- user = raw_input("Username: ")
- password = getpass.getpass("Password: ")
- idle(user,password)
- def idle(user,password):
- y = 1
- mud = pexpect.spawn('telnet game.mortalrealms.com 4321')
- mud.expect('Who art thou:')
- mud.sendline(user)
- print mud.before,mud.after,
- mud.expect('Password:')
- mud.sendline(password)
- mud.expect('Press return to continue:')
- mud.sendline('\n')
- print mud.before, mud.after,
- while mud.isalive():
- if ((y % x ) == 0):
- mud.sendline('\n')
- time.sleep(20)
- else:
- mud.interact()
- y = y + 1
- if __name__ == "__main__":
- signal.signal(signal.SIGINT, mode)
- get_name()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement