Skip to content

Commit 17c556a

Browse files
committed
Minor patches (and one bug from ML)
1 parent edc6f47 commit 17c556a

File tree

7 files changed

+37
-13
lines changed

7 files changed

+37
-13
lines changed

lib/core/common.py

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3727,7 +3727,6 @@ def isAdminFromPrivileges(privileges):
37273727

37283728
# In Firebird there is no specific privilege that means
37293729
# that the user is DBA
3730-
# TODO: confirm
37313730
retVal |= (Backend.isDbms(DBMS.FIREBIRD) and all(_ in privileges for _ in ("SELECT", "INSERT", "UPDATE", "DELETE", "REFERENCES", "EXECUTE")))
37323731

37333732
return retVal
@@ -3810,7 +3809,7 @@ def geturl(self):
38103809
continue
38113810

38123811
# flag to know if we are dealing with the same target host
3813-
_ = reduce(lambda x, y: x == y, map(lambda x: urlparse.urlparse(x).netloc.split(':')[0], (response.geturl(), url)))
3812+
_ = checkSameHost(response.geturl(), url)
38143813

38153814
if conf.scope:
38163815
if not re.search(conf.scope, url, re.I):
@@ -3833,6 +3832,18 @@ def geturl(self):
38333832

38343833
return retVal
38353834

3835+
def checkSameHost(*urls):
3836+
"""
3837+
Returns True if all provided urls share that same host
3838+
3839+
>>> checkSameHost('http://www.target.com/page1.php?id=1', 'http://www.target.com/images/page2.php')
3840+
True
3841+
>>> checkSameHost('http://www.target.com/page1.php?id=1', 'http://www.target2.com/images/page2.php')
3842+
False
3843+
"""
3844+
3845+
return all(urlparse.urlparse(url or "").netloc.split(':')[0] == urlparse.urlparse(urls[0] or "").netloc.split(':')[0] for url in urls)
3846+
38363847
def getHostHeader(url):
38373848
"""
38383849
Returns proper Host header value for a given target URL
@@ -3902,6 +3913,13 @@ def evaluateCode(code, variables=None):
39023913
def serializeObject(object_):
39033914
"""
39043915
Serializes given object
3916+
3917+
>>> serializeObject([1, 2, 3, ('a', 'b')])
3918+
'gAJdcQEoSwFLAksDVQFhVQFihnECZS4='
3919+
>>> serializeObject(None)
3920+
'gAJOLg=='
3921+
>>> serializeObject('foobar')
3922+
'gAJVBmZvb2JhcnEBLg=='
39053923
"""
39063924

39073925
return base64pickle(object_)
@@ -3912,6 +3930,8 @@ def unserializeObject(value):
39123930
39133931
>>> unserializeObject(serializeObject([1, 2, 3])) == [1, 2, 3]
39143932
True
3933+
>>> unserializeObject('gAJVBmZvb2JhcnEBLg==')
3934+
'foobar'
39153935
"""
39163936

