client.py 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. # ---------------------------------------------------------------------
  2. # neobots 1.0.5 -------------------------------------------------------
  3. # Made by txtsd -------------------------------------------------------
  4. # Based on raredaredevil's/DarkByte's HabiBot/NeoAuto -----------------
  5. # Open Source Neopets Automation --------------------------------------
  6. # ---------------------------------------------------------------------
  7. # Imports -------------------------------------------------------------
  8. import urllib2
  9. import pyamf
  10. import time
  11. import sys
  12. from pyamf.remoting.client import RemotingService
  13. from classes.NeoAccount import NeoAccount
  14. from classes.habi import habi
  15. # End Imports ---------------------------------------------------------
  16. debugmode = 1
  17. # Settings ------------------------------------------------------------
  18. neouser = "" # Neopets Username
  19. neopass = "" # Neopets Password
  20. proxyaddress = "" # Optional proxy eg. "127.0.0.1:8888", leave at "" for none
  21. housecount = 2 # How many houses we will build in our map
  22. nestcount = 3 # How many nests we will build in our map
  23. storagecount = 15 # How many storage centers we will build in our map
  24. hospitalcount = 4 # How many hospitals we will build in our map
  25. # ---------------------------------------------------------------------
  26. if debugmode == 0:
  27. if len(sys.argv) == 4:
  28. neouser = sys.argv[1] # Get args from commandline
  29. neopass = sys.argv[2] # Get args from commandline
  30. proxyaddress = sys.argv[3] # Get args from commandline
  31. elif len(sys.argv) == 3:
  32. neouser = sys.argv[1] # Get args from commandline
  33. neopass = sys.argv[2] # Get args from commandline
  34. else:
  35. print "Debug mode was turned off, but incorrect args sent, so fell back to debug mode."
  36. acc = NeoAccount(neouser, neopass, proxyaddress)
  37. acc.login()
  38. habiopener = urllib2.build_opener(urllib2.HTTPCookieProcessor(acc.session.cookies))
  39. if proxyaddress != "":
  40. habiopener.setproxy = proxyaddress
  41. lastlogintime = time.time()
  42. pyamfhandler = RemotingService(
  43. 'http://habitarium.neopets.com/amfphp/gateway.php',
  44. amf_version=pyamf.AMF3,
  45. user_agent="Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/36.0.1951.5 Safari/537.36",
  46. opener=habiopener.open)
  47. # Setup habi hander module
  48. habihandler = habi(acc, pyamfhandler, housecount, nestcount, storagecount, hospitalcount)
  49. test = 1
  50. while test == 1:
  51. try:
  52. habihandler.DoLoop()
  53. time.sleep(10)
  54. except KeyboardInterrupt:
  55. print "\n------------------"
  56. print "neobots was interrupted via keyboard"
  57. print "------------------"
  58. sys.exit()