Example #1
0
def FSMORoles():
    print()
    print("  [*] Checking if your system is Domain Controller  ", end="")
    bfunc.LoadAnimation()
    print()

    p = subprocess.Popen(["powershell.exe", ".\\scripts\\cup\\dccheck.ps1"],
                         stdout=sys.stdout)
    # se ponen dos barras para que no de problemas de codec
    p.communicate()

    lines = len(open('.\\scripts\\cup\\temp\\checkdcdiag.txt').readlines())

    p1 = subprocess.Popen(
        ["powershell.exe", "del .\\scripts\\cup\\temp\\checkdcdiag.txt"],
        stdout=sys.stdout)
    p2 = subprocess.Popen(
        ["powershell.exe", "del .\\scripts\\cup\\temp\\dcdiag.txt"],
        stdout=sys.stdout)

    #print (lineas2);

    if (lines != 0):
        print()
        print(
            " Your system is NOT Domain Controller, use option 1 to promote your system in a Domain Controller"
        )
        bfunc.PressKey()
    else:
        print()
        os.system('netdom query fsmo')
        bfunc.PressKey()
Example #2
0
def PreferredDNS():
    print();
    print(" Remember that for configure the network card is necessary the configuration of the adapter name ('Internal Network')");
    print();

    pdns = input("  Choose a address of Preferred DNS: ");

    flag4 = 0;
    pattern = "^\d{1,3}.\d{1,3}.\d{1,3}.\d{1,3}$";
    match4 = re.match(pattern, pdns);


    #dns preferido
    if (match4):
        field4 = pdns.split(".");
        for i in range(0, len(field4)):
            if (int(field4[i]) < 256):
                flag4 += 1
            else:
                flag4 = 0

    if (flag4 != 4):
        print();
        print("  Error, enter a correct DNS");
    else:
        os.system(f'netsh interface ip set dns "Internal Network" static {pdns}');
        print('  Correct Configuration for Internal Network adapter');
    bfunc.PressKey();
Example #3
0
def CheckRequirements():
    print(
        "+-----------------------------------------------------------------------+"
    )
    print(
        "|          Minimum requirements for install AD (ICAAD Software)         |"
    )
    print(
        "+-----------------------------------------------------------------------+"
    )
    print(
        "| Operating System: Windows Server 2012, 2016 & 2019                    |"
    )
    print(
        "| RAM Memory: 2 GB                                                      |"
    )
    print(
        "| Network: 2 network cards (internal y external)                        |"
    )
    print(
        "| Storage: 2 Hard disks (Optional for the installation of AD)           |"
    )
    print(
        "+-----------------------------------------------------------------------+"
    )
    bfunc.PressKey()
Example #4
0
def ExportObj():
    p = subprocess.Popen(
        ["powershell.exe", ".\\scripts\\obj\\cmd\\exportObj.ps1"],
        stdout=sys.stdout)
    # se ponen dos barras para que no de problemas de codec
    p.communicate()
    os.system('del .\\scripts\\obj\\cmd\\temp\\exportObj.txt')
    bfunc.PressKey()
Example #5
0
def CheckDNSResolutionNames():
    print();
    print(" For check the resolution names, enter the domain name or IP address");
    print();
    print(" Use the command 'exit' to exit");
    print();
    os.system('nslookup');
    bfunc.PressKey();
Example #6
0
def CheckSystem():
    osName = "OS Name"
    sistemaOperativo = "Nombre del sistema operativo"
    osType1 = "Microsoft Windows Server 2012"
    osType2 = "Microsoft Windows Server 2016"
    osType3 = "Microsoft Windows Server 2019"
    memory = "Total Physical Memory"
    memoria = "Cantidad total de memoria"
    quanMemory1 = "2,048 MB"
    quanMemory2 = "4,096 MB"
    quanMemory3 = "8,192 MB"
    quanMemory4 = "16,384 MB"
    cantMemoria1 = "2.048 MB"
    cantMemoria2 = "4.096 MB"
    cantMemoria3 = "8.192 MB"
    cantMemoria4 = "16.384 MB"
    networkCards = "Network Card(s)"
    tarjetasRed = "Tarjeta(s) de red"
    cnt = 0

    #os.system('systeminfo > systeminfo.txt') ;
    dirFile = 'systeminfo.txt'
    with open(dirFile, 'r') as reader:
        for line in reader:
            if (osName in line or sistemaOperativo in line):

                if (osType1 in line or osType2 in line or osType3 in line):
                    cnt = cnt + 1

            elif (memory in line or memoria in line):

                if (quanMemory1 in line or quanMemory2 in line
                        or quanMemory3 in line or quanMemory4 in line
                        or cantMemoria1 in line or cantMemoria2 in line
                        or cantMemoria3 in line or cantMemoria4 in line):
                    cnt = cnt + 1

            elif (networkCards in line or tarjetasRed in line):
                for i in line:
                    if (i.isdigit() == True):
                        number = int(i)
                        if (number >= 2):
                            cnt = cnt + 1

    if (cnt == 3):
        print()
        print("  Your system is be able to Active Directory")
        PressKey3()
    else:
        print()
        print("  Your system is NOT be able to Active Directory")
        bfunc.PressKey()
