Markopy
Utilizing Markov Models for brute forcing attacks
model_2gram.py
Go to the documentation of this file.
1
#!/usr/bin/python3
2
"""
3
python script for generating a 2gram model
4
"""
5
6
import
string
7
import
re
8
9
10
alphabet = string.printable
11
alphabet = re.sub(
'\s'
,
''
, alphabet)
12
print(f
"alphabet={alphabet}"
)
13
#exit()
14
15
16
f = open(
'../../models/2gram.mdl'
,
"wb"
)
17
#tie start nodes
18
for
sym
in
alphabet:
19
f.write(b
"\x00,1,"
+ bytes(sym, encoding=
'ascii'
) + b
"\n"
)
20
21
#tie terminator nodes
22
for
sym
in
alphabet:
23
f.write(bytes(sym, encoding=
'ascii'
)+ b
",1,\xff\n"
)
24
25
#tie internals
26
for
src
in
alphabet:
27
for
target
in
alphabet:
28
f.write(bytes(src, encoding=
'ascii'
) + b
",1,"
+ bytes(target, encoding=
'ascii'
) + b
"\n"
)
Markopy
MarkovAPICLI
src
scripts
model_2gram.py
Generated by
1.9.0