1234567891011121314151617181920212223242526272829303132333435363738394041 |
- #!/usr/bin/python
- # another way: simply
- # curl -vLA 'Mozilla/5.0' -X POST 'https://landing.mobyklick.de/login' -F 'login=oneclick'
- import re
- import urllib.request
- import urllib3
- headers = {}
- headers['User-Agent'] = 'Mozilla/5.0'
- pool = urllib3.PoolManager()
- dummy='google.com'
- f1 = pool.request(method='GET', url=dummy, headers=headers)
- h1 = f1.data
- forms = re.findall(b'<form.*action=["]?([^"]+)["]?[^>]*>(.*)</form>', h1, re.MULTILINE | re.DOTALL)
- loginaction = forms[0][0]
- print(forms[0][1])
- inputs = re.findall(b"<input[^>]*/>", forms[0][1], re.MULTILINE | re.DOTALL)
- print(inputs)
- instuff = [re.findall(b'([^ "]+)\s*=\s*["]?([^"]+)["]?', inp) for inp in inputs]
- print(instuff)
- fields = {dict(ix)[b"name"].decode(): dict(ix)[b"value"].decode() for ix in instuff}
- # Connected to landing.mobyklick.de (84.46.65.13) port 443 (#2)
- # somehow .get_redirect_location() = False
- href = 'https://landing.mobyklick.de%s' % loginaction.decode()
- # print(href)
- # print(fields)
- f3 = pool.request_encode_body(method='POST', url=href, headers=headers, fields=fields, encode_multipart=True)
- # print(f3.status)
- # print(f3.getheaders())
- # print(f3.data)
|