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

Skip to content

Commit 9404b63

Browse files
committed
Some memory improvements of @cachedmethod
1 parent 58b87e4 commit 9404b63

4 files changed

Lines changed: 8 additions & 7 deletions

File tree

lib/core/common.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2691,6 +2691,7 @@ def enumValueToNameLookup(type_, value_):
26912691

26922692
return retVal
26932693

2694+
@cachedmethod
26942695
def extractRegexResult(regex, content, flags=0):
26952696
"""
26962697
Returns 'result' group value from a possible match with regex on a given

lib/core/decorators.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,11 @@ def cachedmethod(f, cache={}):
1414

1515
def _(*args, **kwargs):
1616
try:
17-
key = (f, tuple(args), frozenset(kwargs.items()))
17+
key = hash((f, tuple(args), frozenset(kwargs.items())))
1818
if key not in cache:
1919
cache[key] = f(*args, **kwargs)
2020
except:
21-
key = "".join(str(_) for _ in (f, args, kwargs))
21+
key = hash("".join(str(_) for _ in (f, args, kwargs)))
2222
if key not in cache:
2323
cache[key] = f(*args, **kwargs)
2424

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.1.11.7"
22+
VERSION = "1.1.11.8"
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)

txt/checksum.md5

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,11 @@ d2cdb9e832e18a81e936ca3348144b16 lib/controller/handler.py
2727
5fb9aaf874daa47ea2b672a22740e56b lib/controller/__init__.py
2828
c1ba81136151b327c71fd01376376451 lib/core/agent.py
2929
d55b4b58019d6dbfddd40ec919f9f172 lib/core/bigarray.py
30-
8ba4d3870b4a7a5a89eb8fe4f039e355 lib/core/common.py
30+
f424e35d21529dafe60c0c5564855d5f lib/core/common.py
3131
54326d3a690f8b26fe5a5da1a589b369 lib/core/convert.py
3232
90b1b08368ac8a859300e6fa6a8c796e lib/core/data.py
3333
1c14bdbf47b8dba31f73da9ad731a54a lib/core/datatype.py
34-
70d60d7a9518083cfa8900b97c065f7a lib/core/decorators.py
34+
2c16cdbbccbfcfc0ddac2cff876ce9f3 lib/core/decorators.py
3535
d3ed5f9baa074df33390d33164d9d8b5 lib/core/defaults.py
3636
96fe4769b6e3e68635fa82cd59cc49fc lib/core/dicts.py
3737
956be8ca65c7f04f08c6f2dce710b3b2 lib/core/dump.py
@@ -46,7 +46,7 @@ ec6a778b0e74749b916caead78ba88b7 lib/core/option.py
4646
760d9df2a27ded29109b390ab202e72d lib/core/replication.py
4747
a2466b62e67f8b31736bac4dac590e51 lib/core/revision.py
4848
02d4762140a72fd44668d3dab5eabda9 lib/core/session.py
49-
b1cea79f42496d6b39be19a0bdc26070 lib/core/settings.py
49+
15a317ddbd48bdf94e1642df57664790 lib/core/settings.py
5050
35bffbad762eb9e03db9e93b1c991103 lib/core/shell.py
5151
a59ec28371ae067a6fdd8f810edbee3d lib/core/subprocessng.py
5252
7c9f2af3c0a8dd89223cfe07b0a0b826 lib/core/target.py
@@ -66,7 +66,7 @@ e07930095e56de11c297d7ac1a1706f2 lib/parse/html.py
6666
d8d9bcf9e7107a5e2cf2dd10f115ac28 lib/parse/payloads.py
6767
2b87577dc6d3609e96fc1e049def5b4f lib/parse/sitemap.py
6868
d2f13a0e2fef5273d419d06e516122e1 lib/request/basicauthhandler.py
69-
669e8cf941bba4a2e987045b3002b8e3 lib/request/basic.py
69+
9ef264b5c0f9e7989b8c2ab91d40400d lib/request/basic.py
7070
28348595147a731677c8bef470c6f57a lib/request/comparison.py
7171
a253670611499bc159879122e05622de lib/request/connect.py
7272
ad6f76839408d827abfcdc57813f8518 lib/request/direct.py

0 commit comments

Comments
 (0)