Esempio n. 1
0
def shell_noint(profile_file):
    global url
    global port
    global action_url
    global user_agent
    global html_file
    global external_js

    try:
        url = profile_getkey(profile_file, "url")
        action_url = profile_getkey(profile_file, "action_url")
        port = int(profile_getkey(profile_file, "port"))
        user_agent = profile_getkey(profile_file, "user_agent")
        html_file = profile_getkey(profile_file, "html_file")
        external_js = profile_getkey(profile_file, "external_js")

        print_startup()
        s = weeman(url, port)
        s.clone()
        s.serve()

    except ValueError:
        printt(3, "Error: your profile file looks bad.")
    except KeyboardInterrupt:
        s = weeman(url, port)
        s.cleanup()
        print("\nInterrupt ...")
    except IndexError:
        if prompt[0] == "help" or prompt[0] == "?":
            print_help()
        else:
            printt(3, "Error: please provide option for \'%s\'." % prompt[0])
    except Exception as e:
        printt(3, "Error: (%s)" % (str(e)))
Esempio n. 2
0
File: shell.py Progetto: 0ps/weeman
def shell_noint(options):
    global url
    global port
    global action_url
    global user_agent
    global html_file

    url = options.url
    action_url = options.action_url
    port = int(options.port)
    user_agent = options.user_agent
    html_file = options.html_file

    try:
        print_startup()
        s = weeman(url,port)
        s.clone()
        s.serve()

    except KeyboardInterrupt:
        s = weeman(url,port)
        s.cleanup()
        print("\nInterrupt ...")
    except IndexError:
        if prompt[0] == "help" or prompt[0] == "?":
            print_help()
        else:
            printt(3, "Error: please provide option for \'%s\'." %prompt[0])
    except Exception as e:
        printt(3, "Error: (%s)" %(str(e)))
Esempio n. 3
0
def shell_noint(profile_file):
    global url
    global port
    global action_url
    global user_agent
    global html_file
    global external_js

    try:
        url = profile_getkey(profile_file, "url")
        action_url = profile_getkey(profile_file, "action_url")
        port = int(profile_getkey(profile_file, "port"))
        user_agent = profile_getkey(profile_file, "user_agent")
        html_file = profile_getkey(profile_file, "html_file")
        external_js = profile_getkey(profile_file, "external_js")

        print_startup()
        s = weeman(url, port)
        s.clone()
        s.serve()

    except ValueError:
        printt(3, "Erro: seu arquivo de perfil parece ruim.")
    except KeyboardInterrupt:
        s = weeman(url, port)
        s.cleanup()
        print("\nInterrupt ...")
    except IndexError:
        if prompt[0] == "help" or prompt[0] == "?":
            print_help()
        else:
            printt(3, "Erro: Forneca opcao para \'%s\'." % prompt[0])
    except Exception as e:
        printt(3, "Erro: (%s)" % (str(e)))
Esempio n. 4
0
def shell_noint(profile_file):
    global url
    global port
    global action_url
    global user_agent
    global html_file

    url = profile_getkey(profile_file, "url")
    action_url = profile_getkey(profile_file, "action_url")
    port = int(profile_getkey(profile_file, "port"))
    user_agent = profile_getkey(profile_file, "user_agent")
    html_file = profile_getkey(profile_file, "html_file")

    try:
        print_startup()
        s = weeman(url,port)
        s.clone()
        s.serve()

    except KeyboardInterrupt:
        s = weeman(url,port)
        s.cleanup()
        print("\nInterrupt ...")
    except IndexError:
        if prompt[0] == "help" or prompt[0] == "?":
            print_help()
        else:
            printt(3, "Error: please provide option for \'%s\'." %prompt[0])
    except Exception as e:
        printt(3, "Error: (%s)" %(str(e)))
Esempio n. 5
0
def shell_noint(options):
    global url
    global port
    global action_url
    global user_agent
    global html_file

    url = options.url
    action_url = options.action_url
    port = int(options.port)
    user_agent = options.user_agent
    html_file = options.html_file

    try:
        print_startup()
        s = weeman(url, port)
        s.clone()
        s.serve()

    except KeyboardInterrupt:
        s = weeman(url, port)
        s.cleanup()
        print("\nInterrupt ...")
    except IndexError:
        if prompt[0] == "help" or prompt[0] == "?":
            print_help()
        else:
            printt(3, "Error: please provide option for \'%s\'." % prompt[0])
    except Exception as e:
        printt(3, "Error: (%s)" % (str(e)))
