コード例 #1
0
def andrew():
    os.system('clear')
    print("Alice-Bob notation of Andrew Protocol")
    print("1. A\t->\tB\t:\tA, {Ta}Kab")
    print("2. B\t->\tA\t:\t{Ta, Tb}Kab")
    print("3. A\t->\tB\t:\t{Tb}Kab")
    print("4. B\t->\tA\t:\t{K'ab, T'b}Kab")
    print()
    print("Versions of an attack")
    print("1) Man in the Middle 1")
    print("2) Man in the Middle 2")
    manInTheMiddleVersion = checkInts(1, 2)

    if manInTheMiddleVersion == 1:
        print("Man in the Middle 1")
        print("An attack exists if:")
        print("L1 >= 0")
        print("L2 >= max(3 * D3, D4) + 1")
    elif manInTheMiddleVersion == 2:
        print("Man in the Middle 2")
        print("An attack exists if:")
        print("L1 >= 0")
        print("L2 >= 3 * D3 + 1, for D3 <= D4")
        print("L2 >= 2 * D3 + D4 + 1, for D3 > D4")

    D1, D2, D3, D4 = check4Delays()
    L1, L2 = check2Lifetimes()

    print("All the parameters have been chosen!")
    print("Press ENTER to verify")
    input()
    os.system('clear')
    return manInTheMiddleVersion, D1, D2, D3, D4, L1, L2
コード例 #2
0
def wooLamPi3():
    os.system('clear')
    print("Alice-Bob notation of Timed version of Woo and Lam Pi 3 Protocol")
    print("1. A\t->\tB\t:\tA")
    print("2. B\t->\tA\t:\tTb")
    print("3. A\t->\tB\t:\t{A, Tb}Kas")
    print("4. B\t->\tS\t:\t{A, {Tb}Kas}Kbs")
    print("5. S\t->\tB\t:\t{A, Tb}Kbs")
    print()
    print("Versions of an attack")
    print("1) Man in the Middle 1")
    print("2) Man in the Middle 2")
    manInTheMiddleVersion = checkInts(1, 2)

    if manInTheMiddleVersion == 1:
        print("Man in the Middle 1")
        print("An attack exists if:")
        print("L1 >= D2 + 2 * D3 + 1")
        print("L2 >= 0")
    elif manInTheMiddleVersion == 2:
        print("Man in the Middle 2")
        print("An attack exists if:")
        print("L1 >= 0")
        print("L2 >= D2 + 2 * D3 + 1")

    D1, D2, D3 = check3Delays()
    L1, L2 = check2Lifetimes()

    print("All the parameters have been chosen!")
    print("Press ENTER to verify")
    input()
    os.system('clear')
    return manInTheMiddleVersion, D1, D2, D3, L1, L2
コード例 #3
0
def yahalomLowe():
    os.system('clear')
    print(
        "Alice-Bob notation of Timed version of Lowe's modification of Yahalom Protocol"
    )
    print("1. A\t->\tB\t:\tA, Ta")
    print("2. B\t->\tS\t:\tB, {A, Ta, Tb}Kbs")
    print("3. S\t->\tA\t:\t{B, Kab, Ta, Tb}Kas")
    print("4. S\t->\tB\t:\t{A, Kab}Kbs")
    print("5. A\t->\tB\t:\t{A, B, S, Tb}Kab")
    print()
    print("Versions of an attack")
    print("1) Man in the Middle 1")
    print("2) Man in the Middle 2")
    manInTheMiddleVersion = checkInts(1, 2)
    print("An attack does not exist")

    D1, D2, D3, D4 = check4Delays()
    L1, L2 = check2Lifetimes()

    print("All the parameters have been chosen!")
    print("Press ENTER to verify")
    input()
    os.system('clear')
    return manInTheMiddleVersion, D1, D2, D3, D4, L1, L2
コード例 #4
0
def nspktLowe():
    os.system('clear')
    print(
        "Alice-Bob notation Timed version of the Lowe's modification of Needham Schroeder Public Key Protocol"
    )
    print("1. A\t->\tB\t:\t{Ta ,A}Kb")
    print("2. B\t->\tA\t:\t{Ta, Tb, B}Ka")
    print("3. A\t->\tB\t:\t{Tb}Kb")
    print()
    print("Versions of an attack")
    print("1) Man in the Middle 1")
    print("2) Man in the Middle 2")
    manInTheMiddleVersion = checkInts(1, 2)
    if manInTheMiddleVersion == 1:
        print("Man in the Middle 1")
        print("An attack exists if:")
        print("L1 >= 3 * D2 + 1")
        print("L2 >= D1 + 2 * D2 + 1")
    elif manInTheMiddleVersion == 2:
        print("Man in the Middle 2")
        print("An attack exists if:")
        print("L1 >= D1 + 2 * D2 + 1")
        print("L2 >= 3 * D2 + 1")
    D1, D2, D3 = check3Delays()
    L1, L2 = check2Lifetimes()

    print("All the parameters have been chosen!")
    print("Press ENTER to verify")
    input()
    os.system('clear')
    return manInTheMiddleVersion, D1, D2, D3, L1, L2
コード例 #5
0
def nssk():
    os.system('clear')
    print(
        "Alice-Bob notation of Timed version of  Needham Schroeder Symetric Key Protocol"
    )
    print("1. A\t->\tS\t:\tA, B, Ta")
    print("2. S\t->\tB\t:\t{Ta, B, Kab, {Kab, A}Kbs}Kas")
    print("3. A\t->\tB\t:\t{Kab ,A}Kbs")
    print("4. B\t->\tA\t:\t{Tb}Kab")
    print("5. A\t->\tB\t:\t{Tb}Kab")
    print()
    print("Versions of an attack")
    print("1) Man in the Middle 1")
    print("2) Man in the Middle 2")
    manInTheMiddleVersion = checkInts(1, 2)
    print("An attack does not exist")

    D1, D2, D3, D4 = check4Delays()
    L1, L2 = check2Lifetimes()

    print("All the parameters have been chosen!")
    print("Press ENTER to verify")
    input()
    os.system('clear')
    return manInTheMiddleVersion, D1, D2, D3, D4, L1, L2
コード例 #6
0
def cskip():
    os.system('clear')
    print("Alice-Bob notation of Carlsen's Secret Key Initiator Protocol")
    print("1. A\t->\tS\t:\tA, B, Ta")
    print("2. S\t->\tB\t:\t{A, B, Ta, Kab}Kas, {A, B, Ta, Kab}Kbs")
    print("3. B\t->\tA\t:\t{A, B, Ta, Kab}Kas, {Ta}Kab, Tb")
    print("4. A\t->\tB\t:\t{Tb}Kab")
    print()
    print("Versions of an attack")
    print("1) Man in the Middle 1")
    print("2) Man in the Middle 2")
    manInTheMiddleVersion = checkInts(1, 2)
    print("An attack does not exist")

    D1, D2, D3, D4, D5, D6 = check6Delays()
    L1, L2 = check2Lifetimes()

    print("All the parameters have been chosen!")
    print("Press ENTER to verify")
    input()
    os.system('clear')
    return manInTheMiddleVersion, D1, D2, D3, D4, D5, D6, L1, L2