mirror of
https://github.com/sqlmapproject/sqlmap.git
synced 2024-11-26 03:23:48 +03:00
Finishing work on Issue #52
This commit is contained in:
parent
40fc6488bf
commit
23fb753759
|
@ -5,6 +5,7 @@ Copyright (c) 2006-2012 sqlmap developers (http://www.sqlmap.org/)
|
||||||
See the file 'doc/COPYING' for copying permission
|
See the file 'doc/COPYING' for copying permission
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
import os
|
||||||
import re
|
import re
|
||||||
import time
|
import time
|
||||||
|
|
||||||
|
@ -25,8 +26,14 @@ def update():
|
||||||
if not conf.updateAll:
|
if not conf.updateAll:
|
||||||
return
|
return
|
||||||
|
|
||||||
|
success = False
|
||||||
rootDir = paths.SQLMAP_ROOT_PATH
|
rootDir = paths.SQLMAP_ROOT_PATH
|
||||||
|
|
||||||
|
if not os.path.exists(os.path.join(rootDir, ".git")):
|
||||||
|
errMsg = "not a git repository. Please checkout the 'sqlmapproject/sqlmap' repository "
|
||||||
|
errMsg += "from GitHub (e.g. git clone https://github.com/sqlmapproject/sqlmap.git sqlmap-dev)"
|
||||||
|
logger.error(errMsg)
|
||||||
|
else:
|
||||||
infoMsg = "updating sqlmap to the latest development version from the "
|
infoMsg = "updating sqlmap to the latest development version from the "
|
||||||
infoMsg += "GitHub repository"
|
infoMsg += "GitHub repository"
|
||||||
logger.info(infoMsg)
|
logger.info(infoMsg)
|
||||||
|
@ -38,18 +45,20 @@ def update():
|
||||||
process = execute("git pull %s" % rootDir, shell=True, stdout=PIPE, stderr=PIPE)
|
process = execute("git pull %s" % rootDir, shell=True, stdout=PIPE, stderr=PIPE)
|
||||||
pollProcess(process, True)
|
pollProcess(process, True)
|
||||||
stdout, stderr = process.communicate()
|
stdout, stderr = process.communicate()
|
||||||
|
success = not process.returncode
|
||||||
|
|
||||||
if not process.returncode:
|
if success:
|
||||||
logger.info("%s the latest revision '%s'" % ("already at" if "Already" in stdout else "updated to", REVISION))
|
logger.info("%s the latest revision '%s'" % ("already at" if "Already" in stdout else "updated to", REVISION))
|
||||||
else:
|
else:
|
||||||
logger.error("update could not be completed (%s)" % repr(stderr))
|
logger.error("update could not be completed ('%s')" % re.sub(r"\W+", " ", stderr).strip())
|
||||||
|
|
||||||
|
if not success:
|
||||||
if IS_WIN:
|
if IS_WIN:
|
||||||
infoMsg = "for Windows platform it's recommended "
|
infoMsg = "for Windows platform it's recommended "
|
||||||
infoMsg += "to use a GitHub for Windows client for updating "
|
infoMsg += "to use a GitHub for Windows client for updating "
|
||||||
infoMsg += "purposes (http://windows.github.com/)"
|
infoMsg += "purposes (http://windows.github.com/)"
|
||||||
else:
|
else:
|
||||||
infoMsg = "for Linux platform it's recommended "
|
infoMsg = "for Linux platform it's required "
|
||||||
infoMsg += "to use a standard 'git' package (e.g.: 'sudo apt-get install git')"
|
infoMsg += "to install a standard 'git' package (e.g.: 'sudo apt-get install git')"
|
||||||
|
|
||||||
logger.info(infoMsg)
|
logger.info(infoMsg)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user