Last active
October 9, 2023 07:08
-
-
Save elliptic-shiho/6160a3a7ffa9bce8ee9b8d227897610b to your computer and use it in GitHub Desktop.
Balsn CTF 2023: Many Time QKD
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sun Oct 8 02:57:45 JST 2023 ~/Downloads/many_time_qkd | |
> time python solve_with_bruteforce.py | |
[+] Getting distribution... | |
[*] Done: defaultdict(<function solve.<locals>.<lambda> at 0x7faaa91104a0>, {0: [5, 19], 1: [5, 19], 2: [8, 16], 3: [19, 5], 4: [23, 1], 5: [3, 21], 6: [23, 1], 7: [8, 16], 8: [4, 20], 9: [22, 2], 10: [2, 22], 11: [5, 19], 12: [20, 4], 13: [20, 4], 14: [2, 22], 15: [3, 21], 16: [2, 22], 17: [21, 3], 18: [21, 3], 19: [19, 5], 20: [4, 20], 21: [21, 3], 22: [16, 8], 23: [0, 24]}) | |
[+] ok = [1, 1, 1, 0, 0, 1, 0, 1, 1, 0, 1, 1, 0, 0, 1, 1, 1, 0, 0, 0, 1, 0, 0, 1] | |
[+] Getting distribution... | |
[*] Done: defaultdict(<function solve.<locals>.<lambda> at 0x7faaa9110540>, {0: [1, 23], 1: [4, 20], 2: [4, 20], 3: [8, 16], 4: [21, 3], 5: [2, 22], 6: [21, 3], 7: [22, 2], 8: [21, 3], 9: [2, 22], 10: [1, 23], 11: [3, 21], 12: [21, 3], 13: [22, 2], 14: [2, 22], 15: [3, 21], 16: [2, 22], 17: [21, 3], 18: [20, 4], 19: [21, 3], 20: [20, 4], 21: [5, 19], 22: [22, 2], 23: [17, 7]}) | |
[+] ok = [1, 1, 1, 0, 0, 1, 0, 1, 1, 0, 1, 1, 0, 0, 1, 1, 1, 0, 0, 0, 1, 0, 0, 1, 1, 1, 1, 1, 0, 1, 0, 0, 0, 1, 1, 1, 0, 0, 1, 1, 1, 0, 0, 0, 0, 1, 0, 0] | |
[+] Getting distribution... | |
[*] Done: defaultdict(<function solve.<locals>.<lambda> at 0x7faaa91104a0>, {0: [2, 22], 1: [4, 20], 2: [3, 21], 3: [3, 21], 4: [5, 19], 5: [19, 5], 6: [23, 1], 7: [4, 20], 8: [3, 21], 9: [0, 24], 10: [18, 6], 11: [2, 22], 12: [20, 4], 13: [6, 18], 14: [3, 21], 15: [0, 24], 16: [22, 2], 17: [20, 4], 18: [21, 3], 19: [22, 2], 20: [7, 17], 21: [3, 21], 22: [22, 2], 23: [22, 2]}) | |
[+] ok = [1, 1, 1, 0, 0, 1, 0, 1, 1, 0, 1, 1, 0, 0, 1, 1, 1, 0, 0, 0, 1, 0, 0, 1, 1, 1, 1, 1, 0, 1, 0, 0, 0, 1, 1, 1, 0, 0, 1, 1, 1, 0, 0, 0, 0, 1, 0, 0, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 0, 1, 0, 1, 1, 1, 0, 0, 0, 0, 1, 1, 0, 0] | |
[+] Getting distribution... | |
[*] Done: defaultdict(<function solve.<locals>.<lambda> at 0x7faaa9110540>, {0: [5, 19], 1: [18, 6], 2: [1, 23], 3: [24, 0], 4: [5, 19], 5: [18, 6], 6: [18, 6], 7: [6, 18], 8: [1, 23], 9: [4, 20], 10: [23, 1], 11: [17, 7], 12: [21, 3], 13: [2, 22], 14: [18, 6], 15: [7, 17], 16: [18, 6], 17: [6, 18], 18: [1, 23], 19: [7, 17], 20: [20, 4], 21: [20, 4], 22: [21, 3], 23: [19, 5]}) | |
[+] ok = [1, 1, 1, 0, 0, 1, 0, 1, 1, 0, 1, 1, 0, 0, 1, 1, 1, 0, 0, 0, 1, 0, 0, 1, 1, 1, 1, 1, 0, 1, 0, 0, 0, 1, 1, 1, 0, 0, 1, 1, 1, 0, 0, 0, 0, 1, 0, 0, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 0, 1, 0, 1, 1, 1, 0, 0, 0, 0, 1, 1, 0, 0, 1, 0, 1, 0, 1, 0, 0, 1, 1, 1, 0, 0, 0, 1, 0, 1, 0, 1, 1, 1, 0, 0, 0, 0] | |
[+] Getting distribution... | |
[*] Done: defaultdict(<function solve.<locals>.<lambda> at 0x7faaa91104a0>, {0: [21, 3], 1: [22, 2], 2: [5, 19], 3: [19, 5], 4: [20, 4], 5: [2, 22], 6: [21, 3], 7: [19, 5], 8: [3, 21], 9: [2, 22], 10: [6, 18], 11: [4, 20], 12: [20, 4], 13: [4, 20], 14: [2, 22], 15: [18, 6], 16: [20, 4], 17: [24, 0], 18: [23, 1], 19: [17, 7], 20: [3, 21], 21: [24, 0], 22: [2, 22], 23: [4, 20]}) | |
[+] ok = [1, 1, 1, 0, 0, 1, 0, 1, 1, 0, 1, 1, 0, 0, 1, 1, 1, 0, 0, 0, 1, 0, 0, 1, 1, 1, 1, 1, 0, 1, 0, 0, 0, 1, 1, 1, 0, 0, 1, 1, 1, 0, 0, 0, 0, 1, 0, 0, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 0, 1, 0, 1, 1, 1, 0, 0, 0, 0, 1, 1, 0, 0, 1, 0, 1, 0, 1, 0, 0, 1, 1, 1, 0, 0, 0, 1, 0, 1, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 1, 1, 1, 1, 0, 1, 1, 0, 0, 0, 0, 0, 1, 0, 1, 1] | |
[+] Getting distribution... | |
[*] Done: defaultdict(<function solve.<locals>.<lambda> at 0x7faaa9110540>, {0: [3, 21], 1: [20, 4], 2: [23, 1], 3: [19, 5], 4: [4, 20], 5: [3, 21], 6: [20, 4], 7: [22, 2], 8: [7, 17], 9: [2, 22], 10: [4, 20], 11: [20, 4], 12: [5, 19], 13: [4, 20], 14: [3, 21], 15: [19, 5], 16: [3, 21], 17: [3, 21], 18: [2, 22], 19: [16, 8], 20: [20, 4], 21: [15, 9], 22: [18, 6], 23: [22, 2]}) | |
[+] ok = [1, 1, 1, 0, 0, 1, 0, 1, 1, 0, 1, 1, 0, 0, 1, 1, 1, 0, 0, 0, 1, 0, 0, 1, 1, 1, 1, 1, 0, 1, 0, 0, 0, 1, 1, 1, 0, 0, 1, 1, 1, 0, 0, 0, 0, 1, 0, 0, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 0, 1, 0, 1, 1, 1, 0, 0, 0, 0, 1, 1, 0, 0, 1, 0, 1, 0, 1, 0, 0, 1, 1, 1, 0, 0, 0, 1, 0, 1, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 1, 1, 1, 1, 0, 1, 1, 0, 0, 0, 0, 0, 1, 0, 1, 1, 1, 0, 0, 0, 1, 1, 0, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 0, 0, 0, 0] | |
[+] Getting distribution... | |
[*] Done: defaultdict(<function solve.<locals>.<lambda> at 0x7faaa91104a0>, {0: [3, 21], 1: [22, 2], 2: [18, 6], 3: [21, 3], 4: [6, 18], 5: [20, 4], 6: [22, 2], 7: [6, 18], 8: [22, 2], 9: [6, 18], 10: [4, 20], 11: [5, 19], 12: [16, 8], 13: [21, 3], 14: [2, 22], 15: [4, 20], 16: [22, 2], 17: [20, 4], 18: [20, 4], 19: [3, 21], 20: [5, 19], 21: [2, 22], 22: [22, 2], 23: [4, 20]}) | |
[+] ok = [1, 1, 1, 0, 0, 1, 0, 1, 1, 0, 1, 1, 0, 0, 1, 1, 1, 0, 0, 0, 1, 0, 0, 1, 1, 1, 1, 1, 0, 1, 0, 0, 0, 1, 1, 1, 0, 0, 1, 1, 1, 0, 0, 0, 0, 1, 0, 0, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 0, 1, 0, 1, 1, 1, 0, 0, 0, 0, 1, 1, 0, 0, 1, 0, 1, 0, 1, 0, 0, 1, 1, 1, 0, 0, 0, 1, 0, 1, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 1, 1, 1, 1, 0, 1, 1, 0, 0, 0, 0, 0, 1, 0, 1, 1, 1, 0, 0, 0, 1, 1, 0, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 1, 0, 1, 1, 1, 0, 0, 1, 1, 0, 0, 0, 1, 1, 1, 0, 1] | |
[+] Getting distribution... | |
[*] Done: defaultdict(<function solve.<locals>.<lambda> at 0x7faaa9110540>, {0: [0, 24], 1: [21, 3], 2: [3, 21], 3: [2, 22], 4: [20, 4], 5: [18, 6], 6: [21, 3], 7: [18, 6], 8: [19, 5], 9: [22, 2], 10: [22, 2], 11: [21, 3], 12: [4, 20], 13: [4, 20], 14: [4, 20], 15: [20, 4], 16: [22, 2], 17: [4, 20], 18: [19, 5], 19: [20, 4], 20: [23, 1], 21: [4, 20], 22: [5, 19], 23: [20, 4]}) | |
[+] ok = [1, 1, 1, 0, 0, 1, 0, 1, 1, 0, 1, 1, 0, 0, 1, 1, 1, 0, 0, 0, 1, 0, 0, 1, 1, 1, 1, 1, 0, 1, 0, 0, 0, 1, 1, 1, 0, 0, 1, 1, 1, 0, 0, 0, 0, 1, 0, 0, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 0, 1, 0, 1, 1, 1, 0, 0, 0, 0, 1, 1, 0, 0, 1, 0, 1, 0, 1, 0, 0, 1, 1, 1, 0, 0, 0, 1, 0, 1, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 1, 1, 1, 1, 0, 1, 1, 0, 0, 0, 0, 0, 1, 0, 1, 1, 1, 0, 0, 0, 1, 1, 0, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 1, 0, 1, 1, 1, 0, 0, 1, 1, 0, 0, 0, 1, 1, 1, 0, 1, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 1, 0, 0, 0, 1, 1, 0] | |
[+] Getting distribution... | |
[*] Done: defaultdict(<function solve.<locals>.<lambda> at 0x7faaa91104a0>, {0: [19, 5], 1: [4, 20], 2: [7, 17], 3: [23, 1], 4: [5, 19], 5: [4, 20], 6: [21, 3], 7: [2, 22], 8: [3, 21], 9: [6, 18], 10: [1, 23], 11: [2, 22], 12: [23, 1], 13: [20, 4], 14: [3, 21], 15: [5, 19], 16: [21, 3], 17: [3, 21], 18: [4, 20], 19: [18, 6], 20: [4, 20], 21: [18, 6], 22: [4, 20], 23: [21, 3]}) | |
[+] ok = [1, 1, 1, 0, 0, 1, 0, 1, 1, 0, 1, 1, 0, 0, 1, 1, 1, 0, 0, 0, 1, 0, 0, 1, 1, 1, 1, 1, 0, 1, 0, 0, 0, 1, 1, 1, 0, 0, 1, 1, 1, 0, 0, 0, 0, 1, 0, 0, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 0, 1, 0, 1, 1, 1, 0, 0, 0, 0, 1, 1, 0, 0, 1, 0, 1, 0, 1, 0, 0, 1, 1, 1, 0, 0, 0, 1, 0, 1, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 1, 1, 1, 1, 0, 1, 1, 0, 0, 0, 0, 0, 1, 0, 1, 1, 1, 0, 0, 0, 1, 1, 0, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 1, 0, 1, 1, 1, 0, 0, 1, 1, 0, 0, 0, 1, 1, 1, 0, 1, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 1, 0, 0, 0, 1, 1, 0, 0, 1, 1, 0, 1, 1, 0, 1, 1, 1, 1, 1, 0, 0, 1, 1, 0, 1, 1, 0, 1, 0, 1, 0] | |
[+] Getting distribution... | |
[*] Done: defaultdict(<function solve.<locals>.<lambda> at 0x7faaa9110540>, {0: [7, 17], 1: [19, 5], 2: [21, 3], 3: [20, 4], 4: [1, 23], 5: [20, 4], 6: [5, 19], 7: [20, 4], 8: [21, 3], 9: [3, 21], 10: [18, 6], 11: [2, 22], 12: [5, 19], 13: [21, 3], 14: [3, 21], 15: [1, 23], 16: [5, 19], 17: [3, 21], 18: [3, 21], 19: [3, 21], 20: [2, 22], 21: [4, 20], 22: [22, 2], 23: [21, 3]}) | |
[+] ok = [1, 1, 1, 0, 0, 1, 0, 1, 1, 0, 1, 1, 0, 0, 1, 1, 1, 0, 0, 0, 1, 0, 0, 1, 1, 1, 1, 1, 0, 1, 0, 0, 0, 1, 1, 1, 0, 0, 1, 1, 1, 0, 0, 0, 0, 1, 0, 0, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 0, 1, 0, 1, 1, 1, 0, 0, 0, 0, 1, 1, 0, 0, 1, 0, 1, 0, 1, 0, 0, 1, 1, 1, 0, 0, 0, 1, 0, 1, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 1, 1, 1, 1, 0, 1, 1, 0, 0, 0, 0, 0, 1, 0, 1, 1, 1, 0, 0, 0, 1, 1, 0, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 1, 0, 1, 1, 1, 0, 0, 1, 1, 0, 0, 0, 1, 1, 1, 0, 1, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 1, 0, 0, 0, 1, 1, 0, 0, 1, 1, 0, 1, 1, 0, 1, 1, 1, 1, 1, 0, 0, 1, 1, 0, 1, 1, 0, 1, 0, 1, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0] | |
[+] Getting distribution... | |
[*] Done: defaultdict(<function solve.<locals>.<lambda> at 0x7faaa91104a0>, {0: [5, 19], 1: [20, 4], 2: [2, 22], 3: [5, 19], 4: [20, 4], 5: [21, 3], 6: [20, 4], 7: [3, 21], 8: [5, 19], 9: [4, 20], 10: [23, 1], 11: [21, 3], 12: [22, 2], 13: [18, 6], 14: [6, 18], 15: [0, 24], 16: [20, 4], 17: [4, 20], 18: [18, 6], 19: [4, 20], 20: [4, 20], 21: [3, 21], 22: [4, 20], 23: [2, 22]}) | |
[+] ok = [1, 1, 1, 0, 0, 1, 0, 1, 1, 0, 1, 1, 0, 0, 1, 1, 1, 0, 0, 0, 1, 0, 0, 1, 1, 1, 1, 1, 0, 1, 0, 0, 0, 1, 1, 1, 0, 0, 1, 1, 1, 0, 0, 0, 0, 1, 0, 0, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 0, 1, 0, 1, 1, 1, 0, 0, 0, 0, 1, 1, 0, 0, 1, 0, 1, 0, 1, 0, 0, 1, 1, 1, 0, 0, 0, 1, 0, 1, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 1, 1, 1, 1, 0, 1, 1, 0, 0, 0, 0, 0, 1, 0, 1, 1, 1, 0, 0, 0, 1, 1, 0, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 1, 0, 1, 1, 1, 0, 0, 1, 1, 0, 0, 0, 1, 1, 1, 0, 1, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 1, 0, 0, 0, 1, 1, 0, 0, 1, 1, 0, 1, 1, 0, 1, 1, 1, 1, 1, 0, 0, 1, 1, 0, 1, 1, 0, 1, 0, 1, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 0, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 1, 1, 0, 1, 0, 1, 1, 1, 1, 1] | |
[+] Getting distribution... | |
[*] Done: defaultdict(<function solve.<locals>.<lambda> at 0x7faaa9110540>, {0: [20, 4], 1: [4, 20], 2: [4, 20], 3: [2, 22], 4: [19, 5],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, 0, 1, 1, 0, 0, 1, 1] | |
[+] Getting distribution... | |
[*] Done: defaultdict(<function solve.<locals>.<lambda> at 0x7faaa91104a0>, {0: [7, 17], 1: [3, 21], 2: [5, 19], 3: [4, 20], 4: [1, 23], 5: [23, 1], 6: [21, 3], 7: [20, 4], 8: [22, 2], 9: [5, 19], 10: [2, 22], 11: [22, 2], 12: [5, 19], 13: [4, 20], 14: [21, 3], 15: [3, 21], 16: [19, 5], 17: [4, 20], 18: [6, 18], 19: [2, 22], 20: [23, 1], 21: [20, 4], 22: [21, 3], 23: [2, 22]}) | |
[+] ok = [1, 1, 1, 0, 0, 1, 0, 1, 1, 0, 1, 1, 0, 0, 1, 1, 1, 0, 0, 0, 1, 0, 0, 1, 1, 1, 1, 1, 0, 1, 0, 0, 0, 1, 1, 1, 0, 0, 1, 1, 1, 0, 0, 0, 0, 1, 0, 0, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 0, 1, 0, 1, 1, 1, 0, 0, 0, 0, 1, 1, 0, 0, 1, 0, 1, 0, 1, 0, 0, 1, 1, 1, 0, 0, 0, 1, 0, 1, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 1, 1, 1, 1, 0, 1, 1, 0, 0, 0, 0, 0, 1, 0, 1, 1, 1, 0, 0, 0, 1, 1, 0, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 1, 0, 1, 1, 1, 0, 0, 1, 1, 0, 0, 0, 1, 1, 1, 0, 1, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 1, 0, 0, 0, 1, 1, 0, 0, 1, 1, 0, 1, 1, 0, 1, 1, 1, 1, 1, 0, 0, 1, 1, 0, 1, 1, 0, 1, 0, 1, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 0, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 1, 1, 0, 1, 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 0, 1, 1, 0, 1, 0, 1, 1, 1, 0, 0, 0, 1] | |
[+] Getting distribution... | |
[*] Done: defaultdict(<function solve.<locals>.<lambda> at 0x7faaa9110540>, {0: [0, 24], 1: [22, 2], 2: [22, 2], 3: [3, 21], 4: [18, 6], 5: [4, 20], 6: [19, 5], 7: [4, 20], 8: [1, 23], 9: [21, 3], 10: [6, 18], 11: [2, 22], 12: [21, 3], 13: [22, 2], 14: [22, 2], 15: [2, 22], 16: [4, 20], 17: [23, 1], 18: [4, 20], 19: [5, 19], 20: [21, 3], 21: [20, 4], 22: [18, 6], 23: [22, 2]}) | |
[+] ok = [1, 1, 1, 0, 0, 1, 0, 1, 1, 0, 1, 1, 0, 0, 1, 1, 1, 0, 0, 0, 1, 0, 0, 1, 1, 1, 1, 1, 0, 1, 0, 0, 0, 1, 1, 1, 0, 0, 1, 1, 1, 0, 0, 0, 0, 1, 0, 0, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 0, 1, 0, 1, 1, 1, 0, 0, 0, 0, 1, 1, 0, 0, 1, 0, 1, 0, 1, 0, 0, 1, 1, 1, 0, 0, 0, 1, 0, 1, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 1, 1, 1, 1, 0, 1, 1, 0, 0, 0, 0, 0, 1, 0, 1, 1, 1, 0, 0, 0, 1, 1, 0, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 1, 0, 1, 1, 1, 0, 0, 1, 1, 0, 0, 0, 1, 1, 1, 0, 1, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 1, 0, 0, 0, 1, 1, 0, 0, 1, 1, 0, 1, 1, 0, 1, 1, 1, 1, 1, 0, 0, 1, 1, 0, 1, 1, 0, 1, 0, 1, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 0, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 1, 1, 0, 1, 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 0, 1, 1, 0, 1, 0, 1, 1, 1, 0, 0, 0, 1, 1, 0, 0, 1, 0, 1, 0, 1, 1, 0, 1, 1, 0, 0, 0, 1, 1, 0, 1, 1, 0, 0, 0, 0] | |
[+] Getting distribution... | |
[*] Done: defaultdict(<function solve.<locals>.<lambda> at 0x7faaa91104a0>, {0: [4, 20], 1: [21, 3], 2: [3, 21], 3: [2, 22], 4: [20, 4], 5: [5, 19], 6: [18, 6], 7: [2, 22], 8: [2, 22], 9: [17, 7], 10: [4, 20], 11: [22, 2], 12: [7, 17], 13: [21, 3], 14: [3, 21], 15: [2, 22], 16: [19, 5], 17: [4, 20], 18: [20, 4], 19: [2, 22], 20: [4, 20], 21: [21, 3], 22: [20, 4], 23: [19, 5]}) | |
[+] ok = [1, 1, 1, 0, 0, 1, 0, 1, 1, 0, 1, 1, 0, 0, 1, 1, 1, 0, 0, 0, 1, 0, 0, 1, 1, 1, 1, 1, 0, 1, 0, 0, 0, 1, 1, 1, 0, 0, 1, 1, 1, 0, 0, 0, 0, 1, 0, 0, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 0, 1, 0, 1, 1, 1, 0, 0, 0, 0, 1, 1, 0, 0, 1, 0, 1, 0, 1, 0, 0, 1, 1, 1, 0, 0, 0, 1, 0, 1, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 1, 1, 1, 1, 0, 1, 1, 0, 0, 0, 0, 0, 1, 0, 1, 1, 1, 0, 0, 0, 1, 1, 0, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 1, 0, 1, 1, 1, 0, 0, 1, 1, 0, 0, 0, 1, 1, 1, 0, 1, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 1, 0, 0, 0, 1, 1, 0, 0, 1, 1, 0, 1, 1, 0, 1, 1, 1, 1, 1, 0, 0, 1, 1, 0, 1, 1, 0, 1, 0, 1, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 0, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 1, 1, 0, 1, 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 0, 1, 1, 0, 1, 0, 1, 1, 1, 0, 0, 0, 1, 1, 0, 0, 1, 0, 1, 0, 1, 1, 0, 1, 1, 0, 0, 0, 1, 1, 0, 1, 1, 0, 0, 0, 0, 1, 0, 1, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 1, 0, 0, 0] | |
[+] Getting distribution... | |
[*] Done: defaultdict(<function solve.<locals>.<lambda> at 0x7faaa9110540>, {0: [20, 4], 1: [1, 23], 2: [20, 4], 3: [19, 5], 4: [17, 7], 5: [4, 20], 6: [3, 21], 7: [2, 22], 8: [21, 3], 9: [3, 21], 10: [19, 5], 11: [5, 19], 12: [2, 22], 13: [2, 22], 14: [4, 20], 15: [19, 5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0, 0, 1, 0, 1, 0, 1, 1, 0, 1, 1, 0, 0, 0, 1, 1, 0, 1, 1, 0, 0, 0, 0, 1, 0, 1, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 1, 0, 0, 0, 0, 1, 0, 0, 0, 1, 1, 1, 0, 1, 0, 1, 1, 1, 1, 0, 1, 1, 0, 1, 1, 1, 1, 1] | |
[+] Getting distribution... | |
[*] Done: defaultdict(<function solve.<locals>.<lambda> at 0x7faaa91104a0>, {0: [6, 18], 1: [3, 21], 2: [5, 19], 3: [22, 2], 4: [2, 22], 5: [4, 20], 6: [22, 2], 7: [20, 4], 8: [18, 6], 9: [19, 5], 10: [19, 5], 11: [2, 22], 12: [3, 21], 13: [4, 20], 14: [21, 3], 15: [3, 21], 16: [4, 20], 17: [20, 4], 18: [21, 3], 19: [18, 6], 20: [23, 1], 21: [6, 18], 22: [20, 4], 23: [4, 20]}) | |
[+] ok = [1, 1, 1, 0, 0, 1, 0, 1, 1, 0, 1, 1, 0, 0, 1, 1, 1, 0, 0, 0, 1, 0, 0, 1, 1, 1, 1, 1, 0, 1, 0, 0, 0, 1, 1, 1, 0, 0, 1, 1, 1, 0, 0, 0, 0, 1, 0, 0, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 0, 1, 0, 1, 1, 1, 0, 0, 0, 0, 1, 1, 0, 0, 1, 0, 1, 0, 1, 0, 0, 1, 1, 1, 0, 0, 0, 1, 0, 1, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 1, 1, 1, 1, 0, 1, 1, 0, 0, 0, 0, 0, 1, 0, 1, 1, 1, 0, 0, 0, 1, 1, 0, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 1, 0, 1, 1, 1, 0, 0, 1, 1, 0, 0, 0, 1, 1, 1, 0, 1, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 1, 0, 0, 0, 1, 1, 0, 0, 1, 1, 0, 1, 1, 0, 1, 1, 1, 1, 1, 0, 0, 1, 1, 0, 1, 1, 0, 1, 0, 1, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 0, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 1, 1, 0, 1, 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 0, 1, 1, 0, 1, 0, 1, 1, 1, 0, 0, 0, 1, 1, 0, 0, 1, 0, 1, 0, 1, 1, 0, 1, 1, 0, 0, 0, 1, 1, 0, 1, 1, 0, 0, 0, 0, 1, 0, 1, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 1, 0, 0, 0, 0, 1, 0, 0, 0, 1, 1, 1, 0, 1, 0, 1, 1, 1, 1, 0, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 0, 1, 1, 0, 0, 0, 0, 1, 0, 1] | |
[+] Getting distribution... | |
[*] Done: defaultdict(<function solve.<locals>.<lambda> at 0x7faaa9110540>, {0: [21, 3], 1: [19, 5], 2: [20, 4], 3: [3, 21], 4: [1, 23], 5: [0, 24], 6: [1, 23], 7: [18, 6], 8: [3, 21], 9: [18, 6], 10: [2, 22], 11: [3, 21], 12: [19, 5], 13: [20, 4], 14: [21, 3], 15: [3, 21], 16: [4, 20], 17: [3, 21], 18: [18, 6], 19: [3, 21], 20: [3, 21], 21: [21, 3], 22: [20, 4], 23: [20, 4]}) | |
[+] ok = [1, 1, 1, 0, 0, 1, 0, 1, 1, 0, 1, 1, 0, 0, 1,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1, 0, 0, 0, 0, 1, 0, 0, 0, 1, 1, 1, 0, 1, 0, 1, 1, 1, 1, 0, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 0, 1, 1, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 1, 1, 1, 1, 0, 1, 0, 1, 1, 0, 0, 0, 1, 1, 1, 0, 1, 1, 0, 0, 0] | |
[+] Getting distribution... | |
[*] Done: defaultdict(<function solve.<locals>.<lambda> at 0x7faaa91104a0>, {0: [19, 5], 1: [2, 22], 2: [2, 22], 3: [4, 20], 4: [20, 4], 5: [20, 4], 6: [21, 3], 7: [5, 19], 8: [24, 0], 9: [4, 20], 10: [2, 22], 11: [2, 22], 12: [22, 2], 13: [18, 6], 14: [2, 22], 15: [18, 6], 16: [20, 4], 17: [21, 3], 18: [22, 2], 19: [7, 17], 20: [5, 19], 21: [2, 22], 22: [21, 3], 23: [3, 21]}) | |
[+] ok = [1, 1, 1, 0, 0, 1, 0, 1, 1, 0, 1, 1, 0, 0, 1, 1, 1, 0, 0, 0, 1, 0, 0, 1, 1, 1, 1, 1, 0, 1, 0, 0, 0, 1, 1, 1, 0, 0, 1, 1, 1, 0, 0, 0, 0, 1, 0, 0, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 0, 1, 0, 1, 1, 1, 0, 0, 0, 0, 1, 1, 0, 0, 1, 0, 1, 0, 1, 0, 0, 1, 1, 1, 0, 0, 0, 1, 0, 1, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 1, 1, 1, 1, 0, 1, 1, 0, 0, 0, 0, 0, 1, 0, 1, 1, 1, 0, 0, 0, 1, 1, 0, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 1, 0, 1, 1, 1, 0, 0, 1, 1, 0, 0, 0, 1, 1, 1, 0, 1, 1, 0, 1,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1, 0, 1, 1, 1, 0, 0, 0, 1, 1, 0, 0, 1, 0, 1, 0, 1, 1, 0, 1, 1, 0, 0, 0, 1, 1, 0, 1, 1, 0, 0, 0, 0, 1, 0, 1, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 1, 0, 0, 0, 0, 1, 0, 0, 0, 1, 1, 1, 0, 1, 0, 1, 1, 1, 1, 0, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 0, 1, 1, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 1, 1, 1, 1, 0, 1, 0, 1, 1, 0, 0, 0, 1, 1, 1, 0, 1, 1, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 0, 1, 1, 1, 0, 0, 1, 0, 0, 0, 0, 1, 1, 1, 0, 1, 0, 1, 1, 1, 0, 1, 0, 0, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 0, 0, 1, 1, 1] | |
[+] Getting distribution... | |
[*] Done: defaultdict(<function solve.<locals>.<lambda> at 0x7faaa91104a0>, {0: [5, 19], 1: [23, 1], 2: [5, 19], 3: [3, 21], 4: [5, 19], 5: [4, 20], 6: [3, 21], 7: [21, 3], 8: [4, 20], 9: [2, 22], 10: [22, 2], 11: [3, 21], 12: [3, 21], 13: [5, 19], 14: [23, 1], 15: [22, 2], 16: [21, 3], 17: [2, 22], 18: [3, 21], 19: [21, 3], 20: [18, 6], 21: [21, 3], 22: [17, 7], 23: [19, 5]}) | |
[+] ok = [1, 1, 1, 0, 0, 1, 0, 1, 1, 0, 1, 1, 0, 0, 1, 1, 1, 0, 0, 0, 1, 0, 0, 1, 1, 1, 1, 1, 0, 1, 0, 0, 0, 1, 1, 1, 0, 0, 1, 1, 1, 0, 0, 0, 0, 1, 0, 0, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 0, 1, 0, 1, 1, 1, 0, 0, 0, 0, 1, 1,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, 0, 1, 1, 1, 0, 0, 0, 0, 1, 1, 0, 1, 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 0, 1, 1, 0, 1, 0, 1, 1, 1, 0, 0, 0, 1, 1, 0, 0, 1, 0, 1, 0, 1, 1, 0, 1, 1, 0, 0, 0, 1, 1, 0, 1, 1, 0, 0, 0, 0, 1, 0, 1, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 1, 0, 0, 0, 0, 1, 0, 0, 0, 1, 1, 1, 0, 1, 0, 1, 1, 1, 1, 0, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 0, 1, 1, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 1, 1, 1, 1, 0, 1, 0, 1, 1, 0, 0, 0, 1, 1, 1, 0, 1, 1, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 0, 1, 1, 1, 0, 0, 1, 0, 0, 0, 0, 1, 1, 1, 0, 1, 0, 1, 1, 1, 0, 1, 0, 0, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 1, 1, 0, 1, 1, 1, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0] | |
[+] index_keys = [2, 5, 6, 7, 8, 11, 12, 15, 16, 23, 25, 29, 30, 31, 34, 38, 39, 42, 43, 44, 45, 47, 49, 51, 52, 53, 54, 55, 56, 58, 60, 63, 64, 65, 66, 67, 70, 71, 73, 74, 75, 78, 79, 80, 82, 84, 85, 87, 90, 93, 94, 95, 96, 98, 99, 100, 102, 105, 109, 112, 113, 117, 118, 119, 120, 121, 125, 126, 128, 129, 130, 132, 133, 134, 136, 137, 138, 140, 141, 144, 146, 148, 156, 157, 159, 160, 161, 163, 166, 167, 173, 175, 176, 181, 184, 185, 192, 193, 194, 196, 198, 200, 201, 203, 205, 207, 213, 216, 217, 221, 222, 223, 224, 226, 232, 233, 234, 237, 239, 241, 242, 245, 248, 249, 250, 253, 256, 258, 264, 271, 272, 275, 279, 280, 282, 283, 284, 285, 286, 289, 294, 297, 300, 301, 303, 305, 308, 310, 311, 312, 314, 315, 324, 326, 327, 332, 335, 336, 338, 342, 343, 346, 347, 350, 351, 352, 353, 354, 355, 357, 358, 360, 364, 369, 370, 371, 372, 373, 374, 377, 378, 380, 381, 382, 385, 386, 387, 389, 390, 391, 392, 393, 394, 395, 399, 402, 404, 408, 410, 412, 413, 414, 418, 422, 423, 424, 426, 428, 429, 430, 436, 437, 438, 440, 441, 443, 446, 448, 449, 450, 452, 453, 454, 455, 461, 464, 465, 468, 469, 470, 471, 473, 474, 475, 479, 483, 485, 486, 488, 490, 495, 496, 497, 498, 500, 501, 502, 503, 504, 505, 506, 509, 510, 514, 516, 517, 523, 530, 536, 538, 539, 540, 541, 542, 544, 547, 549, 551, 556, 557, 558, 561, 562, 563, 564, 565, 569, 572, 577, 578, 579, 581, 582, 584, 589, 590, 591, 594, 595, 597, 600, 601, 602, 606, 610, 611, 613, 614, 615, 617, 618, 619, 620, 621, 622, 624, 626, 628, 631, 633, 634, 635, 636, 638, 642, 645, 646, 647, 648, 650, 651, 652, 654, 657, 663, 664, 666, 667, 669, 671, 673, 674, 675, 676, 678, 679, 680, 682, 683, 684, 685, 686, 688, 689, 691, 692, 693, 695, 696, 697, 698, 701, 702, 704, 707, 708, 712, 714, 715, 716, 717, 718, 719, 720, 721, 722, 724, 726, 728, 738, 740, 743, 744, 746, 748, 749, 750, 753, 754, 756, 757, 759, 760, 761, 762, 763] | |
[+] ciphertext = b'!k m\x08A!t\xbf\x11\xac\xcb_\xf4\xe1\xdf\tPW\x1b\x12\xf8\xdeI\xe5\xdc\xa0\xbe>\x81\x0b\xbc&j\xb1H\xad\xc2\xfc\xc7\xe46IX\xea\x1fs\xb6\xc6\xc5' | |
[+] nonce = b'\x01\x0e\x84WX\xab#\xe5\x0b\xcar\xb2V\xa4+D' | |
[*] larger_elements = [504, 505, 506, 509, 510, 514, 516, 517] | |
[+] Solve with brute force! | |
[+] key = b'\xdd\xf3\x8b\x99\x013\x84c\xaf\xf9IEwR<\xb0\x077\xcd&\xda\x85\xf7\xd0a\xed\x03\x8d\xfb\xbe0O' | |
[+] cipher.nonce = b'\x01\x0e\x84WX\xab#\xe5\x0b\xcar\xb2V\xa4+D' | |
[+] decrypted = b'BALSN{I_giV3_Y0u_kEy_because_y0u_are_sOO00_smarT}\n' | |
real 1m56.999s | |
user 0m1.870s | |
sys 0m0.720s |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from socket import create_connection | |
from collections import defaultdict | |
from Crypto.Cipher import AES | |
from scryptos import long_to_bytes | |
from ast import literal_eval | |
import binascii | |
class Tube: | |
def __init__(s, host, port, debug=False): | |
s.host = host | |
s.port = port | |
s.sock = create_connection((host, port)) | |
s.debug = debug | |
def recv(s, size=1024) -> bytes: | |
buf = s.sock.recv(size) | |
if s.debug: | |
print(f"[Tube#recv] {buf=}") | |
return buf | |
def recv_until(s, expected: bytes) -> bytes: | |
buf = b"" | |
while True: | |
buf += s.sock.recv(1) | |
if expected in buf: | |
break | |
if s.debug: | |
print(f"[Tube#recv_until] {buf=}") | |
return buf | |
def send(s, buf): | |
if s.debug: | |
print(f"[Tube#send] {buf=}") | |
s.sock.send(buf) | |
def send_line(s, buf): | |
s.send(buf + b"\n") | |
def close(s): | |
s.sock.close() | |
if s.debug: | |
print("[Tube#close] closed") | |
def solve(tube): | |
ok = [] | |
COUNT = 24 | |
GUESS_COUNT = 24 * 21 | |
while len(ok) < GUESS_COUNT: | |
distribution = defaultdict(lambda: [0, 0]) | |
print("[+] Getting distribution...") | |
for _ in range(COUNT): | |
tube.recv_until(b"[768 qubits are transmitted.]\n") | |
tube.send_line(b"0" * len(ok) + b"1" * 24) | |
next_16bits = tube.recv_until(b"\n").decode().strip().replace("?", "") | |
for i, x in enumerate(map(int, next_16bits)): | |
distribution[i][x] += 1 | |
print(f"[*] Done: {distribution}") | |
for i in range(24): | |
a, b = distribution[i] | |
assert a + b == COUNT | |
if a < b: | |
ok.append(1) | |
else: | |
ok.append(0) | |
print(f"[+] {ok = }") | |
data = b"[768 qubits are transmitted.]\n" | |
index_keys = [] | |
tube.recv_until(data) | |
while b"768 qubits" in data: | |
tube.send_line(b"0" * GUESS_COUNT + b"1" * (768 - GUESS_COUNT)) | |
tube.recv_until(b"\n") # bits | |
index_keys = literal_eval("[" + tube.recv_until(b"\n\n").decode().strip() + "]") | |
data = tube.recv_until(b"\n") | |
ciphertext = binascii.unhexlify(data.decode().strip().strip()) | |
nonce = binascii.unhexlify(tube.recv_until(b"\n").decode().strip()) | |
print(f"[+] {ok = }") | |
print(f"[+] {index_keys = }") | |
print(f"[+] {ciphertext = }") | |
print(f"[+] {nonce = }") | |
if max(index_keys[:256]) < GUESS_COUNT: | |
key = long_to_bytes(int("".join([str(ok[i]) for i in index_keys[:256]]), 2)) | |
print(f"[+] {key = }") | |
cipher = AES.new(key, AES.MODE_EAX, nonce=nonce) | |
print(f"{cipher.nonce = }") | |
decrypted = cipher.decrypt(ciphertext) | |
print(f"{decrypted}") | |
return True | |
else: | |
larger_elements = [x for x in index_keys[:256] if GUESS_COUNT <= x] | |
L = len(larger_elements) | |
print(f"[*] {larger_elements = }") | |
if L > 28: | |
print("[-] Damn") | |
return False | |
print("[+] Solve with brute force!") | |
for cand in range(2**L): | |
bits = "".join([str(ok[i]) for i in index_keys[: 256 - L]]) | |
bits += format(cand, f"0{L}b") | |
assert len(bits) == 256 | |
key = long_to_bytes(int(bits, 2)) | |
key = b"\x00" * (32 - len(key)) + key | |
cipher = AES.new(key, AES.MODE_EAX, nonce=nonce) | |
decrypted = cipher.decrypt(ciphertext) | |
if b"BALSN" in decrypted: | |
print(f"[+] {key = }") | |
print(f"[+] {cipher.nonce = }") | |
print(f"[+] {decrypted = }") | |
return True | |
return False | |
def main(): | |
r = False | |
while not r: | |
tube = Tube("guessq.balsnctf.com", 1258) | |
r = solve(tube) | |
tube.close() | |
if __name__ == "__main__": | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment