mirror of
https://github.com/sqlmapproject/sqlmap.git
synced 2025-03-03 19:55:47 +03:00
added support for displaying revision number at unhandled exception message
This commit is contained in:
parent
9a7fd29d4f
commit
264e0a6fda
|
@ -431,7 +431,7 @@ class Dump:
|
|||
self.dbTableColumns(printDbs)
|
||||
|
||||
def query(self, query, queryRes):
|
||||
self.string(query, queryRes)
|
||||
self.string(query, queryRes)
|
||||
|
||||
def rFile(self,filePath,fileData):
|
||||
self.string("%s file saved to" % filePath,fileData,sort=False)
|
||||
|
|
|
@ -10,6 +10,7 @@ See the file 'doc/COPYING' for copying permission
|
|||
from lib.core.settings import PLATFORM
|
||||
from lib.core.settings import PYVERSION
|
||||
from lib.core.settings import VERSION
|
||||
from lib.core.settings import REVISION
|
||||
from lib.core.settings import VERSION_STRING
|
||||
|
||||
|
||||
|
@ -75,7 +76,7 @@ def unhandledException():
|
|||
errMsg += "following text and any information needed to reproduce the "
|
||||
errMsg += "bug. The developers will try to reproduce the bug, fix it "
|
||||
errMsg += "accordingly and get back to you.\n"
|
||||
errMsg += "sqlmap version: %s\n" % VERSION
|
||||
errMsg += "sqlmap version: %s%s\n" % (VERSION, " (r%d)" % REVISION if REVISION else "")
|
||||
errMsg += "Python version: %s\n" % PYVERSION
|
||||
errMsg += "Operating system: %s" % PLATFORM
|
||||
return errMsg
|
||||
|
|
39
lib/core/revision.py
Normal file
39
lib/core/revision.py
Normal file
|
@ -0,0 +1,39 @@
|
|||
import os
|
||||
import re
|
||||
|
||||
from subprocess import PIPE
|
||||
from subprocess import Popen as execute
|
||||
|
||||
def getRevisionNumber():
|
||||
curDir = os.path.dirname(os.path.realpath(__file__))
|
||||
retVal = None
|
||||
|
||||
try:
|
||||
import pysvn
|
||||
|
||||
client = pysvn.Client()
|
||||
if client.info(curDir):
|
||||
retVal = client.info(curDir).revision.number
|
||||
|
||||
except ImportError, _:
|
||||
process = execute("svn info %s" % curDir, shell=True, stdout=PIPE, stderr=PIPE)
|
||||
|
||||
svnStdout, svnStderr = process.communicate()
|
||||
|
||||
if svnStdout:
|
||||
revision = re.search("Revision:\s+([\d]+)", svnStdout)
|
||||
|
||||
if revision:
|
||||
retVal = revision.group(1)
|
||||
|
||||
if retVal:
|
||||
try:
|
||||
retVal = int(retVal)
|
||||
except ValueError:
|
||||
retVal = None
|
||||
|
||||
#if not retVal:
|
||||
#debugMsg = "sqlmap was not able to retrieve the revision number"
|
||||
#logger.debug(debugMsg)
|
||||
|
||||
return retVal
|
|
@ -12,8 +12,11 @@ import os
|
|||
import subprocess
|
||||
import sys
|
||||
|
||||
from lib.core.revision import getRevisionNumber
|
||||
|
||||
# sqlmap version and site
|
||||
VERSION = "0.9-dev"
|
||||
REVISION = getRevisionNumber()
|
||||
VERSION_STRING = "sqlmap/%s" % VERSION
|
||||
DESCRIPTION = "automatic SQL injection and database takeover tool"
|
||||
SITE = "http://sqlmap.sourceforge.net"
|
||||
|
|
Loading…
Reference in New Issue
Block a user