Exemplo n.º 1
0
def menu_analytics():
    while (True):
        os.system("clear")
        header()
        ui_design.color(3)
        print("Select one of the options from below:")
        ui_design.reset()
        print("1)Battery")
        print("2)Ram")
        print("3)Storage")
        print("4)Retrurn to the menu")
        print("5)Exit")
        print("Enter your choice: ", end=" ")
        ch = int(input())
        print()
        os.system("clear")
        if (ch == 1):
            battery()
        elif (ch == 2):
            ram()
        elif (ch == 3):
            storage()
        elif (ch == 4):
            import menu
        elif (ch == 5):
            break
        else:
            print("Invalid input")
Exemplo n.º 2
0
def change_port():
    ui_design.color(3)
    print("Change the port number")
    print("----------------------")
    ui_design.reset()
    print("The file with the configuration is going to open in 10 seconds ")
    print(
        "You can change the port number, you will get the field when the file opens.."
    )
    ui_design.color(3)
    print("Listen xyz....Replace xyz with the port number of your choice")
    print("The current port number is")
    os.system("netstat -tlnp|grep httpd")
    ui_design.reset()
    print("	Please save the file after changing the port number")
    print()
    time.sleep(10)
    os.system("gedit /etc/httpd/conf/httpd.conf")
    print("Have you updated?(y/n)")
    if (input() == "y"):
        print("please wait while we update the port number for you")
        os.system("systemctl restart httpd")
        time.sleep(3)
        print("The new port number is:")
        os.system("netstat -tlnp | grep httpd")
        time.sleep(4)
    web_menu()
Exemplo n.º 3
0
def images_list():
    ui_design.color(3)
    print("Here you can see the running containers")
    print("----------------------------------------")
    ui_design.reset()
    os.system("docker images ls --all")
    time.sleep(6)
Exemplo n.º 4
0
def show_running():
    ui_design.color(3)
    print("Here you can see the running containers")
    print("----------------------------------------")
    ui_design.reset()
    os.system("docker container ls --all")
    time.sleep(6)
    docker_menu()
Exemplo n.º 5
0
def list_files():
    os.system("clear")
    ui_design.color(3)
    print("THe list of files in the web server: ")
    ui_design.reset()
    os.system("ls /var/www/html")
    time.sleep(10)
    web_menu()
Exemplo n.º 6
0
def prevlogin():
    os.system("clear")
    header()
    print(os.system("w"))
    ui_design.color(2)
    print("Want to check again?(Y to agree)")
    ui_design.reset()
    if (input() == 'y' or input() == 'Y'):
        prevlogin()
    else:
        return
Exemplo n.º 7
0
def docker_menu():
    os.system("clear")
    ui_design.color(3)
    print("Here's what you can do:")
    ui_design.reset()
    print()
    print("1)Start a container")
    print("2)Show the list of running containers")
    print("3)Show the available images")
    print("4)Show configuration")
    print("5)Return to the main menu?")
Exemplo n.º 8
0
def software_requirement():
    if (subprocess.run(["rpm", "-q", "httpd"],
                       stdout=subprocess.DEVNULL).returncode == 1):
        ui_design.color(1)
        print("!Apache web server not installed", end=" ")
        print(u'\u2717')
        ui_design.reset()
        print("installing web server")
        subprocess.run(["yum", "install", "httpd", "-y"],
                       stdout=subprocess.DEVNULL)
    ui_design.color(2)
    print("Apache web server is installed", end=" ")
    print(u'\u2713')
    if (subprocess.run(["systemctl", "status", "firewalld"],
                       stdout=subprocess.DEVNULL).returncode == 0):
        ui_design.color(1)
        print(
            "!Firewall is enabled, firewall must be disabled for web server to work",
            end=" ")
        print(u'\u2717')
        os.system("systemctl stop firewalld")

    ui_design.color(2)
    print("Firewall disabled ", end="")
    print(u'\u2713')
    os.system("systemctl enable httpd")
    print("Httpd enabled ", end="")
    print(u'\u2713')
    print("All requirements checked (3/3)", end=" ")
    print(u'\u2713\u2713\u2713')
    ui_design.reset()
Exemplo n.º 9
0
def menu_main():
    flag = 0
    ui_design.color(3)
    entry = getpass.getpass()
    if (entry == "root"):
        flag = 1
    if (flag == 0):
        for i in range(3):
            if (i == 0): ui_design.color(2)
            if (i == 1): ui_design.color(3)
            if (i == 2): ui_design.color(1)
            print(
                "Enter the password again, Your have {} attempts left".format(
                    3 - i),
                end=" ")
            if (i == 0):
                print("\N{grinning face}")
            elif (i == 1):
                print("\N{thinking face}")
            else:
                print("\N{face with thermometer}")
            ui_design.color(3)
            entry = getpass.getpass()
            if (entry == "root"):
                flag = 1
                break
    if (flag == 1):
        #f=open("login.txt","w+")
        ch = -1
        while (True):
            os.system("clear")
            menu()
            print("Enter your choice: ", end="")
            ch = input()
            if (ch == "1"):
                yum()
            if (ch == "2"):
                webserver.webserver_main()
            if (ch == "3"):
                dc.docker_main()
            if (ch == "4"):
                analytics.menu_analytics()
            elif (ch == "5"):
                prevlogin()
            else:
                print("Enter correct choice")
            os.system("clear")
        #os.remove("login.txt")
    ui_design.reset()
