# Path: interface/messages.py
# def print_error(*args, **kwargs):
#     print(Color.RED + Color.BOLD + "[-]" + Color.ENDC, *args, **kwargs)
# 
# def print_help(*args, **kwargs):
#     print(Color.PURPLE + Color.BOLD + "[?]" + Color.ENDC, *args, **kwargs)
# 
# def print_info(*args, **kwargs):
#     print(Color.BLUE + Color.BOLD + "[*]" + Color.ENDC, *args, **kwargs)
# 
# def print_warning(*args, **kwargs):
#     print(Color.YELLOW + Color.BOLD + "[!]" + Color.ENDC, *args, **kwargs)
# 
# def print_red(msg):
#     print(Color.RED + msg + Color.ENDC)
# 
# def print_success(*args, **kwargs):
#     print(Color.GREEN + Color.BOLD + "[+]" + Color.ENDC, *args, **kwargs)


import core.io
import time
import base64
import cmd
import socket
import struct
import select
import requests
import xml.dom.minidom
import re
import traceback
import sys
import core.globals
import interface.utils
from interface.messages import print_error, print_help, print_info, print_warning, print_red, \
    print_success
        print_help("Originally this was miranda host command, but REXT already has host command")

    def help_add(self):
        print_help("Allows you to manually add device (e.g. shodan search result)")
        print("\tusage:add [device name] [device xml root]")
        print("\texample: add 192.168.1.2:49152 http://192.168.1.2:49152/description.xml")

    def help_pcap(self):
        print_help("Passively listens for SSDP NOTIFY messages from UPNP devices")

    # Passively listen for UPNP NOTIFY packets
    def do_pcap(self, e):
        print_info('Entering passive mode, Ctrl+C')

        count = 0
        start = time.time()

        while True:
            try:
                if 0 < self.max_hosts <= count:
                    break

                if 0 < self.timeout < (time.time() - start):
                    raise Exception("Timeout exceeded")

                if self.parse_ssdp_info(self.recieve(1024, False), False, False):
                    count += 1

            except Exception as e:
                print("\n")

# Path: interface/messages.py
# def print_error(*args, **kwargs):
#     print(Color.RED + Color.BOLD + "[-]" + Color.ENDC, *args, **kwargs)
# 
# def print_help(*args, **kwargs):
#     print(Color.PURPLE + Color.BOLD + "[?]" + Color.ENDC, *args, **kwargs)
# 
# def print_info(*args, **kwargs):
#     print(Color.BLUE + Color.BOLD + "[*]" + Color.ENDC, *args, **kwargs)
# 
# def print_warning(*args, **kwargs):
#     print(Color.YELLOW + Color.BOLD + "[!]" + Color.ENDC, *args, **kwargs)
# 
# def print_red(msg):
#     print(Color.RED + msg + Color.ENDC)
# 
# def print_success(*args, **kwargs):
#     print(Color.GREEN + Color.BOLD + "[+]" + Color.ENDC, *args, **kwargs)


# Path: modules/misc/generic/upnp_console.py
import core.io
import time
import base64
import cmd
import socket
import struct
import select
import requests
import xml.dom.minidom
import re
import traceback
import sys
import core.globals
import interface.utils
from interface.messages import print_error, print_help, print_info, print_warning, print_red, \
    print_success

        print_help("Originally this was miranda host command, but REXT already has host command")

    def help_add(self):
        print_help("Allows you to manually add device (e.g. shodan search result)")
        print("\tusage:add [device name] [device xml root]")
        print("\texample: add 192.168.1.2:49152 http://192.168.1.2:49152/description.xml")

    def help_pcap(self):
        print_help("Passively listens for SSDP NOTIFY messages from UPNP devices")

    # Passively listen for UPNP NOTIFY packets
    def do_pcap(self, e):
        print_info('Entering passive mode, Ctrl+C')

        count = 0
        start = time.time()

        while True:
            try:
                if 0 < self.max_hosts <= count:
                    break

                if 0 < self.timeout < (time.time() - start):
                    raise Exception("Timeout exceeded")

                if self.parse_ssdp_info(self.recieve(1024, False), False, False):
                    count += 1

            except Exception as e:
                print("\n")

                print_info("Passive mode halted...")