Fixes --profile

This commit is contained in:
Miroslav Stampar 2018-06-20 13:51:03 +02:00
parent 2b55ae3e2a
commit e5968cae31
4 changed files with 35 additions and 28 deletions

View File

@ -80,15 +80,20 @@ def profile(profileOutputFile=None, dotOutputFile=None, imageOutputFile=None):
if isinstance(pydotGraph, list): if isinstance(pydotGraph, list):
pydotGraph = pydotGraph[0] pydotGraph = pydotGraph[0]
pydotGraph.write_png(imageOutputFile) try:
pydotGraph.write_png(imageOutputFile)
except OSError:
errMsg = "profiling requires graphviz installed "
errMsg += "(Hint: 'sudo apt-get install graphviz')"
logger.error(errMsg)
else:
infoMsg = "displaying interactive graph with xdot library"
logger.info(infoMsg)
infoMsg = "displaying interactive graph with xdot library" # Display interactive Graphviz dot file by using extra/xdot/xdot.py
logger.info(infoMsg) # http://code.google.com/p/jrfonseca/wiki/XDot
win = xdot.DotWindow()
# Display interactive Graphviz dot file by using extra/xdot/xdot.py win.connect('destroy', gtk.main_quit)
# http://code.google.com/p/jrfonseca/wiki/XDot win.set_filter("dot")
win = xdot.DotWindow() win.open_file(dotOutputFile)
win.connect('destroy', gtk.main_quit) gtk.main()
win.set_filter("dot")
win.open_file(dotOutputFile)
gtk.main()

View File

@ -19,7 +19,7 @@ from lib.core.enums import DBMS_DIRECTORY_NAME
from lib.core.enums import OS from lib.core.enums import OS
# sqlmap version (<major>.<minor>.<month>.<monthly commit>) # sqlmap version (<major>.<minor>.<month>.<monthly commit>)
VERSION = "1.2.6.28" VERSION = "1.2.6.29"
TYPE = "dev" if VERSION.count('.') > 2 and VERSION.split('.')[-1] != '0' else "stable" TYPE = "dev" if VERSION.count('.') > 2 and VERSION.split('.')[-1] != '0' else "stable"
TYPE_COLORS = {"dev": 33, "stable": 90, "pip": 34} TYPE_COLORS = {"dev": 33, "stable": 90, "pip": 34}
VERSION_STRING = "sqlmap/%s#%s" % ('.'.join(VERSION.split('.')[:-1]) if VERSION.count('.') > 2 and VERSION.split('.')[-1] == '0' else VERSION, TYPE) VERSION_STRING = "sqlmap/%s#%s" % ('.'.join(VERSION.split('.')[:-1]) if VERSION.count('.') > 2 and VERSION.split('.')[-1] == '0' else VERSION, TYPE)

View File

@ -143,10 +143,7 @@ def main():
if not conf.updateAll: if not conf.updateAll:
# Postponed imports (faster start) # Postponed imports (faster start)
if conf.profile: if conf.smokeTest:
from lib.core.profiling import profile
profile()
elif conf.smokeTest:
from lib.core.testing import smokeTest from lib.core.testing import smokeTest
smokeTest() smokeTest()
elif conf.liveTest: elif conf.liveTest:
@ -154,15 +151,20 @@ def main():
liveTest() liveTest()
else: else:
from lib.controller.controller import start from lib.controller.controller import start
try: if conf.profile:
start() from lib.core.profiling import profile
except thread.error as ex: globals()["start"] = start
if "can't start new thread" in getSafeExString(ex): profile()
errMsg = "unable to start new threads. Please check OS (u)limits" else:
logger.critical(errMsg) try:
raise SystemExit start()
else: except thread.error as ex:
raise if "can't start new thread" in getSafeExString(ex):
errMsg = "unable to start new threads. Please check OS (u)limits"
logger.critical(errMsg)
raise SystemExit
else:
raise
except SqlmapUserQuitException: except SqlmapUserQuitException:
errMsg = "user quit" errMsg = "user quit"

View File

@ -43,12 +43,12 @@ cada93357a7321655927fc9625b3bfec lib/core/exception.py
e9e32e5afe49ecd644b3a0ca9c9a36fc lib/core/optiondict.py e9e32e5afe49ecd644b3a0ca9c9a36fc lib/core/optiondict.py
d2672b24ffa985523066613138fccbbd lib/core/option.py d2672b24ffa985523066613138fccbbd lib/core/option.py
c8c386d644d57c659d74542f5f57f632 lib/core/patch.py c8c386d644d57c659d74542f5f57f632 lib/core/patch.py
7cfd04e583cca782b843f6f6d973981a lib/core/profiling.py 945b313b8bb9713f570f5ebb05416799 lib/core/profiling.py
6f654e1715571eff68a0f8af3d62dcf8 lib/core/readlineng.py 6f654e1715571eff68a0f8af3d62dcf8 lib/core/readlineng.py
0c3eef46bdbf87e29a3f95f90240d192 lib/core/replication.py 0c3eef46bdbf87e29a3f95f90240d192 lib/core/replication.py
a7db43859b61569b601b97f187dd31c5 lib/core/revision.py a7db43859b61569b601b97f187dd31c5 lib/core/revision.py
fcb74fcc9577523524659ec49e2e964b lib/core/session.py fcb74fcc9577523524659ec49e2e964b lib/core/session.py
eceda1743cad3fb421344c19ab4148ed lib/core/settings.py e5a223ce6a904c33c896cc6a6161eb01 lib/core/settings.py
0dfc2ed40adf72e302291f6ecd4406f6 lib/core/shell.py 0dfc2ed40adf72e302291f6ecd4406f6 lib/core/shell.py
a7edc9250d13af36ac0108f259859c19 lib/core/subprocessng.py a7edc9250d13af36ac0108f259859c19 lib/core/subprocessng.py
36bd2dc292c0e10e39bd9c43b77fe1bc lib/core/target.py 36bd2dc292c0e10e39bd9c43b77fe1bc lib/core/target.py
@ -226,7 +226,7 @@ ec2ba8c757ac96425dcd2b97970edd3a shell/stagers/stager.asp_
0c48ddb1feb7e38a951ef05a0d48e032 shell/stagers/stager.jsp_ 0c48ddb1feb7e38a951ef05a0d48e032 shell/stagers/stager.jsp_
2f9e459a4cf6a58680978cdce5ff7971 shell/stagers/stager.php_ 2f9e459a4cf6a58680978cdce5ff7971 shell/stagers/stager.php_
4eaeef94314956e4517e5310a28d579a sqlmapapi.py 4eaeef94314956e4517e5310a28d579a sqlmapapi.py
c5ecca109867f7ce4d325f487cf7badd sqlmap.py b6e9d67cafb85ff2c3fde165fc577a8d sqlmap.py
1a1e3a78ded58b240c9dbb1b17996acf tamper/0x2char.py 1a1e3a78ded58b240c9dbb1b17996acf tamper/0x2char.py
4c3b8a7daa4bff52e01d4168be0eedbe tamper/apostrophemask.py 4c3b8a7daa4bff52e01d4168be0eedbe tamper/apostrophemask.py
4115a55b8aba464723d645b7d3156b6e tamper/apostrophenullencode.py 4115a55b8aba464723d645b7d3156b6e tamper/apostrophenullencode.py