Want more features on Pastebin? Sign Up, it's FREE!
Guest

source code for a wiki vandal bot

By: a guest on Nov 28th, 2014  |  syntax: Python  |  size: 1.36 KB  |  views: 171  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. import mwclient
  2. import threading
  3.  
  4. listusers = list()
  5. listcats = list()
  6. addrsa = raw_input('address > ')
  7. addrsb = raw_input('path to api.php >')
  8. for x in range(3):
  9.     users = raw_input('Username> ')
  10.     listusers.append(users)
  11.  
  12. pswd = raw_input('password> ')
  13. for x in range(3):
  14.     categry = raw_input('Category >')
  15.     listcats.append(categry)
  16.  
  17. str1 = raw_input('String to find >')
  18. str2 = raw_input('String to replace with > ')
  19. def mean(username, category):
  20.     site = mwclient.Site(str(addrsa), path=str(addrsb))
  21.     try:
  22.         site.login(username,str(pswd))
  23.     except:
  24.         print('exception...')
  25.        
  26.     for page in site.Categories[category]:
  27.         print('Currently editing '+page.page_title)
  28.         try:
  29.             text = page.text()
  30.             text = text.replace(str1, str2)
  31.             page.save(text, summary='automated editing process')
  32.         except:
  33.             print('Unknown exception')
  34. def murderthatwiki():
  35.         instance1=None
  36.         instance2=None
  37.         instance3=None
  38.         instance1 = threading.Thread(group=None,target=mean,name=instance1,args=(listusers[0],listcats[0]))
  39.         instance2 = threading.Thread(group=None,target=mean,name=instance2,args=(listusers[1],listcats[1]))
  40.         instance3 = threading.Thread(group=None,target=mean,name=instance3,args=(listusers[2],listcats[2]))
  41.  
  42.         instance1.start()
  43.         instance2.start()
  44.         instance3.start()
clone this paste RAW Paste Data