コード例 #1
0
def ReverseString():
    print(
        "    ____                               _____ __       _            ")
    print(
        "   / __ \\___ _   _____  _____________ / ___// /______(_)___  ____ _")
    print(
        "  / /_/ / _ \\ | / / _ \\/ ___/ ___/ _ \\__ \\/ __/ ___/ / __ \\/ __ `/"
    )
    print(
        " / _, _/  __/ |/ /  __/ /  (__  )  __/__/ / /_/ /  / / / / / /_/ / ")
    print(
        "/_/ |_|\\___/|___/\\___/_/  /____/\\___/____/\\__/_/  /_/_/ /_/\\__, /  "
    )
    print(
        "                                                          /____/ \n\n"
    )
    message = input("This Cipher does exactly what it says\n\n~$-")
    arr = list(message)

    encryption = ''

    for i in range(1, (len(arr) + 1)):
        encryption = encryption + str(arr[-i])

    ldscr()
    os.system('cls')
    print(encryption)
    now = datetime.now()
    Database.AddRecord(UID, "ReverseString", message,
                       now.strftime("%d/%m/%Y %H:%M:%S"))
    iyt = input()
コード例 #2
0
def ReverseSubstitution():
    encry = input(
        "You can decode the code encrypted by the SubstitutionCipher\n\n~$-")
    jj = list(encry)
    replace = {
        '$': "a",
        'v': "b",
        '@': "c",
        'g': "d",
        '^': "e",
        '|': "f",
        '\\': "g",
        '5': "h",
        '2': "i",
        'u': "j",
        '8': "k",
        'w': "l",
        '*': "m",
        '7': "n",
        'm': "o",
        'q': "p",
        'p': "q",
        '%': "r",
        '(': "s",
        ')': "t",
        'z': "u",
        '3': "v",
        '!': "w",
        '_': "x",
        '=': "y",
        ':': "z",
        'a': "1",
        'n': "2",
        'x': "3",
        'o': "4",
        '~': "5",
        '`': "6",
        '/': "7",
        'd': "8",
        'i': "9",
        '+': "0",
        '6': " ",
        'r': ",",
        'c': ".",
        ' ': " "
    }
    mess = ''
    for _ in range(0, len(jj)):
        mess = mess + replace[jj[_]]
    ldscr()
    print(mess)
    now = datetime.now()
    Database.AddRecord(UID, "SubstitutionR", encry,
                       now.strftime("%d/%m/%Y %H:%M:%S"))
    iyat = input()
コード例 #3
0
def encryptRailFence():
    print(
        "                                                ######                  #######"
    )
    print(
        "###### #    #  ####  #####  #   # #####  ##### #     #   ##   # #      #       ###### #    #  ####  ###### "
    )
    print(
        "#      ##   # #    # #    #  # #  #    #   #   #     #  #  #  # #      #       #      ##   # #    # #      "
    )
    print(
        "#####  # #  # #      #    #   #   #    #   #   ######  #    # # #      #####   #####  # #  # #      #####  "
    )
    print(
        "#      #  # # #      #####    #   #####    #   #   #   ###### # #      #       #      #  # # #      #      "
    )
    print(
        "#      #   ## #    # #   #    #   #        #   #    #  #    # # #      #       #      #   ## #    # #      "
    )
    print(
        "###### #    #  ####  #    #   #   #        #   #     # #    # # ###### #       ###### #    #  ####  ###### \n"
    )

    text = input("Input Text to be encrypted:")
    key = int(input("Enter Key:"))
    rail = [['\n' for i in range(len(text))] for j in range(key)]

    dir_down = False
    row, col = 0, 0

    for i in range(len(text)):

        if (row == 0) or (row == key - 1):
            dir_down = not dir_down

        rail[row][col] = text[i]
        col += 1

        if dir_down:
            row += 1
        else:
            row -= 1

    result = []
    for i in range(key):
        for j in range(len(text)):
            if rail[i][j] != '\n':
                result.append(rail[i][j])
    ldscr()
    print("".join(result))
    now = datetime.now()
    Database.AddRecord(UID, "RailFenceE", text,
                       now.strftime("%d/%m/%Y %H:%M:%S"))
    cham = input()
