Beispiel #1
0
def updater():
  	
  time.sleep(1)
  
  # Check if git is installed
  requirment = "git"
  requirments.do_check(requirment)
  
  sys.stdout.write("(*) Updating "+ settings.APPLICATION + " (via Github) ... ")
  sys.stdout.flush()
  
  # Check if ".git" exists!
  if os.path.isdir("./.git"):
 
    sys.stdout.write("["+colors.GREEN+" OK "+ colors.RESET+"]\n")
    sys.stdout.flush()
    print "\n------"
    subprocess.Popen("git reset --hard HEAD && git pull", shell=True).wait()
    # Delete *.pyc files.
    subprocess.Popen("find . -name \"*.pyc\" -exec rm -rf {} \;", shell=True).wait()
    # Delete empty directories and files.
    subprocess.Popen("find . -empty -type d -delete", shell=True).wait()
    print "------\n"
      
  else:
    print "["+ colors.RED + " FAILED " + colors.RESET +"]"
    print colors.BGRED + "(x) Do it manually: "+ colors.BOLD +"'git clone https://github.com/stasinopoulos/"+settings.APPLICATION +".git " + settings.APPLICATION +"' "+ colors.RESET + "\n"
    
  sys.exit(1)
Beispiel #2
0
def updater():

    definepath = os.getcwd()
    time.sleep(1)

    # Check if git is installed
    requirment = "git"
    requirments.do_check(requirment)

    sys.stdout.write("(*) Updating " + settings.APPLICATION +
                     " (via Gihub) ... ")
    sys.stdout.flush()

    # Check if ".git" exists!
    if os.path.isdir("./.git"):

        sys.stdout.write("[" + colors.GREEN + " OK " + colors.RESET + "]\n")
        sys.stdout.flush()
        print "\n------"
        update = subprocess.Popen("git reset --hard HEAD && git pull",
                                  shell=True).wait()
        print "------\n"

    else:
        print "[" + colors.RED + " FAILED " + colors.RESET + "]"
        print "(x) Do it manually, 'git clone https://github.com/stasinopoulos/" + settings.APPLICATION + ".git " + settings.APPLICATION + "'\n"

    sys.exit(1)
Beispiel #3
0
def updater():

    time.sleep(1)
    sys.stdout.write("(*) Checking requirements to update " + settings.APPLICATION + " via Github... ")
    sys.stdout.flush()
    try:
        # Check if git is installed
        requirment = "git"
        requirments.do_check(requirment)
        if requirments.do_check(requirment) == True:
            # Check if ".git" exists!
            if os.path.isdir("./.git"):
                # Check if git is installed
                sys.stdout.write("[" + Fore.GREEN + " SUCCEED " + Style.RESET_ALL + "]\n")
                sys.stdout.flush()
                print "\n---"
                subprocess.Popen("git reset --hard HEAD && git pull", shell=True).wait()
                # Delete *.pyc files.
                subprocess.Popen('find . -name "*.pyc" -delete', shell=True).wait()
                # Delete empty directories and files.
                subprocess.Popen("find . -empty -type d -delete", shell=True).wait()
                print "---\n"
            else:
                print "[" + Fore.RED + " FAILED " + Style.RESET_ALL + "]"
                print Back.RED + "(x) Error: Do it manually: " + Style.BRIGHT + "'git clone " + settings.GIT_URL + " " + settings.APPLICATION + "' " + Style.RESET_ALL + "\n"
                sys.exit(0)
        else:
            print "[" + Fore.RED + " FAILED " + Style.RESET_ALL + "]"
            print Back.RED + "(x) Error: " + requirment + " not found." + Style.RESET_ALL + "\n"
            sys.exit(0)

    except Exception as error:
        print Back.RED + "\n(x) Error: " + str(error) + Style.RESET_ALL + "\n"
    sys.exit(0)
Beispiel #4
0
def updater():

    time.sleep(1)
    info_msg = "Checking requirements to update "
    info_msg += settings.APPLICATION + " via GitHub... "
    sys.stdout.write(settings.print_info_msg(info_msg))
    sys.stdout.flush()
    # Check if windows
    if settings.IS_WINDOWS:
        print "[" + Fore.RED + " FAILED " + Style.RESET_ALL + "]"
        err_msg = "For updating purposes on Windows platform, it's recommended "
        err_msg += "to use a GitHub client for Windows (http://windows.github.com/)."
        print settings.print_critical_msg(err_msg)
        sys.exit(0)
    else:
        try:
            requirment = "git"
            # Check if 'git' is installed.
            requirments.do_check(requirment)
            if requirments.do_check(requirment) == True:
                # Check if ".git" exists!
                if os.path.isdir("./.git"):
                    sys.stdout.write("[" + Fore.GREEN + " SUCCEED " +
                                     Style.RESET_ALL + "]\n")
                    sys.stdout.flush()
                    start = 0
                    end = 0
                    start = time.time()
                    print "---"
                    subprocess.Popen("git reset --hard HEAD && git pull",
                                     shell=True).wait()
                    # Delete *.pyc files.
                    subprocess.Popen("find . -name \"*.pyc\" -delete",
                                     shell=True).wait()
                    # Delete empty directories and files.
                    subprocess.Popen("find . -empty -type d -delete",
                                     shell=True).wait()
                    print "---"
                    end = time.time()
                    how_long = int(end - start)
                    info_msg = "Finished in " + time.strftime(
                        '%H:%M:%S', time.gmtime(how_long)) + "."
                    print settings.print_info_msg(info_msg)
                    sys.exit(0)
                else:
                    print "[" + Fore.RED + " FAILED " + Style.RESET_ALL + "]"
                    err_msg = "The '.git' directory not found. Do it manually: "
                    err_msg += Style.BRIGHT + "'git clone " + settings.GIT_URL
                    err_msg += " " + settings.APPLICATION + "' "
                    print settings.print_critical_msg(err_msg)
                    sys.exit(0)
            else:
                print "[" + Fore.RED + " FAILED " + Style.RESET_ALL + "]"
                err_msg = requirment + " not found."
                print settings.print_critical_msg(err_msg)
                sys.exit(0)

        except Exception as err_msg:
            print "\n" + settings.print_critical_msg(err_msg)
        sys.exit(0)
Beispiel #5
0
def updater():
  	
  definepath = os.getcwd()
  time.sleep(1)
  
  # Check if git is installed
  requirment = "git"
  requirments.do_check(requirment)
  
  sys.stdout.write("(*) Updating "+ settings.APPLICATION + " (via Gihub) ... ")
  sys.stdout.flush()
  
  # Check if ".git" exists!
  if os.path.isdir("./.git"):
 
    sys.stdout.write("["+colors.GREEN+" OK "+ colors.RESET+"]\n")
    sys.stdout.flush()
    print "\n------"
    update = subprocess.Popen("git reset --hard HEAD && git pull", shell=True).wait()
    print "------\n"
      
  else:
    print "["+ colors.RED + " FAILED " + colors.RESET +"]"
    print "(x) Do it manually, 'git clone https://github.com/stasinopoulos/"+settings.APPLICATION +".git "+settings.APPLICATION+"'\n"
    
  sys.exit(1)
Beispiel #6
0
def updater():
          
  time.sleep(1)
    
  sys.stdout.write("(*) Checking requirements to update "+ settings.APPLICATION + " via Github... ")
  sys.stdout.flush()
  
  # Check if git is installed
  requirment = "git"
  requirments.do_check(requirment)
  if requirments.do_check(requirment) == True :
    # Check if ".git" exists!
    if os.path.isdir("./.git"):
      # Check if git is installed
      sys.stdout.write("[" + Fore.GREEN + " SUCCEED " + Style.RESET_ALL + "]\n")
      sys.stdout.flush()
      print "\n---"
      subprocess.Popen("git reset --hard HEAD && git pull", shell=True).wait()
      # Delete *.pyc files.
      subprocess.Popen("find . -name \"*.pyc\" -delete", shell=True).wait()
      # Delete empty directories and files.
      subprocess.Popen("find . -empty -type d -delete", shell=True).wait()
      print "---\n"
    else:
      print "["+ Fore.RED + " FAILED " + Style.RESET_ALL +"]"
      print Back.RED + "(x) Error: Do it manually, "+ Style.BRIGHT +"'git clone https://github.com/stasinopoulos/"+settings.APPLICATION +".git " + settings.APPLICATION +"' "+ Style.RESET_ALL + "\n"   
      sys.exit(0)
  else:
      print "["+ Fore.RED + " FAILED " + Style.RESET_ALL +"]"
      print Back.RED + "(x) Error: " + requirment + " not found." + Style.RESET_ALL + "\n"
      sys.exit(0)

  sys.exit(0)
Beispiel #7
0
def unicorn_updater(current_version):
    info_msg = "Checking requirements to update "
    info_msg += "TrustedSec's Magic Unicorn via GitHub... "
    sys.stdout.write(settings.print_info_msg(info_msg))
    sys.stdout.flush()
    if menu.options.offline:
        print "[" + Fore.RED + " FAILED " + Style.RESET_ALL + "]"
        err_msg = "You cannot update TrustedSec's Magic Unicorn "
        err_msg += "via GitHub without access on the Internet."
        print settings.print_critical_msg(err_msg)
        sys.exit(0)
    # Check if windows
    if settings.IS_WINDOWS:
        print "[" + Fore.RED + " FAILED " + Style.RESET_ALL + "]"
        err_msg = "For updating purposes on Windows platform, it's recommended "
        err_msg += "to use a GitHub client for Windows (http://windows.github.com/)."
        print settings.print_critical_msg(err_msg)
        sys.exit(0)
    else:
        try:
            requirment = "git"
            # Check if 'git' is installed.
            requirments.do_check(requirment)
            if requirments.do_check(requirment) == True:
                sys.stdout.write("[" + Fore.GREEN + " SUCCEED " +
                                 Style.RESET_ALL + "]\n")
                sys.stdout.flush()
                if len(current_version) == 0:
                    unicorn_path = os.path.abspath(
                        os.path.join(os.path.dirname(__file__), '../',
                                     'thirdparty/'))
                    os.chdir(unicorn_path)
                else:
                    os.chdir("../")
                    subprocess.Popen("rm -rf unicorn", shell=True).wait()
                start = 0
                end = 0
                start = time.time()
                print "---"
                subprocess.Popen(
                    "git clone https://github.com/trustedsec/unicorn",
                    shell=True).wait()
                print "---"
                end = time.time()
                how_long = int(end - start)
                info_msg = "Finished in " + time.strftime(
                    '%H:%M:%S', time.gmtime(how_long)) + "."
                print settings.print_info_msg(info_msg)
                os.chdir("unicorn")
            else:
                print "[" + Fore.RED + " FAILED " + Style.RESET_ALL + "]"
                err_msg = requirment + " not found."
                print settings.print_critical_msg(err_msg)
                sys.exit(0)

        except Exception as err_msg:
            print settings.print_critical_msg(err_msg)
        sys.exit(0)
