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

Skip to content

Commit cd92de1

Browse files
committed
Adding colorful banner
1 parent 7d578d3 commit cd92de1

2 files changed

Lines changed: 13 additions & 2 deletions

File tree

lib/core/common.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@
8080
from lib.core.exception import SqlmapUserQuitException
8181
from lib.core.log import LOGGER_HANDLER
8282
from lib.core.optiondict import optDict
83+
from lib.core.settings import BANNER
8384
from lib.core.settings import BOLD_PATTERNS
8485
from lib.core.settings import BRUTE_DOC_ROOT_PREFIXES
8586
from lib.core.settings import BRUTE_DOC_ROOT_SUFFIXES
@@ -986,7 +987,9 @@ def banner():
986987
This function prints sqlmap banner with its version
987988
"""
988989

989-
_ = """\n %s - %s\n %s\n\n""" % (VERSION_STRING, DESCRIPTION, SITE)
990+
_ = BANNER
991+
if not getattr(LOGGER_HANDLER, "is_tty", False):
992+
_ = re.sub("\033.+?m", "", _)
990993
dataToStdout(_, forceOutput=True)
991994

992995
def parsePasswordHash(password):

lib/core/settings.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,21 @@
1919
# sqlmap version and site
2020
VERSION = "1.0-dev"
2121
REVISION = getRevisionNumber()
22-
VERSION_STRING = "sqlmap/%s%s" % (VERSION, "-%s" % REVISION if REVISION else "")
22+
VERSION_STRING = "sqlmap/%s%s" % (VERSION, "-%s" % REVISION if REVISION else "-nongit")
2323
DESCRIPTION = "automatic SQL injection and database takeover tool"
2424
SITE = "http://sqlmap.org"
2525
ISSUES_PAGE = "https://github.com/sqlmapproject/sqlmap/issues/new"
2626
GIT_REPOSITORY = "git://github.com/sqlmapproject/sqlmap.git"
2727
2828

29+
# colorful banner
30+
BANNER = """\033[01;33m _
31+
___ ___| |_____ ___ ___ \033[01;37m{\033[01;%dm%s\033[01;37m}\033[01;33m
32+
|_ -| . | | | .'| . |
33+
|___|_ |_|_|_|_|__,| _|
34+
|_| |_| \033[0m\033[4m%s\033[0m\n
35+
""" % ((31 + hash(REVISION) % 6) if REVISION else 30, VERSION_STRING.split('/')[-1], SITE)
36+
2937
# Minimum distance of ratio from kb.matchRatio to result in True
3038
DIFF_TOLERANCE = 0.05
3139
CONSTANT_RATIO = 0.9

0 commit comments

Comments
 (0)