Esempio n. 6
0
File: shell.py Progetto: ad3n/weeman
def shell():
    global url
    global port
    global action_url
    global user_agent
    global html_file

    print_startup()
    complete(array)

    if os.path.exists("history.log"):
        if  os.stat("history.log").st_size == 0:
            history = open("history.log", "w")
        else:
            history = open("history.log", "a")
    else:
        history = open("history.log", "w")

    while True:
        try:
            an = raw_input(" (weeman ) : ")
            prompt = an.split()
            if not prompt:
                print("Error: What? try help.")
            elif prompt[0] == ";" or prompt[0] == "clear":
                print("\033[H\033[J")
            elif prompt[0] == "q" or prompt[0] == "quit":
                printt(2,"bye bye!")
                break;
            elif prompt[0] == "help" or prompt[0] == "?":
                if prompt[1]:
                    print_help_option(str(prompt[1]))
                else:
                    print_help()
            elif prompt[0] == "show":
                l = 11 + len(url)
                sys.stdout.write("\033[01;32m\t")
                print("-" * l)
                print("\turl        : %s " %url)
                print("\tport       : %d " %(port))
                print("\taction_url : %s " %(action_url))
                print("\tuser_agent : %s " %(user_agent))
                print("\thtml_file  : %s " %(html_file))
                sys.stdout.write("\t\033[00m")
                print("-" * l)
            elif prompt[0] == "set":
                if prompt[1] == "port":
                    port = int(prompt[2])
                    ## Check if port == 80 and not running as root
                    if port == 80 and os.getuid() != 0:
                        printt(2, "Permission denied, to bind port 80, you need to run weeman as root.");
                    history.write("port = %s\n" %port)
                if prompt[1] == "url":
                    url = str(prompt[2])
                    history.write("url = %s\n" %url)
                if prompt[1] == "action_url":
                    action_url = str(prompt[2])
                    history.write("action_url = %s\n" %action_url)
                if prompt[1] == "user_agent":
                    prompt.pop(0)
                    u = str()
                    for x in prompt:
                        u+=" "+x
                    user_agent = str(u.replace("user_agent", ""))
                    history.write("user_agent = %s\n" %user_agent)
                if prompt[1] == "html_file":
                    html_file = str(prompt[2])
            elif prompt[0] == "run" or prompt[0] == "r":
                s = weeman(url,port)
                s.clone()
                s.serve()
            elif prompt[0] == "banner" or prompt[0] == "b":
                print_startup()
            else:
                print("Error: \'%s\' What? try help." %prompt[0])

        except KeyboardInterrupt:
            s = weeman(url,port)
            s.cleanup()
            print("\nInterrupt ...")
        except IndexError:
            if prompt[0] == "help" or prompt[0] == "?":
                print_help()
            else:
                printt(3, "Error: please provide value for \'%s\'." %prompt[0])
        except Exception as e:
            printt(3, "Error: (%s)" %(str(e)))
