-
Notifications
You must be signed in to change notification settings - Fork 21
/
mod0keecrack.h
executable file
·113 lines (95 loc) · 3.37 KB
/
mod0keecrack.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
/*
* Copyright (c) 2016, mod0keecrack
* Thorsten Schroeder <ths at modzero dot ch>
*
* All rights reserved.
*
* This file is part of mod0keecrack.
*
* "THE BEER-WARE LICENSE" (Revision 42):
* Thorsten Schroeder <ths at modzero dot ch> wrote this file. As long as you
* retain this notice you can do whatever you want with this stuff. If we meet
* some day, and you think this stuff is worth it, you can buy me a beer in
* return. Thorsten Schroeder.
*
* NON-MILITARY-USAGE CLAUSE
* Redistribution and use in source and binary form for military use and
* military research is not permitted. Infringement of these clauses may
* result in publishing the source code of the utilizing applications and
* libraries to the public. As this software is developed, tested and
* reviewed by *international* volunteers, this clause shall not be refused
* due to the matter of *national* security concerns.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE DDK PROJECT BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* File: mod0keecrack.h
* Description: Project header file. Datatypes und function prototypes.
*/
#ifndef _MOD0KEECRACK_H
#define _MOD0KEECRACK_H
typedef uintmax_t off_t;
enum _m0_kdbx_headerid {
END,
COMMENT,
CIPHERID,
COMPRESSIONFLAGS,
MASTERSEED,
TRANSFORMSEED, // 5
TRANSFORMROUNDS,
ENCRYPTIONIV,
PROTECTEDSTREAMKEY,
STREAMSTARTBYTES,
INNERRANDOMSTREAMID, // 10
HEADERIDCOUNT
};
typedef enum _m0_kdbx_headerid m0_kdbx_headerid_t;
typedef struct _m0_kdbx_header_entry {
uint8_t id;
uint16_t len;
uint8_t *data;
uint32_t dw;
uint64_t qw;
} m0_kdbx_header_entry_t;
typedef struct _m0_kdbx_header {
uint32_t magic;
uint32_t identifier;
uint16_t minor_version;
uint16_t major_version;
} m0_kdbx_header_t;
typedef struct _m0_kdbx_payload {
off_t offset_start;
off_t pos;
size_t len;
uint8_t *encrypted;
uint8_t *decrypted;
} m0_kdbx_payload_t;
typedef struct _m0kdbx_data {
m0_kdbx_header_t header;
size_t data_len;
uint8_t *data;
} m0_kbdx_data_t;
typedef struct _m0_kdbx_database {
m0_kdbx_header_t fileheader;
m0_kdbx_header_entry_t kdbxheader;
m0_kdbx_payload_t payload;
} m0_kdbx_database_t;
// Function prototypes
size_t kdbx_headerentries_free(m0_kdbx_header_entry_t *);
size_t kdbx_headerentries_read(FILE *, m0_kdbx_header_entry_t *);
void kdbx_headerentries_dump(m0_kdbx_header_entry_t *);
size_t kdbx_header_read(FILE *, m0_kdbx_header_t *);
void kdbx_header_dump(m0_kdbx_header_t);
size_t kdbx_payload_read(FILE *, m0_kdbx_payload_t *);
void kdbx_payload_dump(m0_kdbx_payload_t);
bool kdbx_payload_crack(m0_kdbx_database_t *, FILE *);
bool kdbx_decrypt_payload(m0_kdbx_database_t *, char *, uint8_t *);
#endif