Skip to content

Commit da66f1b

Browse files
committed
Adding HUFFMAN_PRIOR_WEIGHTS
1 parent 0d82096 commit da66f1b

3 files changed

Lines changed: 15 additions & 4 deletions

File tree

data/txt/sha256sums.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ ccc4a717e887652b1fcce073d9409d9c59a3b28548c703a9e453d15845f90cd7 lib/core/patch
189189
9bf174058f15d14e24e94f9aaf42df045119d3617c6c54bd2f3af79b462f331d lib/core/replication.py
190190
0b8c38a01bb01f843d94a6c5f2075ee47520d0c4aa799cecea9c3e2c5a4a23a6 lib/core/revision.py
191191
888daba83fd4a34e9503fe21f01fef4cc730e5cde871b1d40e15d4cbc847d56c lib/core/session.py
192-
bfb81831c04059573ed0d17904242183f4d51065f235f00d437f7fc6ddcf33c7 lib/core/settings.py
192+
90a49806b83a83f6402b3dd6e35f7f2468d3dbcc0cafc3c382bda6e248344609 lib/core/settings.py
193193
c7804223319e18eb0b8e2cbf0a8b6896d1cefb7b0b1a2e9f1cf826a8a3b56750 lib/core/shell.py
194194
a2e98a94b231432736d6b304fc75525c8b5fdb4768c418387c5b4c1a610dad64 lib/core/subprocessng.py
195195
19f1e3c5e3ba703d28d510cd7a9ab8284d5fbe9df5ce7e77c86e5931571364b7 lib/core/target.py
@@ -232,7 +232,7 @@ f522436fbd14bdab090a1d305fcac0361800cb8e36c8cbcb47933298376a71e0 lib/takeover/r
232232
0787f78e6bd9bb21d4267c95c4c99806711bb57c5518485c2e25f10fcf9c41fc lib/takeover/udf.py
233233
23d73af417604dab460b74cdc230896153f018a6c00d144019491053640a172f lib/takeover/web.py
234234
8cc1e226d4150fe8aa1a056e5d32d858ed6444d3d4e2af7fb4bc08f0bbe9d527 lib/takeover/xp_cmdshell.py
235-
4dcc79ef8c6af69d9890f16e06cacad70c2e657770d8afca0e425833cd780f08 lib/techniques/blind/inference.py
235+
63e2bc0e2fb6407760245b4f36d7430b626b9654bce51485b6cbf24717225246 lib/techniques/blind/inference.py
236236
1966ca704961fb987ab757f0a4afddbf841d1a880631b701487c75cef63d60c3 lib/techniques/blind/__init__.py
237237
1966ca704961fb987ab757f0a4afddbf841d1a880631b701487c75cef63d60c3 lib/techniques/dns/__init__.py
238238
3df9839fb92a81d46b6194d7adacb43f391efb78b071783c132e8d596ecbfaf1 lib/techniques/dns/test.py

lib/core/settings.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
from thirdparty import six
2121

2222
# sqlmap version (<major>.<minor>.<month>.<monthly commit>)
23-
VERSION = "1.10.6.151"
23+
VERSION = "1.10.6.152"
2424
TYPE = "dev" if VERSION.count('.') > 2 and VERSION.split('.')[-1] != '0' else "stable"
2525
TYPE_COLORS = {"dev": 33, "stable": 90, "pip": 34}
2626
VERSION_STRING = "sqlmap/%s#%s" % ('.'.join(VERSION.split('.')[:-1]) if VERSION.count('.') > 2 and VERSION.split('.')[-1] == '0' else VERSION, TYPE)
@@ -523,6 +523,16 @@
523523
# Number of consecutive Huffman (set-membership) character attempts allowed to decline/escape without a single validated success before the technique latches itself off (safety against trimmed/blocked long IN() payloads)
524524
HUFFMAN_PROBE_LIMIT = 8
525525

526+
# Cold-start (prior) weights for the order-0 Huffman model used in adaptive blind retrieval. Gently
527+
# biases the initial tree toward bytes that dominate real DBMS output (lowercase text, digits, common
528+
# identifier punctuation) so SHORT extractions don't pay the full balanced-tree depth before the online
529+
# frequency model warms up. Magnitude is small so genuine learned counts overtake it within a few dozen
530+
# characters (kept low-risk for uniform/hex columns: hex digits 0-9a-f are themselves favored here).
531+
HUFFMAN_PRIOR_WEIGHTS = {}
532+
for _weight, _chars in ((6, " etaoinsrhldcumfgypwbvkxjqz"), (4, "0123456789"), (3, "_.-/@:,'")):
533+
for _char in _chars:
534+
HUFFMAN_PRIOR_WEIGHTS[ord(_char)] = _weight
535+
526536
# Minimum range between minimum and maximum of statistical set
527537
MIN_STATISTICAL_RANGE = 0.01
528538

lib/techniques/blind/inference.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343
from lib.core.exception import SqlmapUnsupportedFeatureException
4444
from lib.core.settings import CHAR_INFERENCE_MARK
4545
from lib.core.settings import HUFFMAN_PROBE_LIMIT
46+
from lib.core.settings import HUFFMAN_PRIOR_WEIGHTS
4647
from lib.core.settings import INFERENCE_BLANK_BREAK
4748
from lib.core.settings import INFERENCE_EQUALS_CHAR
4849
from lib.core.settings import INFERENCE_GREATER_CHAR
@@ -296,7 +297,7 @@ def huffmanChar(idx):
296297

297298
heap = []
298299
for order, ordinal in enumerate(xrange(128)):
299-
heapq.heappush(heap, (model.get(ordinal, 0) + 1, order, (ordinal,)))
300+
heapq.heappush(heap, (model.get(ordinal, 0) + HUFFMAN_PRIOR_WEIGHTS.get(ordinal, 1), order, (ordinal,)))
300301
heapq.heappush(heap, (max(model.get(ESCAPE, 0), 1), 128, (ESCAPE,)))
301302

302303
counter = 129

0 commit comments

Comments
 (0)