Skip to content

Instantly share code, notes, and snippets.

@wolfy1339
Last active March 20, 2016 19:38
Show Gist options
  • Save wolfy1339/3e73287b14081f542548 to your computer and use it in GitHub Desktop.
Save wolfy1339/3e73287b14081f542548 to your computer and use it in GitHub Desktop.
Simple script to delete given members
import requests
from bs4 import BeautifulSoup
import json
removed = json.load(open('removed.json').read())
session = requests.Session()
with open('password') as f:
data = {
'name': 'wolfy1339a',
'pass': f.read().split('\n')[0],
}
r = session.post('https://powdertoy.co.uk/Login.html', data=data)
r.raise_for_status()
test = session.get('http://powdertoy.co.uk/Groups/Page/Groups.html')
test.raise_for_status()
s = BeautifulSoup(test.text, 'html5lib')
ul = s.split('<ul class="dropdown-menu">')[0].split('</ul>')[0]
key = ul.findAll('li', {'class': 'item'})[4].find('a')['href'].split('?Key=')[1]
def getUserData():
params = {
'Group': '832'
}
request = session.get(
'http://powdertoy.co.uk/Groups/Admin/Members.html',
params=params)
soup = BeautifulSoup(request.text, 'html5lib')
names = soup.findAll('a', {'class': 'MemberName'})
userData = []
for i in names:
if i.text in removed:
userData.append([i.text, i['href'].split('?ID=')[1]])
else:
pass
return userData
def remove(user, key, groupID):
data = {
'Group': groupID,
'Member': user,
'Key': key,
'Confirm': 'Confirm'
}
session.post(
'http://powdertoy.co.uk/Groups/Admin/MemberRemove.html',
data=data)
for i in getuserData():
remove(i[1], key, '832')
[
"Talas",
"akronmantpt",
"gajawesomeness",
"konsole",
"nicolasgaymer777",
"purplepuppys13",
"shadowninja16",
"Cschuttey",
"DarthGhostbuster",
"GodOfEarthAndAll",
"Mandan",
"MiningMarsh",
"PyroDude",
"RROONNAANN",
"Skitz",
"UC17",
"Wrhub",
"jay301",
"physicsrocks",
"PyroDudeM",
"TheGamersGroup",
"159819",
"594695",
"BrickBuiltStudios",
"Bungie",
"Gary55",
"ILLADVISED",
"JamesB",
"KB",
"SUP3RSONiC",
"ShadowPlasma",
"VIP84",
"Xoner",
"YouCantHandleTheWojo",
"arsanyo",
"aryaj",
"gamer1234",
"guiopd",
"iamdumb",
"killerchickens",
"madnoodle",
"sails23",
"SopaXorzTaker",
"stuntmaster12",
"wardwi",
"xetalim"
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment