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

Skip to content

Commit 71c46f5

Browse files
committed
adding option --csv-del
1 parent 02bd9a5 commit 71c46f5

7 files changed

Lines changed: 24 additions & 19 deletions

File tree

lib/core/common.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,6 @@
7979
from lib.core.settings import INFERENCE_UNKNOWN_CHAR
8080
from lib.core.settings import UNICODE_ENCODING
8181
from lib.core.settings import DBMS_DICT
82-
from lib.core.settings import DEFAULT_CSV_DELIMITER
8382
from lib.core.settings import DESCRIPTION
8483
from lib.core.settings import DUMMY_SQL_INJECTION_CHARS
8584
from lib.core.settings import IS_WIN
@@ -2989,7 +2988,7 @@ def safeCSValue(value):
29892988

29902989
if retVal and isinstance(retVal, basestring):
29912990
if not (retVal[0] == retVal[-1] == '"'):
2992-
if any(map(lambda x: x in retVal, [DEFAULT_CSV_DELIMITER, '"', '\n'])):
2991+
if any(map(lambda x: x in retVal, [conf.csvDel, '"', '\n'])):
29932992
retVal = '"%s"' % retVal.replace('"', '""')
29942993

29952994
return retVal

lib/core/defaults.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
from lib.core.datatype import AttribDict
1111

1212
_defaults = {
13+
"csvDel": ",",
1314
"timeSec": 5,
1415
"googlePage": 1,
1516
"cpuThrottle": 5,

lib/core/dump.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
from lib.core.data import logger
2525
from lib.core.enums import DBMS
2626
from lib.core.replication import Replication
27-
from lib.core.settings import DEFAULT_CSV_DELIMITER
2827
from lib.core.settings import TRIM_STDOUT_DUMP_SIZE
2928
from lib.core.settings import UNICODE_ENCODING
3029

@@ -398,7 +397,7 @@ def dbTableValues(self, tableValues):
398397
if field == fields:
399398
dataToDumpFile(dumpFP, "%s" % safeCSValue(column))
400399
else:
401-
dataToDumpFile(dumpFP, "%s%s" % (safeCSValue(column), DEFAULT_CSV_DELIMITER))
400+
dataToDumpFile(dumpFP, "%s%s" % (safeCSValue(column), conf.csvDel))
402401

403402
field += 1
404403

@@ -444,7 +443,7 @@ def dbTableValues(self, tableValues):
444443
if field == fields:
445444
dataToDumpFile(dumpFP, "%s" % safeCSValue(value))
446445
else:
447-
dataToDumpFile(dumpFP, "%s%s" % (safeCSValue(value), DEFAULT_CSV_DELIMITER))
446+
dataToDumpFile(dumpFP, "%s%s" % (safeCSValue(value), conf.csvDel))
448447

449448
field += 1
450449

lib/core/optiondict.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,9 @@
161161
"trafficFile": "string",
162162
"batch": "boolean",
163163
"charset": "string",
164+
"checkTor": "boolean",
164165
"crawlDepth": "integer",
166+
"csvDel": "string",
165167
"eta": "boolean",
166168
"flushSession": "boolean",
167169
"forms": "boolean",
@@ -170,7 +172,6 @@
170172
"replicate": "boolean",
171173
"updateAll": "boolean",
172174
"tor": "boolean",
173-
"checkTor": "boolean"
174175
},
175176

176177
"Miscellaneous": {

lib/core/settings.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -413,9 +413,6 @@
413413
# Common column names containing usernames (used for hash cracking in some cases)
414414
COMMON_USER_COLUMNS = ('user', 'username', 'user_name', 'benutzername', 'benutzer', 'utilisateur', 'usager', 'consommateur', 'utente', 'utilizzatore', 'usufrutuario', 'korisnik', 'usuario', 'consumidor')
415415

416-
# Default delimiter used in CSV file format
417-
DEFAULT_CSV_DELIMITER = ','
418-
419416
# Default delimiter in GET/POST values
420417
DEFAULT_GET_POST_DELIMITER = '&'
421418

lib/parse/cmdline.py

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -238,12 +238,12 @@ def cmdLineParser():
238238

239239
techniques.add_option("--technique", dest="tech",
240240
help="SQL injection techniques to test for "
241-
"(default %s)" % defaults.tech)
241+
"(default \"%s\")" % defaults.tech)
242242

243243
techniques.add_option("--time-sec", dest="timeSec",
244244
type="int",
245245
help="Seconds to delay the DBMS response "
246-
"(default %s)" % defaults.timeSec)
246+
"(default %d)" % defaults.timeSec)
247247

248248
techniques.add_option("--union-cols", dest="uCols",
249249
help="Range of columns to test for UNION query SQL injection")
@@ -487,9 +487,17 @@ def cmdLineParser():
487487
general.add_option("--charset", dest="charset",
488488
help="Force character encoding used for data retrieval")
489489

490+
general.add_option("--check-tor", dest="checkTor",
491+
action="store_true",
492+
help="Check to see if Tor is used properly")
493+
490494
general.add_option("--crawl", dest="crawlDepth", type="int",
491495
help="Crawl the website starting from the target url")
492496

497+
general.add_option("--csv-del", dest="csvDel",
498+
help="Delimiting character used in CSV output "
499+
"(default \"%s\")" % defaults.csvDel)
500+
493501
general.add_option("--eta", dest="eta",
494502
action="store_true",
495503
help="Display for each output the "
@@ -523,10 +531,6 @@ def cmdLineParser():
523531
action="store_true",
524532
help="Use default Tor (Vidalia/Privoxy/Polipo) proxy address")
525533

526-
general.add_option("--check-tor", dest="checkTor",
527-
action="store_true",
528-
help="Check to see if Tor is used properly")
529-
530534
general.add_option("--update", dest="updateAll",
531535
action="store_true",
532536
help="Update sqlmap")

sqlmap.conf

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -533,11 +533,19 @@ batch = False
533533
# Force character encoding used for data retrieval.
534534
charset =
535535

536+
# Check to see if Tor is used properly
537+
# Valid: True or False
538+
checkTor = False
539+
536540
# Crawl the website starting from the target url
537541
# Valid: integer
538542
# Default: 0
539543
crawlDepth = 0
540544

545+
# Delimiting character used in CSV output.
546+
# Default: ,
547+
csvDel = ,
548+
541549
# Retrieve each query output length and calculate the estimated time of
542550
# arrival in real time.
543551
# Valid: True or False
@@ -567,10 +575,6 @@ replicate = False
567575
# Valid: True or False
568576
tor = False
569577

570-
# Check to see if Tor is used properly
571-
# Valid: True or False
572-
checkTor = False
573-
574578
# Update sqlmap.
575579
# Valid: True or False
576580
updateAll = False

0 commit comments

Comments
 (0)