Esempio n. 7
0
def shell(quiet_mode):
    """
        The shell, parse command line args,
        and set variables.
    """
    global url
    global port
    global action_url
    global user_agent
    global html_file

    if not quiet_mode:
        print_startup()
    complete(array)

    if os.path.exists("history.log"):
        if  os.stat("history.log").st_size == 0:
            history = open("history.log", "w")
        else:
            history = open("history.log", "a")
    else:
        history = open("history.log", "w")

    while True:
        try:
            an = raw_input(PROMPT_P)
            prompt = an.split()
            if not prompt:
                print("Error: What? try help.")
            elif prompt[0] == ";" or prompt[0] == "clear":
                print("\033[H\033[J")
            elif prompt[0] == "q" or prompt[0] == "quit":
                printt(2,"bye bye!")
                break;
            elif prompt[0] == "help" or prompt[0] == "?":
                if prompt[1]:
                    print_help_option(str(prompt[1]))
                else:
                    print_help()
            elif prompt[0] == "show":
                l = 20
                sys.stdout.write("\033[01;37m\t")
                print("-" * l)
                print("\turl        : %s " %url)
                print("\tport       : %d " %(port))
                print("\taction_url : %s " %(action_url))
                print("\tuser_agent : %s " %(user_agent))
                print("\thtml_file  : %s " %(html_file))
                sys.stdout.write("\t")
                print("-" * l)
                sys.stdout.write("\033[01;00m")
            elif prompt[0] == "set":
                if prompt[1] == "port":
                    port = int(prompt[2])
                    ## Check if port == 80 and not running as root
                    if port == 80 and os.getuid() != 0:
                        printt(2, "Permission denied, to bind port 80, you need to run weeman as root.");
                    history.write("port = %s\n" %port)
                if prompt[1] == "url":
                    url = str(prompt[2])
                    history.write("url = %s\n" %url)
                if prompt[1] == "action_url":
                    action_url = str(prompt[2])
                    history.write("action_url = %s\n" %action_url)
                if prompt[1] == "user_agent":
                    prompt.pop(0)
                    u = str()
                    for x in prompt:
                        u+=" "+x
                    user_agent = str(u.replace("user_agent", ""))
                    history.write("user_agent = %s\n" %user_agent)
                if prompt[1] == "html_file":
                    html_file = str(prompt[2])
            elif prompt[0] == "run" or prompt[0] == "r":
                if not url:
                    printt(3, "Error: \'url\' Can't be \'None\', please use \'set\'.")
                elif not action_url:
                    printt(3, "Error: \'action_url\' Can't be \'None\', please use \'set\'.")
                else:
                    # Here we start the server (:
                    s = weeman(url,port)
                    s.clone()
                    s.serve()
            elif prompt[0] == "banner" or prompt[0] == "b":
                print_startup()
            else:
                print("Error: \'%s\' What? try help." %prompt[0])

        except KeyboardInterrupt:
            s = weeman(url,port)
            s.cleanup()
            print("\nInterrupt ...")
        except IndexError:
            if prompt[0] == "help" or prompt[0] == "?":
                print_help()
            else:
                printt(3, "Error: please provide option for \'%s\'." %prompt[0])
        except Exception as e:
            printt(3, "Error: (%s)" %(str(e)))
Esempio n. 8
0
def shell():
    """
        The shell, parse command line args,
        and set variables.
    """
    global url
    global port
    global action_url
    global user_agent
    global html_file
    global external_js

    print_startup()

    if os.path.exists("history.log"):
        if os.stat("history.log").st_size == 0:
            history = open("history.log", "w")
        else:
            history = open("history.log", "a")
    else:
        history = open("history.log", "w")

    while True:
        try:
            # for Re-complete
            complete(array)
            an = raw_input("weeman > ") or "help"
            prompt = an.split()
            if not prompt:
                continue
            elif prompt[0] == ";" or prompt[0] == "clear":
                print("\033[H\033[J")
            elif prompt[0] == "q" or prompt[0] == "quit":
                printt(2, "bye bye!")
                break
            elif prompt[0] == "help" or prompt[0] == "?":
                if prompt[1]:
                    print_help_option(str(prompt[1]))
                else:
                    print_help()
            elif prompt[0] == "show":
                sys.stdout.write("\033[01;37m\t")
                print("-" * 20)
                print("\turl          : %s " % url)
                print("\tport         : %d " % (port))
                print("\taction_url   : %s " % (action_url))
                print("\tuser_agent   : %s " % (user_agent))
                print("\thtml_file    : %s " % (html_file))
                print("\texternal_js  : %s " % (external_js))
                sys.stdout.write("\t")
                print("-" * 20)
                sys.stdout.write("\033[01;00m")
            elif prompt[0] == "set":
                if prompt[1] == "port":
                    port = int(prompt[2])
                    ## Check if port == 80 and not running as root
                    if port == 80 and os.getuid() != 0:
                        printt(
                            2,
                            "Permission denied, to bind port 80, you need to run weeman as root."
                        )
                    history.write("port = %s\n" % port)
                if prompt[1] == "url":
                    url = str(prompt[2])
                    history.write("url = %s\n" % url)
                if prompt[1] == "action_url":
                    action_url = str(prompt[2])
                    history.write("action_url = %s\n" % action_url)
                if prompt[1] == "user_agent":
                    prompt.pop(0)
                    u = str()
                    for x in prompt:
                        u += " " + x
                    user_agent = str(u.replace("user_agent", ""))
                    history.write("user_agent = %s\n" % user_agent)
                if prompt[1] == "html_file":
                    html_file = str(prompt[2])
                if prompt[1] == "external_js":
                    external_js = str(prompt[2])
                    history.write("external_js = %s\n" % external_js)
            elif prompt[0] == "run" or prompt[0] == "r":
                if not url:
                    printt(3, "Error: please set \"url\".")
                elif not action_url:
                    printt(3, "Error: please set \"action_url\".")
                else:
                    # Here we start the server (:
                    s = weeman(url, port)
                    s.clone()
                    s.serve()
            elif prompt[0] == "banner" or prompt[0] == "b":
                print_startup()
            else:
                print("Error: No such command \'%s\'." % prompt[0])

        except KeyboardInterrupt:
            s = weeman(url, port)
            s.cleanup()
            print("\n%s" % say)
        except IndexError:
            if prompt[0] == "help" or prompt[0] == "?":
                print_help()
            else:
                printt(3,
                       "Error: please provide option for \'%s\'." % prompt[0])
        except Exception as e:
            printt(3, "Error: (%s)" % (str(e)))
