Advertisement
Guest User

Untitled

a guest
May 5th, 2017
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.93 KB | None | 0 0
  1. import requests
  2. import mechanicalsoup
  3. from requests.auth import HTTPBasicAuth
  4. from bs4 import BeautifulSoup
  5. import sys
  6. import time
  7.  
  8.  
  9. url_home = 'https://4v4.vampirism.eu/'
  10. url_ban = 'https://4v4.vampirism.eu/bancp/bancp.php'
  11. USERNAME = 'XXXXXXXX'
  12. PASSWORD = 'XXXXXXXX'
  13. banned_list = 'C:\\Users\\Rick\\Desktop\\Autoban\\banlist.txt'
  14.  
  15.  
  16.  
  17. def find_name():
  18.     bad_name = ""
  19.     response = requests.get(url_home, auth=HTTPBasicAuth(USERNAME, PASSWORD))
  20.     c = BeautifulSoup(response.content)
  21.     for word in c.text.split():
  22.         if 'iq55' in word.lower():
  23.             bad_name = word
  24.             print("\n\nBanned player found")
  25.     if bad_name == "":
  26.         print("\n\nNo banned players found")
  27.     return bad_name
  28.  
  29.  
  30. def add_to_list(initial_ban_name):
  31.     add = False
  32.     if initial_ban_name not in open(banned_list).read():
  33.         with open(banned_list, 'a') as file:
  34.             file.write('%s\n' % initial_ban_name)
  35.             print("Banned player name ADDED to the list")
  36.             add = True
  37.             file.close()
  38.             return add
  39.     else:
  40.         print("Banned player name is already on the list")
  41.         return add
  42.  
  43.  
  44.  
  45.  
  46. def sleep_bot():
  47.     print("\nbot is sleepy, waiting 10 seconds")
  48.     for x in range(10,0,-1):
  49.         sys.stdout.write("\r")
  50.         sys.stdout.write("%s seconds remaining" %x)
  51.         sys.stdout.flush()
  52.         time.sleep(1)
  53.  
  54.  
  55. def post():
  56.     requests.post(url_ban, auth=HTTPBasicAuth(USERNAME, PASSWORD), data=payload)
  57.     print("Player has been successfully banned")
  58.  
  59.  
  60. while True:
  61.     ban_on_website = False
  62.     initial_ban_name = find_name()
  63.     if initial_ban_name != "":
  64.         ban_on_website = add_to_list(initial_ban_name)
  65.     payload = {
  66.         'banneduser': initial_ban_name,
  67.         'reason': 'other',
  68.         'reason1': 'Ban Avoidance',
  69.         'server': 'allrealms',
  70.         'length': '1'
  71.     }
  72.     if ban_on_website:
  73.         post()
  74.     sleep_bot()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement