1 | Here you will find a brief overview of the tools and libraries provided by Bletchley. For further details, see the individual tool usage statements, pydoc documentation, and of course the <a href="https://github.com/ecbftw/bletchley">source code</a>. |
---|
2 | |
---|
3 | = Installation = |
---|
4 | See: <a href="https://github.com/ecbftw/bletchley/blob/master/trunk/INSTALL">INSTALL</a> |
---|
5 | |
---|
6 | = Command Line Tools = |
---|
7 | |
---|
8 | == bletchley-analyze == |
---|
9 | |
---|
10 | Analyzes samples of encrypted data in an attempt to decode samples to |
---|
11 | binary and identify patterns useful in cryptanalysis. The purpose of |
---|
12 | the tool is to provide an cryptanalyst with a variety of information |
---|
13 | that is useful in determining how a token is encoded, encrypted and |
---|
14 | formatted. |
---|
15 | <br /> |
---|
16 | bletchley-analyze currently performs two primary functions: iterative |
---|
17 | encoding detection and ciphertext-only block analysis. Encrypted tokens |
---|
18 | are processed in multiple rounds. Within each round, the following |
---|
19 | occurs: |
---|
20 | <ul> |
---|
21 | <li>Token length analysis is performed to attempt to determine possible |
---|
22 | ciphertext block sizes, where applicable</li> |
---|
23 | <li>The tokens are analyzed for blocks of data that are repeated |
---|
24 | throughout any of the tokens</li> |
---|
25 | <li>A hexadecimal dump and escaped binary/ascii string is printed for |
---|
26 | each token with repeated blocks highlighted</li> |
---|
27 | <li>The full set of all known and possible data encodings is |
---|
28 | determined<sup>1</sup></li> |
---|
29 | <li>An educated guess is made as to the most likely encoding is</li> |
---|
30 | <li>All tokens are decoded using the most likely encoding, and then the |
---|
31 | process is repeated until no further encodings are detected</li> |
---|
32 | </ul> |
---|
33 | |
---|
34 | `bletchley-analyze` can read from stdin or from a file. Tokens are |
---|
35 | delimited with newlines. Various options are provided to give the |
---|
36 | analyst control over the block sizes and encoding used during analysis. |
---|
37 | See the tool's usage statement for more information. |
---|
38 | |
---|
39 | As an example, several tokens were encrypted using ECB mode and encoded |
---|
40 | using base64, and then percent (URL) encoded: |
---|
41 | {{{ |
---|
42 | zRW5bHxcRYHHqi0nriqOzg%3D%3D |
---|
43 | meU8SyxVHE3Hqi0nriqOzg%3D%3D |
---|
44 | vTA9eA4hhbFlktsbYI4hIg%3D%3D |
---|
45 | meU8SyxVHE1lktsbYI4hIg%3D%3D |
---|
46 | }}} |
---|
47 | |
---|
48 | These tokens were then fed to `bletchley-analyze`: |
---|
49 | <img src="https://raw.githubusercontent.com/ecbftw/bletchley/master/wiki/images/bletchley-analyze.png" /> |
---|
50 | |
---|
51 | 1. <i>Bletchley's blobtools module currently supports 36 encoding variants, |
---|
52 | including various forms of hexadecimal, base32, base64, and percent |
---|
53 | encodings. Try '`-e ?`' to list them.</i> |
---|
54 | |
---|
55 | |
---|
56 | == bletchley-encode == |
---|
57 | A simple tool to encode arbitrary data using a specified encoding chain. |
---|
58 | See the usage statement for more information. A quick example: |
---|
59 | {{{ |
---|
60 | $ echo 'Mallory Is My Friend.' | bletchley-encode -e percent/upper-plus,base64/rfc3548 |
---|
61 | TWFsbG9yeSBJcyBNeSBGcmllbmQuCg%3D%3D |
---|
62 | }}} |
---|
63 | |
---|
64 | NOTE: The encoding chain is applied from right to left in order to be consistent with other tools. |
---|
65 | That is, one can use the same encoding chain ordering for |
---|
66 | `bletchley-encode`, `bletchley-decode`, and `bletchley-analyze`. |
---|
67 | |
---|
68 | |
---|
69 | == bletchley-decode == |
---|
70 | A simple tool to decode data using a specified encoding chain. See the |
---|
71 | usage statement for more information. A quick example: |
---|
72 | {{{ |
---|
73 | $ echo 'TWFsbG9yeSBJcyBNeSBGcmllbmQuCg%3D%3D' | bletchley-decode -e percent/upper-plus,base64/rfc3548 |
---|
74 | Mallory Is My Friend. |
---|
75 | }}} |
---|
76 | |
---|
77 | == bletchley-http2py == |
---|
78 | This script parses an HTTP request (provided via stdin or as a text |
---|
79 | file) and generates a Python script that sends (approximately) the same |
---|
80 | request. This is useful when one wants to repeatedly send variations of |
---|
81 | a request that was observed to be sent by an application or web |
---|
82 | browser. For more information, see the script's usage statement. |
---|
83 | |
---|
84 | == bletchley-nextrand == |
---|
85 | A simple program which computes the state of a Java Random class |
---|
86 | instance given two sequential outputs of |
---|
87 | <a href="http://docs.oracle.com/javase/6/docs/api/java/util/Random.html#nextInt()">`nextInt()`</a>. |
---|
88 | For more information, see the usage statement. |
---|
89 | |
---|
90 | |
---|
91 | = Libraries = |
---|
92 | |
---|
93 | Start with '`pydoc3 bletchley`'. The following provides a brief overview of what each module is for. |
---|
94 | |
---|
95 | |
---|
96 | == blobtools == |
---|
97 | This module contains the code which handles base analysis of encrypted |
---|
98 | token encodings. It can be used to automatically detect the most likely |
---|
99 | encoding variant ("dialect") as well as to quickly encode or decode data |
---|
100 | which is wrapped in multiple levels of encodings. |
---|
101 | |
---|
102 | |
---|
103 | == buffertools == |
---|
104 | This module contains a collection of tools mean to help one manipulate |
---|
105 | binary buffers of ciphertext. |
---|
106 | |
---|
107 | |
---|
108 | == CBC == |
---|
109 | The CBC module contains various tools for attacking CBC encrypted data. |
---|
110 | In particular, it contains the POA class which automates padding oracle |
---|
111 | attacks. To use the POA class, one simply needs to implement a function |
---|
112 | in Python 3 which submits a request to an oracle and returns True if the |
---|
113 | padding check was successful and False otherwise. See |
---|
114 | '`pydoc3 bletchley.CBC.POA`' for more details. |
---|
115 | |
---|
116 | |
---|
117 | = Support = |
---|
118 | |
---|
119 | Having trouble? Submit an issue <a href="https://github.com/ecbftw/bletchley/issues">here</a>, or |
---|
120 | ask on the <a href="https://groups.google.com/d/forum/bletchley-devel">email list</a>. |
---|
121 | |
---|
122 | |
---|
123 | = Contributing = |
---|
124 | |
---|
125 | We welcome any kind of help with the project, from new tools to bug |
---|
126 | fixes and documentation. You might want to start with our |
---|
127 | <a href="https://github.com/ecbftw/bletchley/blob/master/trunk/doc/TODO">TODO</a> |
---|
128 | list. To submit a patch, just check out a copy of our Subversion |
---|
129 | repository, make your changes, and submit the output of `svn diff` to one of the project leaders. |
---|