Esempio n. 9
0
def shell():
    global url
    global port
    global action_url
    global user_agent

    print_startup()
    complete(array)

    if os.path.exists("history.log"):
        if  os.stat("history.log").st_size == 0:
            history = open("history.log", "w")
        else:
            history = open("history.log", "a")
    else:
        history = open("history.log", "w")

    while True:
        try:
            an = raw_input("\033[1;37m\033[1;31mroot@lteezy:\033[1;37m ")
            prompt = an.split()
            if not prompt:
                print("Error: Try command help for more details.")
            elif prompt[0] == ";" or prompt[0] == "clear":
                print("\033[H\033[J")
            elif prompt[0] == "q" or prompt[0] == "quit":
                printt(2,"have a great day")
                break;
            elif prompt[0] == "help" or prompt[0] == "?":
                print_help()
            elif prompt[0] == "show":
                l = 11 + len(url)
                sys.stdout.write("\033[01;34m\t")
                print("-" * l)
                print("\turl        : %s " %url)
                print("\tport       : %d " %(port))
                print("\taction_url : %s " %(action_url))
                print("\tuser_agent : %s " %(user_agent))
                sys.stdout.write("\t\033[00m")
                print("-" * l)
            elif prompt[0] == "set":
                if prompt[1] == "port":
                    port = int(prompt[2])
                    history.write("port = %s\n" %port)
                if prompt[1] == "url":
                    url = str(prompt[2])
                    history.write("url = %s\n" %url)
                if prompt[1] == "action_url":
                    action_url = str(prompt[2])
                    history.write("action_url = %s\n" %action_url)
                if prompt[1] == "user_agent":
                    prompt.pop(0)
                    u = str()
                    for x in prompt:
                        u+=" "+x
                    user_agent = str(u.replace("user_agent", ""))
                    history.write("user_agent = %s\n" %user_agent)
            elif prompt[0] == "run" or prompt[0] == "r":
                s = cybercloner(url,port)
                s.clone()
                s.serve()
            elif prompt[0] == "banner" or prompt[0] == "b":
                print_startup()
            else:
                print("Error: \'%s\' Try command help for more details." %prompt[0])

        except KeyboardInterrupt:
            s = cybercloner(url,port)
            s.cleanup()
            print("\nInterrupt ...")
        except Exception as e:
            printt(3, "Error: CYBER CLONER saw an error! (%s)" %(str(e)))