Beispiel #8
0
def do_check():

  # Check if 'tor' is installed.
  requirment = "tor"
  requirments.do_check(requirment)

  # Check if 'privoxy' is installed.
  requirment = "privoxy"
  requirments.do_check(requirment)
    
  check_privoxy_proxy = True
  info_msg = "Testing Tor SOCKS proxy settings (" 
  info_msg += settings.PRIVOXY_IP + ":" + PRIVOXY_PORT 
  info_msg +=  ")... "
  sys.stdout.write(settings.print_info_msg(info_msg))
  sys.stdout.flush()
  try:
    privoxy_proxy = urllib2.ProxyHandler({settings.PROXY_PROTOCOL:settings.PRIVOXY_IP + ":" + PRIVOXY_PORT})
    opener = urllib2.build_opener(privoxy_proxy)
    urllib2.install_opener(opener)
  except:
    check_privoxy_proxy = False
    pass
    
  if check_privoxy_proxy:
    try:
      check_tor_page = opener.open("https://check.torproject.org/").read()
      found_ip = re.findall(r":  <strong>" + "(.*)" + "</strong></p>", check_tor_page)
      if not "You are not using Tor" in check_tor_page:
        sys.stdout.write("[" + Fore.GREEN + " SUCCEED " + Style.RESET_ALL + "]\n")
        sys.stdout.flush()
        success_msg = "Your ip address appears to be " + found_ip[0] + ".\n"
        sys.stdout.write(settings.print_success_msg(success_msg))
        warn_msg = "Increasing default value for option '--time-sec' to"
        warn_msg += " " + str(settings.TIMESEC) + " because switch '--tor' was provided."
        print settings.print_warning_msg(warn_msg)  

      else:
        print "[" + Fore.RED + " FAILED " + Style.RESET_ALL + "]"
        err_msg = "Can't establish connection with the Tor SOCKS proxy. "
        err_msg += "Please make sure that you have "
        err_msg += "Tor installed and running so "
        err_msg += "you could successfully use "
        err_msg += "switch '--tor'."
        print settings.print_critical_msg(err_msg)  
        sys.exit(0)  

    except urllib2.URLError, err_msg:
      print "[" + Fore.RED + " FAILED " + Style.RESET_ALL + "]"
      warn_msg = "Please make sure that you have "
      warn_msg += "Tor installed and running so "
      warn_msg += "you could successfully use "
      warn_msg += "switch '--tor'."
      print settings.print_warning_msg(warn_msg)  
      print settings.print_critical_msg(str(err_msg.args[0]).split("] ")[1] + ".")
      sys.exit(0)  
Beispiel #9
0
def updater():
  
  time.sleep(1)
  info_msg = "Checking requirements to update " 
  info_msg += settings.APPLICATION + " via GitHub... "
  sys.stdout.write(settings.print_info_msg(info_msg))
  sys.stdout.flush()
  # Check if windows
  if settings.IS_WINDOWS:
    print "[" + Fore.RED + " FAILED " + Style.RESET_ALL + "]"
    err_msg = "For updating purposes on Windows platform, it's recommended "
    err_msg += "to use a GitHub client for Windows (http://windows.github.com/)."
    print settings.print_critical_msg(err_msg)
    sys.exit(0)
  else:
    try:
      requirment = "git"
      # Check if 'git' is installed.
      requirments.do_check(requirment)
      if requirments.do_check(requirment) == True :
        # Check if ".git" exists!
        if os.path.isdir("./.git"):
          sys.stdout.write("[" + Fore.GREEN + " SUCCEED " + Style.RESET_ALL + "]\n")
          sys.stdout.flush()
          start = 0
          end = 0
          start = time.time()
          print "---"
          subprocess.Popen("git reset --hard HEAD && git pull", shell=True).wait()
          # Delete *.pyc files.
          subprocess.Popen("find . -name \"*.pyc\" -delete", shell=True).wait()
          # Delete empty directories and files.
          subprocess.Popen("find . -empty -type d -delete", shell=True).wait()
          print "---"
          end  = time.time()
          how_long = int(end - start)
          info_msg = "Finished in " + time.strftime('%H:%M:%S', time.gmtime(how_long)) + "."
          print settings.print_info_msg(info_msg)
          print ""
          os._exit(0)
        else:
          print "[" + Fore.RED + " FAILED " + Style.RESET_ALL + "]"
          err_msg = "The '.git' directory not found. Do it manually: " 
          err_msg += Style.BRIGHT + "'git clone " + settings.GIT_URL 
          err_msg += " " + settings.APPLICATION + "' "
          print settings.print_critical_msg(err_msg)    
          sys.exit(0)
      else:
          print "[" + Fore.RED + " FAILED " + Style.RESET_ALL + "]"
          err_msg = requirment + " not found."
          print settings.print_critical_msg(err_msg)
          sys.exit(0)

    except Exception as err_msg:
      print "\n" + settings.print_critical_msg(err_msg)
    sys.exit(0)
Beispiel #10
0
def updater():
    time.sleep(1)
    info_msg = "Checking requirements to update "
    info_msg += settings.APPLICATION + " from GitHub repository. "
    sys.stdout.write(settings.print_info_msg(info_msg))
    sys.stdout.flush()
    if menu.options.offline:
        print(settings.FAIL_STATUS)
        err_msg = "You cannot update commix via GitHub without access on the Internet."
        print(settings.print_critical_msg(err_msg))
        raise SystemExit()
    # Check if windows
    if settings.IS_WINDOWS:
        print(settings.FAIL_STATUS)
        err_msg = "For updating purposes on Windows platform, it's recommended "
        err_msg += "to use a GitHub client for Windows (http://windows.github.com/)."
        print(settings.print_critical_msg(err_msg))
        raise SystemExit()
    else:
        try:
            requirment = "git"
            # Check if 'git' is installed.
            requirments.do_check(requirment)
            if requirments.do_check(requirment) == True:
                if menu.options.verbose:
                    debug_msg = "commix will try to update itself using '" + requirment + "' command."
                    print(settings.print_debug_msg(debug_msg))
                # Check if ".git" exists!
                if os.path.isdir("./.git"):
                    sys.stdout.write(settings.SUCCESS_STATUS + "\n")
                    sys.stdout.flush()
                    info_msg = "Updating " + settings.APPLICATION + " to the latest (dev) "
                    info_msg += "version. "
                    sys.stdout.write(settings.print_info_msg(info_msg))
                    sys.stdout.flush()
                    revision_num()
                    print("")
                    os._exit(0)
                else:
                    print(settings.FAIL_STATUS)
                    err_msg = "The '.git' directory not found. Do it manually: "
                    err_msg += Style.BRIGHT + "'git clone " + settings.GIT_URL
                    err_msg += " " + settings.APPLICATION + "' "
                    print(settings.print_critical_msg(err_msg))
                    raise SystemExit()
            else:
                print(settings.FAIL_STATUS)
                err_msg = requirment + " not found."
                print(settings.print_critical_msg(err_msg))
                raise SystemExit()

        except Exception as err_msg:
            print("\n" + settings.print_critical_msg(err_msg))
        raise SystemExit()
Beispiel #11
0
def unicorn_updater(current_version):
    APPLICATION_NAME = "TrustedSec's Magic Unicorn"
    info_msg = "Checking requirements to update "
    info_msg += APPLICATION_NAME + " from GitHub repo... "
    sys.stdout.write(settings.print_info_msg(info_msg))
    sys.stdout.flush()
    if menu.options.offline:
        print "[" + Fore.RED + " FAILED " + Style.RESET_ALL + "]"
        err_msg = "You cannot update TrustedSec's Magic Unicorn "
        err_msg += "via GitHub without access on the Internet."
        print settings.print_critical_msg(err_msg)
        raise SystemExit()
    # Check if windows
    if settings.IS_WINDOWS:
        print "[" + Fore.RED + " FAILED " + Style.RESET_ALL + "]"
        err_msg = "For updating purposes on Windows platform, it's recommended "
        err_msg += "to use a GitHub client for Windows (http://windows.github.com/)."
        print settings.print_critical_msg(err_msg)
        raise SystemExit()
    else:
        try:
            requirment = "git"
            # Check if 'git' is installed.
            requirments.do_check(requirment)
            if requirments.do_check(requirment) == True:
                sys.stdout.write("[" + Fore.GREEN + " SUCCEED " +
                                 Style.RESET_ALL + "]\n")
                sys.stdout.flush()
                if len(current_version) == 0:
                    unicorn_path = os.path.abspath(
                        os.path.join(os.path.dirname(__file__), '../',
                                     'thirdparty/'))
                    os.chdir(unicorn_path)
                else:
                    os.chdir("../")
                    subprocess.Popen("rm -rf unicorn", shell=True).wait()
                info_msg = "Updating " + APPLICATION_NAME + " to the latest (dev) "
                info_msg += "version... "
                subprocess.Popen(
                    "git clone https://github.com/trustedsec/unicorn",
                    shell=True).wait()
                os.chdir("unicorn")
                sys.stdout.write(settings.print_info_msg(info_msg))
                sys.stdout.flush()
                revision_num()
            else:
                print "[" + Fore.RED + " FAILED " + Style.RESET_ALL + "]"
                err_msg = requirment + " not found."
                print settings.print_critical_msg(err_msg)
                raise SystemExit()

        except Exception as err_msg:
            print settings.print_critical_msg(err_msg)
        raise SystemExit()