Example #7
0
def ChangeAdapter():
    print()
    adapter = input(" Current adapter name: ")
    print()
    newAdapter = input(
        " What of this names do you want for the adapter: Internal Network (i) or Internet (e): "
    )
    print()
    if (newAdapter == "i" or newAdapter == "I"):
        os.system(
            f'netsh interface set interface name="{adapter}" newname="Internal Network"'
        )
    elif (newAdapter == "e" or newAdapter == "E"):
        os.system(
            f'netsh interface set interface name="{adapter}" newname="Internet"'
        )
    else:
        print(" Choose a correct option (i/e)")

    bfunc.PressKey()
Example #8
0
def SecCopy():
    print()
    source = input(" Source directory (i.e.: D:\Directory): ")
    print()
    destination = input(" Destination directory (i.e.: D:\Copy): ")

    if path.exists(source):

        print()
        option = input(
            f" Do you want to copy all the files, directories and subdirectories of {source}? (y/n): "
        )
        print()

        if (option == "y") or (option == "Y"):
            os.system(f'xcopy "{source}" "{destination}" /d/e/y/c/i/h')
            #print(" Archivos copiados")
            #print("0")
            bfunc.PressKey()

        elif (option == "n") or (option == "N"):

            option2 = input(
                f" Do you want to copy the directories and subdirectories of {source}? (y/n): "
            )
            print()
            #option3 = input(f" ¿Desea copiar archivos con una extensión específica? (s/n): ")
            #print();

            if (option2 == "y") or (option2 == "Y"):
                #os.system(f"xcopy '{source}' '{destination}' /d/e/y/c/i/h > log.txt 2>&1")

                option3 = input(
                    f" Do you want to copy this files with especific extension (y/n): "
                )
                print()

                if (option3 == "N") or (option3 == "n"):
                    os.system(f'xcopy "{source}" "{destination}" /d/e/y/c/i/h')
                    #print("1")
                    bfunc.PressKey()

                elif (option2 == "y") or (option2 == "Y"):
                    extension = input(
                        " Enter the extension of the files to copy (i.e.: pdf, doc, txt...): "
                    )
                    print()
                    os.system(
                        f'xcopy "{source}\*.{extension}" "{destination}" /d/e/y/c/i/h'
                    )
                    #print("2")
                    bfunc.PressKey()

                else:
                    print("")
                    print(" Choose a correct option (y/n)")
                    bfunc.PressKey()

            elif (option2 == "N") or (option2 == "n"):

                print(
                    f" [*] Only the files of the directory {source} will be copied"
                )
                print()

                option4 = input(
                    f" Do you want to copy the files with a especific extension? (y/n): "
                )
                print()

                if (option4 == "N") or (option4 == "n"):
                    os.system(f'xcopy "{source}" "{destination}" /d/y/c/i/h')
                    #print("3")
                    bfunc.PressKey()

                elif (option4 == "Y") or (option4 == "y"):
                    extension = input(
                        " Enter the extension of the files to copy (i.e.: pdf, doc, txt...): "
                    )
                    print()
                    os.system(
                        f'xcopy "{source}\*.{extension}" "{destination}" /d/y/c/i/h'
                    )
                    #print("4")
                    print()
                    bfunc.PressKey()

                else:
                    print("")
                    print(" Choose a correct option (y/n)")
                    bfunc.PressKey()

            else:
                print()
                print(" Choose a correct option (y/n))")
                bfunc.PressKey()

        else:
            print()
            print(" Choose a correct option (y/n)")
            bfunc.PressKey()

    else:
        print()
        print(f"Directory {source} doesn't exists")
        bfunc.PressKey()
