How to use the termcolor.colored function in termcolor

To help you get started, we’ve selected a few termcolor examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github pyprob / pyprob / tests / test_inference.py View on Github external
tests.append('GaussianWithUnknownMeanMarsagliaTestCase')
    # tests.append('HiddenMarkovModelTestCase')
    # tests.append('BranchingTestCase')
    tests.append('MiniCaptchaTestCase')

    time_start = time.time()
    success = unittest.main(defaultTest=tests, verbosity=2, exit=False).result.wasSuccessful()
    print('\nDuration                   : {}'.format(util.days_hours_mins_secs_str(time.time() - time_start)))
    print('Models run                 : {}'.format(' '.join(tests)))
    print('\nTotal inference performance:\n')
    print(colored('                                              Samples        KL divergence  Duration (s) ', 'yellow', attrs=['bold']))
    print(colored('Importance sampling                         : ', 'yellow', attrs=['bold']), end='')
    print(colored('{:+.6e}  {:+.6e}  {:+.6e}'.format(importance_sampling_samples, importance_sampling_kl_divergence, importance_sampling_duration), 'white', attrs=['bold']))
    print(colored('Importance sampling w/ inference net. (FF)  : ', 'yellow', attrs=['bold']), end='')
    print(colored('{:+.6e}  {:+.6e}  {:+.6e}'.format(importance_sampling_with_inference_network_ff_samples, importance_sampling_with_inference_network_ff_kl_divergence, importance_sampling_with_inference_network_ff_duration), 'white', attrs=['bold']))
    print(colored('Importance sampling w/ inference net. (LSTM): ', 'yellow', attrs=['bold']), end='')
    print(colored('{:+.6e}  {:+.6e}  {:+.6e}'.format(importance_sampling_with_inference_network_lstm_samples, importance_sampling_with_inference_network_lstm_kl_divergence, importance_sampling_with_inference_network_lstm_duration), 'white', attrs=['bold']))
    print(colored('Lightweight Metropolis Hastings             : ', 'yellow', attrs=['bold']), end='')
    print(colored('{:+.6e}  {:+.6e}  {:+.6e}'.format(lightweight_metropolis_hastings_samples, lightweight_metropolis_hastings_kl_divergence, lightweight_metropolis_hastings_duration), 'white', attrs=['bold']))
    print(colored('Random-walk Metropolis Hastings             : ', 'yellow', attrs=['bold']), end='')
    print(colored('{:+.6e}  {:+.6e}  {:+.6e}\n'.format(random_walk_metropolis_hastings_samples, random_walk_metropolis_hastings_kl_divergence, random_walk_metropolis_hastings_duration), 'white', attrs=['bold']))
    sys.exit(0 if success else 1)
github hxuhack / logic_bombs / script / klee_run.py View on Github external
import re
import subprocess
from termcolor import colored
from subprocess import Popen, call, PIPE
import argparse
import csv


os.environ['LD_LIBRARY_PATH'] = '/home/klee/klee_build/klee/lib/:$LD_LIBRARY_PAT'
lib_path = '/home/klee/klee_build/klee/lib/'

parser = argparse.ArgumentParser()
parser.add_argument("-e", "--expected", type=int, help="Expected amount of results")
parser.add_argument("-p", "--program", type=str, help="Binary program")
args = parser.parse_args()
print(colored('[+] Compiling ...', 'green'))

cmd = 'clang -Iinclude -L ' + lib_path + ' -Lbuild -o klee/a.out klee/a.c -lkleeRuntest -lpthread -lutils -lcrypto -lm'
p = Popen(cmd.split(' '))
rt_value = p.wait()
if rt_value != 0:
    exit(3)

pattern = re.compile(r"data:(.*)\n")
tests = []
running_res = set()
for file in sorted(os.listdir(os.path.join('klee', 'klee-last'))):
    if file.endswith('.ktest'):
        cmd = 'KTEST_FILE=klee/klee-last/%s' % file
        res = os.system(cmd + ' klee/a.out') >> 8
        running_res.add(res)
        p = subprocess.Popen(str.split("ktest-tool --write-ints klee/klee-last/%s" % file, ' '), stdout=subprocess.PIPE, stderr=subprocess.PIPE)
github horacio9a / chaturbate-anonymous / cb3.py View on Github external
break
            print(' =>',(num+1),value[:-1])
          print()
          mn = int(input(' => Select CB Online All Models => '))
          print()
          nr_lines = sum(1 for line in open(config.get('files', 'online_all_model_list')))
          if mn > nr_lines:
             print(colored(' => Too big number <=', 'yellow', 'on_red'))
             print()
             print(colored(' => END <=', 'yellow','on_blue'))
             sys.exit()
          break
       except ValueError:
          print(colored('\n => Input must be a number <=\n', 'yellow', 'on_red'))
    model = open(config.get('files', 'online_all_model_list'), 'r').readlines()[mn-1][:-1]
    print ((colored(' => Selected CB Online All Model => {} <=', 'yellow', 'on_blue')).format(model))
    print()

  if oa == 'OA1000':
    while True:
       try:
          modellist = open(config.get('files', 'online_all_model_list'),'r')
          for (num, value) in enumerate(modellist):
            if num in range (1000, 5000):
              break
            print(' =>',(num+1),value[:-1])
          print()
          mn = int(input(' => Select CB Online All Model => '))
          print()
          nr_lines = sum(1 for line in open(config.get('files', 'online_all_model_list')))
          if mn > nr_lines:
             print(colored(' => Too big number <=', 'yellow', 'on_red'))
github horacio9a / chaturbate-anonymous / cbytr.py View on Github external
sys.exit()

   else:
      print(colored(' => Model is PVT/HIDDEN or AWAY <=', 'yellow','on_red'))
      print
      print(colored(' => END <=', 'yellow','on_blue'))
      sys.exit()

 else:
   print(colored(' => Model is OFFLINE <=', 'yellow','on_red'))
   print
   print(colored(' => END <=', 'yellow','on_blue'))
   sys.exit()

else:
   print(colored(' => Page Not Found <=', 'yellow','on_red'))
   print
   print(colored(' => END <=', 'yellow','on_blue'))
   sys.exit()
github Tankerch / COM3D2_DLC_Checker / COM_DLC_Checker.py View on Github external
def PRINT_HEADER():
    init()
    print(colored("===========================================================================================",
                  'cyan', attrs=['bold']))
    print(colored('COM_DLC_Checker', 'cyan', attrs=['bold']) + " | " + colored(
        ' Github.com/Tankerch/COM3D2_DLC_Checker', 'cyan', attrs=['bold']))
    print(colored("===========================================================================================",
                  'cyan', attrs=['bold']))
    print("Checking internet connection : ")
github torque59 / Nosql-Exploitation-Framework / dbattacks / mongoattacks.py View on Github external
def tryandgetpass(db, names):

    global passfound
    passfound = ""
    try:
        if names:
            db.authenticate(names.split(':')[0], names.split(':')[1])
            # print colored("[+] Auth Succeeded with username:%s and Password
            # %s"%(names.split(':')[0],names.split(':')[1]),'green')
            passfound = "[+] Auth Succeeded with username:%s and Password %s" % (
                names.split(':')[0], names.split(':')[1])
        else:
            pass
    except pymongo.errors.OperationFailure:
        print(colored("[-] Auth Failed with username:%s and Password %s" %
                      (names.split(':')[0], names.split(':')[1]), 'red'))
github dvopsway / datasploit / domain / domain_emailhunter.py View on Github external
def banner():
    print colored(style.BOLD + '\n---> Harvesting Email Addresses:.\n' + style.END, 'blue')
github gfek / Hunting-New-Registered-Domains / hnrd.py View on Github external
"\n    \_ Updated Date", colored(ud, 'yellow'), \
							"\n    \_ Expiration Date", colored(ed, 'yellow'), \
							"\n    \_ DateDiff", colored(cdd, 'yellow'), \
							"\n    \_ Name",colored(name, 'yellow'),\
							"\n    \_ Email", colored(','.join(email), 'yellow'), \
							"\n    \_ Registrar", colored(reg, 'yellow'))

							if isinstance(name,list):
								for n in name:
									NAMES.append(n)
							else:
								NAMES.append(name)
						else:
								print("  \_ ", colored(dwhois,'cyan'), \
								"\n    \_ Created Date", colored(cd, 'yellow'), \
								"\n    \_ Updated Date", colored(ud, 'yellow'), \
								"\n    \_ Expiration Date", colored(ed, 'yellow'), \
								"\n    \_ DateDiff", colored(cdd, 'yellow'), \
								"\n    \_ Name",colored(name, 'yellow'),\
								"\n    \_ Email", colored(email, 'yellow'),	\
								"\n    \_ Registrar", colored(reg, 'yellow'))

				except Exception as exc:
					print(('%r generated an exception: %s' % (dwhois, exc)))
	except ValueError:
		pass
	return NAMES
github torque59 / Nosql-Exploitation-Framework / nosqlexp.py View on Github external
try:
				print colored("\t[-] Password Sha:" + str(json_couch['password_sha']),'green')
				print colored("\t[-] Salt:" + str(json_couch['salt']),'green')
			except KeyError:
				print colored("\t[-] Password Sha: Nil" ,'green')
				print colored("\t[-] Salt: Nil" ,'green')
	try:
		print colored("\n[!] Enumerating DB's \n",'blue')
		for db in couch:
			print colored("\t[-] %s"%(db),'green')
			time.sleep(2)
	except couchdb.http.Unauthorized:
		print colored("[-] The DB requires Credentials or Wrong Credentials :( \n",'red')
		further = False
	if further != False:
		print colored("\n\n[!] Trying to Retrieve CouchDB Configs\n",'green') #Parsing needed to be added
		try:
			for key, value in couch.config().iteritems() :
				print key,value
		except couchdb.http.Unauthorized:
			print colored("[-] Oops Looks Like u need Credentials \n",'red')
			username,password=auth_req('couch')
			couch.resource.credentials = (username,password)
			couch_enum(couch)
github ecstatic-nobel / Analyst-Arsenal / commons.py View on Github external
continue

            score = score_domain(config, domain.lower(), self.args)
            
            if score < self.args.score:
                if self.args.log_nc:
                    with open(self.args.log_nc, "a") as log_nc:
                        log_nc.write("{}\n".format(domain))
                self.domain_queue.task_done()
                continue

            if self.args.verbose:
                if score >= 120:
                    tqdm.tqdm.write("{}: {} (score={})".format(
                        message_header("critical"), 
                        colored(domain, "red", attrs=["underline", "bold"]), 
                        score)
                    )
                elif score >= 90:
                    tqdm.tqdm.write("{}: {} (score={})".format(
                        message_header("suspicious"), 
                        colored(domain, "yellow", attrs=["underline"]), 
                        score)
                    )
                elif score >= self.args.score:
                    tqdm.tqdm.write("{}: {} (score={})".format(
                        message_header("triggered"), 
                        colored(domain, "cyan", attrs=["underline"]), 
                        score)
                    )

            url = "http://{}".format(domain)