Beispiel #12
0
def updater():

    time.sleep(1)
    info_msg = "Checking requirements to update "
    info_msg += settings.APPLICATION + " from GitHub repo... "
    sys.stdout.write(settings.print_info_msg(info_msg))
    sys.stdout.flush()
    if menu.options.offline:
        print "[" + Fore.RED + " FAILED " + Style.RESET_ALL + "]"
        err_msg = "You cannot update commix via GitHub without access on the Internet."
        print settings.print_critical_msg(err_msg)
        sys.exit(0)
    # Check if windows
    if settings.IS_WINDOWS:
        print "[" + Fore.RED + " FAILED " + Style.RESET_ALL + "]"
        err_msg = "For updating purposes on Windows platform, it's recommended "
        err_msg += "to use a GitHub client for Windows (http://windows.github.com/)."
        print settings.print_critical_msg(err_msg)
        sys.exit(0)
    else:
        try:
            requirment = "git"
            # Check if 'git' is installed.
            requirments.do_check(requirment)
            if requirments.do_check(requirment) == True:
                # Check if ".git" exists!
                if os.path.isdir("./.git"):
                    sys.stdout.write("[" + Fore.GREEN + " SUCCEED " +
                                     Style.RESET_ALL + "]\n")
                    sys.stdout.flush()
                    info_msg = "Updating " + settings.APPLICATION + " to the latest (dev) "
                    info_msg += "version... "
                    sys.stdout.write(settings.print_info_msg(info_msg))
                    sys.stdout.flush()
                    revision_num()
                    print ""
                    os._exit(0)
                else:
                    print "[" + Fore.RED + " FAILED " + Style.RESET_ALL + "]"
                    err_msg = "The '.git' directory not found. Do it manually: "
                    err_msg += Style.BRIGHT + "'git clone " + settings.GIT_URL
                    err_msg += " " + settings.APPLICATION + "' "
                    print settings.print_critical_msg(err_msg)
                    sys.exit(0)
            else:
                print "[" + Fore.RED + " FAILED " + Style.RESET_ALL + "]"
                err_msg = requirment + " not found."
                print settings.print_critical_msg(err_msg)
                sys.exit(0)

        except Exception as err_msg:
            print "\n" + settings.print_critical_msg(err_msg)
        sys.exit(0)
Beispiel #13
0
def updater():
  
  time.sleep(1)
  info_msg = "Checking requirements to update " 
  info_msg += settings.APPLICATION + " from GitHub repo... "
  sys.stdout.write(settings.print_info_msg(info_msg))
  sys.stdout.flush()
  if menu.options.offline:  
    print "[" + Fore.RED + " FAILED " + Style.RESET_ALL + "]"
    err_msg = "You cannot update commix via GitHub without access on the Internet."
    print settings.print_critical_msg(err_msg)
    raise SystemExit()
  # Check if windows
  if settings.IS_WINDOWS:
    print "[" + Fore.RED + " FAILED " + Style.RESET_ALL + "]"
    err_msg = "For updating purposes on Windows platform, it's recommended "
    err_msg += "to use a GitHub client for Windows (http://windows.github.com/)."
    print settings.print_critical_msg(err_msg)
    raise SystemExit()
  else:
    try:
      requirment = "git"
      # Check if 'git' is installed.
      requirments.do_check(requirment)
      if requirments.do_check(requirment) == True :
        # Check if ".git" exists!
        if os.path.isdir("./.git"):
          sys.stdout.write("[" + Fore.GREEN + " SUCCEED " + Style.RESET_ALL + "]\n")
          sys.stdout.flush()
          info_msg = "Updating " + settings.APPLICATION + " to the latest (dev) " 
          info_msg += "version... "
          sys.stdout.write(settings.print_info_msg(info_msg))
          sys.stdout.flush()
          revision_num()
          print ""
          os._exit(0)
        else:
          print "[" + Fore.RED + " FAILED " + Style.RESET_ALL + "]"
          err_msg = "The '.git' directory not found. Do it manually: " 
          err_msg += Style.BRIGHT + "'git clone " + settings.GIT_URL 
          err_msg += " " + settings.APPLICATION + "' "
          print settings.print_critical_msg(err_msg)    
          raise SystemExit()
      else:
          print "[" + Fore.RED + " FAILED " + Style.RESET_ALL + "]"
          err_msg = requirment + " not found."
          print settings.print_critical_msg(err_msg)
          raise SystemExit()

    except Exception as err_msg:
      print "\n" + settings.print_critical_msg(err_msg)
    raise SystemExit()
Beispiel #14
0
def unicorn_updater(current_version):
  APPLICATION_NAME = "TrustedSec's Magic Unicorn"
  info_msg = "Checking requirements to update " 
  info_msg += APPLICATION_NAME + " from GitHub repo... "
  sys.stdout.write(settings.print_info_msg(info_msg))
  sys.stdout.flush()
  if menu.options.offline:  
    print "[" + Fore.RED + " FAILED " + Style.RESET_ALL + "]"
    err_msg = "You cannot update TrustedSec's Magic Unicorn "
    err_msg += "via GitHub without access on the Internet."
    print settings.print_critical_msg(err_msg)
    raise SystemExit()
  # Check if windows
  if settings.IS_WINDOWS:
    print "[" + Fore.RED + " FAILED " + Style.RESET_ALL + "]"
    err_msg = "For updating purposes on Windows platform, it's recommended "
    err_msg += "to use a GitHub client for Windows (http://windows.github.com/)."
    print settings.print_critical_msg(err_msg)
    raise SystemExit()
  else:
    try:
      requirment = "git"
      # Check if 'git' is installed.
      requirments.do_check(requirment)
      if requirments.do_check(requirment) == True :
        sys.stdout.write("[" + Fore.GREEN + " SUCCEED " + Style.RESET_ALL + "]\n")
        sys.stdout.flush()
        if len(current_version) == 0:
          unicorn_path = os.path.abspath(os.path.join(os.path.dirname(__file__), '../', 'thirdparty/'))
          os.chdir(unicorn_path)
        else:
          os.chdir("../")
          subprocess.Popen("rm -rf unicorn", shell=True).wait()
        info_msg = "Updating " + APPLICATION_NAME + " to the latest (dev) " 
        info_msg += "version... "
        subprocess.Popen("git clone https://github.com/trustedsec/unicorn", shell=True).wait()
        os.chdir("unicorn")
        sys.stdout.write(settings.print_info_msg(info_msg))
        sys.stdout.flush()
        revision_num()
      else:
        print "[" + Fore.RED + " FAILED " + Style.RESET_ALL + "]"
        err_msg = requirment + " not found."
        print settings.print_critical_msg(err_msg)
        raise SystemExit()

    except Exception as err_msg:
      print settings.print_critical_msg(err_msg)
    raise SystemExit()
Beispiel #15
0
def do_check():
    # Check if 'tor' is installed.
    requirment = "tor"
    requirments.do_check(requirment)

    # Check if 'privoxy' is installed.
    requirment = "privoxy"
    requirments.do_check(requirment)

    check_privoxy_proxy = True
    info_msg = "Testing Tor SOCKS proxy settings "
    info_msg += settings.PRIVOXY_IP + ":" + PRIVOXY_PORT + "... "
    sys.stdout.write(settings.print_info_msg(info_msg))
    sys.stdout.flush()

    try:
        privoxy_proxy = urllib2.ProxyHandler({
            settings.PROXY_PROTOCOL:
            settings.PRIVOXY_IP + ":" + PRIVOXY_PORT
        })
        opener = urllib2.build_opener(privoxy_proxy)
        urllib2.install_opener(opener)

    except:
        check_privoxy_proxy = False
        pass

    if check_privoxy_proxy:
        try:
            check_ip = opener.open("https://check.torproject.org/").read()
            new_ip = re.findall(r":  <strong>" + "(.*)" + "</strong></p>",
                                check_ip)
            sys.stdout.write("[" + Fore.GREEN + " SUCCEED " + Style.RESET_ALL +
                             "]\n")
            sys.stdout.flush()
            success_msg = "Your ip address appears to be " + new_ip[0] + ".\n"
            sys.stdout.write(settings.print_success_msg(success_msg))

        except urllib2.URLError, err_msg:
            print "[" + Fore.RED + " FAILED " + Style.RESET_ALL + "]"
            warn_msg = "Please make sure that you have "
            warn_msg += "Tor installed and running so "
            warn_msg += "you could successfully use "
            warn_msg += "switch '--tor'."
            print settings.print_warning_msg(warn_msg)
            print settings.print_critical_msg(
                str(err_msg.args[0]).split("] ")[1] + ".")
            sys.exit(0)
