Exemple #1
0
    def get_config():
        from crypt import AESCipher

        config_path = os.path.dirname(os.path.abspath(__file__))
        config_file = os.path.join(config_path, 'config.json')
        with open(config_file, 'r') as f:
            config = json.load(f)

        crypt = AESCipher(config['CRYPT_KEY'])

        config_developer_key = crypt.decrypt(config['DEVELOPER_KEY'])
        config_login_user_name = crypt.decrypt(config['REMOT3_USER_NAME'])
        config_login_password = crypt.decrypt(config['REMOT3_PASSWORD'])

        return config_developer_key, config_login_user_name, config_login_password
Exemple #2
0
def extract(in_file, out_file, password):
    # Process source image
    img = Image.open(in_file)
    (width, height) = img.size
    conv = img.convert("RGBA").getdata()
    print "[+] Image size: %dx%d pixels." % (width, height)

    # Extract LSBs
    v = []
    for h in range(height):
        for w in range(width):
            (r, g, b, a) = conv.getpixel((w, h))
            v.append(r & 1)
            v.append(g & 1)
            v.append(b & 1)

    data_out = assemble(v)

    # Decrypt
    cipher = AESCipher(password)
    data_dec = cipher.decrypt(data_out)

    # Write decrypted data
    out_f = open(out_file, "wb")
    out_f.write(data_dec)
    out_f.close()

    print "[+] Written extracted data to %s." % out_file
Exemple #3
0
def extract(in_file, out_file, password):
    # Process source image
    img = Image.open(in_file)
    (width, height) = img.size
    conv = img.convert("RGBA").getdata()
    print "[+] Image size: %dx%d pixels." % (width, height)

    # Extract LSBs
    v = []
    for h in range(height):
        for w in range(width):
            (r, g, b, a) = conv.getpixel((w, h))
            v.append(r & 1)
            v.append(g & 1)
            v.append(b & 1)

    data_out = assemble(v)

    # Decrypt
    characters = string.ascii_letters + string.digits

    for i in characters:
        for j in characters:
            for k in characters:
                for l in characters:
                    password = i + j + k + l + "needmoneyandgirlfirend"
                    cipher = AESCipher(password)
                    data_dec = cipher.decrypt(data_out)
                    if len(data_dec) > 0 and filter(data_dec):
                        print password, data_dec

    # Write decrypted data

    print "[+] Written extracted data to %s." % out_file
Exemple #4
0
 def decrypt_params(self, s):
     """ 解密参数 """
     # 约定:首部填充21字节随机字符
     s = base64.b64encode(base64.b64decode(s)[21:])
     aes = AESCipher(self.config['crypt']['aeskey'])
     decrypt_data = aes.decrypt(s.replace(' ', '+'))
     return dict([(k, v[0]) for k, v in urlparse.parse_qs(decrypt_data).items()])
Exemple #5
0
def extract(in_file, out_file, password):
	# Process source image
	img = Image.open(in_file)
	(width, height) = img.size
	conv = img.convert("RGBA").getdata()
	print "[+] Image size: %dx%d pixels." % (width, height)

	# Extract LSBs
	v = []
	for h in range(height):
		for w in range(width):
			(r, g, b, a) = conv.getpixel((w, h))
			v.append(r & 1)
			v.append(g & 1)
			v.append(b & 1)
			
	data_out = assemble(v)

	# Decrypt
	cipher = AESCipher(password)
	data_dec = cipher.decrypt(data_out)

	# Write decrypted data
	out_f = open(out_file, "wb")
	out_f.write(data_dec)
	out_f.close()
	
	print "[+] Written extracted data to %s." % out_file
def extract(inputf, outputf, password):
    # Process source image
    img = Image.open(inputf)
    (width, height) = img.size
    conv_image = img.convert("RGBA").getdata()

    # Extract LSBs
    v = []
    for h in range(height):
        for w in range(width):
            (r, g, b, a) = conv_image.getpixel((w, h))
            v.append(r & 1)  #it will only append the lsb of each pixel
            v.append(g & 1)
            v.append(b & 1)

    data_out = bits_to_binary(v)

    # Decrypt
    cipher = AESCipher(password)
    data_dec = cipher.decrypt(data_out)

    # Write decrypted data
    out_f = open(outputf, "wb")
    out_f.write(data_dec)
    out_f.close()

    print ">> Data extracted from stego.png to %s." % outputf
Exemple #7
0
def decrypt(enc_str, platform=1):
    aes = AESCipher(platform)
    dec = aes.decrypt(urllib.unquote(enc_str))
    return dec