Example #9
0
def CheckComponents():
    osName = "OS Name"
    sistemaOperativo = "Nombre del sistema operativo"
    osType1 = "Microsoft Windows Server 2016"
    osType2 = "Microsoft Windows Server 2012"
    osType3 = "Microsoft Windows Server 2019"
    memory = "Total Physical Memory"
    memoria = "Cantidad total de memoria"
    quanMemory1 = "2,048 MB"
    quanMemory2 = "4,096 MB"
    quanMemory3 = "8,192 MB"
    quanMemory4 = "16,384 MB"
    cantMemoria1 = "2.048 MB"
    cantMemoria2 = "4.096 MB"
    cantMemoria3 = "8.192 MB"
    cantMemoria4 = "16.384 MB"
    networkCards = "Network Card(s)"
    tarjetasRed = "Tarjeta(s) de red"
    cnt = 0

    #os.system('systeminfo > systeminfo.txt');
    print()

    dirFile = 'systeminfo.txt'
    with open(dirFile, 'r') as reader:
        for line in reader:
            if (osName in line or sistemaOperativo in line):
                print(f'  {line}')
                if (osType1 in line or osType2 in line or osType3 in line):
                    cnt = cnt + 1
            elif (memory in line or memoria in line):
                print(f'  {line}')
                if (quanMemory1 in line or quanMemory2 in line
                        or quanMemory3 in line or quanMemory4 in line
                        or cantMemoria1 in line or cantMemoria2 in line
                        or cantMemoria3 in line or cantMemoria4 in line):
                    cnt = cnt + 1
                #for idx, i in enumerate(line):
                #for i in line:
                #if (i.isdigit() == True):
                #number = int(i);
                #first = i[0]

                #print(memoryreal);
                #print(number);
                # FIX THIS FOR FUTURE PROBLEMS WITH NUMBERS STARTING IN 1 (16.384 RAM)
                # Collect all the numbers and compare with 2048
                # Use a variable to collect all the numbers
                #if (number >= 2):
                #   cnt+=1;
                #   break
                #else:
                #   break

            elif (networkCards in line or tarjetasRed in line):
                print(f'  {line}')
                for i in line:
                    if (i.isdigit() == True):
                        number = int(i)
                        if (number >= 2):
                            cnt = cnt + 1

    if (cnt == 3):
        print("  Your system is be able to Active Directory")
    else:
        print("  Your system is NOT be able to Active Directory")
    bfunc.PressKey()
Example #10
0
def CheckComputerName():
    print("The current name of your computer is: ")
    os.system('hostname')
    bfunc.PressKey()
Example #11
0
def CheckNetworkConfig():
    os.system('ipconfig /all')
    bfunc.PressKey()
Example #12
0
def ConfigureNetwork(networkCard):
    print()
    print(
        f'============= Configuration of Internal network card "{networkCard}"============='
    )
    print()
    print(
        f'****Remember that the name of your adapter MUST BE "{networkCard}"****'
    )
    print()
    ipAddress = input("  Choose a IP address: ")
    print()
    mask = input("  Choose a mask: ")
    print()
    gateway = input("  Choose a default gateway: ")
    print()
    pdns = input("  Choose a Preferred DNS server: ")

    flag1 = 0
    flag2 = 0
    flag3 = 0
    flag4 = 0
    pattern = "^\d{1,3}.\d{1,3}.\d{1,3}.\d{1,3}$"
    match1 = re.match(pattern, ipAddress)
    match2 = re.match(pattern, mask)
    match3 = re.match(pattern, gateway)
    match4 = re.match(pattern, pdns)

    #IP Address
    if (match1):
        field1 = ipAddress.split(".")
        for i in range(0, len(field1)):
            if (int(field1[i]) < 256):
                flag1 += 1
            else:
                flag1 = 0
    #Mask
    if (match2):
        field2 = mask.split(".")
        for i in range(0, len(field2)):
            if (int(field2[i]) < 256):
                flag2 += 1
            else:
                flag2 = 0

    #default gateway
    if (match3):
        field3 = gateway.split(".")
        for i in range(0, len(field3)):
            if (int(field3[i]) < 256):
                flag3 += 1
            else:
                flag3 = 0

    #Preferred DNS
    if (match4):
        field4 = pdns.split(".")
        for i in range(0, len(field4)):
            if (int(field4[i]) < 256):
                flag4 += 1
            else:
                flag4 = 0

    if (flag1 != 4):
        print()
        print("  Error, enter a valid IP address (i.e.: 192.168.1.10)")
    elif (flag2 != 4):
        print()
        print("  Error, enter a correct mask (i.e.: 255.255.255.0)")
    elif (flag3 != 4):
        print()
        print("  Error, enter a correct puerta de enlace")
    elif (flag4 != 4):
        print()
        print("  Error, enter a correct DNS")
    else:
        os.system(
            f'netsh interface ip set address "{networkCard}" static {ipAddress} {mask} {gateway}'
        )
        os.system(f'netsh interface ip set dns "{networkCard}" static {pdns}')
        print(f'  Correct Configuration for "{networkCard}" adapter')

    bfunc.PressKey()
Example #13
0
def ShowINConfig():
    os.system('netsh interface ipv4 show address "Internal Network"');
    os.system('netsh interface ipv4 show dns "Internal Network"');
    bfunc.PressKey();
Example #14
0
def RefreshDNS():
    os.system('ipconfig -registerdns');
    bfunc.PressKey();
Example #15
0
def ShowDNSZones():
    p = subprocess.Popen(["powershell.exe", "Get-DnsServerZone"],stdout=sys.stdout); # se ponen dos barras para que no de problemas de codec
    p.communicate();
    bfunc.PressKey();
Example #16
0
def DeleteReverseZone():
    p = subprocess.Popen(["powershell.exe", ".\\scripts\\dns\\cmd\\deleteReverseZone.ps1"],stdout=sys.stdout); # se ponen dos barras para que no de problemas de codec
    p.communicate();
    bfunc.PressKey();