コード例 #4
0
def Hash():

    print(
        " .----------------.  .----------------.  .----------------.  .----------------. "
    )
    print(
        "| .--------------. || .--------------. || .--------------. || .--------------. |"
    )
    print(
        "| |  ____  ____  | || |      __      | || |    _______   | || |  ____  ____  | |"
    )
    print(
        "| | |_   ||   _| | || |     /  \\     | || |   /  ___  |  | || | |_   ||   _| | |"
    )
    print(
        "| |   | |__| |   | || |    / /\\ \\    | || |  |  (__ \\_|  | || |   | |__| |   | |"
    )
    print(
        "| |   |  __  |   | || |   / ____ \\   | || |   '.___`-.   | || |   |  __  |   | |"
    )
    print(
        "| |  _| |  | |_  | || | _/ /    \\ \\_ | || |  |`\\____) |  | || |  _| |  | |_  | |"
    )
    print(
        "| | |____||____| | || ||____|  |____|| || |  |_______.'  | || | |____||____| | |"
    )
    print(
        "| |              | || |              | || |              | || |              | |"
    )
    print(
        "| '--------------' || '--------------' || '--------------' || '--------------' |"
    )
    print(
        " '----------------'  '----------------'  '----------------'  '----------------' "
    )

    s = input("Enter the string to be hashed: ")
    md5 = hashlib.md5(s.encode())
    sha224 = hashlib.sha224(s.encode())
    sha1 = hashlib.sha1(s.encode())
    sha256 = hashlib.sha256(s.encode())
    sha384 = hashlib.sha384(s.encode())
    sha512 = hashlib.sha512(s.encode())
    ldscr()
    print("Md5:", md5.hexdigest())
    print("SHA224:", sha224.hexdigest())
    print("SHA256:", sha256.hexdigest())
    print("SHA384:", sha384.hexdigest())
    print("SHA512:", sha512.hexdigest())
    now = datetime.now()
    Database.AddRecord(UID, "Hash", s, now.strftime("%d/%m/%Y %H:%M:%S"))
    lom = input()
コード例 #5
0
def CaesarDecrypt():
    print(
        " .d8888b.                                                        888                                             888   "
    )
    print(
        "d88P  Y88b                                                       888                                             888    "
    )
    print(
        "888    888                                                       888                                             888    "
    )
    print(
        "888         8888b.   .d88b.  .d8888b   8888b.  888d888       .d88888  .d88b.   .d8888b 888d888 888  888 88888b.  888888 "
    )
    print(
        "888            \"88b d8P  Y8b 88K          \"88b 888P\"        d88\" 888 d8P  Y8b d88P\"    888P\"   888  888 888 \"88b 888    "
    )
    print(
        "888    888 .d888888 88888888 \"Y8888b. .d888888 888          888  888 88888888 888      888     888  888 888  888 888    "
    )
    print(
        "Y88b  d88P 888  888 Y8b.          X88 888  888 888          Y88b 888 Y8b.     Y88b.    888     Y88b 888 888 d88P Y88b.  "
    )
    print(
        " \"Y8888P\"  \"Y888888  \"Y8888   88888P' \"Y888888 888           \"Y88888  \"Y8888   \"Y8888P 888      \"Y88888 88888P\"   \"Y888 "
    )
    print(
        "                                                                                                    888 888             "
    )
    print(
        "                                                                                               Y8b d88P 888             "
    )
    print(
        "                                                                                                \"Y88P\"  888            "
    )

    text = input("enter string: ")
    s = int(input("enter shift number: "))
    cipher = ''
    for char in text:
        if char == ' ':
            cipher = cipher + char
        elif char.isupper():
            cipher = cipher + chr((ord(char) - s - 65) % 26 + 65)
        else:
            cipher = cipher + chr((ord(char) - s - 97) % 26 + 97)
    ldscr()
    print(cipher)
    now = datetime.now()
    Database.AddRecord(UID, "CaesarD", text, now.strftime("%d/%m/%Y %H:%M:%S"))
    pewds = input()