Beispiel #16
0
def do_check():
    # Check if 'tor' is installed.
    requirment = "tor"
    requirments.do_check(requirment)

    # Check if 'privoxy' is installed.
    requirment = "privoxy"
    requirments.do_check(requirment)

    check_privoxy_proxy = True
    info_msg = "Testing privoxy proxy settings "
    info_msg += settings.PRIVOXY_IP + ":" + PRIVOXY_PORT + "... "
    sys.stdout.write(settings.print_info_msg(info_msg))
    sys.stdout.flush()

    try:
        privoxy_proxy = urllib2.ProxyHandler({
            settings.PROXY_PROTOCOL:
            settings.PRIVOXY_IP + ":" + PRIVOXY_PORT
        })
        opener = urllib2.build_opener(privoxy_proxy)
        urllib2.install_opener(opener)

    except:
        check_privoxy_proxy = False
        pass

    if check_privoxy_proxy:
        try:
            new_ip = opener.open("http://icanhazip.com/").read()
            sys.stdout.write("[" + Fore.GREEN + " SUCCEED " + Style.RESET_ALL +
                             "]\n")
            sys.stdout.flush()
            success_msg = "Your ip address appears to be " + new_ip
            sys.stdout.write(settings.print_success_msg(success_msg))

        except urllib2.URLError, err_msg:
            print "[" + Fore.RED + " FAILED " + Style.RESET_ALL + "]"
            print settings.print_critical_msg(err_msg)
            sys.exit(0)

        except urllib2.HTTPError, err_msg:
            print "[" + Fore.RED + " FAILED " + Style.RESET_ALL + "]"
            print settings.print_critical_msg(err_msg)
            sys.exit(0)
Beispiel #17
0
def updater():

    time.sleep(1)
    sys.stdout.write("(*) Checking requirements to update " +
                     settings.APPLICATION + " via GitHub... ")
    sys.stdout.flush()
    # Check if windows
    if settings.IS_WINDOWS:
        print "[" + Fore.RED + " FAILED " + Style.RESET_ALL + "]"
        print Back.RED + "(x) Error: For updating purposes on Windows platform, it's recommended to use a GitHub client for Windows (http://windows.github.com/)." + Style.RESET_ALL
        sys.exit(0)
    else:
        try:
            requirment = "git"
            # Check if 'git' is installed.
            requirments.do_check(requirment)
            if requirments.do_check(requirment) == True:
                # Check if ".git" exists!
                if os.path.isdir("./.git"):
                    sys.stdout.write("[" + Fore.GREEN + " SUCCEED " +
                                     Style.RESET_ALL + "]\n")
                    sys.stdout.flush()
                    print "\n---"
                    subprocess.Popen("git reset --hard HEAD && git pull",
                                     shell=True).wait()
                    # Delete *.pyc files.
                    subprocess.Popen("find . -name \"*.pyc\" -delete",
                                     shell=True).wait()
                    # Delete empty directories and files.
                    subprocess.Popen("find . -empty -type d -delete",
                                     shell=True).wait()
                    print "---\n"
                else:
                    print "[" + Fore.RED + " FAILED " + Style.RESET_ALL + "]"
                    print Back.RED + "(x) Error: The '.git' directory not found. Do it manually: " + Style.BRIGHT + "'git clone " + settings.GIT_URL + " " + settings.APPLICATION + "' " + Style.RESET_ALL
                    sys.exit(0)
            else:
                print "[" + Fore.RED + " FAILED " + Style.RESET_ALL + "]"
                print Back.RED + "(x) Error: " + requirment + " not found." + Style.RESET_ALL + "\n"
                sys.exit(0)

        except Exception as error:
            print Back.RED + "\n(x) Error: " + str(
                error) + Style.RESET_ALL + "\n"
        sys.exit(0)
Beispiel #18
0
def do_check():
    # Check if 'tor' is installed.
    requirment = "tor"
    requirments.do_check(requirment)

    # Check if 'privoxy' is installed.
    requirment = "privoxy"
    requirments.do_check(requirment)

    check_privoxy_proxy = True
    sys.stdout.write("(*) Testing privoxy proxy settings " +
                     settings.PRIVOXY_IP + ":" + PRIVOXY_PORT + "... ")
    sys.stdout.flush()

    try:
        privoxy_proxy = urllib2.ProxyHandler({
            settings.PROXY_PROTOCOL:
            settings.PRIVOXY_IP + ":" + PRIVOXY_PORT
        })
        opener = urllib2.build_opener(privoxy_proxy)
        urllib2.install_opener(opener)

    except:
        check_privoxy_proxy = False
        pass

    if check_privoxy_proxy:
        try:
            new_ip = opener.open("http://icanhazip.com/").read()
            sys.stdout.write("[" + Fore.GREEN + " SUCCEED " + Style.RESET_ALL +
                             "]\n")
            sys.stdout.flush()
            sys.stdout.write(Style.BRIGHT +
                             "(!) Your ip address appears to be " +
                             Style.UNDERLINE + new_ip + Style.RESET_ALL)

        except urllib2.URLError, err:
            print "[" + Fore.RED + " FAILED " + Style.RESET_ALL + "]"
            print Back.RED + "(x) Error: " + str(err) + Style.RESET_ALL
            sys.exit(0)

        except urllib2.HTTPError, err:
            print "[" + Fore.RED + " FAILED " + Style.RESET_ALL + "]"
            print Back.RED + "(x) Error: " + str(err) + Style.RESET_ALL
            sys.exit(0)
Beispiel #19
0
def do_check():
  # Check if 'tor' is installed.
  requirment = "tor"
  requirments.do_check(requirment)

  # Check if 'privoxy' is installed.
  requirment = "privoxy"
  requirments.do_check(requirment)
    
  check_privoxy_proxy = True
  info_msg = "Testing privoxy proxy settings " 
  info_msg += settings.PRIVOXY_IP + ":" + PRIVOXY_PORT + "... "
  sys.stdout.write(settings.print_info_msg(info_msg))
  sys.stdout.flush()

  try:
    privoxy_proxy = urllib2.ProxyHandler({settings.PROXY_PROTOCOL:settings.PRIVOXY_IP + ":" + PRIVOXY_PORT})
    opener = urllib2.build_opener(privoxy_proxy)
    urllib2.install_opener(opener)

  except:
    check_privoxy_proxy = False
    pass
    
  if check_privoxy_proxy:
    try:     
      new_ip = opener.open("http://icanhazip.com/").read()
      sys.stdout.write("[" + Fore.GREEN + " SUCCEED " + Style.RESET_ALL + "]\n")
      sys.stdout.flush()
      success_msg = + "Your ip address appears to be " + Style.UNDERLINE + new_ip
      sys.stdout.write(settings.print_success_msg(success_msg))

    except urllib2.URLError, err_msg:
      print "[" + Fore.RED + " FAILED " + Style.RESET_ALL + "]"
      print settings.print_error_msg(err_msg)
      sys.exit(0)
      
    except urllib2.HTTPError, err_msg:
      print "[" + Fore.RED + " FAILED " + Style.RESET_ALL + "]"
      print settings.print_error_msg(err_msg)
      sys.exit(0)
Beispiel #20
0
def updater():

  time.sleep(1)
  sys.stdout.write("(*) Checking requirements to update "+ settings.APPLICATION + " via GitHub... ")
  sys.stdout.flush()
  # Check if windows
  if settings.IS_WINDOWS:
    print "["+ Fore.RED + " FAILED " + Style.RESET_ALL +"]"
    print Back.RED + "(x) Error: For updating purposes on Windows platform, it's recommended to use a GitHub client for Windows (http://windows.github.com/)." + Style.RESET_ALL
    sys.exit(0)
  else:
    try:
      requirment = "git"
      # Check if 'git' is installed.
      requirments.do_check(requirment)
      if requirments.do_check(requirment) == True :
        # Check if ".git" exists!
        if os.path.isdir("./.git"):
          sys.stdout.write("[" + Fore.GREEN + " SUCCEED " + Style.RESET_ALL + "]\n")
          sys.stdout.flush()
          print "\n---"
          subprocess.Popen("git reset --hard HEAD && git pull", shell=True).wait()
          # Delete *.pyc files.
          subprocess.Popen("find . -name \"*.pyc\" -delete", shell=True).wait()
          # Delete empty directories and files.
          subprocess.Popen("find . -empty -type d -delete", shell=True).wait()
          print "---\n"
        else:
          print "["+ Fore.RED + " FAILED " + Style.RESET_ALL +"]"
          print Back.RED + "(x) Error: The '.git' directory not found. Do it manually: "+ Style.BRIGHT +"'git clone " + settings.GIT_URL + " " + settings.APPLICATION +"' "+ Style.RESET_ALL    
          sys.exit(0)
      else:
          print "["+ Fore.RED + " FAILED " + Style.RESET_ALL +"]"
          print Back.RED + "(x) Error: " + requirment + " not found." + Style.RESET_ALL + "\n"
          sys.exit(0)

    except Exception as error:
      print Back.RED + "\n(x) Error: " + str(error) + Style.RESET_ALL + "\n" 
    sys.exit(0)
Beispiel #21
0
def do_check():
  # Check if 'tor' is installed.
  requirment = "tor"
  requirments.do_check(requirment)

  # Check if 'privoxy' is installed.
  requirment = "privoxy"
  requirments.do_check(requirment)
    
  check_privoxy_proxy = True
  sys.stdout.write("(*) Testing privoxy proxy settings " + settings.PRIVOXY_IP + ":" + PRIVOXY_PORT + "... ")
  sys.stdout.flush()

  try:
    privoxy_proxy = urllib2.ProxyHandler({settings.PROXY_PROTOCOL:settings.PRIVOXY_IP + ":" + PRIVOXY_PORT})
    opener = urllib2.build_opener(privoxy_proxy)
    urllib2.install_opener(opener)

  except:
    check_privoxy_proxy = False
    pass
    
  if check_privoxy_proxy:
    try:     
      new_ip = opener.open("http://icanhazip.com/").read()
      sys.stdout.write("[" + Fore.GREEN + " SUCCEED " + Style.RESET_ALL + "]\n")
      sys.stdout.flush()
      sys.stdout.write(Style.BRIGHT + "(!) Your ip address appears to be " + Style.UNDERLINE + new_ip + Style.RESET_ALL)

    except urllib2.URLError, err:
      print "[" + Fore.RED + " FAILED " + Style.RESET_ALL + "]"
      print Back.RED + "(x) Error: " + str(err) + Style.RESET_ALL
      sys.exit(0)
      
    except urllib2.HTTPError, err:
      print "[" + Fore.RED + " FAILED " + Style.RESET_ALL + "]"
      print Back.RED + "(x) Error: " + str(err) + Style.RESET_ALL
      sys.exit(0)
