Skip to content

Commit 9b3d229

Browse files
committed
1 parent c74756c commit 9b3d229

File tree

16 files changed

+90
-90
lines changed

16 files changed

+90
-90
lines changed

doc/CONTRIBUTING.md

Lines changed: 38 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,38 @@
1-
# Contributing to sqlmap
2-
3-
## Reporting bugs
4-
5-
**Bug reports are welcome**!
6-
Please report all bugs on the [issue tracker](https://github.com/sqlmapproject/sqlmap/issues).
7-
8-
### Guidelines
9-
10-
* Before you submit a bug report, search both [open](https://github.com/sqlmapproject/sqlmap/issues?q=is%3Aopen+is%3Aissue) and [closed](https://github.com/sqlmapproject/sqlmap/issues?q=is%3Aissue+is%3Aclosed) issues to make sure the issue has not come up before. Also, check the [user's manual](https://github.com/sqlmapproject/sqlmap/wiki) for anything relevant.
11-
* Make sure you can reproduce the bug with the latest development version of sqlmap.
12-
* Your report should give detailed instructions on how to reproduce the problem. If sqlmap raises an unhandled exception, the entire traceback is needed. Details of the unexpected behaviour are welcome too. A small test case (just a few lines) is ideal.
13-
* If you are making an enhancement request, lay out the rationale for the feature you are requesting. *Why would this feature be useful?*
14-
* If you are not sure whether something is a bug, or want to discuss a potential new feature before putting in an enhancement request, the [mailing list](https://lists.sourceforge.net/lists/listinfo/sqlmap-users) is a good place to bring it up.
15-
16-
## Submitting code changes
17-
18-
All code contributions are greatly appreciated. First off, clone the [Git repository](https://github.com/sqlmapproject/sqlmap), read the [user's manual](https://github.com/sqlmapproject/sqlmap/wiki) carefully, go through the code yourself and [drop us an email](mailto:dev@sqlmap.org) if you are having a hard time grasping its structure and meaning. We apologize for not commenting the code enough - you could take a chance to read it through and [improve it](https://github.com/sqlmapproject/sqlmap/issues/37).
19-
20-
Our preferred method of patch submission is via a Git [pull request](https://help.github.com/articles/using-pull-requests).
21-
Many [people](https://raw.github.com/sqlmapproject/sqlmap/master/doc/THANKS.md) have contributed in different ways to the sqlmap development. **You** can be the next!
22-
23-
### Guidelines
24-
25-
In order to maintain consistency and readability throughout the code, we ask that you adhere to the following instructions:
26-
27-
* Each patch should make one logical change.
28-
* Wrap code to 76 columns when possible.
29-
* Avoid tabbing, use four blank spaces instead.
30-
* Before you put time into a non-trivial patch, it is worth discussing it on the [mailing list](https://lists.sourceforge.net/lists/listinfo/sqlmap-users) or privately by [email](mailto:dev@sqlmap.org).
31-
* Do not change style on numerous files in one single pull request, we can [discuss](mailto:dev@sqlmap.org) about those before doing any major restyling, but be sure that personal preferences not having a strong support in [PEP 8](http://www.python.org/dev/peps/pep-0008/) will likely to be rejected.
32-
* Make changes on less than five files per single pull request - there is rarely a good reason to have more than five files changed on one pull request, as this dramatically increases the review time required to land (commit) any of those pull requests.
33-
* Style that is too different from main branch will be ''adapted'' by the developers side.
34-
* Do not touch anything inside `thirdparty/` and `extra/` folders.
35-
36-
### Licensing
37-
38-
By submitting code contributions to the sqlmap developers, to the mailing list, or via Git pull request, checking them into the sqlmap source code repository, it is understood (unless you specify otherwise) that you are offering the sqlmap copyright holders the unlimited, non-exclusive right to reuse, modify, and relicense the code. This is important because the inability to relicense code has caused devastating problems for other software projects (such as KDE and NASM). If you wish to specify special license conditions of your contributions, just say so when you send them.
1+
# Contributing to sqlmap
2+
3+
## Reporting bugs
4+
5+
**Bug reports are welcome**!
6+
Please report all bugs on the [issue tracker](https://github.com/sqlmapproject/sqlmap/issues).
7+
8+
### Guidelines
9+
10+
* Before you submit a bug report, search both [open](https://github.com/sqlmapproject/sqlmap/issues?q=is%3Aopen+is%3Aissue) and [closed](https://github.com/sqlmapproject/sqlmap/issues?q=is%3Aissue+is%3Aclosed) issues to make sure the issue has not come up before. Also, check the [user's manual](https://github.com/sqlmapproject/sqlmap/wiki) for anything relevant.
11+
* Make sure you can reproduce the bug with the latest development version of sqlmap.
12+
* Your report should give detailed instructions on how to reproduce the problem. If sqlmap raises an unhandled exception, the entire traceback is needed. Details of the unexpected behaviour are welcome too. A small test case (just a few lines) is ideal.
13+
* If you are making an enhancement request, lay out the rationale for the feature you are requesting. *Why would this feature be useful?*
14+
* If you are not sure whether something is a bug, or want to discuss a potential new feature before putting in an enhancement request, the [mailing list](https://lists.sourceforge.net/lists/listinfo/sqlmap-users) is a good place to bring it up.
15+
16+
## Submitting code changes
17+
18+
All code contributions are greatly appreciated. First off, clone the [Git repository](https://github.com/sqlmapproject/sqlmap), read the [user's manual](https://github.com/sqlmapproject/sqlmap/wiki) carefully, go through the code yourself and [drop us an email](mailto:dev@sqlmap.org) if you are having a hard time grasping its structure and meaning. We apologize for not commenting the code enough - you could take a chance to read it through and [improve it](https://github.com/sqlmapproject/sqlmap/issues/37).
19+
20+
Our preferred method of patch submission is via a Git [pull request](https://help.github.com/articles/using-pull-requests).
21+
Many [people](https://raw.github.com/sqlmapproject/sqlmap/master/doc/THANKS.md) have contributed in different ways to the sqlmap development. **You** can be the next!
22+
23+
### Guidelines
24+
25+
In order to maintain consistency and readability throughout the code, we ask that you adhere to the following instructions:
26+
27+
* Each patch should make one logical change.
28+
* Wrap code to 76 columns when possible.
29+
* Avoid tabbing, use four blank spaces instead.
30+
* Before you put time into a non-trivial patch, it is worth discussing it on the [mailing list](https://lists.sourceforge.net/lists/listinfo/sqlmap-users) or privately by [email](mailto:dev@sqlmap.org).
31+
* Do not change style on numerous files in one single pull request, we can [discuss](mailto:dev@sqlmap.org) about those before doing any major restyling, but be sure that personal preferences not having a strong support in [PEP 8](http://www.python.org/dev/peps/pep-0008/) will likely to be rejected.
32+
* Make changes on less than five files per single pull request - there is rarely a good reason to have more than five files changed on one pull request, as this dramatically increases the review time required to land (commit) any of those pull requests.
33+
* Style that is too different from main branch will be ''adapted'' by the developers side.
34+
* Do not touch anything inside `thirdparty/` and `extra/` folders.
35+
36+
### Licensing
37+
38+
By submitting code contributions to the sqlmap developers, to the mailing list, or via Git pull request, checking them into the sqlmap source code repository, it is understood (unless you specify otherwise) that you are offering the sqlmap copyright holders the unlimited, non-exclusive right to reuse, modify, and relicense the code. This is important because the inability to relicense code has caused devastating problems for other software projects (such as KDE and NASM). If you wish to specify special license conditions of your contributions, just say so when you send them.

lib/controller/controller.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ def _showInjections():
161161
else:
162162
header = "sqlmap resumed the following injection point(s) from stored session"
163163

164-
if hasattr(conf, "api"):
164+
if conf.api:
165165
conf.dumper.string("", {"url": conf.url, "query": conf.parameters.get(PLACE.GET), "data": conf.parameters.get(PLACE.POST)}, content_type=CONTENT_TYPE.TARGET)
166166
conf.dumper.string("", kb.injections, content_type=CONTENT_TYPE.TECHNIQUES)
167167
else:

lib/core/common.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,7 @@ def getOs(target, info):
270270
infoApi = {}
271271

272272
if info and "type" in info:
273-
if hasattr(conf, "api"):
273+
if conf.api:
274274
infoApi["%s operating system" % target] = info
275275
else:
276276
infoStr += "%s operating system: %s" % (target, Format.humanize(info["type"]))
@@ -288,12 +288,12 @@ def getOs(target, info):
288288
infoStr += " (%s)" % Format.humanize(info["codename"])
289289

290290
if "technology" in info:
291-
if hasattr(conf, "api"):
291+
if conf.api:
292292
infoApi["web application technology"] = Format.humanize(info["technology"], ", ")
293293
else:
294294
infoStr += "\nweb application technology: %s" % Format.humanize(info["technology"], ", ")
295295

296-
if hasattr(conf, "api"):
296+
if conf.api:
297297
return infoApi
298298
else:
299299
return infoStr.lstrip()
@@ -896,7 +896,7 @@ def dataToStdout(data, forceOutput=False, bold=False, content_type=None, status=
896896
message = data
897897

898898
try:
899-
if hasattr(conf, "api"):
899+
if conf.get("api"):
900900
sys.stdout.write(message, status, content_type)
901901
else:
902902
sys.stdout.write(setColor(message, bold))

lib/core/dump.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ def __init__(self):
6363
self._lock = threading.Lock()
6464

6565
def _write(self, data, newline=True, console=True, content_type=None):
66-
if hasattr(conf, "api"):
66+
if conf.api:
6767
dataToStdout(data, content_type=content_type, status=CONTENT_STATUS.COMPLETE)
6868
return
6969

@@ -110,7 +110,7 @@ def singleString(self, data, content_type=None):
110110
def string(self, header, data, content_type=None, sort=True):
111111
kb.stickyLevel = None
112112

113-
if hasattr(conf, "api"):
113+
if conf.api:
114114
self._write(data, content_type=content_type)
115115
return
116116

@@ -144,7 +144,7 @@ def lister(self, header, elements, content_type=None, sort=True):
144144
except:
145145
pass
146146

147-
if hasattr(conf, "api"):
147+
if conf.api:
148148
self._write(elements, content_type=content_type)
149149
return
150150

@@ -193,7 +193,7 @@ def userSettings(self, header, userSettings, subHeader, content_type=None):
193193
users = userSettings.keys()
194194
users.sort(key=lambda x: x.lower() if isinstance(x, basestring) else x)
195195

196-
if hasattr(conf, "api"):
196+
if conf.api:
197197
self._write(userSettings, content_type=content_type)
198198
return
199199

@@ -227,7 +227,7 @@ def dbs(self, dbs):
227227

228228
def dbTables(self, dbTables):
229229
if isinstance(dbTables, dict) and len(dbTables) > 0:
230-
if hasattr(conf, "api"):
230+
if conf.api:
231231
self._write(dbTables, content_type=CONTENT_TYPE.TABLES)
232232
return
233233

@@ -270,7 +270,7 @@ def dbTables(self, dbTables):
270270

271271
def dbTableColumns(self, tableColumns, content_type=None):
272272
if isinstance(tableColumns, dict) and len(tableColumns) > 0:
273-
if hasattr(conf, "api"):
273+
if conf.api:
274274
self._write(tableColumns, content_type=content_type)
275275
return
276276

@@ -344,7 +344,7 @@ def dbTableColumns(self, tableColumns, content_type=None):
344344

345345
def dbTablesCount(self, dbTables):
346346
if isinstance(dbTables, dict) and len(dbTables) > 0:
347-
if hasattr(conf, "api"):
347+
if conf.api:
348348
self._write(dbTables, content_type=CONTENT_TYPE.COUNT)
349349
return
350350

@@ -403,7 +403,7 @@ def dbTableValues(self, tableValues):
403403
db = "All"
404404
table = tableValues["__infos__"]["table"]
405405

406-
if hasattr(conf, "api"):
406+
if conf.api:
407407
self._write(tableValues, content_type=CONTENT_TYPE.DUMP_TABLE)
408408
return
409409

@@ -666,7 +666,7 @@ def dbTableValues(self, tableValues):
666666
logger.warn(msg)
667667

668668
def dbColumns(self, dbColumnsDict, colConsider, dbs):
669-
if hasattr(conf, "api"):
669+
if conf.api:
670670
self._write(dbColumnsDict, content_type=CONTENT_TYPE.COLUMNS)
671671
return
672672

lib/core/option.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2192,7 +2192,7 @@ def _mergeOptions(inputOptions, overrideOptions):
21922192
if key not in conf or value not in (None, False) or overrideOptions:
21932193
conf[key] = value
21942194

2195-
if not hasattr(conf, "api"):
2195+
if not conf.api:
21962196
for key, value in conf.items():
21972197
if value is not None:
21982198
kb.explicitSettings.add(key)

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.4.13"
22+
VERSION = "1.1.4.14"
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)

lib/techniques/blind/inference.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ def bisection(payload, expression, length=None, charsetType=None, firstChar=None
9797
# Set kb.partRun in case "common prediction" feature (a.k.a. "good samaritan") is used or the engine is called from the API
9898
if conf.predictOutput:
9999
kb.partRun = getPartRun()
100-
elif hasattr(conf, "api"):
100+
elif conf.api:
101101
kb.partRun = getPartRun(alias=False)
102102
else:
103103
kb.partRun = None
@@ -168,7 +168,7 @@ def bisection(payload, expression, length=None, charsetType=None, firstChar=None
168168
warnMsg += "usage of option '--threads' for faster data retrieval"
169169
singleTimeWarnMessage(warnMsg)
170170

171-
if conf.verbose in (1, 2) and not showEta and not hasattr(conf, "api"):
171+
if conf.verbose in (1, 2) and not showEta and not conf.api:
172172
if isinstance(length, int) and conf.threads > 1:
173173
dataToStdout("[%s] [INFO] retrieved: %s" % (time.strftime("%X"), "_" * min(length, conf.progressWidth)))
174174
dataToStdout("\r[%s] [INFO] retrieved: " % time.strftime("%X"))
@@ -492,7 +492,7 @@ def blindThread():
492492
if (endCharIndex - startCharIndex == conf.progressWidth) and (endCharIndex < length - 1):
493493
output = output[:-2] + '..'
494494

495-
if conf.verbose in (1, 2) and not showEta and not hasattr(conf, "api"):
495+
if conf.verbose in (1, 2) and not showEta and not conf.api:
496496
_ = count - firstChar
497497
output += '_' * (min(length, conf.progressWidth) - len(output))
498498
status = ' %d/%d (%d%%)' % (_, length, round(100.0 * _ / length))
@@ -522,7 +522,7 @@ def blindThread():
522522
finalValue = "".join(value)
523523
infoMsg = "\r[%s] [INFO] retrieved: %s" % (time.strftime("%X"), filterControlChars(finalValue))
524524

525-
if conf.verbose in (1, 2) and not showEta and infoMsg and not hasattr(conf, "api"):
525+
if conf.verbose in (1, 2) and not showEta and infoMsg and not conf.api:
526526
dataToStdout(infoMsg)
527527

528528
# No multi-threading (--threads = 1)
@@ -558,7 +558,7 @@ def blindThread():
558558
if result:
559559
if showEta:
560560
progress.progress(time.time() - charStart, len(commonValue))
561-
elif conf.verbose in (1, 2) or hasattr(conf, "api"):
561+
elif conf.verbose in (1, 2) or conf.api:
562562
dataToStdout(filterControlChars(commonValue[index - 1:]))
563563

564564
finalValue = commonValue
@@ -608,7 +608,7 @@ def blindThread():
608608

609609
if showEta:
610610
progress.progress(time.time() - charStart, index)
611-
elif conf.verbose in (1, 2) or hasattr(conf, "api"):
611+
elif conf.verbose in (1, 2) or conf.api:
612612
dataToStdout(filterControlChars(val))
613613

614614
# some DBMSes (e.g. Firebird, DB2, etc.) have issues with trailing spaces
@@ -635,11 +635,11 @@ def blindThread():
635635
elif partialValue:
636636
hashDBWrite(expression, "%s%s" % (PARTIAL_VALUE_MARKER if not conf.hexConvert else PARTIAL_HEX_VALUE_MARKER, partialValue))
637637

638-
if conf.hexConvert and not abortedFlag and not hasattr(conf, "api"):
638+
if conf.hexConvert and not abortedFlag and not conf.api:
639639
infoMsg = "\r[%s] [INFO] retrieved: %s %s\n" % (time.strftime("%X"), filterControlChars(finalValue), " " * retrievedLength)
640640
dataToStdout(infoMsg)
641641
else:
642-
if conf.verbose in (1, 2) and not showEta and not hasattr(conf, "api"):
642+
if conf.verbose in (1, 2) and not showEta and not conf.api:
643643
dataToStdout("\n")
644644

645645
if (conf.verbose in (1, 2) and showEta) or conf.verbose >= 3:

lib/techniques/brute/use.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ def tableExistsThread():
114114
threadData.shared.value.append(table)
115115
threadData.shared.unique.add(table.lower())
116116

117-
if conf.verbose in (1, 2) and not hasattr(conf, "api"):
117+
if conf.verbose in (1, 2) and not conf.api:
118118
clearConsoleLine(True)
119119
infoMsg = "[%s] [INFO] retrieved: %s\n" % (time.strftime("%X"), unsafeSQLIdentificatorNaming(table))
120120
dataToStdout(infoMsg, True)
@@ -222,7 +222,7 @@ def columnExistsThread():
222222
if result:
223223
threadData.shared.value.append(column)
224224

225-
if conf.verbose in (1, 2) and not hasattr(conf, "api"):
225+
if conf.verbose in (1, 2) and not conf.api:
226226
clearConsoleLine(True)
227227
infoMsg = "[%s] [INFO] retrieved: %s\n" % (time.strftime("%X"), unsafeSQLIdentificatorNaming(column))
228228
dataToStdout(infoMsg, True)

lib/techniques/error/use.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,7 @@ def errorUse(expression, dump=False):
301301
_, _, _, _, _, expressionFieldsList, expressionFields, _ = agent.getFields(expression)
302302

303303
# Set kb.partRun in case the engine is called from the API
304-
kb.partRun = getPartRun(alias=False) if hasattr(conf, "api") else None
304+
kb.partRun = getPartRun(alias=False) if conf.api else None
305305

306306
# We have to check if the SQL query might return multiple entries
307307
# and in such case forge the SQL limiting the query output one

lib/techniques/union/use.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ def unionUse(expression, unpack=True, dump=False):
215215
_, _, _, _, _, expressionFieldsList, expressionFields, _ = agent.getFields(origExpr)
216216

217217
# Set kb.partRun in case the engine is called from the API
218-
kb.partRun = getPartRun(alias=False) if hasattr(conf, "api") else None
218+
kb.partRun = getPartRun(alias=False) if conf.api else None
219219

220220
if Backend.isDbms(DBMS.MSSQL) and kb.dumpColumns:
221221
kb.rowXmlMode = True

0 commit comments

Comments
 (0)