From b1fb5f34cc0211a2a8cadddfd1157a5aa8fe6dac Mon Sep 17 00:00:00 2001 From: moritz Date: Wed, 29 May 2019 14:23:57 +0200 Subject: [PATCH] remove color codes when running on windows --- src/have_I_b33n_pwned.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/have_I_b33n_pwned.py b/src/have_I_b33n_pwned.py index e56bf4f..2b442cd 100644 --- a/src/have_I_b33n_pwned.py +++ b/src/have_I_b33n_pwned.py @@ -25,6 +25,7 @@ # - add feature: keepass integration? isnt there something like this already? +from os import name from sys import argv, stdout, exit from argparse import ArgumentParser from hashlib import sha1 @@ -32,9 +33,12 @@ from getpass import getpass from requests import get -RED = "\033[1;31m" -GREEN = "\033[0;32m" -RESET = "\033[0;0m" +if name == 'nt': + (RED, GREEN, RESET) = ("", "", "") +else: + RED = "\033[1;31m" + GREEN = "\033[0;32m" + RESET = "\033[0;0m" API = 'https://api.pwnedpasswords.com/range/' API_MAIL = 'https://haveibeenpwned.com/api/v2/breachedaccount/' ROW = '{:<30}{:<10}{:<45}'