Beispiel #22
0
def installer():
    packages = "build-essential python-dev"
    dependencies = "git python-pip"

    info_msg = "Starting the installer... "
    sys.stdout.write(settings.print_info_msg(info_msg))
    sys.stdout.flush()

    # Check if OS is Linux.
    if platform.system() == "Linux":

        # You need to have root privileges to run this script
        if os.geteuid() != 0:
            print "[" + Fore.RED + " FAILED " + Style.RESET_ALL + "]"
            err_msg = "You need to have root privileges to run this option!"
            print settings.print_critical_msg(err_msg)
            sys.exit(0)

        # Check if commix is already installed.
        if os.path.isdir("/usr/share/" + settings.APPLICATION + ""):
            print "[" + Fore.RED + " FAILED " + Style.RESET_ALL + "]"
            warn_msg = "It seems that " + settings.APPLICATION
            warn_msg += " is already installed in your system."
            print settings.print_warning_msg(warn_msg)
            while True:
                question_msg = "Do you want to remove commix? [Y/n/q] > "
                sys.stdout.write(settings.print_question_msg(question_msg))
                uninstall = sys.stdin.readline().replace("\n", "").lower()
                if uninstall in settings.CHOICE_YES:
                    uninstaller()
                    sys.exit(0)
                elif uninstall in settings.CHOICE_NO or \
                uninstall in settings.CHOICE_QUIT:
                    sys.exit(0)
                else:
                    if uninstall == "":
                        uninstall = "enter"
                    err_msg = "'" + uninstall + "' is not a valid answer."
                    print settings.print_error_msg(err_msg)
                    pass

        # Check for git.
        if not os.path.isfile("/usr/bin/git") or not os.path.isfile(
                "/usr/bin/pip"):
            # Install requirement.
            if os.path.isfile("/etc/apt/sources.list"):
                sys.stdout.write("[" + Fore.GREEN + " SUCCEED " +
                                 Style.RESET_ALL + "]\n")
                sys.stdout.flush()
                # Check for dependencies.
                dependencies_items = dependencies.split()
                for item in dependencies_items:
                    requirments.do_check(item)
            else:
                print "[" + Fore.RED + " FAILED " + Style.RESET_ALL + "]"
                err_msg = "The installer is not designed for any "
                err_msg += "other Linux distro than Ubuntu / Debian."
                print settings.print_critical_msg(err_msg)
                err_msg = "    Please install manually: " + dependencies
                print Back.RED + err_msg + Style.RESET_ALL
                print ""
                sys.exit(0)

        # Force install of necessary packages
        subprocess.Popen("apt-get --force-yes -y install " + packages +
                         ">/dev/null 2>&1",
                         shell=True).wait()
        sys.stdout.write("[" + Fore.GREEN + " SUCCEED " + Style.RESET_ALL +
                         "]\n")
        sys.stdout.flush()

        info_msg = "Installing " + settings.APPLICATION
        info_msg += " into the /usr/share/" + settings.APPLICATION + "... "
        sys.stdout.write(settings.print_info_msg(info_msg))
        try:
            current_dir = os.getcwd()
            subprocess.Popen("cp -r " + current_dir + " /usr/share/" +
                             settings.APPLICATION + " >/dev/null 2>&1",
                             shell=True).wait()
            subprocess.Popen("chmod 775 /usr/share/" + settings.APPLICATION +
                             "/" + settings.APPLICATION +
                             ".py >/dev/null 2>&1",
                             shell=True).wait()
        except:
            print "[" + Fore.RED + " FAILED " + Style.RESET_ALL + "]"
            sys.exit(0)
        sys.stdout.write("[" + Fore.GREEN + " SUCCEED " + Style.RESET_ALL +
                         "]\n")
        sys.stdout.flush()

        info_msg = "Installing " + settings.APPLICATION
        info_msg += " to /usr/bin/" + settings.APPLICATION + "... "
        sys.stdout.write(settings.print_info_msg(info_msg))
        try:
            with open("/usr/bin/" + settings.APPLICATION, 'w') as f:
                f.write('#!/bin/bash\n')
                f.write('cd /usr/share/commix/ && ./commix.py "$@"\n')
                subprocess.Popen("chmod +x /usr/bin/" + settings.APPLICATION +
                                 " >/dev/null 2>&1",
                                 shell=True).wait()
        except:
            print "[" + Fore.RED + " FAILED " + Style.RESET_ALL + "]"
            sys.exit(0)
        sys.stdout.write("[" + Fore.GREEN + " SUCCEED " + Style.RESET_ALL +
                         "]\n")
        sys.stdout.flush()

        #Create the Output Directory
        OUTPUT_DIR = ".output/"
        try:
            os.stat(OUTPUT_DIR)
        except:
            os.mkdir(OUTPUT_DIR)

        success_msg = "The installation is finished! Type '"
        success_msg += settings.APPLICATION + "' to launch it."
        print settings.print_success_msg(success_msg)

    else:
        print "[" + Fore.RED + " FAILED " + Style.RESET_ALL + "]"
        err_msg = "The installer is not designed for any other system other than Linux."
        print settings.print_critical_msg(err_msg)
        err_msg = "    Please install manually: " + packages + dependencies
        print settings.print_critical_msg(err_msg)
        print ""
        sys.exit(0)

    #eof
Beispiel #23
0
def installer():
    packages = "build-essential python-dev"
    dependencies = "git python-pip"

    info_msg = "Starting the installer. "
    sys.stdout.write(settings.print_info_msg(info_msg))
    sys.stdout.flush()

    # Check if OS is Linux.
    if settings.PLATFORM == "posix":
        # You need to have administrative privileges to run this script.
        if not common.running_as_admin():
            print(settings.SINGLE_WHITESPACE)
            err_msg = "You need to have administrative privileges to run this option."
            print(settings.print_critical_msg(err_msg))
            raise SystemExit()

        # Check if commix is already installed.
        if os.path.isdir("/usr/share/" + settings.APPLICATION + ""):
            print(settings.SINGLE_WHITESPACE)
            warn_msg = "It seems that " + settings.APPLICATION
            warn_msg += " is already installed in your system."
            print(settings.print_warning_msg(warn_msg))
            while True:
                if not menu.options.batch:
                    question_msg = "Do you want to remove commix? [Y/n] > "
                    uninstall = _input(
                        settings.print_question_msg(question_msg))
                else:
                    uninstall = ""
                if len(uninstall) == 0:
                    uninstall = "Y"
                if uninstall in settings.CHOICE_YES:
                    uninstaller()
                    raise SystemExit()
                elif uninstall in settings.CHOICE_NO or \
                uninstall in settings.CHOICE_QUIT:
                    raise SystemExit()
                else:
                    err_msg = "'" + uninstall + "' is not a valid answer."
                    print(settings.print_error_msg(err_msg))
                    pass

        # Check for git.
        if not os.path.isfile("/usr/bin/git") or not os.path.isfile(
                "/usr/bin/pip"):
            # Install requirement.
            if os.path.isfile("/etc/apt/sources.list"):
                sys.stdout.write(settings.SUCCESS_STATUS + "\n")
                sys.stdout.flush()
                # Check for dependencies.
                dependencies_items = dependencies.split()
                for item in dependencies_items:
                    requirments.do_check(item)
            else:
                print(settings.SINGLE_WHITESPACE)
                err_msg = "The installer is not designed for any "
                err_msg += "other Linux distro than Ubuntu / Debian. "
                err_msg += "Please install manually: " + dependencies
                print(settings.print_critical_msg(err_msg))
                print(settings.SINGLE_WHITESPACE)
                raise SystemExit()

        # Force install of necessary packages
        subprocess.Popen("apt-get --force-yes -y install " + packages +
                         ">/dev/null 2>&1",
                         shell=True).wait()
        sys.stdout.write(settings.SUCCESS_STATUS + "\n")
        sys.stdout.flush()

        info_msg = "Installing " + settings.APPLICATION
        info_msg += " into the /usr/share/" + settings.APPLICATION + ". "
        sys.stdout.write(settings.print_info_msg(info_msg))
        try:
            current_dir = os.getcwd()
            subprocess.Popen("cp -r " + current_dir + " /usr/share/" +
                             settings.APPLICATION + " >/dev/null 2>&1",
                             shell=True).wait()
            subprocess.Popen("chmod 775 /usr/share/" + settings.APPLICATION +
                             "/" + settings.APPLICATION +
                             ".py >/dev/null 2>&1",
                             shell=True).wait()
        except:
            print(settings.SINGLE_WHITESPACE)
            raise SystemExit()
        sys.stdout.write(settings.SUCCESS_STATUS + "\n")
        sys.stdout.flush()

        info_msg = "Installing " + settings.APPLICATION
        info_msg += " to /usr/bin/" + settings.APPLICATION + ". "
        sys.stdout.write(settings.print_info_msg(info_msg))
        try:
            with open("/usr/bin/" + settings.APPLICATION, 'w') as f:
                f.write('#!/bin/bash\n')
                f.write('cd /usr/share/commix/ && ./commix.py "$@"\n')
                subprocess.Popen("chmod +x /usr/bin/" + settings.APPLICATION +
                                 " >/dev/null 2>&1",
                                 shell=True).wait()
        except:
            print(settings.SINGLE_WHITESPACE)
            raise SystemExit()
        sys.stdout.write(settings.SUCCESS_STATUS + "\n")
        sys.stdout.flush()

        #Create the Output Directory
        try:
            os.stat(settings.OUTPUT_DIR)
        except:
            try:
                os.mkdir(settings.OUTPUT_DIR)
            except OSError as err_msg:
                try:
                    error_msg = str(err_msg).split("] ")[1] + "."
                except IndexError:
                    error_msg = str(err_msg) + "."
                print(settings.print_critical_msg(error_msg))
                raise SystemExit()

        info_msg = "The installation is finished! Type '"
        info_msg += settings.APPLICATION + "' to launch it."
        print(settings.print_bold_info_msg(info_msg))

    else:
        print(settings.SINGLE_WHITESPACE)
        err_msg = "The installer is not designed for any other system other than Linux. "
        err_msg += "Please install manually: " + packages + dependencies
        print(settings.print_critical_msg(err_msg))
        print(settings.SINGLE_WHITESPACE)
        raise SystemExit()

    # eof
