Advertisement
Guest User

Untitled

a guest
Oct 30th, 2018
174
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 4.48 KB | None | 0 0
  1. from selenium import webdriver
  2. from selenium.webdriver.common.by import By
  3. from selenium.webdriver.support.ui import WebDriverWait
  4. from selenium.webdriver.support import expected_conditions as EC
  5. import tkinter
  6. from tkinter import *
  7.  
  8.  
  9.  
  10.  
  11. """
  12. def buildWindow(windowName, windowTitle, size):
  13.    windowName=Tk()
  14.    windowName.title(windowTitle)
  15.    windowName.geometry(size)
  16.    bankButton = Button(windowName, text="AutoBank", width=15, height=2, command=autoBank).place(x=345, y=0)
  17.    goldButton = Button(windowName, text="Gold Finder", width=15, height=2, command=goldFind).place(x=000, y=0)
  18.    forumButton = Button(windowName, text="Forums", width=15, height=2, command=forumFunc).place(x=685, y=0)
  19.    print(windowName)
  20.    mainloop()
  21.    
  22. """
  23.  
  24. from bs4 import BeautifulSoup
  25. import time
  26. import random
  27.  
  28.  
  29.  
  30.  
  31. def forumFunc():
  32.     browser = webdriver.Chrome()
  33.     browser.get(('http://fusezed.com'))  
  34.  
  35. def grabInfo():
  36.     user,passw,minTime,maxTime,repeat=actuallyGrabbing()
  37.     minTime=int(minTime)
  38.     maxTime=int(maxTime)
  39.     repeat=int(repeat)
  40.     autoBank(repeated=repeat,usernameStr=user,passwordStr=passw)
  41. def actuallyGrabbing():
  42.     minTime=minBox.get()
  43.     maxTime=maxBox.get()
  44.     repeat=timeBox.get()
  45.     user=userEnt.get()
  46.     passw=passEnt.get()
  47.     return user,passw,minTime,maxTime,repeat
  48.    
  49.  
  50. def autoBank(repeated,usernameStr,passwordStr):
  51.         #minTime=int(input('Enter minimum amount of time to wait before banking Hint: try 4900  '))
  52.         #maxTime=int(input('Enter maximum amount of time to wait before banking Hint: try 5900  '))
  53.        
  54.         for i in range(repeated):'
  55.            #print("Attempting purchase " + str(i))
  56.            #login Process
  57.            browser = webdriver.Chrome()
  58.            browser.get(('http://Kingsofchaos.com'))
  59.            time.sleep(15)
  60.            username = browser.find_element_by_name('usrname')
  61.            username.send_keys(usernameStr)
  62.            print('ibrake')
  63.            password = browser.find_element_by_name('peeword')
  64.            print('here?')
  65.            password.send_keys(passwordStr)
  66.            loginButton = browser.find_elements_by_class_name('login_input')
  67.            loginButton[2].click()
  68.  
  69.            #Sleep to make sure selenium doesnt fuck up
  70.            time.sleep(15)
  71.  
  72.  
  73.  
  74.  
  75.  
  76.            #Navigating to armory
  77.  
  78.            browser.get(('http://Kingsofchaos.com/armory.php'))
  79.            time.sleep(15)
  80.            content = browser.page_source
  81.  
  82.            #Scraping html for gold table
  83.            soup = BeautifulSoup(content, "lxml")
  84.            table = soup.find("td", attrs={"class":"menu_cell_repeater_vert"})
  85.            #Parsing table and manipulating string to get amount of gold
  86.            tableRow = table.find("tr")
  87.            goldString = (tableRow.get_text())
  88.            goldString=(goldString[31:])
  89.            goldString=goldString[:-19]
  90.            goldString = goldString.replace(',', '')
  91.            amount2buy = (int(goldString)//450000)
  92.  
  93.            #navigating armory and purchasing weapons
  94.            purchaseField = browser.find_element_by_name('buy_weapon[72]')
  95.            purchaseField.clear()
  96.            purchaseField.send_keys(amount2buy)
  97.            PurchaseButton = browser.find_element_by_name('buybut')
  98.            PurchaseButton.click()
  99.            time.sleep(15)
  100.            #print('Purchase ' + str(i) + " Complete")
  101.            browser.close()
  102.           # print("browser closed")
  103.            i=i+1
  104.            #Random time range to perform banking
  105.            time.sleep(random.randrange(minTime,maxTime))
  106.  
  107. #buildWindow(windowName='master',windowTitle = "Swolo's yolo kit", size= "800x50")
  108. master=Tk()
  109. master.title("Swolo's Auto Buyer")
  110. master.geometry("400x200")
  111. #forumButton = Button(master, text="Forums", width=15, height=2, command=forumFunc)
  112. Label(master, text="UserName:").grid(row=0)
  113. Label(master, text="Password:").grid(row=1)
  114. userEnt = Entry(master)
  115. passEnt = Entry(master)
  116. userEnt.grid(row=0, column=1)
  117. passEnt.grid(row=1, column=1)
  118.  
  119.  
  120.  
  121. Label(master, text="Minimum Time to wait between spending:").grid(row=3)
  122. Label(master, text="Maximum Time to wait between spending").grid(row=4)
  123. Label(master, text="Number of times to bank:").grid(row=5)
  124.  
  125. minBox = Entry(master)
  126. minBox.grid(row =3, column = 1)
  127. maxBox = Entry(master)
  128. maxBox.grid(row=4,column=1)
  129. timeBox=Entry(master)
  130. timeBox.grid(row=5, column=1)
  131. startButton = Button(master, text="Start", width=15, height=2, command=grabInfo).place(x= 120, y = 130)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement