Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 25f29ca

Browse files
committed
Minor updates
1 parent a7695dd commit 25f29ca

6 files changed

Lines changed: 270 additions & 269 deletions

File tree

lib/core/bigarray.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,11 @@ def __init__(self, index, data, dirty):
5151
class BigArray(list):
5252
"""
5353
List-like class used for storing large amounts of data (disk cached)
54+
55+
>>> _ = BigArray(xrange(100000))
56+
>>> _[20] = 0
57+
>>> _[100]
58+
100
5459
"""
5560

5661
def __init__(self, items=None):

lib/core/dicts.py

Lines changed: 257 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -334,3 +334,260 @@
334334
"osCmd": CONTENT_TYPE.OS_CMD,
335335
"regRead": CONTENT_TYPE.REG_READ
336336
}
337+
338+
# Reference: http://www.w3.org/TR/1999/REC-html401-19991224/sgml/entities.html
339+
340+
HTML_ENTITIES = {
341+
"quot": 34,
342+
"amp": 38,
343+
"lt": 60,
344+
"gt": 62,
345+
"nbsp": 160,
346+
"iexcl": 161,
347+
"cent": 162,
348+
"pound": 163,
349+
"curren": 164,
350+
"yen": 165,
351+
"brvbar": 166,
352+
"sect": 167,
353+
"uml": 168,
354+
"copy": 169,
355+
"ordf": 170,
356+
"laquo": 171,
357+
"not": 172,
358+
"shy": 173,
359+
"reg": 174,
360+
"macr": 175,
361+
"deg": 176,
362+
"plusmn": 177,
363+
"sup2": 178,
364+
"sup3": 179,
365+
"acute": 180,
366+
"micro": 181,
367+
"para": 182,
368+
"middot": 183,
369+
"cedil": 184,
370+
"sup1": 185,
371+
"ordm": 186,
372+
"raquo": 187,
373+
"frac14": 188,
374+
"frac12": 189,
375+
"frac34": 190,
376+
"iquest": 191,
377+
"Agrave": 192,
378+
"Aacute": 193,
379+
"Acirc": 194,
380+
"Atilde": 195,
381+
"Auml": 196,
382+
"Aring": 197,
383+
"AElig": 198,
384+
"Ccedil": 199,
385+
"Egrave": 200,
386+
"Eacute": 201,
387+
"Ecirc": 202,
388+
"Euml": 203,
389+
"Igrave": 204,
390+
"Iacute": 205,
391+
"Icirc": 206,
392+
"Iuml": 207,
393+
"ETH": 208,
394+
"Ntilde": 209,
395+
"Ograve": 210,
396+
"Oacute": 211,
397+
"Ocirc": 212,
398+
"Otilde": 213,
399+
"Ouml": 214,
400+
"times": 215,
401+
"Oslash": 216,
402+
"Ugrave": 217,
403+
"Uacute": 218,
404+
"Ucirc": 219,
405+
"Uuml": 220,
406+
"Yacute": 221,
407+
"THORN": 222,
408+
"szlig": 223,
409+
"agrave": 224,
410+
"aacute": 225,
411+
"acirc": 226,
412+
"atilde": 227,
413+
"auml": 228,
414+
"aring": 229,
415+
"aelig": 230,
416+
"ccedil": 231,
417+
"egrave": 232,
418+
"eacute": 233,
419+
"ecirc": 234,
420+
"euml": 235,
421+
"igrave": 236,
422+
"iacute": 237,
423+
"icirc": 238,
424+
"iuml": 239,
425+
"eth": 240,
426+
"ntilde": 241,
427+
"ograve": 242,
428+
"oacute": 243,
429+
"ocirc": 244,
430+
"otilde": 245,
431+
"ouml": 246,
432+
"divide": 247,
433+
"oslash": 248,
434+
"ugrave": 249,
435+
"uacute": 250,
436+
"ucirc": 251,
437+
"uuml": 252,
438+
"yacute": 253,
439+
"thorn": 254,
440+
"yuml": 255,
441+
"OElig": 338,
442+
"oelig": 339,
443+
"Scaron": 352,
444+
"fnof": 402,
445+
"scaron": 353,
446+
"Yuml": 376,
447+
"circ": 710,
448+
"tilde": 732,
449+
"Alpha": 913,
450+
"Beta": 914,
451+
"Gamma": 915,
452+
"Delta": 916,
453+
"Epsilon": 917,
454+
"Zeta": 918,
455+
"Eta": 919,
456+
"Theta": 920,
457+
"Iota": 921,
458+
"Kappa": 922,
459+
"Lambda": 923,
460+
"Mu": 924,
461+
"Nu": 925,
462+
"Xi": 926,
463+
"Omicron": 927,
464+
"Pi": 928,
465+
"Rho": 929,
466+
"Sigma": 931,
467+
"Tau": 932,
468+
"Upsilon": 933,
469+
"Phi": 934,
470+
"Chi": 935,
471+
"Psi": 936,
472+
"Omega": 937,
473+
"alpha": 945,
474+
"beta": 946,
475+
"gamma": 947,
476+
"delta": 948,
477+
"epsilon": 949,
478+
"zeta": 950,
479+
"eta": 951,
480+
"theta": 952,
481+
"iota": 953,
482+
"kappa": 954,
483+
"lambda": 955,
484+
"mu": 956,
485+
"nu": 957,
486+
"xi": 958,
487+
"omicron": 959,
488+
"pi": 960,
489+
"rho": 961,
490+
"sigmaf": 962,
491+
"sigma": 963,
492+
"tau": 964,
493+
"upsilon": 965,
494+
"phi": 966,
495+
"chi": 967,
496+
"psi": 968,
497+
"omega": 969,
498+
"thetasym": 977,
499+
"upsih": 978,
500+
"piv": 982,
501+
"bull": 8226,
502+
"hellip": 8230,
503+
"prime": 8242,
504+
"Prime": 8243,
505+
"oline": 8254,
506+
"frasl": 8260,
507+
"ensp": 8194,
508+
"emsp": 8195,
509+
"thinsp": 8201,
510+
"zwnj": 8204,
511+
"zwj": 8205,
512+
"lrm": 8206,
513+
"rlm": 8207,
514+
"ndash": 8211,
515+
"mdash": 8212,
516+
"lsquo": 8216,
517+
"rsquo": 8217,
518+
"sbquo": 8218,
519+
"ldquo": 8220,
520+
"rdquo": 8221,
521+
"bdquo": 8222,
522+
"dagger": 8224,
523+
"Dagger": 8225,
524+
"permil": 8240,
525+
"lsaquo": 8249,
526+
"rsaquo": 8250,
527+
"euro": 8364,
528+
"weierp": 8472,
529+
"image": 8465,
530+
"real": 8476,
531+
"trade": 8482,
532+
"alefsym": 8501,
533+
"larr": 8592,
534+
"uarr": 8593,
535+
"rarr": 8594,
536+
"darr": 8595,
537+
"harr": 8596,
538+
"crarr": 8629,
539+
"lArr": 8656,
540+
"uArr": 8657,
541+
"rArr": 8658,
542+
"dArr": 8659,
543+
"hArr": 8660,
544+
"forall": 8704,
545+
"part": 8706,
546+
"exist": 8707,
547+
"empty": 8709,
548+
"nabla": 8711,
549+
"isin": 8712,
550+
"notin": 8713,
551+
"ni": 8715,
552+
"prod": 8719,
553+
"sum": 8721,
554+
"minus": 8722,
555+
"lowast": 8727,
556+
"radic": 8730,
557+
"prop": 8733,
558+
"infin": 8734,
559+
"ang": 8736,
560+
"and": 8743,
561+
"or": 8744,
562+
"cap": 8745,
563+
"cup": 8746,
564+
"int": 8747,
565+
"there4": 8756,
566+
"sim": 8764,
567+
"cong": 8773,
568+
"asymp": 8776,
569+
"ne": 8800,
570+
"equiv": 8801,
571+
"le": 8804,
572+
"ge": 8805,
573+
"sub": 8834,
574+
"sup": 8835,
575+
"nsub": 8836,
576+
"sube": 8838,
577+
"supe": 8839,
578+
"oplus": 8853,
579+
"otimes": 8855,
580+
"perp": 8869,
581+
"sdot": 8901,
582+
"lceil": 8968,
583+
"rceil": 8969,
584+
"lfloor": 8970,
585+
"rfloor": 8971,
586+
"lang": 9001,
587+
"rang": 9002,
588+
"loz": 9674,
589+
"spades": 9824,
590+
"clubs": 9827,
591+
"hearts": 9829,
592+
"diams": 9830
593+
}

lib/core/settings.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
from thirdparty.six import unichr as _unichr
1919

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

lib/core/wordlist.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,9 @@ class Wordlist(six.Iterator):
1818
Iterator for looping over a large dictionaries
1919
2020
>>> from lib.core.option import paths
21-
>>> isinstance(next(Wordlist(paths.SMALL_DICT)), six.string_types)
21+
>>> isinstance(next(Wordlist(paths.SMALL_DICT)), six.binary_type)
22+
True
23+
>>> isinstance(next(Wordlist(paths.WORDLIST)), six.binary_type)
2224
True
2325
"""
2426

@@ -58,7 +60,7 @@ def adjust(self):
5860
raise SqlmapDataException(errMsg)
5961
self.fp = _.open(_.namelist()[0])
6062
else:
61-
self.fp = open(self.current, 'r')
63+
self.fp = open(self.current, "rb")
6264
self.iter = iter(self.fp)
6365

6466
self.index += 1

lib/request/basic.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
from lib.core.data import kb
3535
from lib.core.data import logger
3636
from lib.core.decorators import cachedmethod
37+
from lib.core.dicts import HTML_ENTITIES
3738
from lib.core.enums import DBMS
3839
from lib.core.enums import HTTP_HEADER
3940
from lib.core.enums import PLACE
@@ -49,7 +50,6 @@
4950
from lib.core.settings import VIEWSTATE_REGEX
5051
from lib.parse.headers import headersParser
5152
from lib.parse.html import htmlParser
52-
from lib.utils.htmlentities import htmlEntities
5353
from thirdparty import six
5454
from thirdparty.chardet import detect
5555
from thirdparty.identywaf import identYwaf
@@ -341,7 +341,7 @@ def decodePage(page, contentEncoding, contentType):
341341
page = re.sub(b"%([0-9a-fA-F]{2})", lambda _: decodeHex(_.group(1)), page)
342342

343343
# e.g. &amp;
344-
page = re.sub(b"&([^;]+);", lambda _: six.int2byte(htmlEntities[getText(_.group(1))]) if htmlEntities.get(getText(_.group(1)), 256) < 256 else _.group(0), page)
344+
page = re.sub(b"&([^;]+);", lambda _: six.int2byte(HTML_ENTITIES[getText(_.group(1))]) if HTML_ENTITIES.get(getText(_.group(1)), 256) < 256 else _.group(0), page)
345345

346346
kb.pageEncoding = kb.pageEncoding or checkCharEncoding(getHeuristicCharEncoding(page))
347347

@@ -364,7 +364,7 @@ def _(match):
364364
page = re.sub(r"&#(\d+);", _, page)
365365

366366
# e.g. &zeta;
367-
page = re.sub(r"&([^;]+);", lambda _: _unichr(htmlEntities[_.group(1)]) if htmlEntities.get(_.group(1), 0) > 255 else _.group(0), page)
367+
page = re.sub(r"&([^;]+);", lambda _: _unichr(HTML_ENTITIES[_.group(1)]) if HTML_ENTITIES.get(_.group(1), 0) > 255 else _.group(0), page)
368368

369369
return page
370370

0 commit comments

Comments
 (0)