Beispiel #24
0
def installer():
  packages = "build-essential python-dev"
  dependencies = "git python-pip"
  
  sys.stdout.write("(*) Starting the installer... ")
  sys.stdout.flush()
  
  # Check if OS is Linux.
  if platform.system() == "Linux":
    
    # You need to have root privileges to run this script
    if os.geteuid() != 0:
      print Back.RED + "\n(x) Error: You need to have root privileges to run this option!\n" + Style.RESET_ALL
      sys.exit(0)
      
    # Check if commix is already installed.
    if os.path.isdir("/usr/share/"  + settings.APPLICATION + ""):
      print "[" + Fore.RED + " FAILED " + Style.RESET_ALL + "]" 
      print Fore.YELLOW + "(^) Warning: It seems that "  + settings.APPLICATION + " is already installed in your system." + Style.RESET_ALL
      while True:
        uninstall = raw_input("(?) Do you want to remove commix? [Y/n/q] > ").lower()
        if uninstall in settings.CHOISE_YES:
          uninstaller()
          sys.exit(0)
        elif uninstall in settings.CHOISE_NO or \
        uninstall in settings.CHOISE_QUIT: 
          sys.exit(0)
        else:
          if uninstall == "":
            uninstall = "enter"
          print Back.RED + "(x) Error: '" + uninstall + "' is not a valid answer." + Style.RESET_ALL
          pass
      
    # Check for git.
    if not os.path.isfile("/usr/bin/git") or not os.path.isfile("/usr/bin/pip"):
      # Install requirement.
      if os.path.isfile("/etc/apt/sources.list"):
        sys.stdout.write("[" + Fore.GREEN + " SUCCEED " + Style.RESET_ALL + "]\n")
        sys.stdout.flush()
        # Check for dependencies.
        dependencies_items = dependencies.split()
        for item in dependencies_items:
          requirments.do_check(item)
      else:
        print "[" + Fore.RED + " FAILED " + Style.RESET_ALL + "]"
        print Back.RED + "(x) Error: The installer is not designed for any other Linux distro than Ubuntu / Debian." + Style.RESET_ALL
        print Back.RED + "    Please install manually: " + dependencies + Style.RESET_ALL
        print ""
        sys.exit(0)
        
    # Force install of necessary packages
    subprocess.Popen("apt-get --force-yes -y install " + packages + ">/dev/null 2>&1", shell=True).wait()
    sys.stdout.write("[" + Fore.GREEN + " SUCCEED " + Style.RESET_ALL + "]\n")
    sys.stdout.flush()
    
    sys.stdout.write("(*) Installing "  + settings.APPLICATION + " into the /usr/share/"  + settings.APPLICATION + "... ")
    try:
      current_dir = os.getcwd()
      subprocess.Popen("cp -r " + current_dir + " /usr/share/" + settings.APPLICATION + " >/dev/null 2>&1", shell=True).wait()
      subprocess.Popen("chmod 775 /usr/share/"  + settings.APPLICATION + "/" + settings.APPLICATION + ".py >/dev/null 2>&1", shell=True).wait()
    except:
      print "[" + Fore.RED + " FAILED " + Style.RESET_ALL + "]"
      sys.exit(0)
    sys.stdout.write("[" + Fore.GREEN + " SUCCEED " + Style.RESET_ALL + "]\n")
    sys.stdout.flush()
    
    sys.stdout.write("(*) Installing "  + settings.APPLICATION + " to /usr/bin/"  + settings.APPLICATION + "... ")
    try:    
      with open("/usr/bin/" + settings.APPLICATION, 'w') as f:
        f.write('#!/bin/bash\n')
        f.write('cd /usr/share/commix/ && ./commix.py "$@"\n')
        subprocess.Popen("chmod +x /usr/bin/"  + settings.APPLICATION + " >/dev/null 2>&1", shell=True).wait()
    except:
      print "[" + Fore.RED + " FAILED " + Style.RESET_ALL + "]"
      sys.exit(0)
    sys.stdout.write("[" + Fore.GREEN + " SUCCEED " + Style.RESET_ALL + "]\n")
    sys.stdout.flush()
    
    #Create the Output Directory
    OUTPUT_DIR = ".output/"
    try:
        os.stat(OUTPUT_DIR)
    except:
        os.mkdir(OUTPUT_DIR)  
    
    print Style.BRIGHT + "(!) The installation is finished! Type '"  + settings.APPLICATION + "' to launch it." + Style.RESET_ALL

  else :
    print "[" + Fore.RED + " FAILED " + Style.RESET_ALL + "]"
    print Back.RED + "(x) Error: The installer is not designed for any other system other than Linux." + Style.RESET_ALL
    print Back.RED + "    Please install manually: " + packages + dependencies + Style.RESET_ALL
    print ""
    sys.exit(0)
Beispiel #25
0
def do_check():

  # Check if 'tor' is installed.
  requirment = "tor"
  requirments.do_check(requirment)

  # Check if 'privoxy' is installed.
  requirment = "privoxy"
  requirments.do_check(requirment)
    
  check_privoxy_proxy = True
  info_msg = "Testing Tor SOCKS proxy settings (" 
  info_msg += settings.PRIVOXY_IP + ":" + PRIVOXY_PORT 
  info_msg +=  "). "
  sys.stdout.write(settings.print_info_msg(info_msg))
  sys.stdout.flush()
  try:
    privoxy_proxy = _urllib.request.ProxyHandler({settings.SCHEME:settings.PRIVOXY_IP + ":" + PRIVOXY_PORT})
    opener = _urllib.request.build_opener(privoxy_proxy)
    _urllib.request.install_opener(opener)
  except:
    check_privoxy_proxy = False
    pass
    
  if check_privoxy_proxy:
    try:
      check_tor_page = opener.open("https://check.torproject.org/").read()
      found_ip = re.findall(r":  <strong>" + "(.*)" + "</strong></p>", check_tor_page)
      if not "You are not using Tor" in check_tor_page:
        sys.stdout.write(settings.SUCCESS_STATUS + "\n")
        sys.stdout.flush()
        if menu.options.tor_check:
          info_msg = "Tor connection is properly set. "
        else:
          info_msg = ""
        info_msg += "Your ip address appears to be " + found_ip[0] + ".\n"
        sys.stdout.write(settings.print_bold_info_msg(info_msg))
        warn_msg = "Increasing default value for option '--time-sec' to"
        warn_msg += " " + str(settings.TIMESEC) + " because switch '--tor' was provided."
        print(settings.print_warning_msg(warn_msg))  

      else:
        print(settings.FAIL_STATUS)
        if menu.options.tor_check:
          err_msg = "It seems that your Tor connection is not properly set. "
        else:
          err_msg = "" 
        err_msg += "Can't establish connection with the Tor SOCKS proxy. "
        err_msg += "Please make sure that you have "
        err_msg += "Tor installed and running so "
        err_msg += "you could successfully use "
        err_msg += "switch '--tor'."
        print(settings.print_critical_msg(err_msg))  
        raise SystemExit() 

    except _urllib.error.URLError as err_msg:
      print(settings.FAIL_STATUS)
      if menu.options.tor_check:
        err_msg = "It seems that your Tor connection is not properly set. "
      else:
        err_msg = ""
      err_msg = "Please make sure that you have "
      err_msg += "Tor installed and running so "
      err_msg += "you could successfully use "
      err_msg += "switch '--tor'."
      print(settings.print_critical_msg(err_msg))  
      raise SystemExit()  

    except _http_client.BadStatusLine as err_msg:
      print(settings.FAIL_STATUS)
      if len(err_msg.line) > 2 :
        print(err_msg.line, err_msg.message)
      raise SystemExit()