コード例 #6
0
def Angie():
    #ASCII
    print("    :::     ::::    :::  :::::::: ::::::::::: :::::::::: ")
    print("  :+: :+:   :+:+:   :+: :+:    :+:    :+:     :+:        ")
    print(" +:+   +:+  :+:+:+  +:+ +:+           +:+     +:+        ")
    print("+#++:++#++: +#+ +:+ +#+ :#:           +#+     +#++:++#   ")
    print("+#+     +#+ +#+  +#+#+# +#+   +#+#    +#+     +#+        ")
    print("#+#     #+# #+#   #+#+# #+#    #+#    #+#     #+#        ")
    print("###     ### ###    ####  ######## ########### ########## ")
    print("")
    #ART
    import random
    op = input(
        "This Function will create a Decoy for you to place among your sensitive data(like passwords)\nHowever, It can be also used as an actual password generator\nA random hex will be generated.\nEnter the parameters carefully.\n1)Totally random lenght and boundaries\n2)Set Lenght\n3)Set boundaries\n4)Set Lenght and Boundaries\n~$-"
    )
    if (op == "1"):
        l = random.randint(4, 64)
        angie = ''
        for i in range(l):
            angie += chr(random.randint(32, 126))
    elif (op == "2"):
        l = int(input("Lenght:"))
        angie = ''
        for i in range(l):
            angie += chr(random.randint(32, 126))
    elif (op == "3"):
        l = random.randint(4, 64)
        b1 = int(input("Enter Start of ASCII set:"))
        b2 = int(input("Enter end of ASCII set:"))
        angie = ''
        for i in range(l):
            angie += chr(random.randint(b1, b2))
    elif (op == "4"):
        l = int(input("Lenght:"))
        b1 = int(input("Enter Start of ASCII set:"))
        b2 = int(input("Enter end of ASCII set:"))
        angie = ''
        for i in range(l):
            angie += chr(random.randint(b1, b2))

    ldscr()

    print("The Decoy is:", angie)
    now = datetime.now()
    Database.AddRecord(UID, "Angie", "Generated As per Requirements of user",
                       now.strftime("%d/%m/%Y %H:%M:%S"))
    lot = input()
コード例 #7
0
def BoxCipher():
    print("______           _____ _       _               ")
    print("| ___ \\         /  __ (_)     | |              ")
    print("| |_/ / _____  _| /  \\/_ _ __ | |__   ___ _ __ ")
    print("| ___ \\/ _ \\ \\/ / |   | | '_ \\| '_ \\ / _ \\ '__|")
    print("| |_/ / (_) >  <| \\__/\\ | |_) | | | |  __/ |   ")
    print("\\____/ \\___/_/\\_\\____/_| .__/|_| |_|\\___|_|   ")
    print("                        | |                    ")
    print("                        |_|  \n\n")

    print("This will re-structure you message\n")
    import math
    message = input("~$-").strip()
    message = message.replace(" ", "")
    l = len(message)
    sl = math.sqrt(l)
    r = math.floor(sl)
    c = int(sl)

    ldscr()

    decry = []
    fin = ''
    decry = message.split(' ')
    for i in range(0, len(decry)):
        fin = fin + str(decry[i])
        i = i + 1

    dole = list(fin)

    box_rows = [dole[i:i + r] for i in range(0, len(dole), r)]

    print("")

    for _ in range(0, len(box_rows)):
        print(box_rows[_])

    for i in range(0, c):
        print(message[i:l:r], end=" ")
    now = datetime.now()
    Database.AddRecord(UID, "BoxCipher", message,
                       now.strftime("%d/%m/%Y %H:%M:%S"))

    bye = input()
