Python colors.red() Examples

The following are 12 code examples of colors.red(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module colors , or try the search function .
Example #1
Source File: new_algo.py    From Photoroid with GNU General Public License v3.0 6 votes vote down vote up
def check_match(source):
    try:
        import numpy as np
    except ImportError:
        print("[-] Error importing numpy module.")
        exit(1)
    list_search_images = os.listdir(
        os.path.join(os.getcwd(), target_images_dir_name))
    colors.success("Search image list grabbed ")
    print(
        "\n{}\
        ----------------------------------------------------------------------\
        {}".format(
            colors.red, colors.green
        )
    )
    print("\n\t {}:: Similar images found are :: \n".format(colors.lightgreen))
    for path in list_search_images:
        src_image = cv2.imread(os.path.join(target_images_dir_name, path), 0)
        if custom_hashing(source) == custom_hashing(src_image):
            print("Image : {}".format(path)) 
Example #2
Source File: populate.py    From mcsema with Apache License 2.0 6 votes vote down vote up
def main():
    # TODO: Make it portable
    locations = [ "/usr/bin", "/bin"]

    current = set()
    # If `bin` does not exist create it first
    if not os.path.isdir(bin_dir):
        os.mkdir(bin_dir)

    for f in os.listdir(bin_dir):
        current.add(f)

    for f in os.listdir(tags_dir):
        basename = util.strip_whole_config(f)
        if not basename:
            continue

        if basename in current:
            print(" > " + basename + " is present in " + tags_dir)
            continue

        if not try_find(locations, basename):
            print(" > " + colors.red(basename + " not found anywhere")) 
Example #3
Source File: main.py    From ssh_client with MIT License 6 votes vote down vote up
def main(argv):
  # Parse the username, hostname, and keyfile from the command line arguments
  username, hostname = argv[1].split('@')
  keyfile = argv[2]

  # Construct an SSH connection
  ssh = SSHConnection(hostname, username, keyfile)
  ssh.connect()

  # Run an interactive prompt, until the user enters an empty line or closes the input stream
  print colors.red(ssh.read())
  while True:
    try:
      command_to_run = raw_input('> ')
    except EOFError:
      command_to_run = ''

    if command_to_run.strip() == '':
      break
    ssh.send(command_to_run + '\n')
    print colors.red(ssh.read())

  # Cleanly close the SSH connection
  exit_status = ssh.disconnect()
  return exit_status 
Example #4
Source File: dash.py    From DASH with GNU General Public License v3.0 6 votes vote down vote up
def forward(port):
    try:
        import requests
        import json
    except:
        process_display(1,1,"Module not found\n    Make sure you have installed 'requirements.txt' and configured DASH")
        sys.exit(0)

    ngrok = subprocess.Popen(['ngrok','http','-region','ap' ,str(port)],stdout=subprocess.PIPE)
    process_display(1,0,"[1/2] Public Server is started.")
    time.sleep(3)
    tunnel_url = requests.get("http://localhost:4040/api/tunnels").text
    j = json.loads(tunnel_url)
    try:
        tunnel_url = j['tunnels'][0]['public_url']
        process_display(0,0,"The link for the page is : "+tunnel_url)
    except IndexError:
        process_display(1,2,"Rechecking the URLs in 4s :/ ")
        time.sleep(4)
        tunnel_url = requests.get("http://localhost:4040/api/tunnels").text
        j = json.loads(tunnel_url)
        tunnel_url = j['tunnels'][0]['public_url']
        process_display(0,0,"The link for the page is : "+tunnel_url)
    print("\n{}-------------------------------{} _^_ {}-------------------------------{}\n".format(colors.white,colors.red,colors.white,colors.red)) 
Example #5
Source File: run.py    From scrubadub with MIT License 5 votes vote down vote up
def run_test(command):
    wrapped_command = "cd %s && %s" % (root_dir, command)
    pipe = subprocess.Popen(
        wrapped_command, shell=True,
    )
    pipe.wait()
    if pipe.returncode == 0:
        print(green("TEST PASSED"))
    else:
        print(red("TEST FAILED"))
    return pipe.returncode

# load the script tests from the .travis.yml file 
Example #6
Source File: logo.py    From Photoroid with GNU General Public License v3.0 5 votes vote down vote up
def banner():

    print(r'''
    {}
             /▔▔▔▔▔\/▔▔/  /▔▔/▔▔▔▔▔\/▔▔▔▔▔▔▔▔▔▔/▔▔▔▔▔▔\ /▔▔▔▔▔▔▔\/▔▔▔▔▔\/▔▔/▔▔▔▔▔▔\
            / {}/▔▔/{} /  /  /  / {}/▔▔/{} /▔▔▔▔/ /▔▔▔/  {}/▔▔/{}  /  {}/▔▔/{}  / {}/▔▔/{} /  / {}/▔ \{}  /
           /  {}▔▔▔{} /   ▔▔   / {}/  /{} /    / /   /  {}/  /{}  /   {}▔▔{}   / {}/  /{} /  / {}/   /{} /
          / /▔▔▔▔/  /▔▔/  / {}/  /{} /    / /   /  {}/  /{}  /  /\ \▔▔/ {}/  /{} /  / {}/   /{} /
         / /    /  /  /  /\ {}▔▔{}  /    / /    \  {}▔▔{}   /  /  \ \ \{} ▔▔{}  /  /  {}▔▔▔▔{} /
    {}     ▔▔     ▔▔▔   ▔▔▔  ▔▔▔▔▔     ▔▔      ▔▔▔▔▔▔ ▔▔▔    ▔▔  ▔▔▔▔ ▔▔▔ ▔▔▔▔▔▔▔
                                                       {} Made by :- pr0t0n
                                                       {} P.S. Project is under Beta mode.
    '''.format(color.red,color.lightblue,color.red,color.lightblue,color.red,color.lightblue,color.red,color.lightblue,color.red,color.lightblue,color.red,color.lightblue,color.red,color.lightblue,color.red,color.lightblue,color.red,color.lightblue,color.red,color.lightblue,color.red,color.lightblue,color.red,color.lightblue,color.red,color.lightblue,color.red,color.lightblue,color.red,color.lightblue,color.red,color.lightblue,color.red,color.lightblue,color.red,color.lightblue,color.red,color.lightblue,color.red,color.lightblue,color.red,color.red,color.lightgreen,color.blue)) 
Example #7
Source File: logo.py    From Photoroid with GNU General Public License v3.0 5 votes vote down vote up
def banner():

    print(r'''
    {}
             /▔▔▔▔▔\/▔▔/  /▔▔/▔▔▔▔▔\/▔▔▔▔▔▔▔▔▔▔/▔▔▔▔▔▔\ /▔▔▔▔▔▔▔\/▔▔▔▔▔\/▔▔/▔▔▔▔▔▔\
            / {}/▔▔/{} /  /  /  / {}/▔▔/{} /▔▔▔▔/ /▔▔▔/  {}/▔▔/{}  /  {}/▔▔/{}  / {}/▔▔/{} /  / {}/▔ \{}  /
           /  {}▔▔▔{} /   ▔▔   / {}/  /{} /    / /   /  {}/  /{}  /   {}▔▔{}   / {}/  /{} /  / {}/   /{} /
          / /▔▔▔▔/  /▔▔/  / {}/  /{} /    / /   /  {}/  /{}  /  /\ \▔▔/ {}/  /{} /  / {}/   /{} /
         / /    /  /  /  /\ {}▔▔{}  /    / /    \  {}▔▔{}   /  /  \ \ \{} ▔▔{}  /  /  {}▔▔▔▔{} /
    {}     ▔▔     ▔▔▔   ▔▔▔  ▔▔▔▔▔     ▔▔      ▔▔▔▔▔▔ ▔▔▔    ▔▔  ▔▔▔▔ ▔▔▔ ▔▔▔▔▔▔▔
                                                       {} Made by :- pr0t0n
                                                       {} P.S. Project is under Beta mode.
    '''.format(color.red,color.lightblue,color.red,color.lightblue,color.red,color.lightblue,color.red,color.lightblue,color.red,color.lightblue,color.red,color.lightblue,color.red,color.lightblue,color.red,color.lightblue,color.red,color.lightblue,color.red,color.lightblue,color.red,color.lightblue,color.red,color.lightblue,color.red,color.lightblue,color.red,color.lightblue,color.red,color.lightblue,color.red,color.lightblue,color.red,color.lightblue,color.red,color.lightblue,color.red,color.lightblue,color.red,color.lightblue,color.red,color.red,color.lightgreen,color.blue)) 
Example #8
Source File: thread_photo.py    From Photoroid with GNU General Public License v3.0 5 votes vote down vote up
def check_match():

    list_temp_images = os.listdir(os.path.join(
        os.getcwd(), template_image_dir_name))
    colors.success("Template image list grabbed.")
    list_search_images = os.listdir(
        os.path.join(os.getcwd(), target_images_dir_name))
    colors.success("Search images list grabbed")
    print(
        "\n{}\
        ----------------------------------------------------------------------\
        {}"
        .format(colors.red, colors.green))
    print("\n\t {}:: Similar images found are :: \n".format(colors.lightgreen))

    image_thread_process = []

    for path in list_search_images:
        image_thread_process.append(
            th(
                target=thread_checker,
                args=(path, list_temp_images,)
            )
        )

    for process in image_thread_process:
        process.start()

    for process in image_thread_process:
        process.join()

    colors.success("Threading function completed") 
Example #9
Source File: result_data.py    From mcsema with Apache License 2.0 5 votes vote down vote up
def get_result_color(self):
        if self.total == 0:
            return colors.magneta

        if self.total == self.success:
            return colors.green

        if self.success == 0:
            return colors.red

        return colors.orange 
Example #10
Source File: result_data.py    From mcsema with Apache License 2.0 5 votes vote down vote up
def print_ces(self):
        for case, ce in self.ces.items():
            print(colors.red(self.basename) + ': '+ ('without_args' if not case else case))
            print(ce) 
Example #11
Source File: dash.py    From DASH with GNU General Public License v3.0 5 votes vote down vote up
def header():
    print('\n\t\t{}-{} DASH {}-{}\n'.format(colors.red,colors.white,colors.red,colors.white)) 
Example #12
Source File: photo.py    From Photoroid with GNU General Public License v3.0 4 votes vote down vote up
def check_match():
    try:
        import numpy as np
    except ImportError:
        print("[-] Error importing numpy module.")
        exit(1)

    list_temp_images = os.listdir(os.path.join(
        os.getcwd(), template_image_dir_name))
    colors.success("Template image list grabbed.")
    list_search_images = os.listdir(
        os.path.join(os.getcwd(), target_images_dir_name))
    colors.success("Search image list grabbed ")
    print(
        "\n{}----------------------------------------------------------------------{}".format(colors.red, colors.green))
    print("\n\t {}:: Similar images found are :: \n".format(colors.lightgreen))

    for path in list_search_images:
        checked = []
        pos = 0

        # Reading images to be matched one by one.
        src_image = cv2.imread(os.path.join(
            target_images_dir_name, path), cv2.IMREAD_COLOR)

        # Converting image to grayscale.
        src_gray = cv2.cvtColor(src_image, cv2.COLOR_BGR2GRAY)

        # Checking if all the templates are there in image or not.
        while pos < 12:
            template_path = list_temp_images[pos]
            template_image = cv2.imread(os.path.join(
                template_image_dir_name, template_path), cv2.IMREAD_GRAYSCALE)

            # Using cv2.matchTemplate() to check if template is found or not.
            result = cv2.matchTemplate(
                src_gray, template_image, cv2.TM_CCOEFF_NORMED)
            thresh = 0.9
            loc = np.where(result > thresh)
            if str(loc[0]) == str(loc[1]):
                checked.append("False")
                break
            else:
                checked.append("True")
            pos += 1

        if "False" not in checked:
            print("Image : {}".format(path))