Esempio n. 10
0
def shell(quiet_mode):
    """
        The shell, parse command line args,
        and set variables.
    """
    global url
    global port
    global action_url
    global user_agent
    global html_file

    if not quiet_mode:
        print_startup()
    complete(array)

    if os.path.exists("history.log"):
        if os.stat("history.log").st_size == 0:
            history = open("history.log", "w")
        else:
            history = open("history.log", "a")
    else:
        history = open("history.log", "w")

    while True:
        try:
            an = raw_input(PROMPT_P)
            prompt = an.split()
            if not prompt:
                print("Error: What? try help.")
            elif prompt[0] == ";" or prompt[0] == "clear":
                print("\033[H\033[J")
            elif prompt[0] == "q" or prompt[0] == "quit":
                printt(2, "bye bye!")
                break
            elif prompt[0] == "help" or prompt[0] == "?":
                if prompt[1]:
                    print_help_option(str(prompt[1]))
                else:
                    print_help()
            elif prompt[0] == "show":
                l = 20
                sys.stdout.write("\033[01;37m\t")
                print("-" * l)
                print("\turl        : %s " % url)
                print("\tport       : %d " % (port))
                print("\taction_url : %s " % (action_url))
                print("\tuser_agent : %s " % (user_agent))
                print("\thtml_file  : %s " % (html_file))
                sys.stdout.write("\t")
                print("-" * l)
                sys.stdout.write("\033[01;00m")
            elif prompt[0] == "set":
                if prompt[1] == "port":
                    port = int(prompt[2])
                    ## Check if port == 80 and not running as root
                    if port == 80 and os.getuid() != 0:
                        printt(2, "Permission denied, to bind port 80, you need to run weeman as root.")
                    history.write("port = %s\n" % port)
                if prompt[1] == "url":
                    url = str(prompt[2])
                    history.write("url = %s\n" % url)
                if prompt[1] == "action_url":
                    action_url = str(prompt[2])
                    history.write("action_url = %s\n" % action_url)
                if prompt[1] == "user_agent":
                    prompt.pop(0)
                    u = str()
                    for x in prompt:
                        u += " " + x
                    user_agent = str(u.replace("user_agent", ""))
                    history.write("user_agent = %s\n" % user_agent)
                if prompt[1] == "html_file":
                    html_file = str(prompt[2])
            elif prompt[0] == "run" or prompt[0] == "r":
                if not url:
                    printt(3, "Error: 'url' Can't be 'None', please use 'set'.")
                elif not action_url:
                    printt(3, "Error: 'action_url' Can't be 'None', please use 'set'.")
                else:
                    # Here we start the server (:
                    s = weeman(url, port)
                    s.clone()
                    s.serve()
            elif prompt[0] == "banner" or prompt[0] == "b":
                print_startup()
            else:
                print("Error: '%s' What? try help." % prompt[0])

        except KeyboardInterrupt:
            s = weeman(url, port)
            s.cleanup()
            print("\nInterrupt ...")
        except IndexError:
            if prompt[0] == "help" or prompt[0] == "?":
                print_help()
            else:
                printt(3, "Error: please provide option for '%s'." % prompt[0])
        except Exception as e:
            printt(3, "Error: (%s)" % (str(e)))
Esempio n. 11
0
def shell():
    """
        The shell, parse command line args,
        and set variables.
    """
    global url
    global port
    global action_url
    global user_agent
    global html_file
    global external_js

    print_startup()

    if os.path.exists("history.log"):
        if os.stat("history.log").st_size == 0:
            history = open("history.log", "w")
        else:
            history = open("history.log", "a")
    else:
        history = open("history.log", "w")

    url = str(sys.argv[1])
    port = int(sys.argv[2])

    try:
        if "js" in str(sys.argv[3]):
            external_js = str(sys.argv[3])
        else:
            action_url = str(sys.argv[3])
    except:
        pass

    try:
        external_js = str(sys.argv[4])
    except:
        pass

    while True:
        try:

            #############################################
            if not url:
                printt(3, "Error: please set \"url\".")
            elif not action_url:
                printt(3, "Error: please set \"action_url\".")
            else:
                # Here we start the server (:
                s = weeman(url, port)
                s.clone()
                s.serve()

        except KeyboardInterrupt:
            s = weeman(url, port)
            s.cleanup()
            exit()
        except IndexError:
            if prompt[0] == "help" or prompt[0] == "?":
                print_help()
            else:
                printt(3,
                       "Error: please provide option for \'%s\'." % prompt[0])
        except Exception as e:
            printt(3, "Error: (%s)" % (str(e)))
