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

Skip to content

Commit 9c125a2

Browse files
committed
Minor improvement to use Python ConfigParser library when --save if specified.
Minor update to the user's manual
1 parent 6ff8feb commit 9c125a2

4 files changed

Lines changed: 28 additions & 25 deletions

File tree

doc/README.html

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -215,19 +215,14 @@ <H2><A NAME="ss1.3">1.3</A> <A HREF="#toc1.3">Techniques</A>
215215
statements support</B>: sqlmap tests if the web application supports
216216
stacked queries then, in case it does support, it appends to the affected
217217
parameter in the HTTP request, a semi-colon (<CODE>;</CODE>) followed by the
218-
SQL statement to be executed. This technique is useful if to run SQL
218+
SQL statement to be executed. This technique is useful to run SQL
219219
statements other than <CODE>SELECT</CODE> like, for instance, <EM>data
220220
definition</EM> or <EM>data manipulation</EM> statements possibly leading
221221
to file system read and write access and operating system command
222-
execution depending on the underlying back-end database management system.</LI>
222+
execution depending on the underlying back-end database management system
223+
and the session user privileges.</LI>
223224
</UL>
224225
</P>
225-
<P>It is strongly recommended to run at least once sqlmap with the
226-
<CODE>--union-test</CODE> option to test if the affected parameter is used
227-
within a <CODE>for</CODE> cycle, or similar, and in case use
228-
<CODE>--union-use</CODE> option to exploit this vulnerability because it
229-
saves a lot of time and it does not weight down the web server log file
230-
with hundreds of HTTP requests.</P>
231226

232227

233228
<H2><A NAME="s2">2.</A> <A HREF="#toc2">Features</A></H2>
@@ -2008,6 +2003,13 @@ <H3>Test for UNION query SQL injection</H3>
20082003
In case this vulnerability is exploitable it is strongly recommended to
20092004
use this technique which saves a lot of time.</P>
20102005

2006+
<P>It is strongly recommended to run at least once sqlmap with the
2007+
<CODE>--union-test</CODE> option to test if the affected parameter is used
2008+
within a <CODE>for</CODE> cycle, or similar, and in case use
2009+
<CODE>--union-use</CODE> option to exploit this vulnerability because it
2010+
saves a lot of time and it does not weight down the web server log file
2011+
with hundreds of HTTP requests.</P>
2012+
20112013

20122014
<H3>Use the UNION query SQL injection</H3>
20132015

doc/README.pdf

117 Bytes
Binary file not shown.

doc/README.sgml

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -172,20 +172,14 @@ This SQL injection technique is an alternative to the first one.
172172
statements support</bf>: sqlmap tests if the web application supports
173173
stacked queries then, in case it does support, it appends to the affected
174174
parameter in the HTTP request, a semi-colon (<tt>;</tt>) followed by the
175-
SQL statement to be executed. This technique is useful if to run SQL
175+
SQL statement to be executed. This technique is useful to run SQL
176176
statements other than <tt>SELECT</tt> like, for instance, <em>data
177177
definition</em> or <em>data manipulation</em> statements possibly leading
178178
to file system read and write access and operating system command
179-
execution depending on the underlying back-end database management system.
179+
execution depending on the underlying back-end database management system
180+
and the session user privileges.
180181
</itemize>
181182

182-
It is strongly recommended to run at least once sqlmap with the
183-
<tt>--union-test</tt> option to test if the affected parameter is used
184-
within a <tt>for</tt> cycle, or similar, and in case use
185-
<tt>--union-use</tt> option to exploit this vulnerability because it
186-
saves a lot of time and it does not weight down the web server log file
187-
with hundreds of HTTP requests.
188-
189183

190184
<sect>Features
191185

@@ -1939,6 +1933,14 @@ affected by an inband SQL injection.
19391933
In case this vulnerability is exploitable it is strongly recommended to
19401934
use this technique which saves a lot of time.
19411935

1936+
<p>
1937+
It is strongly recommended to run at least once sqlmap with the
1938+
<tt>--union-test</tt> option to test if the affected parameter is used
1939+
within a <tt>for</tt> cycle, or similar, and in case use
1940+
<tt>--union-use</tt> option to exploit this vulnerability because it
1941+
saves a lot of time and it does not weight down the web server log file
1942+
with hundreds of HTTP requests.
1943+
19421944

19431945
<sect2>Use the UNION query SQL injection
19441946

lib/core/option.py

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@
3434
import urllib2
3535
import urlparse
3636

37+
from ConfigParser import ConfigParser
38+
3739
from lib.core.common import parseTargetUrl
3840
from lib.core.common import paths
3941
from lib.core.common import randomRange
@@ -657,6 +659,7 @@ def __saveCmdline():
657659
debugMsg = "saving command line options on a sqlmap configuration INI file"
658660
logger.debug(debugMsg)
659661

662+
config = ConfigParser()
660663
userOpts = {}
661664

662665
for family in optDict.keys():
@@ -667,10 +670,8 @@ def __saveCmdline():
667670
if option in optionData:
668671
userOpts[family].append((option, value, optionData[option]))
669672

670-
confFP = open(paths.SQLMAP_CONFIG, "w")
671-
672673
for family, optionData in userOpts.items():
673-
confFP.write("[%s]\n" % family)
674+
config.add_section(family)
674675

675676
optionData.sort()
676677

@@ -691,12 +692,10 @@ def __saveCmdline():
691692
if isinstance(value, str):
692693
value = value.replace("\n", "\n ")
693694

694-
confFP.write("%s = %s\n" % (option, value))
695-
696-
confFP.write("\n")
695+
config.set(family, option, value)
697696

698-
confFP.flush()
699-
confFP.close()
697+
confFP = open(paths.SQLMAP_CONFIG, "wb")
698+
config.write(confFP)
700699

701700
infoMsg = "saved command line options on '%s' configuration file" % paths.SQLMAP_CONFIG
702701
logger.info(infoMsg)

0 commit comments

Comments
 (0)