Exemplo n.º 10
0
def upload():
    os.system("clear")
    ui_design.color(3)
    print("Upload your files here")
    print("-----------------------")
    ui_design.reset()
    print("Enter the location where your files are located")
    files = input()
    inp = "cp "
    inp += files
    inp += " /var/www/html"
    os.system(inp)
    ui_design.color(5)
    print("Want to upload more files?(y/n)")
    if (input() == "y"):
        upload()
Exemplo n.º 11
0
def menu():
    header()
    ui_design.color(3)
    print("\nWhat do you want to do?")
    ui_design.color(7)
    print("Work on remote(1)/local(0) system?")
    if (int(input()) == 1):
        print("Provide the login details of the remote system..")
        print("username: "******" ")
        username = input()
        print()
        password = getpass.getpass()
    print("1)Install any software")
    print("2)Configure Web Server")
    print("3)Work with Docker")
    print("4)Analytics")
    print("5)View previous logins to the system")
Exemplo n.º 12
0
def ram():
    free = [0] * 100
    y = [i for i in range(0, 100)]
    while (True):
        os.system("clear")
        free.append(getram())
        free.pop(0)
        ui_design.color(3)

        gb.plot(np.array(y),
                np.array(free),
                terminal="dumb",
                _with='lines',
                unset='grid')
        ui_design.reset()
        print(free[len(free) - 1])
        os.system("clear")
        time.sleep(5)
Exemplo n.º 13
0
def launch():
    os.system("clear")
    ui_design.color(3)
    print("Welcome to the container launch window!!")
    print("-----------------------------------------")
    ui_design.reset()
    print("Enter the name of the container you want to launch:")
    name = input()
    print("Enter the name of the os image:")
    osimage = input()
    inp = "docker run -it --name "
    inp += name
    inp += " " + osimage
    os.system(inp)
    print("Want to launch another container?(y/n)")
    if (input() == "y"):
        launch()
    else:
        docker_main()
Exemplo n.º 14
0
def header():
    ui_design.background(7)
    ui_design.color(0)
    print(
        "                                                                       ",
        end=" ")
    print("        ")
    print("------------------------------------------------", end="")
    print("--------------------------------")
    ui_design.blink_text()
    ui_design.bold()
    print(
        "                                  WELCOME TO ATUI                               "
    )
    ui_design.reset()
    ui_design.background(7)
    ui_design.color(0)
    print("------------------------------------------------", end="")
    print("--------------------------------")
    ui_design.reset()
Exemplo n.º 15
0
def header():
    temp = os.popen('stty size', 'r').read().split()
    ui_design.background(5)
    ui_design.color(2)
    for i in range(int(temp[1])):
        print('-', end="")
    for i in range(int(int(temp[1]) / 2)):
        print(' ', end="")

    ui_design.blink_text()
    ui_design.bold()
    print("ANALYTICS", end="")
    for i in range(int(int(temp[1]) / 2), int(temp[1]) - 9):
        print(' ', end="")
    ui_design.reset()
    ui_design.background(7)
    ui_design.color(2)
    for i in range(int(temp[1])):
        print('-', end="")
    ui_design.reset()
Exemplo n.º 16
0
def header():
    temp = os.popen('stty size', 'r').read().split()
    ui_design.background(7)
    os.system("tput setab 7")
    ui_design.color(2)
    for i in range(int(temp[1])):
        print('-', end="")
    for i in range(int(int(temp[1]) / 2)):
        print(' ', end="")
    ui_design.blink_text()
    ui_design.bold()
    print("WEB SERVER", end="")
    for i in range(int(int(temp[1]) / 2), int(temp[1]) - 10):
        print(' ', end="")
    ui_design.reset()
    ui_design.background(7)
    ui_design.color(2)
    for i in range(int(temp[1])):
        print('-', end="")
    ui_design.reset()
Exemplo n.º 17
0
def requirement():
    if (subprocess.run(["rpm", "-q", "docker-ce"],
                       stdout=subprocess.DEVNULL).returncode == 1):
        ui_design.color(1)
        print("Docker not installed", end="")
        print(u'\u2717')
        ui_design.reset()
        print("installing docker")
        os.system(
            "sudo dnf config-manager --add-repo=https://download.docker.com/linux/centos/docker-ce.repo"
        )
        os.system(
            "sudo dnf install https://download.docker.com/linux/centos/7/x86_64/stable/Packages/containerd.io-1.2.6-3.3.el7.x86_64.rpm"
        )
        os.system("sudo dnf install docker-ce")
    ui_design.color(2)
    print("Docker is installed", end=" ")
    print(u'\u2713')
    print("Required packages installed", end=" ")
    print(u'\u2713\u2713')
    ui_design.reset()
    time.sleep(4)
Exemplo n.º 18
0
def homepage():
    for i in range(3):
        if i == 0:
            ui_design.color(1)
        elif i == 1:
            ui_design.color(3)
        else:
            ui_design.color(2)
        print("You are going to see the home page in a few seconds:")
        time.sleep(2)
    os.system("xdg-open http://0.0.0.0")
    webserver_main()
Exemplo n.º 19
0
def battery():
    batt = [get_battery()] * 1000
    y = [i for i in range(0, 100)]
    while (True):
        os.system("clear")
        batt.append(get_battery())
        batt.pop(0)
        if (batt[len(batt) - 1] > 60):
            ui_design.color(2)
        elif (batt[len(batt) - 1] > 30):
            ui_design.color(4)
        else:
            ui_design.color(1)

        gb.plot(np.array(batt), terminal="dumb", _with='lines', unset='grid')
        ui_design.reset()
        print(batt[len(batt) - 1])
        os.system("clear")
        time.sleep(1)