Esempio n. 12
0
def shell():
    global url
    global port
    global action_url
    global user_agent

    print_startup()
    complete(array)

    if os.path.exists("history.log"):
        if  os.stat("history.log").st_size == 0:
            history = open("history.log", "w")
        else:
            history = open("history.log", "a")
    else:
        history = open("history.log", "w")

    while True:
        try:
            an = raw_input(" (STD9-Phishing ) : ")
            prompt = an.split()
            if not prompt:
                print("Error: ? try help.")
            elif prompt[0] == ";" or prompt[0] == "clear":
                print("\033[H\033[J")
            elif prompt[0] == "q" or prompt[0] == "quit":
                printt(2,"au revoir !")
                break;
            elif prompt[0] == "help" or prompt[0] == "?":
                print_help()
            elif prompt[0] == "show":
                l = 11 + len(url)
                sys.stdout.write("\033[01;32m\t")
                print("-" * l)
                print("\turl        : %s " %url)
                print("\tport       : %d " %(port))
                print("\taction_url : %s " %(action_url))
                print("\tuser_agent : %s " %(user_agent))
                sys.stdout.write("\t\033[00m")
                print("-" * l)
            elif prompt[0] == "set":
                if prompt[1] == "port":
                    port = int(prompt[2])
                    history.write("port = %s\n" %port)
                if prompt[1] == "url":
                    url = str(prompt[2])
                    history.write("url = %s\n" %url)
                if prompt[1] == "action_url":
                    action_url = str(prompt[2])
                    history.write("action_url = %s\n" %action_url)
                if prompt[1] == "user_agent":
                    prompt.pop(0)
                    u = str()
                    for x in prompt:
                        u+=" "+x
                    user_agent = str(u.replace("user_agent", ""))
                    history.write("user_agent = %s\n" %user_agent)
            elif prompt[0] == "run" or prompt[0] == "r":
                s = STD9-Phishing(url,port)
                s.clone()
                s.serve()
            elif prompt[0] == "banner" or prompt[0] == "b":
                print_startup()
            else:
                print("Error: \'%s\' What? try help." %prompt[0])

        except KeyboardInterrupt:
            s = weeman(url,port)
            s.cleanup()
            print("\nInterrupt ...")
        except Exception as e:
            printt(3, "Error: STD9-Phishing recived error! (%s)" %(str(e)))
Esempio n. 13
0
def shell():
    global url
    global port
    global action_url
    global user_agent

    print_startup()
    complete(array)

    if os.path.exists("history.log"):
        if  os.stat("history.log").st_size == 0:
            history = open("history.log", "w")
        else:
            history = open("history.log", "a")
    else:
        history = open("history.log", "w")

    while True:
        try:
            an = raw_input(" (weeman ) : ")
            prompt = an.split()
            if not prompt:
                print("Error: What? try help.")
            elif prompt[0] == ";" or prompt[0] == "clear":
                print("\033[H\033[J")
            elif prompt[0] == "q" or prompt[0] == "quit":
                printt(2,"bye bye!")
                break;
            elif prompt[0] == "help" or prompt[0] == "?":
                print_help()
            elif prompt[0] == "show":
                l = 11 + len(url)
                sys.stdout.write("\033[01;32m\t")
                print("-" * l)
                print("\turl        : %s " %url)
                print("\tport       : %d " %(port))
                print("\taction_url : %s " %(action_url))
                print("\tuser_agent : %s " %(user_agent))
                sys.stdout.write("\t\033[00m")
                print("-" * l)
            elif prompt[0] == "set":
                if prompt[1] == "port":
                    port = int(prompt[2])
                    history.write("port = %s\n" %port)
                if prompt[1] == "url":
                    url = str(prompt[2])
                    history.write("url = %s\n" %url)
                if prompt[1] == "action_url":
                    action_url = str(prompt[2])
                    history.write("action_url = %s\n" %action_url)
                if prompt[1] == "user_agent":
                    prompt.pop(0)
                    u = str()
                    for x in prompt:
                        u+=" "+x
                    user_agent = str(u.replace("user_agent", ""))
                    history.write("user_agent = %s\n" %user_agent)
            elif prompt[0] == "run" or prompt[0] == "r":
                s = weeman(url,port)
                s.clone()
                s.serve()
            elif prompt[0] == "banner" or prompt[0] == "b":
                print_startup()
            else:
                print("Error: \'%s\' What? try help." %prompt[0])

        except KeyboardInterrupt:
            s = weeman(url,port)
            s.cleanup()
            print("\nInterrupt ...")
        except Exception as e:
            printt(3, "Error: Weeman recived error! (%s)" %(str(e)))
