Skip to forum content

You are not logged in. Please login or register.


forums.pvpgn.pro → 3d Party Tools → [Дополнение] Утилита для генерации SRP хешей

Pages 1

You must login or register to post a reply

RSS topic feed

Posts: 2

1 (edited by xpeh 12.12.2012 02:36)

Topic: [Дополнение] Утилита для генерации SRP хешей

This utility, written in python, generates SRP hashes for Warcraft 3 & pvpgn 1.99.x

These values are stored in BNET\acct\salt and BNET\acct\verifier.

If you enter salt and the correct password, verifier should match.
-------------------------------------------------------------------------------

Которые хранятся в BNET\acct\salt и BNET\acct\verifier.

Написана на питоне. Если ввести соль и правильный пароль, verifier должен совпасть.

Апдейт: v. 1.3

[code=python]#!/usr/bin/env python
# coding: utf8

# 30.08.11
# edited 09.11.12
# @author xpeh
# @version 1.3
#
# calculates Warcraft 3 Battle.Net & pvpgn 1.99.x SRP hash (verifier)

from hashlib import sha1
import sys, os

N = 0xF8FF1A8B619918032186B68CA092B5557E976C78C73212D91216F6658523C787
g = 47

def usage():
    print "usage: %s username password [32 byte salt as hex]" % os.path.basename(sys.argv[0])
    sys.exit(1)

def intToBuf(int, size=32):
    '''Returns at least size bytes
    '''
    hexstr = "%x" % int
    length = len(hexstr)
    if length < size*2:
        hexstr = ("0"*(size*2-length) + hexstr)
    elif length % 2 != 0:
        hexstr = ("0" + hexstr)
    return hexstr.decode('hex')

def bufToInt(buf):
    return int(buf.encode('hex'),16)
   
def srp_hash(username, password, salt):
    # x = reverse_bytes( sha1(salt, sha1(upper(username),":", upper(password))) )
    x = sha1(salt + sha1(username.upper() + ":" + password.upper()).digest()).digest()
    # [::-1] means reverse bytes in buffer
    print 'password hash:', x[::-1].encode('hex')
    x = bufToInt(x[::-1])

    # verifier = reverse_bytes(g^x % N)
    verifier = pow(g, x, N)
    verifier = intToBuf(verifier)[::-1]
    return verifier

   
if __name__ == "__main__":
    if len(sys.argv) < 3:
        usage()

    username = sys.argv[1]
    password = sys.argv[2]

    if len(sys.argv) >= 4:
        salt = sys.argv[3]
        salt = salt.replace(" ","").decode('hex')
    else:
        # random salt
        salt = os.urandom(32)

    print "salt     :", salt.encode('hex')
    verifier = srp_hash(username, password, salt)
    print "verifier :", verifier.encode('hex')
[/code]

Post's attachments

Attachment icon bnet-srp.py 1.68 kb, 160 downloads since 2012-09-22 

2

Re: [Дополнение] Утилита для генерации SRP хешей

xpeh wrote:

This utility, written in python, generates SRP hashes for Warcraft 3 & pvpgn 1.99.x

These values are stored in BNET\acct\salt and BNET\acct\verifier.

If you enter salt and the correct password, verifier should match.
-------------------------------------------------------------------------------

Которые хранятся в BNET\acct\salt и BNET\acct\verifier.

Написана на питоне. Если ввести соль и правильный пароль, verifier должен совпасть.

Апдейт: v. 1.3

[code=python]#!/usr/bin/env python
# coding: utf8

# 30.08.11
# edited 09.11.12
# @author xpeh
# @version 1.3
#
# calculates Warcraft 3 Battle.Net & pvpgn 1.99.x SRP hash (verifier)

from hashlib import sha1
import sys, os

N = 0xF8FF1A8B619918032186B68CA092B5557E976C78C73212D91216F6658523C787
g = 47

def usage():
    print "usage: %s username password [32 byte salt as hex]" % os.path.basename(sys.argv[0])
    sys.exit(1)

def intToBuf(int, size=32):
    '''Returns at least size bytes
    '''
    hexstr = "%x" % int
    length = len(hexstr)
    if length < size*2:
        hexstr = ("0"*(size*2-length) + hexstr)
    elif length % 2 != 0:
        hexstr = ("0" + hexstr)
    return hexstr.decode('hex')

def bufToInt(buf):
    return int(buf.encode('hex'),16)
   
def srp_hash(username, password, salt):
    # x = reverse_bytes( sha1(salt, sha1(upper(username),":", upper(password))) )
    x = sha1(salt + sha1(username.upper() + ":" + password.upper()).digest()).digest()
    # [::-1] means reverse bytes in buffer
    print 'password hash:', x[::-1].encode('hex')
    x = bufToInt(x[::-1])

    # verifier = reverse_bytes(g^x % N)
    verifier = pow(g, x, N)
    verifier = intToBuf(verifier)[::-1]
    return verifier

   
if __name__ == "__main__":
    if len(sys.argv) < 3:
        usage()

    username = sys.argv[1]
    password = sys.argv[2]

    if len(sys.argv) >= 4:
        salt = sys.argv[3]
        salt = salt.replace(" ","").decode('hex')
    else:
        # random salt
        salt = os.urandom(32)

    print "salt     :", salt.encode('hex')
    verifier = srp_hash(username, password, salt)
    print "verifier :", verifier.encode('hex')
[/code]

Как Это Работает Добавил этот код на python и он не работает помогите плз как это работает

Posts: 2

Pages 1

You must login or register to post a reply

Who now at forum

Currently view post: 0 guests, 0 registered users

forums.pvpgn.pro → 3d Party Tools → [Дополнение] Утилита для генерации SRP хешей



Generated in 0.057 seconds (81% PHP - 19% DB) with 22 queries