mirror of
https://github.com/sqlmapproject/sqlmap.git
synced 2025-06-16 02:53:21 +03:00
Minor refactoring
This commit is contained in:
parent
fecd830622
commit
0aa15a72b0
|
@ -18,7 +18,7 @@ from lib.core.enums import OS
|
||||||
from thirdparty.six import unichr as _unichr
|
from thirdparty.six import unichr as _unichr
|
||||||
|
|
||||||
# sqlmap version (<major>.<minor>.<month>.<monthly commit>)
|
# sqlmap version (<major>.<minor>.<month>.<monthly commit>)
|
||||||
VERSION = "1.3.8.24"
|
VERSION = "1.3.8.25"
|
||||||
TYPE = "dev" if VERSION.count('.') > 2 and VERSION.split('.')[-1] != '0' else "stable"
|
TYPE = "dev" if VERSION.count('.') > 2 and VERSION.split('.')[-1] != '0' else "stable"
|
||||||
TYPE_COLORS = {"dev": 33, "stable": 90, "pip": 34}
|
TYPE_COLORS = {"dev": 33, "stable": 90, "pip": 34}
|
||||||
VERSION_STRING = "sqlmap/%s#%s" % ('.'.join(VERSION.split('.')[:-1]) if VERSION.count('.') > 2 and VERSION.split('.')[-1] == '0' else VERSION, TYPE)
|
VERSION_STRING = "sqlmap/%s#%s" % ('.'.join(VERSION.split('.')[:-1]) if VERSION.count('.') > 2 and VERSION.split('.')[-1] == '0' else VERSION, TYPE)
|
||||||
|
|
|
@ -155,7 +155,24 @@ def postgres_passwd(password, username, uppercase=False):
|
||||||
|
|
||||||
return retVal.upper() if uppercase else retVal.lower()
|
return retVal.upper() if uppercase else retVal.lower()
|
||||||
|
|
||||||
def mssql_passwd(password, salt, uppercase=False):
|
def mssql_new_passwd(password, salt, uppercase=False): # since version '2012'
|
||||||
|
"""
|
||||||
|
Reference(s):
|
||||||
|
http://hashcat.net/forum/thread-1474.html
|
||||||
|
https://sqlity.net/en/2460/sql-password-hash/
|
||||||
|
|
||||||
|
>>> mssql_new_passwd(password='testpass', salt='4086ceb6', uppercase=False)
|
||||||
|
'0x02004086ceb6eb051cdbc5bdae68ffc66c918d4977e592f6bdfc2b444a7214f71fa31c35902c5b7ae773ed5f4c50676d329120ace32ee6bc81c24f70711eb0fc6400e85ebf25'
|
||||||
|
"""
|
||||||
|
|
||||||
|
binsalt = decodeHex(salt)
|
||||||
|
unistr = b"".join((_.encode(UNICODE_ENCODING) + b"\0") if ord(_) < 256 else _.encode(UNICODE_ENCODING) for _ in password)
|
||||||
|
|
||||||
|
retVal = "0200%s%s" % (salt, sha512(unistr + binsalt).hexdigest())
|
||||||
|
|
||||||
|
return "0x%s" % (retVal.upper() if uppercase else retVal.lower())
|
||||||
|
|
||||||
|
def mssql_passwd(password, salt, uppercase=False): # versions '2005' and '2008'
|
||||||
"""
|
"""
|
||||||
Reference(s):
|
Reference(s):
|
||||||
http://www.leidecker.info/projects/phrasendrescher/mssql.c
|
http://www.leidecker.info/projects/phrasendrescher/mssql.c
|
||||||
|
@ -172,7 +189,7 @@ def mssql_passwd(password, salt, uppercase=False):
|
||||||
|
|
||||||
return "0x%s" % (retVal.upper() if uppercase else retVal.lower())
|
return "0x%s" % (retVal.upper() if uppercase else retVal.lower())
|
||||||
|
|
||||||
def mssql_old_passwd(password, salt, uppercase=True): # prior to version '2005'
|
def mssql_old_passwd(password, salt, uppercase=True): # version '2000' and before
|
||||||
"""
|
"""
|
||||||
Reference(s):
|
Reference(s):
|
||||||
www.exploit-db.com/download_pdf/15537/
|
www.exploit-db.com/download_pdf/15537/
|
||||||
|
@ -190,22 +207,6 @@ def mssql_old_passwd(password, salt, uppercase=True): # prior to version '2005'
|
||||||
|
|
||||||
return "0x%s" % (retVal.upper() if uppercase else retVal.lower())
|
return "0x%s" % (retVal.upper() if uppercase else retVal.lower())
|
||||||
|
|
||||||
def mssql_new_passwd(password, salt, uppercase=False):
|
|
||||||
"""
|
|
||||||
Reference(s):
|
|
||||||
http://hashcat.net/forum/thread-1474.html
|
|
||||||
|
|
||||||
>>> mssql_new_passwd(password='testpass', salt='4086ceb6', uppercase=False)
|
|
||||||
'0x02004086ceb6eb051cdbc5bdae68ffc66c918d4977e592f6bdfc2b444a7214f71fa31c35902c5b7ae773ed5f4c50676d329120ace32ee6bc81c24f70711eb0fc6400e85ebf25'
|
|
||||||
"""
|
|
||||||
|
|
||||||
binsalt = decodeHex(salt)
|
|
||||||
unistr = b"".join((_.encode(UNICODE_ENCODING) + b"\0") if ord(_) < 256 else _.encode(UNICODE_ENCODING) for _ in password)
|
|
||||||
|
|
||||||
retVal = "0200%s%s" % (salt, sha512(unistr + binsalt).hexdigest())
|
|
||||||
|
|
||||||
return "0x%s" % (retVal.upper() if uppercase else retVal.lower())
|
|
||||||
|
|
||||||
def oracle_passwd(password, salt, uppercase=True):
|
def oracle_passwd(password, salt, uppercase=True):
|
||||||
"""
|
"""
|
||||||
Reference(s):
|
Reference(s):
|
||||||
|
|
Loading…
Reference in New Issue
Block a user