コード例 #8
0
def BoxCipherDecryption():
    print("______           _____ _       _               ")
    print("| ___ \\         /  __ (_)     | |              ")
    print("| |_/ / _____  _| /  \\/_ _ __ | |__   ___ _ __ ")
    print("| ___ \\/ _ \\ \\/ / |   | | '_ \\| '_ \\ / _ \\ '__|")
    print("| |_/ / (_) >  <| \\__/\\ | |_) | | | |  __/ |   ")
    print("\\____/ \\___/_/\\_\\____/_| .__/|_| |_|\\___|_|   ")
    print("                        | |                    ")
    print("                        |_|  \n\n")

    message = input("Please enter message to be Decrypted:")
    message = message.split(" ")
    tex = ''
    for i in range(len(message)):
        tex += message[i]

    l = len(tex)
    sl = math.sqrt(l)
    r = math.floor(sl)
    c = int(sl)
    fin = list(tex)
    boxr = [fin[i:i + c] for i in range(0, len(fin), c)]
    #for i in range(0, c):
    #	print(tex[i : l : c+1], end = " ")
    jj = ''
    x = 0
    for i in range(c):
        for j in range(l % r):
            jj += tex[x]
            x += c + 1
        for j in range(r - l % r):
            jj += tex[x]
            x += c
        x = i + 1
    last = ''
    for i in range(l % r):
        last += message[i][-1]
    ldscr()
    print("The encrypted message is:\n" + str(jj + last))
    now = datetime.now()
    Database.AddRecord(UID, "BoxCipherD", message,
                       now.strftime("%d/%m/%Y %H:%M:%S"))
    dec = input()
コード例 #9
0
def Anagram():
    print(
        "   ###    ##    ##    ###     ######   ########     ###    ##     ## "
    )
    print(
        "  ## ##   ###   ##   ## ##   ##    ##  ##     ##   ## ##   ###   ### "
    )
    print(
        " ##   ##  ####  ##  ##   ##  ##        ##     ##  ##   ##  #### #### "
    )
    print(
        "##     ## ## ## ## ##     ## ##   #### ########  ##     ## ## ### ## "
    )
    print(
        "######### ##  #### ######### ##    ##  ##   ##   ######### ##     ## "
    )
    print(
        "##     ## ##   ### ##     ## ##    ##  ##    ##  ##     ## ##     ## "
    )
    print(
        "##     ## ##    ## ##     ##  ######   ##     ## ##     ## ##     ## "
    )
    message = input(
        "This will print all possible arrangements(permutations) of the word\nP.S. Heavy RAM user and May crash if lenght of word more than 9 letters.\n\nEnter word:"
    )
    l = message.split(" ")
    perms = sorted(
        set(["".join(perm) for perm in itertools.permutations(message)]))
    n = "./AnaGrams/" + message + ".txt"
    f = open(n, "w")
    for i in range(len(perms)):
        if (perms[i] == message):
            f.write(str(i) + "." + perms[i] + "**")
            f.write("\n")
        else:
            f.write(str(i) + "." + perms[i])
            f.write("\n")
    f.close()
    now = datetime.now()
    Database.AddRecord(UID, "Anagram", message,
                       now.strftime("%d/%m/%Y %H:%M:%S"))
    fam = input("All anagrams have been saved in a file in \'AnaGrams\'")
