From 13d5b2c0ffab3cf29a043e2067f9d4ddc4b996f7 Mon Sep 17 00:00:00 2001 From: Miroslav Stampar Date: Mon, 20 Dec 2010 09:44:21 +0000 Subject: [PATCH] code refactoring --- lib/core/datatype.py | 31 +++++++++++++++---------------- lib/core/option.py | 10 ++-------- 2 files changed, 17 insertions(+), 24 deletions(-) diff --git a/lib/core/datatype.py b/lib/core/datatype.py index 6aa25c322..6f00206e3 100644 --- a/lib/core/datatype.py +++ b/lib/core/datatype.py @@ -62,22 +62,21 @@ class advancedDict(dict): def __setstate__(self, dict): self.__dict__ = dict -def injectionDict(): - injection = advancedDict() +class injectionDict(advancedDict): + def __init__(self): + advancedDict.__init__(self) - injection.place = None - injection.parameter = None - injection.ptype = None - injection.prefix = None - injection.suffix = None - injection.clause = None + self.place = None + self.parameter = None + self.ptype = None + self.prefix = None + self.suffix = None + self.clause = None - # data is a dict with stype as key and a tuple as value with - # title, where, comment and reqPayload - injection.data = advancedDict() + # data is a dict with stype as key and a tuple as value with + # title, where, comment and reqPayload + self.data = advancedDict() - injection.dbms = None - injection.dbms_version = None - injection.os = None - - return injection + self.dbms = None + self.dbms_version = None + self.os = None diff --git a/lib/core/option.py b/lib/core/option.py index 24f1a427a..eed6e02b4 100644 --- a/lib/core/option.py +++ b/lib/core/option.py @@ -1131,11 +1131,7 @@ def __setKnowledgeBaseAttributes(flushAll=True): kb.data = advancedDict() - # Injection types - kb.booleanTest = None - kb.errorTest = None - kb.stackedTest = None - kb.timeTest = None + # Old style injection flag kb.unionTest = None # Basic back-end DBMS fingerprint @@ -1154,8 +1150,6 @@ def __setKnowledgeBaseAttributes(flushAll=True): kb.hintValue = None kb.htmlFp = [] kb.injection = injectionDict() - kb.injection.parameter = None - kb.injection.place = None kb.injections = [] kb.lastErrorPage = None kb.lastQueryDuration = 0 @@ -1169,7 +1163,7 @@ def __setKnowledgeBaseAttributes(flushAll=True): kb.matchRatio = None kb.nullConnection = None kb.pageTemplate = None - kb.pageTemplates = advancedDict() + kb.pageTemplates = dict() kb.originalPage = None # Back-end DBMS underlying operating system fingerprint via banner (-b)