Markopy
Utilizing Markov Models for brute forcing attacks
markopy.cpp
Go to the documentation of this file.
1
/** @file markopy.cpp
2
* @brief CPython wrapper for libmarkov utils.
3
* @authors Ata Hakçıl, Celal Sahir Çetiner
4
*
5
* This file is a wrapper for libmarkov utilities, exposing:
6
* - MarkovPasswords
7
* - Import
8
* - Export
9
* - Train
10
* - Generate
11
* - ModelMatrix
12
* - Import
13
* - Export
14
* - Train
15
* - ConstructMatrix
16
* - DumpJSON
17
* - FastRandomWalk
18
*
19
* @copydoc Markov::API::MarkovPasswords
20
* @copydoc Markov::API::ModelMatrix
21
*
22
*/
23
24
#
define
BOOST_ALL_STATIC_LIB
1
25
#
define
BOOST_PYTHON_STATIC_LIB
1
26
#
include
<
Python
.
h
>
27
#
include
<
boost
/
python
.
hpp
>
28
#
include
<
MarkovAPI
/
src
/
modelMatrix
.
h
>
29
30
31
using
namespace
boost::python;
32
33
/**
34
* @brief CPython module for Markov::API objects
35
*/
36
namespace
Markov
::
Markopy
{
37
BOOST_PYTHON_MODULE(markopy)
38
{
39
bool
(Markov::API::MarkovPasswords::*Import)(
const
char
*) = &
Markov
::
Model
<
char
>
::
Import
;
40
bool
(Markov::API::MarkovPasswords::*Export)(
const
char
*) = &
Markov
::
Model
<
char
>
::
Export
;
41
class_<
Markov
::
API
::
MarkovPasswords
>(
"MarkovPasswords"
, init<>())
42
.def(init<>())
43
.def(
"Train"
, &
Markov
::
API
::
MarkovPasswords
::
Train
)
44
.def(
"Generate"
, &
Markov
::
API
::
MarkovPasswords
::
Generate
)
45
.def(
"Import"
, Import,
"Import a model file."
)
46
.def(
"Export"
, Export,
"Export a model to file."
)
47
;
48
49
int
(Markov::API::ModelMatrix::*FastRandomWalk)(
unsigned
long
int
,
const
char
*,
int
,
int
,
int
,
bool
)
50
= &
Markov
::
API
::
ModelMatrix
::
FastRandomWalk
;
51
class_<
Markov
::
API
::
ModelMatrix
>(
"ModelMatrix"
, init<>())
52
53
.def(init<>())
54
.def(
"Train"
, &
Markov
::
API
::
ModelMatrix
::
Train
)
55
.def(
"Import"
, &
Markov
::
API
::
ModelMatrix
::
Import
,
"Import a model file."
)
56
.def(
"Export"
, Export,
"Export a model to file."
)
57
.def(
"ConstructMatrix"
,&
Markov
::
API
::
ModelMatrix
::
ConstructMatrix
)
58
.def(
"DumpJSON"
,&
Markov
::
API
::
ModelMatrix
::
DumpJSON
)
59
.def(
"FastRandomWalk"
,FastRandomWalk)
60
;
61
};
62
};
Markopy
Markopy
src
Module
markopy.cpp
Generated by
1.9.0