-
Notifications
You must be signed in to change notification settings - Fork 0
/
hijack.h
84 lines (75 loc) · 2.03 KB
/
hijack.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
#ifndef __HIJACK_H__
#define __HIJACK_H__
// declare all of our includes
#include <ctype.h>
#include <errno.h>
#include <fcntl.h>
#include <getopt.h>
#include <limits.h>
#include <linux/input.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#include <string.h>
#include <time.h>
#include <unistd.h>
#include <dirent.h>
#include <signal.h>
#include <sys/reboot.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <sys/limits.h>
#include <sys/stat.h>
#include <sys/mount.h>
#include <cutils/properties.h>
// sleepwait time (we default to MAX_INT fur die lulz)
#ifndef HIJACK_SLEEPWAIT_SEC
#define HIJACK_SLEEPWAIT_SEC UINT_MAX
#endif
// file that throws us into recovery mode
#ifndef RECOVERY_MODE_FILE
#define RECOVERY_MODE_FILE "/data/.recovery_mode"
#endif
// if we enable logging...
#ifdef LOG_ENABLE
// log device
#ifndef LOG_DEVICE
#define LOG_DEVICE "/dev/block/mmcblk0p1" // default to SD card
#endif
// log mount point
#ifndef LOG_MOUNT
#define LOG_MOUNT "/sdlog" // default to SD logging
#endif
// log file name (will be placed under SDLOG_MOUNT)
#ifndef LOG_FILE
#define LOG_FILE "hijack.log" // this works
#endif
// script that dumps dmesg/logcat/etc
#ifndef LOG_DUMP_BINARY
#define LOG_DUMP_BINARY "/system/bin/hijack.log_dump"
#endif
// frequency of indefinite log
#define LOG_INDEF_FREQ "10s"
// convenience define
#define LOG_PATH LOG_MOUNT"/"LOG_FILE
#endif
// update-binary executable
#ifndef UPDATE_BINARY
#define UPDATE_BINARY "/cdrom/recovery/update-binary"
#endif
// boot update.zip
#ifndef BOOT_UPDATE_ZIP
#define BOOT_UPDATE_ZIP "/cdrom/recovery/hijack-boot.zip"
#endif
// recovery update.zip
#ifndef RECOVERY_UPDATE_ZIP
#define RECOVERY_UPDATE_ZIP "/cdrom/recovery/recovery.zip"
#endif
// function prototypes! :D
int exec_and_wait(char ** argp);
int remount_root(const char * hijack_exec, int rw);
int hijack_mount(const char * hijack_exec, const char * dev, const char * mount_point);
int hijack_umount(const char * hijack_exec, const char * mount_point);
void hijack_log(char * format, ...);
int mark_file(char * filename);
#endif