Created
May 26, 2012 05:28
-
-
Save laclefyoshi/2792392 to your computer and use it in GitHub Desktop.
check keys of Yahoo! Axis
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
# Copyright : (c) SAEKI Yoshiyasu | |
# License : MIT-style license | |
# <http://www.opensource.org/licenses/mit-license.php> | |
# last updated: 2012/05/26 | |
import binascii | |
import subprocess | |
crx = open("YAxis_Chrome_v1_0_20120520.crx", "rb") | |
# http://sxp.yimg.com/ei/ynano/YAxis_Chrome_v1_0_20120520.crx or | |
# https://github.com/nikcub/yahoo-spoof | |
magic_number = crx.read(4) # http://code.google.com/chrome/extensions/crx.html | |
ver = crx.read(4) | |
pub_len = crx.read(4) | |
sig_len = crx.read(4) | |
real_pub_len = ord(pub_len.strip('\x00')) | |
pub_key = crx.read(real_pub_len) | |
pub_file = file("pub_key", "wb") | |
pub_file.write(pub_key) | |
pub_file.close() | |
pub_modulus = pub_key[29:(len(pub_key) - 5)] | |
# http://etherhack.co.uk/asymmetric/docs/rsa_key_breakdown.html | |
pub_modulus_hex = binascii.hexlify(pub_modulus).upper() | |
uzip = subprocess.Popen( | |
"unzip -qc YAxis_Chrome_v1_0_20120520.crx nano_client.pem".split(" "), | |
stdout=subprocess.PIPE) | |
ossl = subprocess.Popen("openssl rsa -noout -modulus".split(" "), | |
stdin=uzip.stdout, stdout=subprocess.PIPE) | |
uzip.stdout.close() | |
prv_modulus = ossl.communicate()[0].strip().split("=")[1] | |
print "Public key modulus: ", pub_modulus_hex | |
print "Private key modulus: ", prv_modulus | |
if pub_modulus_hex == prv_modulus: | |
print "match!" | |
else: | |
print "not match" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment