Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/core/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -1400,7 +1400,7 @@ def banner():
if not any(_ in sys.argv for _ in ("--version", "--api")) and not conf.get("disableBanner"):
result = BANNER

if not IS_TTY or any(_ in sys.argv for _ in ("--disable-coloring", "--disable-colouring")):
if not IS_TTY or conf.get("disableColoring") or any(_ in sys.argv for _ in ("--disable-coloring", "--disable-colouring")):
result = clearColors(result)
elif IS_WIN:
coloramainit()
Expand Down
3 changes: 3 additions & 0 deletions lib/core/log.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@

class _ColorizingStreamHandler(ColorizingStreamHandler):
def colorize(self, message, levelno, force=False):
from lib.core.data import conf # import inside function to avoid ImportError
if conf.get("disableColoring"):
return message
if levelno in self.level_map and (self.is_tty or force):
bg, fg, bold = self.level_map[levelno]
params = []
Expand Down
5 changes: 5 additions & 0 deletions sqlmap.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,11 @@ def main():
resolveCrossReferences()
checkEnvironment()
setPaths(modulePath())

# Check for NO_COLOR environment variable
if os.environ.get("NO_COLOR") not in (None, ""):
conf.disableColoring = True

banner()

# Store original command line options for possible later restoration
Expand Down
Loading