commit 21b2836b39275ec5f4dffc53e5a12a767575d2db Author: Arlo Breault arlolra@gmail.com Date: Fri May 10 20:22:13 2013 -0700
Override Host header.
Make connection to www.google.com but access the flashproxy-reg.appspot.com domain. --- flashproxy-reg-appspot | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/flashproxy-reg-appspot b/flashproxy-reg-appspot index cb595ce..69f96c3 100755 --- a/flashproxy-reg-appspot +++ b/flashproxy-reg-appspot @@ -31,8 +31,10 @@ def get_facilitator_pubkey(): return RSA.load_pub_key_bio(BIO.MemoryBuffer(DEFAULT_FACILITATOR_PUBKEY_PEM))
def get_external_ip(): + req = urllib2.Request("https://www.google.com/ip") + req.add_header("Host", "flashproxy-reg.appspot.com") try: - f = urllib2.urlopen("https://flashproxy-reg.appspot.com/ip") + f = urllib2.urlopen(req) except: return None ip = f.read() @@ -140,5 +142,7 @@ rsa = get_facilitator_pubkey() reg_crypt = rsa.public_encrypt(reg_plain, RSA.pkcs1_oaep_padding) reg = base64.urlsafe_b64encode(reg_crypt)
-url = urlparse.urljoin("http://flashproxy-reg.appspot.com/reg/", reg) -urllib2.urlopen(url) +url = urlparse.urljoin("https://www.google.com/reg/", reg) +req = urllib2.Request(url) +req.add_header("Host", "flashproxy-reg.appspot.com") +urllib2.urlopen(req)