Beispiel #26
0
def installer():
  packages = "build-essential python-dev"
  dependencies = "git python-pip"
  
  info_msg = "Starting the installer... "
  sys.stdout.write(settings.print_info_msg(info_msg))
  sys.stdout.flush()
  
  # Check if OS is Linux.
  if platform.system() == "Linux":
    
    # You need to have root privileges to run this script
    if os.geteuid() != 0:
      print "[" + Fore.RED + " FAILED " + Style.RESET_ALL + "]" 
      err_msg = "You need to have root privileges to run this option!"
      print settings.print_critical_msg(err_msg)
      sys.exit(0)
      
    # Check if commix is already installed.
    if os.path.isdir("/usr/share/"  + settings.APPLICATION + ""):
      print "[" + Fore.RED + " FAILED " + Style.RESET_ALL + "]" 
      warn_msg = "It seems that "  + settings.APPLICATION 
      warn_msg += " is already installed in your system."
      print settings.print_warning_msg(warn_msg)
      while True:
        question_msg = "Do you want to remove commix? [Y/n/q] > "
        sys.stdout.write(settings.print_question_msg(question_msg))
        uninstall = sys.stdin.readline().replace("\n","").lower()
        if uninstall in settings.CHOICE_YES:
          uninstaller()
          sys.exit(0)
        elif uninstall in settings.CHOICE_NO or \
        uninstall in settings.CHOICE_QUIT: 
          sys.exit(0)
        else:
          if uninstall == "":
            uninstall = "enter"
          err_msg = "'" + uninstall + "' is not a valid answer."
          print settings.print_error_msg(err_msg)
          pass
      
    # Check for git.
    if not os.path.isfile("/usr/bin/git") or not os.path.isfile("/usr/bin/pip"):
      # Install requirement.
      if os.path.isfile("/etc/apt/sources.list"):
        sys.stdout.write("[" + Fore.GREEN + " SUCCEED " + Style.RESET_ALL + "]\n")
        sys.stdout.flush()
        # Check for dependencies.
        dependencies_items = dependencies.split()
        for item in dependencies_items:
          requirments.do_check(item)
      else:
        print "[" + Fore.RED + " FAILED " + Style.RESET_ALL + "]"
        err_msg = "The installer is not designed for any "
        err_msg += "other Linux distro than Ubuntu / Debian." 
        print settings.print_critical_msg(err_msg)
        err_msg = "    Please install manually: " + dependencies
        print Back.RED + err_msg + Style.RESET_ALL
        print ""
        sys.exit(0)
        
    # Force install of necessary packages
    subprocess.Popen("apt-get --force-yes -y install " + packages + ">/dev/null 2>&1", shell=True).wait()
    sys.stdout.write("[" + Fore.GREEN + " SUCCEED " + Style.RESET_ALL + "]\n")
    sys.stdout.flush()

    info_msg =  "Installing " + settings.APPLICATION 
    info_msg += " into the /usr/share/"  + settings.APPLICATION + "... "
    sys.stdout.write(settings.print_info_msg(info_msg))
    try:
      current_dir = os.getcwd()
      subprocess.Popen("cp -r " + current_dir + " /usr/share/" + settings.APPLICATION + " >/dev/null 2>&1", shell=True).wait()
      subprocess.Popen("chmod 775 /usr/share/"  + settings.APPLICATION + "/" + settings.APPLICATION + ".py >/dev/null 2>&1", shell=True).wait()
    except:
      print "[" + Fore.RED + " FAILED " + Style.RESET_ALL + "]"
      sys.exit(0)
    sys.stdout.write("[" + Fore.GREEN + " SUCCEED " + Style.RESET_ALL + "]\n")
    sys.stdout.flush()
    
    info_msg = "Installing "  + settings.APPLICATION 
    info_msg += " to /usr/bin/"  + settings.APPLICATION + "... "
    sys.stdout.write(settings.print_info_msg(info_msg))
    try:    
      with open("/usr/bin/" + settings.APPLICATION, 'w') as f:
        f.write('#!/bin/bash\n')
        f.write('cd /usr/share/commix/ && ./commix.py "$@"\n')
        subprocess.Popen("chmod +x /usr/bin/"  + settings.APPLICATION + " >/dev/null 2>&1", shell=True).wait()
    except:
      print "[" + Fore.RED + " FAILED " + Style.RESET_ALL + "]"
      sys.exit(0)
    sys.stdout.write("[" + Fore.GREEN + " SUCCEED " + Style.RESET_ALL + "]\n")
    sys.stdout.flush()
    
    #Create the Output Directory
    OUTPUT_DIR = ".output/"
    try:
        os.stat(OUTPUT_DIR)
    except:
        os.mkdir(OUTPUT_DIR)  
    
    success_msg = "The installation is finished! Type '"  
    success_msg += settings.APPLICATION + "' to launch it." 
    print settings.print_success_msg(success_msg)

  else :
    print "[" + Fore.RED + " FAILED " + Style.RESET_ALL + "]"
    err_msg = "The installer is not designed for any other system other than Linux."
    print settings.print_critical_msg(err_msg)
    err_msg = "    Please install manually: " + packages + dependencies
    print settings.print_critical_msg(err_msg)
    print ""
    sys.exit(0)

  #eof
Beispiel #27
0
def do_check():

  # Check if 'tor' is installed.
  requirment = "tor"
  requirments.do_check(requirment)

  # Check if 'privoxy' is installed.
  requirment = "privoxy"
  requirments.do_check(requirment)
    
  check_privoxy_proxy = True
  info_msg = "Testing Tor SOCKS proxy settings (" 
  info_msg += settings.PRIVOXY_IP + ":" + PRIVOXY_PORT 
  info_msg +=  ")... "
  sys.stdout.write(settings.print_info_msg(info_msg))
  sys.stdout.flush()
  try:
    privoxy_proxy = urllib2.ProxyHandler({settings.SCHEME:settings.PRIVOXY_IP + ":" + PRIVOXY_PORT})
    opener = urllib2.build_opener(privoxy_proxy)
    urllib2.install_opener(opener)
  except:
    check_privoxy_proxy = False
    pass
    
  if check_privoxy_proxy:
    try:
      check_tor_page = opener.open("https://check.torproject.org/").read()
      found_ip = re.findall(r":  <strong>" + "(.*)" + "</strong></p>", check_tor_page)
      if not "You are not using Tor" in check_tor_page:
        sys.stdout.write("[" + Fore.GREEN + " SUCCEED " + Style.RESET_ALL + "]\n")
        sys.stdout.flush()
        if menu.options.tor_check:
          success_msg = "Tor connection is properly set. "
        else:
          success_msg = ""
        success_msg += "Your ip address appears to be " + found_ip[0] + ".\n"
        sys.stdout.write(settings.print_success_msg(success_msg))
        warn_msg = "Increasing default value for option '--time-sec' to"
        warn_msg += " " + str(settings.TIMESEC) + " because switch '--tor' was provided."
        print settings.print_warning_msg(warn_msg)  

      else:
        print "[" + Fore.RED + " FAILED " + Style.RESET_ALL + "]"
        if menu.options.tor_check:
          err_msg = "It seems that your Tor connection is not properly set. "
        else:
          err_msg = "" 
        err_msg += "Can't establish connection with the Tor SOCKS proxy. "
        err_msg += "Please make sure that you have "
        err_msg += "Tor installed and running so "
        err_msg += "you could successfully use "
        err_msg += "switch '--tor'."
        print settings.print_critical_msg(err_msg)  
        raise SystemExit() 

    except urllib2.URLError, err_msg:
      print "[" + Fore.RED + " FAILED " + Style.RESET_ALL + "]"
      if menu.options.tor_check:
        err_msg = "It seems that your Tor connection is not properly set. "
      else:
        err_msg = ""
      err_msg = "Please make sure that you have "
      err_msg += "Tor installed and running so "
      err_msg += "you could successfully use "
      err_msg += "switch '--tor'."
      print settings.print_critical_msg(err_msg)  
      raise SystemExit()  

    except httplib.BadStatusLine, err_msg:
      print "[ " + Fore.RED + "FAILED" + Style.RESET_ALL + " ]"
      if len(err_msg.line) > 2 :
        print err_msg.line, err_msg.message
      raise SystemExit()
Beispiel #28
0
def installer():
  packages = "build-essential python-dev"
  dependencies = "git python-pip"
  
  sys.stdout.write("(*) Starting installer ... ")
  sys.stdout.flush()
  
  # Check if OS is Linux.
  if platform.system() == "Linux":
    
    # You need to have root privileges to run this script
    if os.geteuid() != 0:
      print colors.RED + "\n(x) Error:  You need to have root privileges to run this option.\n" + colors.RESET
      sys.exit(0)
      
    # Check if commix is already installed.
    if os.path.isdir("/usr/share/"  + settings.APPLICATION + ""):
      print "[" + colors.RED + " FAILED " + colors.RESET + "]" 
      print colors.RED + "(x) Error: "  + settings.APPLICATION + " is already installed in /usr/share/"  + settings.APPLICATION + ", remove and start again." + colors.RESET
      print ""
      sys.exit(0)
      
    # Check for git.
    if not os.path.isfile("/usr/bin/git") or not os.path.isfile("/usr/bin/pip"):
      # Install requirment.
      if os.path.isfile("/etc/apt/sources.list"):
	sys.stdout.write("[" + colors.GREEN + " DONE " + colors.RESET + "]\n")
	sys.stdout.flush()
	# Check for dependencies.
	dependencies_items = dependencies.split()
	for item in dependencies_items:
	  requirments.do_check(item)
      else:
	print "[" + colors.RED + " FAILED " + colors.RESET + "]"
	print colors.RED + "(x) Error: The installer is not designed for any other Linux distro than Ubuntu / Debian." + colors.RESET
	print colors.RED + "    Please install manually: " + dependencies + colors.RESET
	print ""
	sys.exit(0)
	
    # Force install of necessary packages
    subprocess.Popen("apt-get --force-yes -y install " + packages + ">/dev/null 2>&1", shell=True).wait()
    sys.stdout.write("[" + colors.GREEN + " DONE " + colors.RESET + "]\n")
    sys.stdout.flush()
    
    sys.stdout.write("(*) Installing "  + settings.APPLICATION + " into the /usr/share/"  + settings.APPLICATION + " ... ")
    try:
      current_dir = os.getcwd()
      subprocess.Popen("cp -r " + current_dir + " /usr/share/" + settings.APPLICATION + " >/dev/null 2>&1", shell=True).wait()
      subprocess.Popen("chmod 775 /usr/share/"  + settings.APPLICATION + "/" + settings.APPLICATION + ".py >/dev/null 2>&1", shell=True).wait()
    except:
      print "[" + colors.RED + " FAILED " + colors.RESET + "]"
      sys.exit(0)
    sys.stdout.write("[" + colors.GREEN + " DONE " + colors.RESET + "]\n")
    sys.stdout.flush()
    
    sys.stdout.write("(*) Installing "  + settings.APPLICATION + " to /usr/bin/"  + settings.APPLICATION + " ... ")
    try:    
      with open('/usr/bin/commix', 'w') as f:
	f.write('#!/bin/bash\n')
	f.write('cd /usr/share/commix/ && ./commix.py "$@"')
	subprocess.Popen("chmod +x /usr/bin/"  + settings.APPLICATION + " >/dev/null 2>&1", shell=True).wait()
    except:
      print "[" + colors.RED + " FAILED " + colors.RESET + "]"
      sys.exit(0)
    sys.stdout.write("[" + colors.GREEN + " DONE " + colors.RESET + "]\n")
    sys.stdout.flush()
    
    #Create the Output Directory
    OUTPUT_DIR = ".output/"
    dir = os.path.dirname(OUTPUT_DIR)
    try:
	os.stat(OUTPUT_DIR)
    except:
	os.mkdir(OUTPUT_DIR)  
    
    print colors.BOLD + "(!) The installation is finished! Type '"  + settings.APPLICATION + "' to launch it." + colors.RESET

  else :
    print "[" + colors.RED + " FAILED " + colors.RESET + "]"
    print colors.RED + "(x) Error: The installer is not designed for any other system other than Linux." + colors.RESET
    print colors.RED + "    Please install manually: " + packages + dependencies + colors.RESET
    print ""
    sys.exit(0)
