mirror of
https://github.com/sqlmapproject/sqlmap.git
synced 2024-11-29 04:53:48 +03:00
Replacing deprecated has_key() with operator in (PEP8)
This commit is contained in:
parent
e4a3c015e5
commit
1712603dce
|
@ -92,7 +92,7 @@ def main():
|
||||||
req = urllib2.Request(sqlfile)
|
req = urllib2.Request(sqlfile)
|
||||||
response = urllib2.urlopen(req)
|
response = urllib2.urlopen(req)
|
||||||
|
|
||||||
if response.headers.has_key("Content-Length"):
|
if "Content-Length" in response.headers:
|
||||||
if int(response.headers.get("Content-Length")) > MAX_FILE_SIZE:
|
if int(response.headers.get("Content-Length")) > MAX_FILE_SIZE:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
|
|
@ -47,7 +47,7 @@ def hexencode(value):
|
||||||
return utf8encode(value).encode("hex")
|
return utf8encode(value).encode("hex")
|
||||||
|
|
||||||
def md5hash(value):
|
def md5hash(value):
|
||||||
if sys.modules.has_key('hashlib'):
|
if "hashlib" in sys.modules:
|
||||||
return hashlib.md5(value).hexdigest()
|
return hashlib.md5(value).hexdigest()
|
||||||
else:
|
else:
|
||||||
return md5.new(value).hexdigest()
|
return md5.new(value).hexdigest()
|
||||||
|
@ -60,7 +60,7 @@ def ordencode(value):
|
||||||
return tuple(ord(char) for char in value)
|
return tuple(ord(char) for char in value)
|
||||||
|
|
||||||
def sha1hash(value):
|
def sha1hash(value):
|
||||||
if sys.modules.has_key('hashlib'):
|
if "hashlib" in sys.modules:
|
||||||
return hashlib.sha1(value).hexdigest()
|
return hashlib.sha1(value).hexdigest()
|
||||||
else:
|
else:
|
||||||
return sha.new(value).hexdigest()
|
return sha.new(value).hexdigest()
|
||||||
|
|
|
@ -47,11 +47,11 @@ class AttribDict(dict):
|
||||||
"""
|
"""
|
||||||
|
|
||||||
# This test allows attributes to be set in the __init__ method
|
# This test allows attributes to be set in the __init__ method
|
||||||
if not self.__dict__.has_key('_AttribDict__initialised'):
|
if "_AttribDict__initialised" not in self.__dict__:
|
||||||
return dict.__setattr__(self, item, value)
|
return dict.__setattr__(self, item, value)
|
||||||
|
|
||||||
# Any normal attributes are handled normally
|
# Any normal attributes are handled normally
|
||||||
elif self.__dict__.has_key(item):
|
elif item in self.__dict__:
|
||||||
dict.__setattr__(self, item, value)
|
dict.__setattr__(self, item, value)
|
||||||
|
|
||||||
else:
|
else:
|
||||||
|
|
|
@ -81,7 +81,7 @@ class Enumeration(GenericEnumeration):
|
||||||
|
|
||||||
if retVal:
|
if retVal:
|
||||||
for table in retVal[0].values()[0]:
|
for table in retVal[0].values()[0]:
|
||||||
if not kb.data.cachedTables.has_key(db):
|
if db not in kb.data.cachedTables:
|
||||||
kb.data.cachedTables[db] = [table]
|
kb.data.cachedTables[db] = [table]
|
||||||
else:
|
else:
|
||||||
kb.data.cachedTables[db].append(table)
|
kb.data.cachedTables[db].append(table)
|
||||||
|
|
|
@ -145,7 +145,7 @@ class Enumeration(GenericEnumeration):
|
||||||
|
|
||||||
if retVal:
|
if retVal:
|
||||||
for table in retVal[0].values()[0]:
|
for table in retVal[0].values()[0]:
|
||||||
if not kb.data.cachedTables.has_key(db):
|
if db not in kb.data.cachedTables:
|
||||||
kb.data.cachedTables[db] = [table]
|
kb.data.cachedTables[db] = [table]
|
||||||
else:
|
else:
|
||||||
kb.data.cachedTables[db].append(table)
|
kb.data.cachedTables[db].append(table)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user