mirror of
https://github.com/sqlmapproject/sqlmap.git
synced 2024-11-22 01:26:42 +03:00
Minor code refactoring
This commit is contained in:
parent
862cc9ac53
commit
e73e06069b
|
@ -404,7 +404,7 @@ def filePathToString(filePath):
|
|||
return strRepl
|
||||
|
||||
def dataToStdout(data, forceOutput=False):
|
||||
if conf.verbose > 0 or forceOutput:
|
||||
if forceOutput or conf.verbose > 0:
|
||||
try:
|
||||
sys.stdout.write(data)
|
||||
sys.stdout.flush()
|
||||
|
@ -569,10 +569,12 @@ def banner():
|
|||
This function prints sqlmap banner with its version
|
||||
"""
|
||||
|
||||
print """
|
||||
ban = """
|
||||
%s - %s
|
||||
%s
|
||||
""" % (VERSION_STRING, DESCRIPTION, SITE)
|
||||
%s\n
|
||||
""" % (VERSION_STRING, DESCRIPTION, SITE)
|
||||
|
||||
dataToStdout(ban, forceOutput=True)
|
||||
|
||||
def parsePasswordHash(password):
|
||||
blank = " " * 8
|
||||
|
|
|
@ -24,8 +24,8 @@ from xml.dom.minidom import Document
|
|||
from subprocess import PIPE
|
||||
from subprocess import Popen as execute
|
||||
|
||||
from lib.core.common import getUnicode
|
||||
from lib.core.common import dataToStdout
|
||||
from lib.core.common import getUnicode
|
||||
from lib.core.common import pollProcess
|
||||
from lib.core.common import readInput
|
||||
from lib.core.data import conf
|
||||
|
@ -209,7 +209,7 @@ def __updateSqlmap():
|
|||
return
|
||||
|
||||
if action.find('_completed') == -1:
|
||||
print "%s\t%s" % (prefix, event_dict['path'])
|
||||
dataToStdout("%s\t%s\n" % (prefix, event_dict['path']))
|
||||
else:
|
||||
revision = getUnicode(event_dict['revision'])
|
||||
index = revision.find('number ')
|
||||
|
|
|
@ -7,6 +7,7 @@ Copyright (c) 2006-2010 sqlmap developers (http://sqlmap.sourceforge.net/)
|
|||
See the file 'doc/COPYING' for copying permission
|
||||
"""
|
||||
|
||||
from lib.core.common import dataToStdout
|
||||
from lib.core.common import readInput
|
||||
from lib.core.data import conf
|
||||
from lib.core.data import kb
|
||||
|
@ -76,7 +77,7 @@ class Abstraction(Web, UDF, xp_cmdshell):
|
|||
if output:
|
||||
conf.dumper.string("command standard output", output)
|
||||
else:
|
||||
print "No output"
|
||||
dataToStdout("No output\n")
|
||||
else:
|
||||
self.execCmd(cmd, forgeCmd=True)
|
||||
|
||||
|
|
|
@ -10,6 +10,7 @@ See the file 'doc/COPYING' for copying permission
|
|||
import os
|
||||
|
||||
from lib.core.agent import agent
|
||||
from lib.core.common import dataToStdout
|
||||
from lib.core.common import readInput
|
||||
from lib.core.convert import urlencode
|
||||
from lib.core.data import conf
|
||||
|
@ -360,7 +361,7 @@ class UDF:
|
|||
if output:
|
||||
conf.dumper.string("return value", output)
|
||||
else:
|
||||
print "No return value"
|
||||
dataToStdout("No return value\n")
|
||||
else:
|
||||
self.udfExecCmd(cmd, udfName=udfToCall, silent=True)
|
||||
|
||||
|
|
|
@ -1769,4 +1769,4 @@ class Enumeration:
|
|||
pass
|
||||
|
||||
elif output != "Quit":
|
||||
print "No output"
|
||||
dataToStdout("No output\n")
|
||||
|
|
|
@ -25,6 +25,7 @@ except ImportError, _:
|
|||
|
||||
from lib.controller.controller import start
|
||||
from lib.core.common import banner
|
||||
from lib.core.common import dataToStdout
|
||||
from lib.core.common import getUnicode
|
||||
from lib.core.common import setPaths
|
||||
from lib.core.common import weAreFrozen
|
||||
|
@ -64,7 +65,7 @@ def main():
|
|||
banner()
|
||||
cmdLineOptions = cmdLineParser()
|
||||
|
||||
print "[*] starting at: %s\n" % time.strftime("%X")
|
||||
dataToStdout("[*] starting at: %s\n\n" % time.strftime("%X"), forceOutput=True)
|
||||
|
||||
try:
|
||||
init(cmdLineOptions)
|
||||
|
@ -112,7 +113,7 @@ def main():
|
|||
else:
|
||||
closeDumper(True)
|
||||
|
||||
print "\n[*] shutting down at: %s\n" % time.strftime("%X")
|
||||
dataToStdout("\n[*] shutting down at: %s\n\n" % time.strftime("%X"), forceOutput=True)
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
|
|
Loading…
Reference in New Issue
Block a user