mirror of
https://github.com/sqlmapproject/sqlmap.git
synced 2025-02-03 13:14:13 +03:00
Avoiding md5/sha1 deprecated warning in Python >=2.6
This commit is contained in:
parent
8f26f30740
commit
4bea0e343a
|
@ -22,8 +22,13 @@ with sqlmap; if not, write to the Free Software Foundation, Inc., 51
|
||||||
Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import md5
|
try:
|
||||||
import sha
|
import hashlib
|
||||||
|
except:
|
||||||
|
import md5
|
||||||
|
import sha
|
||||||
|
|
||||||
|
import sys
|
||||||
import struct
|
import struct
|
||||||
import urllib
|
import urllib
|
||||||
|
|
||||||
|
@ -45,7 +50,10 @@ def hexencode(string):
|
||||||
return string.encode("hex")
|
return string.encode("hex")
|
||||||
|
|
||||||
def md5hash(string):
|
def md5hash(string):
|
||||||
return md5.new(string).hexdigest()
|
if sys.modules.has_key('hashlib'):
|
||||||
|
return hashlib.md5(string).hexdigest()
|
||||||
|
else:
|
||||||
|
return md5.new(string).hexdigest()
|
||||||
|
|
||||||
def orddecode(string):
|
def orddecode(string):
|
||||||
packedString = struct.pack("!"+"I" * len(string), *string)
|
packedString = struct.pack("!"+"I" * len(string), *string)
|
||||||
|
@ -55,7 +63,10 @@ def ordencode(string):
|
||||||
return tuple([ord(char) for char in string])
|
return tuple([ord(char) for char in string])
|
||||||
|
|
||||||
def sha1hash(string):
|
def sha1hash(string):
|
||||||
return sha.new(string).hexdigest()
|
if sys.modules.has_key('hashlib'):
|
||||||
|
return hashlib.sha1(string).hexdigest()
|
||||||
|
else:
|
||||||
|
return sha.new(string).hexdigest()
|
||||||
|
|
||||||
def urldecode(string):
|
def urldecode(string):
|
||||||
result = None
|
result = None
|
||||||
|
|
Loading…
Reference in New Issue
Block a user