Python-forensics-cracking-encryption

提供:Dev Guides
移動先:案内検索

Pythonフォレンジック-暗号化のクラッキング

この章では、分析および証拠の取得中に取得したテキストデータのクラッキングについて学習します。

暗号化のプレーンテキストは、メッセージなどの通常の読み取り可能なテキストです。 一方、暗号テキストは、プレーンテキストを入力した後に取得された暗号化アルゴリズムの出力です。

プレーンテキストメッセージを暗号テキストに変換する単純なアルゴリズムは、敵からプレーンテキストを秘密にするためにJulius Caesarによって発明された* Caesar暗号*です。 この暗号化では、メッセージ内のすべての文字をアルファベット順で3桁シフトします。

以下はデモの図です。

a→D

b→E

c→F

w → Z

x → A

y → B

z → C

=== Example

A message entered when you run a Python script gives all the possibilities of characters, which is used for pattern evidence.

The types of pattern evidences used are as follows −

* Tire Tracks and Marks
* Impressions
* Fingerprints

Every biometric data comprises of vector data, which we need to crack to gather full-proof evidence.

The following Python code shows how you can produce a cipher text from plain text −

[source,prettyprint,notranslate]
----
インポートシステム

def decrypt(k、cipher):plaintext = '' in cipher in:p =(ord(each)-k)%126 if p <32:p + = 95 plaintext + = chr(p)print plaintext

def main(argv):if(len(sys.argv)!= 1):sys.exit( 'Usage:cracking.py')cipher = raw_input( 'Enter message:')for i in range(1,95、 1):__name__ == "__main__"の場合、decrypt(i、cipher):main(sys.argv [1:])
----

=== Output

Now, check the output of this code. When we enter a simple text "Radhika", the program will produce the following cipher text.

image:/python_forensics/cracking_encryption_output.jpg[Cracking Encryption Output]