Beispiel #29
0
def installer():
  packages = "build-essential python-dev"
  dependencies = "git python-pip"
  
  sys.stdout.write(settings.INFO_SIGN + "Starting the installer... ")
  sys.stdout.flush()
  
  # Check if OS is Linux.
  if platform.system() == "Linux":
    
    # You need to have root privileges to run this script
    if os.geteuid() != 0:
      print Back.RED + "\n" + settings.ERROR_SIGN + "You need to have root privileges to run this option!\n" + Style.RESET_ALL
      sys.exit(0)
      
    # Check if commix is already installed.
    if os.path.isdir("/usr/share/"  + settings.APPLICATION + ""):
      print "[" + Fore.RED + " FAILED " + Style.RESET_ALL + "]" 
      print Fore.YELLOW + settings.WARNING_SIGN + "It seems that "  + settings.APPLICATION + " is already installed in your system." + Style.RESET_ALL
      while True:
        uninstall = raw_input(settings.QUESTION_SIGN + "Do you want to remove commix? [Y/n/q] > ").lower()
        if uninstall in settings.CHOISE_YES:
          uninstaller()
          sys.exit(0)
        elif uninstall in settings.CHOISE_NO or \
        uninstall in settings.CHOISE_QUIT: 
          sys.exit(0)
        else:
          if uninstall == "":
            uninstall = "enter"
          print Back.RED + settings.ERROR_SIGN + "'" + uninstall + "' is not a valid answer." + Style.RESET_ALL + "\n"
          pass
      
    # Check for git.
    if not os.path.isfile("/usr/bin/git") or not os.path.isfile("/usr/bin/pip"):
      # Install requirement.
      if os.path.isfile("/etc/apt/sources.list"):
        sys.stdout.write("[" + Fore.GREEN + " SUCCEED " + Style.RESET_ALL + "]\n")
        sys.stdout.flush()
        # Check for dependencies.
        dependencies_items = dependencies.split()
        for item in dependencies_items:
          requirments.do_check(item)
      else:
        print "[" + Fore.RED + " FAILED " + Style.RESET_ALL + "]"
        print Back.RED + settings.ERROR_SIGN + "The installer is not designed for any other Linux distro than Ubuntu / Debian." + Style.RESET_ALL
        print Back.RED + "    Please install manually: " + dependencies + Style.RESET_ALL
        print ""
        sys.exit(0)
        
    # Force install of necessary packages
    subprocess.Popen("apt-get --force-yes -y install " + packages + ">/dev/null 2>&1", shell=True).wait()
    sys.stdout.write("[" + Fore.GREEN + " SUCCEED " + Style.RESET_ALL + "]\n")
    sys.stdout.flush()
    
    sys.stdout.write(settings.INFO_SIGN + "Installing "  + settings.APPLICATION + " into the /usr/share/"  + settings.APPLICATION + "... ")
    try:
      current_dir = os.getcwd()
      subprocess.Popen("cp -r " + current_dir + " /usr/share/" + settings.APPLICATION + " >/dev/null 2>&1", shell=True).wait()
      subprocess.Popen("chmod 775 /usr/share/"  + settings.APPLICATION + "/" + settings.APPLICATION + ".py >/dev/null 2>&1", shell=True).wait()
    except:
      print "[" + Fore.RED + " FAILED " + Style.RESET_ALL + "]"
      sys.exit(0)
    sys.stdout.write("[" + Fore.GREEN + " SUCCEED " + Style.RESET_ALL + "]\n")
    sys.stdout.flush()
    
    sys.stdout.write(settings.INFO_SIGN + "Installing "  + settings.APPLICATION + " to /usr/bin/"  + settings.APPLICATION + "... ")
    try:    
      with open("/usr/bin/" + settings.APPLICATION, 'w') as f:
        f.write('#!/bin/bash\n')
        f.write('cd /usr/share/commix/ && ./commix.py "$@"\n')
        subprocess.Popen("chmod +x /usr/bin/"  + settings.APPLICATION + " >/dev/null 2>&1", shell=True).wait()
    except:
      print "[" + Fore.RED + " FAILED " + Style.RESET_ALL + "]"
      sys.exit(0)
    sys.stdout.write("[" + Fore.GREEN + " SUCCEED " + Style.RESET_ALL + "]\n")
    sys.stdout.flush()
    
    #Create the Output Directory
    OUTPUT_DIR = ".output/"
    try:
        os.stat(OUTPUT_DIR)
    except:
        os.mkdir(OUTPUT_DIR)  
    
    print Style.BRIGHT + "(!) The installation is finished! Type '"  + settings.APPLICATION + "' to launch it." + Style.RESET_ALL

  else :
    print "[" + Fore.RED + " FAILED " + Style.RESET_ALL + "]"
    print Back.RED + settings.ERROR_SIGN + "The installer is not designed for any other system other than Linux." + Style.RESET_ALL
    print Back.RED + "    Please install manually: " + packages + dependencies + Style.RESET_ALL
    print ""
    sys.exit(0)
Beispiel #30
0
def installer():
  packages = "build-essential python-dev"
  dependencies = "git python-pip"
  
  sys.stdout.write("(*) Starting installer ... ")
  sys.stdout.flush()
  
  # Check if OS is Linux.
  if platform.system() == "Linux":
    
    # You need to have root privileges to run this script
    if os.geteuid() != 0:
      print Back.RED + "\n(x) Error:  You need to have root privileges to run this option.\n" + Style.RESET_ALL
      sys.exit(0)
      
    # Check if commix is already installed.
    if os.path.isdir("/usr/share/"  + settings.APPLICATION + ""):
      print "[" + Fore.RED + " FAILED " + Style.RESET_ALL + "]" 
      print Back.RED + "(x) Error: "  + settings.APPLICATION + " is already installed in /usr/share/"  + settings.APPLICATION + ", remove and start again." + Style.RESET_ALL
      print ""
      sys.exit(0)
      
    # Check for git.
    if not os.path.isfile("/usr/bin/git") or not os.path.isfile("/usr/bin/pip"):
      # Install requirement.
      if os.path.isfile("/etc/apt/sources.list"):
        sys.stdout.write("[" + Fore.GREEN + " DONE " + Style.RESET_ALL + "]\n")
        sys.stdout.flush()
        # Check for dependencies.
        dependencies_items = dependencies.split()
        for item in dependencies_items:
          requirments.do_check(item)
      else:
        print "[" + Fore.RED + " FAILED " + Style.RESET_ALL + "]"
        print Back.RED + "(x) Error: The installer is not designed for any other Linux distro than Ubuntu / Debian." + Style.RESET_ALL
        print Back.RED + "    Please install manually: " + dependencies + Style.RESET_ALL
        print ""
        sys.exit(0)
        
    # Force install of necessary packages
    subprocess.Popen("apt-get --force-yes -y install " + packages + ">/dev/null 2>&1", shell=True).wait()
    sys.stdout.write("[" + Fore.GREEN + " DONE " + Style.RESET_ALL + "]\n")
    sys.stdout.flush()
    
    sys.stdout.write("(*) Installing "  + settings.APPLICATION + " into the /usr/share/"  + settings.APPLICATION + " ... ")
    try:
      current_dir = os.getcwd()
      subprocess.Popen("cp -r " + current_dir + " /usr/share/" + settings.APPLICATION + " >/dev/null 2>&1", shell=True).wait()
      subprocess.Popen("chmod 775 /usr/share/"  + settings.APPLICATION + "/" + settings.APPLICATION + ".py >/dev/null 2>&1", shell=True).wait()
    except:
      print "[" + Fore.RED + " FAILED " + Style.RESET_ALL + "]"
      sys.exit(0)
    sys.stdout.write("[" + Fore.GREEN + " DONE " + Style.RESET_ALL + "]\n")
    sys.stdout.flush()
    
    sys.stdout.write("(*) Installing "  + settings.APPLICATION + " to /usr/bin/"  + settings.APPLICATION + " ... ")
    try:    
      with open('/usr/bin/commix', 'w') as f:
        f.write('#!/bin/bash\n')
        f.write('cd /usr/share/commix/ && ./commix.py "$@"')
        subprocess.Popen("chmod +x /usr/bin/"  + settings.APPLICATION + " >/dev/null 2>&1", shell=True).wait()
    except:
      print "[" + Fore.RED + " FAILED " + Style.RESET_ALL + "]"
      sys.exit(0)
    sys.stdout.write("[" + Fore.GREEN + " DONE " + Style.RESET_ALL + "]\n")
    sys.stdout.flush()
    
    #Create the Output Directory
    OUTPUT_DIR = ".output/"
    try:
        os.stat(OUTPUT_DIR)
    except:
        os.mkdir(OUTPUT_DIR)  
    
    print Style.BRIGHT + "(!) The installation is finished! Type '"  + settings.APPLICATION + "' to launch it." + Style.RESET_ALL

  else :
    print "[" + Fore.RED + " FAILED " + Style.RESET_ALL + "]"
    print Back.RED + "(x) Error: The installer is not designed for any other system other than Linux." + Style.RESET_ALL
    print Back.RED + "    Please install manually: " + packages + dependencies + Style.RESET_ALL
    print ""
    sys.exit(0)