-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathdex_killer.h
79 lines (67 loc) · 1.74 KB
/
dex_killer.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
//
// Created by chan on 2017/12/11.
//
#ifndef FUCKDEX_DEX_KILLER_H
#define FUCKDEX_DEX_KILLER_H
#include <stdio.h>
#include <unistd.h>
#include <vector>
#include <string>
#ifdef HAVE_STDINT_H
#include <stdint.h> /* C99 */
typedef uint8_t u1;
typedef uint16_t u2;
typedef uint32_t u4;
typedef uint64_t u8;
typedef int8_t s1;
typedef int16_t s2;
typedef int32_t s4;
typedef int64_t s8;
#else
typedef unsigned char u1;
typedef unsigned short u2;
typedef unsigned int u4;
typedef unsigned long long u8;
typedef signed char s1;
typedef signed short s2;
typedef signed int s4;
typedef signed long long s8;
#endif
#undef SHA1_LEN
#define SHA1_LEN 20
#undef LOGI
#define LOGI(...) printf(__VA_ARGS__)
typedef struct {
u1 magic[8]; /* includes version number */
u4 checksum; /* adler32 checksum */
u1 signature[SHA1_LEN]; /* SHA-1 hash */
u4 fileSize; /* length of entire file */
u4 headerSize; /* offset to start of next section */
u4 endianTag;
u4 linkSize;
u4 linkOff;
u4 mapOff;
u4 stringIdsSize;
u4 stringIdsOff;
u4 typeIdsSize;
u4 typeIdsOff;
u4 protoIdsSize;
u4 protoIdsOff;
u4 fieldIdsSize;
u4 fieldIdsOff;
u4 methodIdsSize;
u4 methodIdsOff;
u4 classDefsSize;
u4 classDefsOff;
u4 dataSize;
u4 dataOff;
} DexHeader;
typedef struct {
u1 sha1[SHA1_LEN];
std::string file_name;
} DexFile;
pid_t find_pid(const std::string &pkg);
pid_t find_tid(const pid_t pid);
int find_mem_file(const pid_t tid);
void scan_memory(std::vector<DexFile> &result_container, const std::string &save_to_dir, int tid, int mem_fd);
#endif //FUCKDEX_DEX_KILLER_H