■ ■ ■ ■ ■ ■
flipperzero-bruteforce.py
1 | 1 | | import os |
2 | 2 | | import math |
3 | 3 | | |
4 | | - | # Script settings: |
5 | | - | REPETITION = 3 # number of tx per key |
6 | | - | |
7 | 4 | | |
8 | 5 | | # Protocol settings: https://phreakerclub.com/447 |
9 | 6 | | class Protocol: |
| skipped 5 lines |
15 | 12 | | - pilot_period: preamble PREPENDED to each key in sub format, empty by default |
16 | 13 | | - stop_bit: APPENDED to each key in sub format, empty by default |
17 | 14 | | - frequency: protocol's frequency in Hz, 433920000 by default |
| 15 | + | - repetition: number of times to repeat each key, 3 by default |
18 | 16 | | """ |
19 | 17 | | |
20 | 18 | | def __init__( |
| skipped 4 lines |
25 | 23 | | pilot_period="", |
26 | 24 | | stop_bit="", |
27 | 25 | | frequency=433920000, |
| 26 | + | repetition=3, |
28 | 27 | | ): |
29 | 28 | | self.name = name |
30 | 29 | | self.n_bits = n_bits |
31 | 30 | | self.transposition_table = transposition_table |
32 | 31 | | self.pilot_period = pilot_period |
33 | 32 | | self.stop_bit = stop_bit |
| 33 | + | self.repetition = repetition |
34 | 34 | | self.file_header = ( |
35 | 35 | | "Filetype: Flipper SubGhz RAW File\n" |
36 | 36 | | + "Version: 1\n" |
| skipped 85 lines |
122 | 122 | | split_files[idx] = open(filename, "w") |
123 | 123 | | split_files[idx].write(self.file_header) |
124 | 124 | | split_files[idx].write( |
125 | | - | "RAW_Data: " + self.key_to_sub(key) * REPETITION + "\n" |
| 125 | + | "RAW_Data: " + self.key_to_sub(key) * self.repetition + "\n" |
126 | 126 | | ) |
127 | 127 | | # close all files |
128 | 128 | | [f.close() for f in split_files if f is not None] |
| skipped 6 lines |
135 | 135 | | {"0": "500 -1500 ", "1": "1500 -500 "}, |
136 | 136 | | stop_bit="1 -21500 ", |
137 | 137 | | frequency=300000000, |
| 138 | + | repetition=5, |
138 | 139 | | ), |
139 | 140 | | Protocol("CAME-12bit", 12, {"0": "-250 500 ", "1": "-500 250 "}, "-9000 250 "), |
140 | 141 | | Protocol("NICE-12bit", 12, {"0": "-700 1400 ", "1": "-1400 700 "}, "-25200 700 "), |
| skipped 7 lines |