0x00 簡介
培根密碼,培根所用的密碼是一種本質上用二進制數設計的,沒有用一般的0和1來表示,而是採用a和b
培根密碼加密有兩種方式:
A aaaaa B aaaab C aaaba D aaabb E aabaa F aabab G aabba H aabbb I abaaa J abaab K ababa L ababb M abbaa N abbab O abbba P abbbb Q baaaa R baaab S baaba T baabb U babaa V babab W babba X babbb Y bbaaa Z bbaab
方式二:
a AAAAA g AABBA n ABBAA t BAABA
b AAAAB h AABBB o ABBAB u-v BAABB
c AAABA i-j ABAAA p ABBBA w BABAA
d AAABB k ABAAB q ABBBB x BABAB
e AABAA l ABABA r BAAAA y BABBA
f AABAB m ABABB s BAAAB z BABBB
html
一般加密者只須要兩種不一樣的字體或使用大小寫來代替ab便可,例如明文爲bling,加密爲:aaaab ababb abaaa abbab aabba,此時再隨意找句句子,使用大小寫來代替ab。密文以下:good GoOd STuDy day DAy Up hAHapython
0x01 解密代碼
#! python3 # -*- coding: utf-8 -*- # @Time : 2017/8/26 上午12:07 # @Author : BlingBling # @File : Baconian.py # @Software: PyCharm Community Edition import re class Baconian(): alphabet = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'] first_cipher = ["aaaaa", "aaaab", "aaaba", "aaabb", "aabaa", "aabab", "aabba", "aabbb", "abaaa", "abaab", "ababa", "ababb", "abbaa", "abbab", "abbba", "abbbb", "baaaa", "baaab", "baaba", "baabb", "babaa", "babab", "babba", "babbb", "bbaaa", "bbaab"] second_cipher = ["aaaaa", "aaaab", "aaaba", "aaabb", "aabaa", "aabab", "aabba", "aabbb", "abaaa", "abaaa", "abaab", "ababa", "ababb", "abbaa", "abbab", "abbba", "abbbb", "baaaa", "baaab", "baaba", "baabb", "baabb", "babaa", "babab", "babba", "babbb"] def __init__(self, str): self.str = str def decode(self): str = self.str.lower() str_array = re.findall(".{5}", str) decode_str1 = "" decode_str2 = "" for key in str_array: for i in range(0,26): if key == Baconian.first_cipher[i]: decode_str1 += Baconian.alphabet[i] if key == Baconian.second_cipher[i]: decode_str2 += Baconian.alphabet[i] print(decode_str1) print(decode_str2) if __name__ == '__main__': str = input("please input string to decode:\n") bacon = Baconian(str) bacon.decode()
總結:編輯器
培根密碼:base64解碼後直接培根解密http://ctf.ssleye.com/baconian.html
Crypto2:RSA小明文攻擊,得出輸出也就是C後,使用https://xz.aliyun.com/t/6459#toc-34裏面的腳本。
字體
MISC2:16進制編輯器打開,逆序答案在內。加密
Re1 ida 打開搜索字符串 flag,一堆 flag 中間只有一個有引用的,就是正確的。spa