コード例 #10
0
def SteganographyEncrypt():

    print(
        "     _______.___________. _______   _______      ___      .__   __.   ______     _______ .______          ___      .______    __    __  ____    ____ "
    )
    print(
        "    /       |           ||   ____| /  _____|    /   \\     |  \\ |  |  /  __  \\   /  _____||   _  \\        /   \\     |   _  \\  |  |  |  | \\   \\  /   / "
    )
    print(
        "   |   (----`---|  |----`|  |__   |  |  __     /  ^  \\    |   \\|  | |  |  |  | |  |  __  |  |_)  |      /  ^  \\    |  |_)  | |  |__|  |  \\   \\/   /  "
    )
    print(
        "    \\   \\       |  |     |   __|  |  | |_ |   /  /_\\  \\   |  . `  | |  |  |  | |  | |_ | |      /      /  /_\\  \\   |   ___/  |   __   |   \\_    _/   "
    )
    print(
        ".----)   |      |  |     |  |____ |  |__| |  /  _____  \\  |  |\\   | |  `--'  | |  |__| | |  |\\  \\----./  _____  \\  |  |      |  |  |  |     |  |     "
    )
    print(
        "|_______/       |__|     |_______| \\______| /__/     \\__\\ |__| \\__|  \\______/   \\______| | _| `._____/__/     \\__\\ | _|      |__|  |__|     |__|     "
    )
    print(
        "                                                                                                                                                    \n "
    )

    print("Move the Image to be encrypted to the file \"En\"\n")
    im = Image.open('./Stego/En/' +
                    input("Enter name of file with extension:"))
    im.save('./Stego/En/Foto.png')
    file = ("./Stego/En/Foto.png")
    message = input("Enter the message to be encrypted:")
    ldscr()
    f = lsb.hide(file, message)
    now = datetime.now()
    Database.AddRecord(UID, "Steganography", message,
                       now.strftime("%d/%m/%Y %H:%M:%S"))
    f.save("./Stego/Fresh/" + input("Enter name of new file with extension:"))
    print("Your file is saved in the folder \'Fresh\' inside of \'Stego\'")
    jj = input()

    pass
コード例 #11
0
def CaesarEncrypt():
    print(
        "                                                                                                  "
    )
    print(
        "	 ,-----.                                     ,------.                                      ,--.    "
    )
    print(
        "	'  .--./ ,--,--. ,---.  ,---.  ,--,--.,--.--.|  .---',--,--,  ,---.,--.--.,--. ,--.,---. ,-'  '-.    "
    )
    print(
        "	|  |    ' ,-.  || .-. :(  .-' ' ,-.  ||  .--'|  `--, |      \\| .--'|  .--' \\  '  /| .-. |'-.  .-'    "
    )
    print(
        "	'  '--'\\\\ '-'  |\\   --..-'  `)\\ '-'  ||  |   |  `---.|  ||  |\\ `--.|  |     \\   ' | '-' '  |  |      "
    )
    print(
        "	 `-----' `--`--' `----'`----'  `--`--'`--'   `------'`--''--' `---'`--'   .-'  /  |  |-'   `--'      "
    )
    print(
        "                                                                                  `---'   `--'               "
    )
    string = input("Enter String to be encrypted: ")
    shift = int(input("Enter Shift/Key: "))
    cipher = ''
    for char in string:
        if char == ' ':
            cipher = cipher + char
        elif char.isupper():
            cipher = cipher + chr((ord(char) + shift - 65) % 26 + 65)
        else:
            cipher = cipher + chr((ord(char) + shift - 97) % 26 + 97)
    ldscr()

    print(cipher)
    now = datetime.now()
    Database.AddRecord(UID, "CaesarE", string,
                       now.strftime("%d/%m/%Y %H:%M:%S"))
    cip = input()
コード例 #12
0
def decryptRailFence():

    print(
        "     _                                    ______        _ _  _______                       "
    )
    print(
        "    | |                               _  (_____ \\      (_) |(_______)                      "
    )
    print(
        "  __| |_____  ____  ____ _   _ ____ _| |_ _____) )_____ _| | _____ _____ ____   ____ _____ "
    )
    print(
        " / _  | ___ |/ ___)/ ___) | | |  _ (_   _)  __  /(____ | | ||  ___) ___ |  _ \\ / ___) ___ |"
    )
    print(
        "( (_| | ____( (___| |   | |_| | |_| || |_| |  \\ \\/ ___ | | || |   | ____| | | ( (___| ____|"
    )
    print(
        " \\____|_____)\\____)_|    \\__  |  __/  \\__)_|   |_\\_____|_|\\_)_|   |_____)_| |_|\\____)_____)"
    )
    print(
        "                        (____/|_|                                                          "
    )

    cipher = input("Input Cipher to be decrypted:")
    key = int(input("Enter Key: "))

    rail = [['\n' for i in range(len(cipher))] for j in range(key)]

    dir_down = None
    row, col = 0, 0

    for i in range(len(cipher)):
        if row == 0:
            dir_down = True
        if row == key - 1:
            dir_down = False

        rail[row][col] = '*'
        col += 1

        if dir_down:
            row += 1
        else:
            row -= 1

    index = 0
    for i in range(key):
        for j in range(len(cipher)):
            if ((rail[i][j] == '*') and (index < len(cipher))):
                rail[i][j] = cipher[index]
                index += 1

    result = []
    row, col = 0, 0
    for i in range(len(cipher)):

        if row == 0:
            dir_down = True
        if row == key - 1:
            dir_down = False

        if (rail[row][col] != '*'):
            result.append(rail[row][col])
            col += 1

        if dir_down:
            row += 1
        else:
            row -= 1
    ldscr()
    print("".join(result))
    now = datetime.now()
    Database.AddRecord(UID, "RailFenceD", cipher,
                       now.strftime("%d/%m/%Y %H:%M:%S"))
    lamas = input()
コード例 #13
0
def Substitution():
    print(
        " _______           ______   _______ ___________________________         __________________ _______  _       "
    )
    print(
        "(  ____ \\|\\     /|(  ___ \\ (  ____ \\__   __/\\__   __/\\__   __/|\\     /|\\__   __/\\__   __/(  ___  )( (    /|"
    )
    print(
        "| (    \\/| )   ( || (   ) )| (    \\/   ) (      ) (      ) (   | )   ( |   ) (      ) (   | (   ) ||  \\  ( |"
    )
    print(
        "| (_____ | |   | || (__/ / | (_____    | |      | |      | |   | |   | |   | |      | |   | |   | ||   \\ | |"
    )
    print(
        "(_____  )| |   | ||  __ (  (_____  )   | |      | |      | |   | |   | |   | |      | |   | |   | || (\\ \\) |"
    )
    print(
        "      ) || |   | || (  \\ \\       ) |   | |      | |      | |   | |   | |   | |      | |   | |   | || | \\   |"
    )
    print(
        "/\\____) || (___) || )___) )/\\____) |   | |   ___) (___   | |   | (___) |   | |   ___) (___| (___) || )  \\  |"
    )
    print(
        "\\_______)(_______)|/ \\___/ \\_______)   )_(   \\_______/   )_(   (_______)   )_(   \\_______/(_______)|/    )_)\n\n"
    )
    mess = str(input("Enter the message to be substituted by a Set Key\n~$-"))

    mess = mess.lower()

    replace = {
        'a': "$",
        'b': "v",
        'c': "@",
        'd': "g",
        'e': "^",
        'f': "|",
        'g': "\\",
        'h': "5",
        'i': "2",
        'j': "u",
        'k': "8",
        'l': "w",
        'm': "*",
        'n': "7",
        'o': "m",
        'p': "q",
        'q': "p",
        'r': "%",
        's': "(",
        't': ")",
        'u': "z",
        'v': "3",
        'w': "!",
        'x': "_",
        'y': "=",
        'z': ":",
        '1': "a",
        '2': "n",
        '3': "x",
        '4': "o",
        '5': "~",
        '6': "`",
        '7': "/",
        '8': "d",
        '9': "i",
        '0': "+",
        ' ': "6",
        ',': "r",
        '.': "c"
    }
    jj = list(mess)

    encryption = ''

    for i in range(0, len(jj)):
        encryption = encryption + str(replace[jj[i]])

    ldscr()
    os.system('cls')
    print(encryption)
    now = datetime.now()
    Database.AddRecord(UID, "Substitution", mess,
                       now.strftime("%d/%m/%Y %H:%M:%S"))
    ayat = input()