Esempio n. 14
0
def shell():
    """
        The shell, parse command line args,
        and set variables.
    """
    global url
    global port
    global action_url
    global user_agent
    global html_file
    global external_js

    print_startup()

    if os.path.exists("history.log"):
        if  os.stat("history.log").st_size == 0:
            history = open("history.log", "w")
        else:
            history = open("history.log", "a")
    else:
        history = open("history.log", "w")

    while True:
        try:
            # for Re-complete
            complete(array)
            an = raw_input("weeman > ") or "help"
            prompt = an.split()
            if not prompt:
              continue
            elif prompt[0] == ";" or prompt[0] == "clear":
                print("\033[H\033[J")
            elif prompt[0] == "q" or prompt[0] == "quit":
                printt(2,"bye bye!")
                break;
            elif prompt[0] == "help" or prompt[0] == "?":
                if prompt[1]:
                    print_help_option(str(prompt[1]))
                else:
                    print_help()
            elif prompt[0] == "show":
                sys.stdout.write("\033[01;37m\t")
                print("-" * 20)
                print("\turl          : %s " %url)
                print("\tport         : %d " %(port))
                print("\taction_url   : %s " %(action_url))
                print("\tuser_agent   : %s " %(user_agent))
                print("\thtml_file    : %s " %(html_file))
                print("\texternal_js  : %s " %(external_js))
                sys.stdout.write("\t")
                print("-" * 20)
                sys.stdout.write("\033[01;00m")
            elif prompt[0] == "set":
                if prompt[1] == "port":
                    port = int(prompt[2])
                    ## Check if port == 80 and not running as root
                    if port == 80 and os.getuid() != 0:
                        printt(2, "Permission denied, to bind port 80, you need to run weeman as root.");
                    history.write("port = %s\n" %port)
                if prompt[1] == "url":
                    url = str(prompt[2])
                    history.write("url = %s\n" %url)
                if prompt[1] == "action_url":
                    action_url = str(prompt[2])
                    history.write("action_url = %s\n" %action_url)
                if prompt[1] == "user_agent":
                    prompt.pop(0)
                    u = str()
                    for x in prompt:
                        u+=" "+x
                    user_agent = str(u.replace("user_agent", ""))
                    history.write("user_agent = %s\n" %user_agent)
                if prompt[1] == "html_file":
                    html_file = str(prompt[2])
                if prompt[1] == "external_js":
                    external_js = str(prompt[2])
                    history.write("external_js = %s\n" %external_js)
            elif prompt[0] == "run" or prompt[0] == "r":
                if not url:
                    printt(3, "Error: please set \"url\".")
                elif not action_url:
                    printt(3, "Error: please set \"action_url\".")
                else:
                    # Here we start the server (:
                    s = weeman(url,port)
                    s.clone()
                    s.serve()
            elif prompt[0] == "banner" or prompt[0] == "b":
                print_startup()
            else:
                print("Error: No such command \'%s\'." %prompt[0])

        except KeyboardInterrupt:
            s = weeman(url,port)
            s.cleanup()
            print("\n%s" %say)
        except IndexError:
            if prompt[0] == "help" or prompt[0] == "?":
                print_help()
            else:
                printt(3, "Error: please provide option for \'%s\'." %prompt[0])
        except Exception as e:
            printt(3, "Error: (%s)" %(str(e)))