39173937
return base64unpickle(value) if value else None
@@ -3958,6 +3978,8 @@ def decodeHexValue(value, raw=False):
39583978
39593979
>>> decodeHexValue('3132332031')
39603980
u'123 1'
3981+
>>> decodeHexValue(['0x31', '0x32'])
3982+
[u'1', u'2']
39613983
"""
39623984

39633985
retVal = value

lib/core/settings.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
from lib.core.enums import OS
2020

2121
# sqlmap version (<major>.<minor>.<month>.<monthly commit>)
22-
VERSION = "1.0.12.11"
22+
VERSION = "1.0.12.12"
2323
TYPE = "dev" if VERSION.count('.') > 2 and VERSION.split('.')[-1] != '0' else "stable"
2424
TYPE_COLORS = {"dev": 33, "stable": 90, "pip": 34}
2525
VERSION_STRING = "sqlmap/%s#%s" % ('.'.join(VERSION.split('.')[:-1]) if VERSION.count('.') > 2 and VERSION.split('.')[-1] == '0' else VERSION, TYPE)

lib/request/connect.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ class WebSocketException(Exception):
3131
from lib.core.agent import agent
3232
from lib.core.common import asciifyUrl
3333
from lib.core.common import calculateDeltaSeconds
34+
from lib.core.common import checkSameHost
3435
from lib.core.common import clearConsoleLine
3536
from lib.core.common import dataToStdout
3637
from lib.core.common import evaluateCode
@@ -266,7 +267,7 @@ def getPage(**kwargs):
266267
url = urlparse.urljoin(conf.url, url)
267268

268269
# flag to know if we are dealing with the same target host
269-
target = reduce(lambda x, y: x == y, map(lambda x: urlparse.urlparse(x).netloc.split(':')[0], [url, conf.url or ""]))
270+
target = checkSameHost(url, conf.url)
270271

271272
if not retrying:
272273
# Reset the number of connection retries

lib/utils/crawler.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
import tempfile
1313
import time
1414

15+
from lib.core.common import checkSameHost
1516
from lib.core.common import clearConsoleLine
1617
from lib.core.common import dataToStdout
1718
from lib.core.common import findPageForms
@@ -97,7 +98,7 @@ def crawlThread():
9798
url = urlparse.urljoin(current, href)
9899

99100
# flag to know if we are dealing with the same target host
100-
_ = reduce(lambda x, y: x == y, map(lambda x: urlparse.urlparse(x).netloc.split(':')[0], (url, target)))
101+
_ = checkSameHost(url, target)
101102

102103
if conf.scope:
103104
if not re.search(conf.scope, url, re.I):

sqlmap.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
sys.dont_write_bytecode = True
1111

12-
from lib.utils import versioncheck # this has to be the first non-standard import
12+
__import__("lib.utils.versioncheck") # this has to be the first non-standard import
1313

1414
import bdb
1515
import distutils

sqlmapapi.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
sys.dont_write_bytecode = True
1313

14-
from lib.utils import versioncheck # this has to be the first non-standard import
14+
__import__("lib.utils.versioncheck") # this has to be the first non-standard import
1515

1616
from sqlmap import modulePath
1717
from lib.core.common import setPaths

txt/checksum.md5

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ ec007a1424da78cfdae90da6ae49ed9b lib/controller/handler.py
2626
cc9c82cfffd8ee9b25ba3af6284f057e lib/controller/__init__.py
2727
cdffff6260c40ccb4e4092fc21d9d63f lib/core/agent.py
2828
eb0bd28b0bd9fbf67dcc3119116df377 lib/core/bigarray.py
29-
35f2579af5793e3c8299f05190eec734 lib/core/common.py
29+
88578e4e2dd5f01cf0098dcd276ca598 lib/core/common.py
3030
ab5ef8fe4e4beaef4016d458d0fdefe3 lib/core/convert.py
3131
e77cca1cb063016f71f6e6bdebf4ec73 lib/core/data.py
3232
1d042f0bc0557d3fd564ea5a46deb77e lib/core/datatype.py
@@ -45,7 +45,7 @@ e60456db5380840a586654344003d4e6 lib/core/readlineng.py
4545
b3a62d41a5af6cd7fa733b6227febb0c lib/core/replication.py
4646
dfb664b223ac3585d51e58839b777d9b lib/core/revision.py
4747
7c15dd2777af4dac2c89cab6df17462e lib/core/session.py
48-
e892660b4e7981a575dde143ca06754b lib/core/settings.py
48+
0e55924e1cd0e5ecdf0173e16ebefd5b lib/core/settings.py
4949
7af83e4f18cab6dff5e67840eb65be80 lib/core/shell.py
5050
23657cd7d924e3c6d225719865855827 lib/core/subprocessng.py
5151
c3ace7874a536d801f308cf1fd03df99 lib/core/target.py
@@ -67,7 +67,7 @@ b40a4c5d91770d347df36d3065b63798 lib/parse/sitemap.py
6767
9299f21804033f099681525bb9bf51c0 lib/request/basicauthhandler.py
6868
083e7f446909b12009e72ae8e5e5737c lib/request/basic.py
6969
c48285682a61d49982cb508351013cb4 lib/request/comparison.py
70-
de812e1f9e88659adc4d904014260ea9 lib/request/connect.py
70+
80e962cf22d340226856f362ed8c5192 lib/request/connect.py
7171
3d4416fb6802e7e29cf727aefa29355d lib/request/direct.py
7272
4ae7f4570fb859045f0487cc0b055a8e lib/request/dns.py
7373
58f63132eb56ad41ae6af4fe61933a2d lib/request/httpshandler.py
@@ -100,7 +100,7 @@ cc9c82cfffd8ee9b25ba3af6284f057e lib/techniques/union/__init__.py
100100
8c00374e60a7699d4d34337da951d64b lib/techniques/union/test.py
101101
afd4d2e3896853299a9b449fe6db626a lib/techniques/union/use.py
102102
26c1babc6289fac9056f8b21d10f3bb1 lib/utils/api.py
103-
7c94b6c3088b68975d468c86d47b1b03 lib/utils/crawler.py
103+
a450944bcd92eededbd5d640c5c2165b lib/utils/crawler.py
104104
2f76b2667244d849cf8401446f571258 lib/utils/deps.py
105105
4dfd3a95e73e806f62372d63bc82511f lib/utils/getch.py
106106
f71a7b0aec145ba77edd3c4543621fb9 lib/utils/hashdb.py
@@ -223,8 +223,8 @@ ff90cb0366f7cefbdd6e573e27e6238c shell/runcmd.exe_
223223
c3cc8b7727161e64ab59f312c33b541a shell/stager.aspx_
224224
1f7f125f30e0e800beb21e2ebbab18e1 shell/stager.jsp_
225225
01e3505e796edf19aad6a996101c81c9 shell/stager.php_
226-
c3ee3d5e5eab01436d4d5e1dab0f32db sqlmapapi.py
227-
c6c088ca8df6e60c63ef64767472bbcb sqlmap.py
226+
f45056e2c5588acfecab92d70575fd05 sqlmapapi.py
227+
034f6214e740191167d7100de9a4983b sqlmap.py
228228
1316deb997418507e76221c84ec99946 tamper/apostrophemask.py
229229
a6efe8f914c769c52afec703bd73609f tamper/apostrophenullencode.py
230230
b1c56983919b69f4f6f0e7929c881e7a tamper/appendnullbyte.py

0 commit comments

Comments
 (0)