Skip to content

Instantly share code, notes, and snippets.

@konfou konfou/
Created Mar 28, 2017

What would you like to do?
#!/usr/bin/env python
import requests
from bs4 import BeautifulSoup
from re import findall
url = ''
headers = { 'X-0x0ACE-Key' : 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' }
# key to be taken by previous challenge on
def solve(bgn,end):
# print all prime numbers within bgn and end seperated by comma
lst = (str(i) for i in range(bgn+1,end) if all(i%j!=0 for j in range(2,int(i**0.5)+1)))
return ','.join(lst)
with requests.session() as s:
soup = BeautifulSoup(s.get(url).text,"lxml")
verify = soup.find('input',attrs={'name':'verification'}).get('value')
challenge = soup.find('span',attrs={'class':'challenge'}).text
lim = [int(i) for i in findall('\d+',challenge)]
payload = { 'verification' : verify, 'solution' : solve(lim[0],lim[1]) }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.