id
int64
0
755k
file_name
stringlengths
3
109
file_path
stringlengths
13
185
content
stringlengths
31
9.38M
size
int64
31
9.38M
language
stringclasses
1 value
extension
stringclasses
11 values
total_lines
int64
1
340k
avg_line_length
float64
2.18
149k
max_line_length
int64
7
2.22M
alphanum_fraction
float64
0
1
repo_name
stringlengths
6
65
repo_stars
int64
100
47.3k
repo_forks
int64
0
12k
repo_open_issues
int64
0
3.4k
repo_license
stringclasses
9 values
repo_extraction_date
stringclasses
92 values
exact_duplicates_redpajama
bool
2 classes
near_duplicates_redpajama
bool
2 classes
exact_duplicates_githubcode
bool
2 classes
exact_duplicates_stackv2
bool
1 class
exact_duplicates_stackv1
bool
2 classes
near_duplicates_githubcode
bool
2 classes
near_duplicates_stackv1
bool
2 classes
near_duplicates_stackv2
bool
1 class
0
package.cpp
topjohnwu_Magisk/native/src/core/package.cpp
#include <base.hpp> #include <consts.hpp> #include <core.hpp> #include <db.hpp> #include <flags.h> using namespace std; using rust::Vec; #define ENFORCE_SIGNATURE (!MAGISK_DEBUG) // These functions will be called on every single zygote process specialization and su request, // so performance is absolutely critical. ...
7,711
C++
.cpp
232
25.706897
95
0.561385
topjohnwu/Magisk
47,255
11,960
25
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
1
selinux.cpp
topjohnwu_Magisk/native/src/core/selinux.cpp
#include <unistd.h> #include <sys/syscall.h> #include <sys/xattr.h> #include <consts.hpp> #include <base.hpp> #include <selinux.hpp> #include <core.hpp> #include <flags.h> using namespace std; int setcon(const char *con) { int fd = open("/proc/self/attr/current", O_WRONLY | O_CLOEXEC); if (fd < 0) re...
4,154
C++
.cpp
116
30.12931
86
0.606227
topjohnwu/Magisk
47,255
11,960
25
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
2
applets.cpp
topjohnwu_Magisk/native/src/core/applets.cpp
#include <libgen.h> #include <sys/types.h> #include <sys/stat.h> #include <consts.hpp> #include <selinux.hpp> #include <base.hpp> using namespace std; struct Applet { string_view name; int (*fn)(int, char *[]); }; constexpr Applet applets[] = { { "su", su_client_main }, { "resetprop", resetprop_main...
1,537
C++
.cpp
57
20.350877
74
0.521117
topjohnwu/Magisk
47,255
11,960
25
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
3
daemon.cpp
topjohnwu_Magisk/native/src/core/daemon.cpp
#include <csignal> #include <libgen.h> #include <sys/un.h> #include <sys/mount.h> #include <consts.hpp> #include <base.hpp> #include <core.hpp> #include <selinux.hpp> #include <db.hpp> #include <flags.h> using namespace std; int SDK_INT = -1; static struct stat self_st; static map<int, poll_callback> *poll_map; st...
13,327
C++
.cpp
433
23.711316
95
0.565329
topjohnwu/Magisk
47,255
11,960
25
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
4
scripting.cpp
topjohnwu_Magisk/native/src/core/scripting.cpp
#include <string> #include <vector> #include <sys/wait.h> #include <consts.hpp> #include <base.hpp> #include <selinux.hpp> #include <core.hpp> using namespace std; #define BBEXEC_CMD bbpath(), "sh" static const char *bbpath() { static string path; path = get_magisk_tmp(); path += "/" BBPATH "/busybox"; ...
6,402
C++
.cpp
206
25.805825
84
0.587768
topjohnwu/Magisk
47,255
11,960
25
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
true
false
5
bootstages.cpp
topjohnwu_Magisk/native/src/core/bootstages.cpp
#include <sys/mount.h> #include <sys/wait.h> #include <sys/sysmacros.h> #include <linux/input.h> #include <libgen.h> #include <set> #include <string> #include <consts.hpp> #include <db.hpp> #include <base.hpp> #include <core.hpp> #include <selinux.hpp> using namespace std; bool zygisk_enabled = false; /********* *...
6,013
C++
.cpp
183
26.42623
84
0.582974
topjohnwu/Magisk
47,255
11,960
25
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
6
socket.cpp
topjohnwu_Magisk/native/src/core/socket.cpp
#include <fcntl.h> #include <endian.h> #include <socket.hpp> #include <base.hpp> using namespace std; bool get_client_cred(int fd, sock_cred *cred) { socklen_t len = sizeof(ucred); if (getsockopt(fd, SOL_SOCKET, SO_PEERCRED, cred, &len) != 0) return false; char buf[4096]; len = sizeof(buf); ...
4,615
C++
.cpp
158
23.759494
93
0.581884
topjohnwu/Magisk
47,255
11,960
25
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
true
false
7
magisk.cpp
topjohnwu_Magisk/native/src/core/magisk.cpp
#include <sys/mount.h> #include <libgen.h> #include <base.hpp> #include <consts.hpp> #include <core.hpp> #include <selinux.hpp> #include <flags.h> using namespace std; [[noreturn]] static void usage() { fprintf(stderr, R"EOF(Magisk - Multi-purpose Utility Usage: magisk [applet [arguments]...] or: magisk [opt...
5,251
C++
.cpp
145
29.365517
81
0.537767
topjohnwu/Magisk
47,255
11,960
25
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
8
thread.cpp
topjohnwu_Magisk/native/src/core/thread.cpp
// Cached thread pool implementation #include <base.hpp> #include <core.hpp> using namespace std; #define THREAD_IDLE_MAX_SEC 60 #define CORE_POOL_SIZE 3 static pthread_mutex_t lock = PTHREAD_MUTEX_INITIALIZER; static pthread_cond_t send_task = PTHREAD_COND_INITIALIZER_MONOTONIC_NP; static pthread_cond_t recv_task...
2,848
C++
.cpp
87
24.517241
86
0.575482
topjohnwu/Magisk
47,255
11,960
25
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
true
false
9
applet_stub.cpp
topjohnwu_Magisk/native/src/core/applet_stub.cpp
#include <sys/stat.h> #include <consts.hpp> #include <selinux.hpp> #include <base.hpp> int main(int argc, char *argv[]) { if (argc < 1) return 1; cmdline_logging(); init_argv0(argc, argv); umask(0); return APPLET_STUB_MAIN(argc, argv); }
268
C++
.cpp
12
18.833333
40
0.641732
topjohnwu/Magisk
47,255
11,960
25
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
10
module.cpp
topjohnwu_Magisk/native/src/core/module.cpp
#include <sys/mman.h> #include <sys/syscall.h> #include <sys/mount.h> #include <map> #include <utility> #include <base.hpp> #include <consts.hpp> #include <core.hpp> #include <selinux.hpp> #include "node.hpp" using namespace std; #define VLOGD(tag, from, to) LOGD("%-8s: %s <- %s\n", tag, to, from) static int bind_...
17,251
C++
.cpp
463
28.645788
108
0.533911
topjohnwu/Magisk
47,255
11,960
25
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
11
db.cpp
topjohnwu_Magisk/native/src/core/db.cpp
#include <unistd.h> #include <dlfcn.h> #include <sys/stat.h> #include <consts.hpp> #include <base.hpp> #include <db.hpp> #include <core.hpp> #define DB_VERSION 12 using namespace std; struct sqlite3; static sqlite3 *mDB = nullptr; #define DBLOGV(...) //#define DBLOGV(...) LOGD("magiskdb: " __VA_ARGS__) // SQLite...
11,999
C++
.cpp
342
27.847953
121
0.574701
topjohnwu/Magisk
47,255
11,960
25
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
12
resetprop.cpp
topjohnwu_Magisk/native/src/core/resetprop/resetprop.cpp
#include <dlfcn.h> #include <sys/types.h> #include <vector> #include <map> #include <base.hpp> #include <core.hpp> #include <resetprop.hpp> #define _REALLY_INCLUDE_SYS__SYSTEM_PROPERTIES_H_ #include <api/_system_properties.h> #include <system_properties/prop_info.h> using namespace std; #ifdef APPLET_STUB_MAIN #def...
13,763
C++
.cpp
395
28.124051
99
0.580245
topjohnwu/Magisk
47,255
11,960
25
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
13
su_daemon.cpp
topjohnwu_Magisk/native/src/core/su/su_daemon.cpp
#include <unistd.h> #include <fcntl.h> #include <pwd.h> #include <sys/socket.h> #include <sys/wait.h> #include <sys/mount.h> #include <consts.hpp> #include <base.hpp> #include <selinux.hpp> #include "su.hpp" #include "pts.hpp" using namespace std; static pthread_mutex_t cache_lock = PTHREAD_MUTEX_INITIALIZER; stati...
13,266
C++
.cpp
408
24.583333
93
0.548637
topjohnwu/Magisk
47,255
11,960
25
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
true
false
14
connect.cpp
topjohnwu_Magisk/native/src/core/su/connect.cpp
#include <sys/types.h> #include <sys/wait.h> #include <base.hpp> #include <selinux.hpp> #include <consts.hpp> #include "su.hpp" using namespace std; #define CALL_PROVIDER \ "/system/bin/app_process", "/system/bin", "com.android.commands.content.Content", \ "call", "--uri", target, "--user", user, "--method", action...
6,835
C++
.cpp
211
24.49763
93
0.530445
topjohnwu/Magisk
47,255
11,960
25
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
16
su.cpp
topjohnwu_Magisk/native/src/core/su/su.cpp
/* * Copyright 2017 - 2023, John Wu (@topjohnwu) * Copyright 2015, Pierre-Hugues Husson <phh@phh.me> * Copyright 2010, Adam Shanks (@ChainsDD) * Copyright 2008, Zinx Verituse (@zinxv) */ #include <unistd.h> #include <getopt.h> #include <fcntl.h> #include <pwd.h> #include <sched.h> #include <sys/types.h> #include ...
8,039
C++
.cpp
215
28.376744
96
0.496153
topjohnwu/Magisk
47,255
11,960
25
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
true
false
17
cli.cpp
topjohnwu_Magisk/native/src/core/deny/cli.cpp
#include <sys/wait.h> #include <sys/mount.h> #include <consts.hpp> #include <base.hpp> #include "deny.hpp" using namespace std; [[noreturn]] static void usage() { fprintf(stderr, R"EOF(DenyList Config CLI Usage: magisk --denylist [action [arguments...] ] Actions: status Return the enforcement statu...
3,953
C++
.cpp
130
23.907692
96
0.5948
topjohnwu/Magisk
47,255
11,960
25
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
true
false
18
logcat.cpp
topjohnwu_Magisk/native/src/core/deny/logcat.cpp
#include <unistd.h> #include <string> #include <cinttypes> #include <android/log.h> #include <sys/syscall.h> #include <base.hpp> #include "deny.hpp" using namespace std; struct logger_entry { uint16_t len; /* length of the payload */ uint16_t hdr_size; /* sizeof(struct logger_entry) */ int32_t pid;...
8,702
C++
.cpp
243
27.242798
100
0.537694
topjohnwu/Magisk
47,255
11,960
25
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
19
utils.cpp
topjohnwu_Magisk/native/src/core/deny/utils.cpp
#include <sys/types.h> #include <sys/stat.h> #include <sys/inotify.h> #include <unistd.h> #include <fcntl.h> #include <dirent.h> #include <set> #include <consts.hpp> #include <base.hpp> #include <db.hpp> #include <core.hpp> #include "deny.hpp" using namespace std; // For the following data structures: // If package...
11,628
C++
.cpp
365
24.271233
92
0.550161
topjohnwu/Magisk
47,255
11,960
25
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
20
main.cpp
topjohnwu_Magisk/native/src/core/zygisk/main.cpp
#include <sys/mount.h> #include <android/dlext.h> #include <dlfcn.h> #include <consts.hpp> #include <base.hpp> #include <core.hpp> #include <selinux.hpp> #include "zygisk.hpp" using namespace std; static void zygiskd(int socket) { if (getuid() != 0 || fcntl(socket, F_GETFD) < 0) exit(-1); init_thre...
2,938
C++
.cpp
88
24
83
0.517606
topjohnwu/Magisk
47,255
11,960
25
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
21
entry.cpp
topjohnwu_Magisk/native/src/core/zygisk/entry.cpp
#include <libgen.h> #include <dlfcn.h> #include <sys/prctl.h> #include <sys/mount.h> #include <android/log.h> #include <android/dlext.h> #include <base.hpp> #include <consts.hpp> #include "zygisk.hpp" #include "module.hpp" using namespace std; string native_bridge = "0"; static bool is_compatible_with(uint32_t) { ...
7,255
C++
.cpp
214
27.238318
97
0.589795
topjohnwu/Magisk
47,255
11,960
25
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
22
hook.cpp
topjohnwu_Magisk/native/src/core/zygisk/hook.cpp
#include <sys/mount.h> #include <dlfcn.h> #include <unwind.h> #include <span> #include <lsplt.hpp> #include <base.hpp> #include <consts.hpp> #include "zygisk.hpp" #include "module.hpp" using namespace std; // ********************* // Zygisk Bootstrapping // ********************* // // Zygisk's lifecycle is driven ...
23,899
C++
.cpp
481
40.590437
112
0.541732
topjohnwu/Magisk
47,255
11,960
25
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
23
module.cpp
topjohnwu_Magisk/native/src/core/zygisk/module.cpp
#include <android/dlext.h> #include <dlfcn.h> #include <lsplt.hpp> #include <base.hpp> #include "zygisk.hpp" #include "module.hpp" using namespace std; ZygiskModule::ZygiskModule(int id, void *handle, void *entry) : id(id), handle(handle), entry{entry}, api{}, mod{nullptr} { // Make sure all pointers are n...
14,035
C++
.cpp
406
27.5
107
0.55653
topjohnwu/Magisk
47,255
11,960
25
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
24
bootimg.cpp
topjohnwu_Magisk/native/src/boot/bootimg.cpp
#include <bit> #include <functional> #include <memory> #include <span> #include <base.hpp> #include "boot-rs.hpp" #include "bootimg.hpp" #include "magiskboot.hpp" #include "compress.hpp" using namespace std; #define PADDING 15 #define SHA256_DIGEST_SIZE 32 #define SHA_DIGEST_SIZE 20 static void decompress(format_t...
36,011
C++
.cpp
896
31.418527
104
0.548525
topjohnwu/Magisk
47,255
11,960
25
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
25
main.cpp
topjohnwu_Magisk/native/src/boot/main.cpp
#include <base.hpp> #include "boot-rs.hpp" #include "magiskboot.hpp" #include "compress.hpp" using namespace std; #ifdef USE_CRT0 __BEGIN_DECLS int musl_vfprintf(FILE *stream, const char *format, va_list arg); int vfprintf(FILE *stream, const char *format, va_list arg) { return musl_vfprintf(stream, format, arg)...
8,056
C++
.cpp
200
33.17
92
0.610245
topjohnwu/Magisk
47,255
11,960
25
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
27
format.cpp
topjohnwu_Magisk/native/src/boot/format.cpp
#include "format.hpp" Name2Fmt name2fmt; Fmt2Name fmt2name; Fmt2Ext fmt2ext; #define CHECKED_MATCH(s) (len >= (sizeof(s) - 1) && BUFFER_MATCH(buf, s)) format_t check_fmt(const void *buf, size_t len) { if (CHECKED_MATCH(CHROMEOS_MAGIC)) { return CHROMEOS; } else if (CHECKED_MATCH(BOOT_MAGIC)) { ...
2,902
C++
.cpp
103
20.621359
83
0.533668
topjohnwu/Magisk
47,255
11,960
25
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
true
false
true
false
28
twostage.cpp
topjohnwu_Magisk/native/src/init/twostage.cpp
#include <sys/mount.h> #include <consts.hpp> #include <base.hpp> #include <sys/vfs.h> #include "init.hpp" using namespace std; void FirstStageInit::prepare() { prepare_data(); if (struct stat st{}; fstatat(-1, "/sdcard", &st, AT_SYMLINK_NOFOLLOW) != 0 && fstatat(-1, "/first_stage_ramdisk/sdcard", &...
2,944
C++
.cpp
73
32.958904
99
0.584207
topjohnwu/Magisk
47,255
11,960
25
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
29
selinux.cpp
topjohnwu_Magisk/native/src/init/selinux.cpp
#include <sys/mount.h> #include <consts.hpp> #include <sepolicy.hpp> #include "init.hpp" using namespace std; void MagiskInit::patch_sepolicy(const char *in, const char *out) { LOGD("Patching monolithic policy\n"); auto sepol = unique_ptr<sepolicy>(sepolicy::from_file(in)); sepol->magisk_rules(); ...
5,135
C++
.cpp
119
36.445378
96
0.638516
topjohnwu/Magisk
47,255
11,960
25
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
30
init.cpp
topjohnwu_Magisk/native/src/init/init.cpp
#include <sys/stat.h> #include <sys/types.h> #include <libgen.h> #include <vector> #include <xz.h> #include <base.hpp> #include "init.hpp" using namespace std; #ifdef USE_CRT0 __BEGIN_DECLS int tiny_vfprintf(FILE *stream, const char *format, va_list arg); int vfprintf(FILE *stream, const char *format, va_list arg)...
2,861
C++
.cpp
94
24.234043
77
0.581818
topjohnwu/Magisk
47,255
11,960
25
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
31
mount.cpp
topjohnwu_Magisk/native/src/init/mount.cpp
#include <set> #include <sys/mount.h> #include <sys/sysmacros.h> #include <libgen.h> #include <base.hpp> #include <flags.h> #include <consts.hpp> #include "init.hpp" using namespace std; struct devinfo { int major; int minor; char devname[32]; char partname[32]; char dmname[32]; char devpath...
9,033
C++
.cpp
234
31.226496
99
0.585722
topjohnwu/Magisk
47,255
11,960
25
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
32
rootdir.cpp
topjohnwu_Magisk/native/src/init/rootdir.cpp
#include <sys/mount.h> #include <libgen.h> #include <sys/sysmacros.h> #include <sepolicy.hpp> #include <consts.hpp> #include <base.hpp> #include <flags.h> #include "init.hpp" using namespace std; static vector<string> rc_list; static string magic_mount_list; #define NEW_INITRC_DIR "/system/etc/init/hw" #define IN...
14,410
C++
.cpp
374
30.112299
121
0.553211
topjohnwu/Magisk
47,255
11,960
25
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
33
getinfo.cpp
topjohnwu_Magisk/native/src/init/getinfo.cpp
#include <sys/sysmacros.h> #include <sys/types.h> #include <sys/stat.h> #include <linux/input.h> #include <fcntl.h> #include <vector> #include <base.hpp> #include "init.hpp" using namespace std; vector<string> mount_list; template<char... cs> using chars = integer_sequence<char, cs...>; // If quoted, parsing ends...
9,085
C++
.cpp
229
33.008734
108
0.568823
topjohnwu/Magisk
47,255
11,960
25
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
true
false
34
logging.cpp
topjohnwu_Magisk/native/src/base/logging.cpp
#include <cstdio> #include <cstdlib> #include <android/log.h> #include <flags.h> #include <base.hpp> using namespace std; #ifndef __call_bypassing_fortify #define __call_bypassing_fortify(fn) (&fn) #endif #undef vsnprintf static int fmt_and_log_with_rs(LogLevel level, const char *fmt, va_list ap) { constexpr i...
2,316
C++
.cpp
72
27.972222
86
0.626231
topjohnwu/Magisk
47,255
11,960
25
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
35
stream.cpp
topjohnwu_Magisk/native/src/base/stream.cpp
#include <unistd.h> #include <cstddef> #include <base.hpp> #include <stream.hpp> using namespace std; static int strm_read(void *v, char *buf, int len) { auto strm = static_cast<stream *>(v); return strm->read(buf, len); } static int strm_write(void *v, const char *buf, int len) { auto strm = static_cas...
5,077
C++
.cpp
175
22.742857
93
0.539787
topjohnwu/Magisk
47,255
11,960
25
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
36
new.cpp
topjohnwu_Magisk/native/src/base/new.cpp
#include <new> #include <cstdlib> /* Override libc++ new implementation * to optimize final build size */ void* operator new(std::size_t s) { return std::malloc(s); } void* operator new[](std::size_t s) { return std::malloc(s); } void operator delete(void *p) { std::free(p); } void operator delete[](void *p) { std...
685
C++
.cpp
12
55.833333
94
0.681073
topjohnwu/Magisk
47,255
11,960
25
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
37
files.cpp
topjohnwu_Magisk/native/src/base/files.cpp
#include <sys/mman.h> #include <sys/sendfile.h> #include <sys/sysmacros.h> #include <linux/fs.h> #include <fcntl.h> #include <unistd.h> #include <libgen.h> #include <base.hpp> using namespace std; int fd_pathat(int dirfd, const char *name, char *path, size_t size) { if (fd_path(dirfd, byte_data(path, size)) < 0)...
3,811
C++
.cpp
131
23.877863
92
0.560109
topjohnwu/Magisk
47,255
11,960
25
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
38
misc.cpp
topjohnwu_Magisk/native/src/base/misc.cpp
#include <sys/types.h> #include <sys/wait.h> #include <sys/prctl.h> #include <sys/sysmacros.h> #include <fcntl.h> #include <pwd.h> #include <unistd.h> #include <syscall.h> #include <random> #include <string> #include <base.hpp> using namespace std; bool byte_view::contains(byte_view pattern) const { return _buf ...
6,944
C++
.cpp
260
21.488462
86
0.568763
topjohnwu/Magisk
47,255
11,960
25
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
39
sepolicy.cpp
topjohnwu_Magisk/native/src/sepolicy/sepolicy.cpp
#include <base.hpp> #include "policy.hpp" using namespace std; // Invert is adding rules for auditdeny; in other cases, invert is removing rules #define strip_av(effect, invert) ((effect == AVTAB_AUDITDENY) == !invert) // libsepol internal APIs __BEGIN_DECLS int policydb_index_decls(sepol_handle_t * handle, policyd...
29,766
C++
.cpp
797
28.144291
130
0.533601
topjohnwu/Magisk
47,255
11,960
25
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
40
main.cpp
topjohnwu_Magisk/native/src/sepolicy/main.cpp
#include <base.hpp> #include <vector> #include "policy.hpp" using namespace std; [[noreturn]] static void usage(char *arg0) { fprintf(stderr, R"EOF(MagiskPolicy - SELinux Policy Patch Tool Usage: %s [--options...] [policy statements...] Options: --help show help message for policy statements -...
4,051
C++
.cpp
114
25.315789
81
0.504337
topjohnwu/Magisk
47,255
11,960
25
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
41
api.cpp
topjohnwu_Magisk/native/src/sepolicy/api.cpp
#include <base.hpp> #include "policy.hpp" using Str = rust::Str; #if 0 template<typename Arg> std::string as_str(const Arg &arg) { if constexpr (std::is_same_v<Arg, const char *> || std::is_same_v<Arg, char *>) { return arg == nullptr ? "*" : arg; } else if constexpr (std::is_same_v<Arg, Xperm>) { ...
5,831
C++
.cpp
169
29.733728
85
0.605006
topjohnwu/Magisk
47,255
11,960
25
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
42
policydb.cpp
topjohnwu_Magisk/native/src/sepolicy/policydb.cpp
#include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> #include <unistd.h> #include <cil/cil.h> #include <base.hpp> #include <stream.hpp> #include "policy.hpp" #define SHALEN 64 static bool cmp_sha256(const char *a, const char *b) { char id_a[SHALEN] = {0}; char id_b[SHALEN] = {0}; if (int fd =...
7,365
C++
.cpp
217
28.092166
88
0.598677
topjohnwu/Magisk
47,255
11,960
25
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
true
false
43
node.hpp
topjohnwu_Magisk/native/src/core/node.hpp
#pragma once #include <sys/mount.h> #include <map> using namespace std; #define TYPE_INTER (1 << 0) /* intermediate node */ #define TYPE_TMPFS (1 << 1) /* replace with tmpfs */ #define TYPE_MODULE (1 << 2) /* mount from module */ #define TYPE_ROOT (1 << 3) /* partition root */ #define TYPE_CUSTOM...
9,908
C++
.h
262
31.507634
96
0.605151
topjohnwu/Magisk
47,255
11,960
25
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
44
pts.hpp
topjohnwu_Magisk/native/src/core/su/pts.hpp
/* * Copyright 2013, Tan Chee Eng (@tan-ce) */ /* * pts.hpp * * Manages the pseudo-terminal driver on Linux/Android and provides some * helper functions to handle raw input mode and terminal window resizing */ #ifndef _PTS_H_ #define _PTS_H_ #include <sys/types.h> /** * pts_open * * Opens a pts device an...
2,253
C++
.h
90
23.1
73
0.712227
topjohnwu/Magisk
47,255
11,960
25
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
true
false
true
false
45
su.hpp
topjohnwu_Magisk/native/src/core/su/su.hpp
#pragma once #include <sys/types.h> #include <sys/stat.h> #include <memory> #include <db.hpp> #include <core.hpp> #define DEFAULT_SHELL "/system/bin/sh" // Constants for atty #define ATTY_IN (1 << 0) #define ATTY_OUT (1 << 1) #define ATTY_ERR (1 << 2) class su_info { public: // Unique key const int ...
1,329
C++
.h
53
21.641509
85
0.667458
topjohnwu/Magisk
47,255
11,960
25
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
true
false
46
deny.hpp
topjohnwu_Magisk/native/src/core/deny/deny.hpp
#pragma once #include <pthread.h> #include <string_view> #include <functional> #include <map> #include <atomic> #include <core.hpp> #define ISOLATED_MAGIC "isolated" namespace DenyRequest { enum : int { ENFORCE, DISABLE, ADD, REMOVE, LIST, STATUS, END }; } namespace DenyResponse { enum...
701
C++
.h
41
14.317073
59
0.697389
topjohnwu/Magisk
47,255
11,960
25
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
47
db.hpp
topjohnwu_Magisk/native/src/core/include/db.hpp
#pragma once #include <sys/stat.h> #include <map> #include <string> #include <string_view> #include <functional> template <class T, size_t N> class db_dict { public: T& operator [](std::string_view key) { return data[get_idx(key)]; } const T& operator [](std::string_view key) const { retu...
2,811
C++
.h
119
20.495798
75
0.625047
topjohnwu/Magisk
47,255
11,960
25
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
48
daemon.hpp
topjohnwu_Magisk/native/src/core/include/daemon.hpp
#pragma once #include <base.hpp> namespace rust { struct MagiskD; } struct MagiskD { // Make sure only references can exist ~MagiskD() = delete; // Binding to Rust static const MagiskD &get(); // C++ implementation void reboot() const; bool post_fs_data() const; void late_start() co...
714
C++
.h
25
25.28
77
0.697059
topjohnwu/Magisk
47,255
11,960
25
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
49
selinux.hpp
topjohnwu_Magisk/native/src/core/include/selinux.hpp
#pragma once #include <base.hpp> int setcon(const char *con); int getfilecon(const char *path, byte_data con); int lgetfilecon(const char *path, byte_data con); int fgetfilecon(int fd, byte_data con); int setfilecon(const char *path, const char *con); int lsetfilecon(const char *path, const char *con); int fsetfileco...
520
C++
.h
13
38.769231
65
0.763889
topjohnwu/Magisk
47,255
11,960
25
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
50
resetprop.hpp
topjohnwu_Magisk/native/src/core/include/resetprop.hpp
#pragma once #include <string> #include <map> #include <cxx.h> struct prop_cb { virtual void exec(const char *name, const char *value, uint32_t serial) = 0; }; using prop_list = std::map<std::string, std::string>; struct prop_collector : prop_cb { explicit prop_collector(prop_list &list) : list(list) {} ...
941
C++
.h
25
35.12
100
0.70989
topjohnwu/Magisk
47,255
11,960
25
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
51
core.hpp
topjohnwu_Magisk/native/src/core/include/core.hpp
#pragma once #include <pthread.h> #include <poll.h> #include <string> #include <limits> #include <atomic> #include <functional> #include "socket.hpp" #include "../core-rs.hpp" #define AID_ROOT 0 #define AID_SHELL 2000 #define AID_APP_START 10000 #define AID_APP_END 19999 #define AID_USER_OFFSET 100000 #define to...
2,319
C++
.h
76
28.894737
90
0.745063
topjohnwu/Magisk
47,255
11,960
25
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
52
socket.hpp
topjohnwu_Magisk/native/src/core/include/socket.hpp
#pragma once #include <sys/un.h> #include <sys/socket.h> #include <string_view> #include <string> #include <vector> struct sock_cred : public ucred { std::string context; }; bool get_client_cred(int fd, sock_cred *cred); std::vector<int> recv_fds(int sockfd); int recv_fd(int sockfd); int send_fds(int sockfd, con...
1,111
C++
.h
33
31.666667
71
0.698975
topjohnwu/Magisk
47,255
11,960
25
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
53
module.hpp
topjohnwu_Magisk/native/src/core/zygisk/module.hpp
#pragma once #include <regex.h> #include <bitset> #include <list> #include "api.hpp" struct ZygiskContext; struct ZygiskModule; struct AppSpecializeArgs_v1; using AppSpecializeArgs_v2 = AppSpecializeArgs_v1; struct AppSpecializeArgs_v3; using AppSpecializeArgs_v4 = AppSpecializeArgs_v3; struct AppSpecializeArgs_v...
8,743
C++
.h
239
31.280335
94
0.664103
topjohnwu/Magisk
47,255
11,960
25
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
54
zygisk.hpp
topjohnwu_Magisk/native/src/core/zygisk/zygisk.hpp
#pragma once #include <sys/mman.h> #include <stdint.h> #include <jni.h> #include <vector> #include <core.hpp> namespace ZygiskRequest { enum : int { GET_INFO, CONNECT_COMPANION, GET_MODDIR, END }; } #if defined(__LP64__) #define ZLOGD(...) LOGD("zygisk64: " __VA_ARGS__) #define ZLOGE(...) LOGE("zygis...
1,718
C++
.h
50
31.38
124
0.683353
topjohnwu/Magisk
47,255
11,960
25
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
56
jni_hooks.hpp
topjohnwu_Magisk/native/src/core/zygisk/jni_hooks.hpp
// Generated by gen_jni_hooks.py std::array<JNINativeMethod, 17> zygote_methods = {{ { "nativeForkAndSpecialize", "(II[II[[IILjava/lang/String;Ljava/lang/String;[ILjava/lang/String;Ljava/lang/String;)I", (void *) +[] [[clang::no_stack_protector]] (JNIEnv *env, jclass clazz, jint uid, jint g...
25,969
C++
.h
277
82.592058
539
0.685247
topjohnwu/Magisk
47,255
11,960
25
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
57
consts.hpp
topjohnwu_Magisk/native/src/include/consts.hpp
#pragma once #define JAVA_PACKAGE_NAME "com.topjohnwu.magisk" #define ZYGISKLDR "libzygisk.so" #define NBPROP "ro.dalvik.vm.native.bridge" #define SECURE_DIR "/data/adb" #define MODULEROOT SECURE_DIR "/modules" #define MODULEUPGRADE SECURE_DIR "/modules_update" #define DATABIN SECURE...
1,924
C++
.h
44
42.568182
70
0.709023
topjohnwu/Magisk
47,255
11,960
25
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
58
magiskboot.hpp
topjohnwu_Magisk/native/src/boot/magiskboot.hpp
#pragma once #include <sys/types.h> #include <base.hpp> #define HEADER_FILE "header" #define KERNEL_FILE "kernel" #define RAMDISK_FILE "ramdisk.cpio" #define VND_RAMDISK_DIR "vendor_ramdisk" #define SECOND_FILE "second" #define EXTRA_FILE "extra" #define KER_DTB_FILE "kernel_dtb" #define RECV_...
1,031
C++
.h
25
39.56
81
0.715285
topjohnwu/Magisk
47,255
11,960
25
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
59
format.hpp
topjohnwu_Magisk/native/src/boot/format.hpp
#pragma once #include <string_view> typedef enum { UNKNOWN, /* Boot formats */ CHROMEOS, AOSP, AOSP_VENDOR, DHTB, BLOB, /* Compression formats */ GZIP, ZOPFLI, XZ, LZMA, BZIP2, LZ4, LZ4_LEGACY, LZ4_LG, /* Unsupported compression */ LZOP, /* Misc */ MTK, ...
2,224
C++
.h
76
27.026316
90
0.696913
topjohnwu/Magisk
47,255
11,960
25
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
true
false
60
bootimg.hpp
topjohnwu_Magisk/native/src/boot/bootimg.hpp
#pragma once #include <cstdint> #include <utility> #include <bitset> #include <cxx.h> #include "format.hpp" /****************** * Special Headers *****************/ struct mtk_hdr { uint32_t magic; /* MTK magic */ uint32_t size; /* Size of the content */ char name[32]; /* The...
21,885
C++
.h
573
34.453752
124
0.63175
topjohnwu/Magisk
47,255
11,960
25
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
61
compress.hpp
topjohnwu_Magisk/native/src/boot/compress.hpp
#pragma once #include <cxx.h> #include <stream.hpp> #include "format.hpp" out_strm_ptr get_encoder(format_t type, out_strm_ptr &&base); out_strm_ptr get_decoder(format_t type, out_strm_ptr &&base); void compress(const char *method, const char *infile, const char *outfile); void decompress(char *infile, const char *o...
520
C++
.h
11
46
75
0.741107
topjohnwu/Magisk
47,255
11,960
25
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
62
init.hpp
topjohnwu_Magisk/native/src/init/init.hpp
#include <base.hpp> #include <stream.hpp> #include "init-rs.hpp" using kv_pairs = std::vector<std::pair<std::string, std::string>>; struct BootConfig { bool skip_initramfs; bool force_normal_boot; bool rootwait; bool emulator; char slot[3]; char dt_dir[64]; char fstab_suffix[32]; char...
3,129
C++
.h
123
21.121951
88
0.613865
topjohnwu/Magisk
47,255
11,960
25
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
63
config.h
topjohnwu_Magisk/native/src/external/xz_config/config.h
/* config.h. Generated from config.h.in by configure. */ /* config.h.in. Generated from configure.ac by autoheader. */ /* Define if building universal (internal helper macro) */ /* #undef AC_APPLE_UNIVERSAL_BUILD */ /* How many MiB of RAM to assume if the real amount cannot be determined. */ #define ASSUME_RAM 12...
15,262
C++
.h
354
41.384181
78
0.719453
topjohnwu/Magisk
47,255
11,960
25
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
true
false
false
false
false
false
false
64
xz_lzma2.h
topjohnwu_Magisk/native/src/external/xz-embedded/xz_lzma2.h
/* * LZMA2 definitions * * Authors: Lasse Collin <lasse.collin@tukaani.org> * Igor Pavlov <http://7-zip.org/> * * This file has been put into the public domain. * You can do whatever you want with this file. */ #ifndef XZ_LZMA2_H #define XZ_LZMA2_H /* Range coder constants */ #define RC_SHIFT_BITS 8 ...
6,199
C++
.h
178
32.61236
78
0.724103
topjohnwu/Magisk
47,255
11,960
25
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
65
xz_private.h
topjohnwu_Magisk/native/src/external/xz-embedded/xz_private.h
/* * Private includes and definitions * * Author: Lasse Collin <lasse.collin@tukaani.org> * * This file has been put into the public domain. * You can do whatever you want with this file. */ #ifndef XZ_PRIVATE_H #define XZ_PRIVATE_H #ifdef __KERNEL__ # include <linux/xz.h> # include <linux/kernel.h> # include ...
4,667
C++
.h
139
30.877698
78
0.701397
topjohnwu/Magisk
47,255
11,960
25
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
true
true
false
false
false
false
false
false
66
xz.h
topjohnwu_Magisk/native/src/external/xz-embedded/xz.h
/* * XZ decompressor * * Authors: Lasse Collin <lasse.collin@tukaani.org> * Igor Pavlov <http://7-zip.org/> * * This file has been put into the public domain. * You can do whatever you want with this file. */ #ifndef XZ_H #define XZ_H #ifdef __KERNEL__ # include <linux/stddef.h> # include <linux/type...
12,395
C++
.h
283
41.787986
78
0.666612
topjohnwu/Magisk
47,255
11,960
25
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
true
true
false
false
false
false
false
false
67
xz_config.h
topjohnwu_Magisk/native/src/external/xz-embedded/xz_config.h
/* * Private includes and definitions for userspace use of XZ Embedded * * Author: Lasse Collin <lasse.collin@tukaani.org> * * This file has been put into the public domain. * You can do whatever you want with this file. */ #ifndef XZ_CONFIG_H #define XZ_CONFIG_H /* Uncomment to enable CRC64 support. */ /* #de...
3,089
C++
.h
108
26.092593
74
0.669477
topjohnwu/Magisk
47,255
11,960
25
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
68
xz_stream.h
topjohnwu_Magisk/native/src/external/xz-embedded/xz_stream.h
/* * Definitions for handling the .xz file format * * Author: Lasse Collin <lasse.collin@tukaani.org> * * This file has been put into the public domain. * You can do whatever you want with this file. */ #ifndef XZ_STREAM_H #define XZ_STREAM_H #if defined(__KERNEL__) && !XZ_INTERNAL_CRC32 # include <linux/crc32...
1,487
C++
.h
50
27.64
74
0.719298
topjohnwu/Magisk
47,255
11,960
25
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
true
true
false
false
false
false
false
false
69
files.hpp
topjohnwu_Magisk/native/src/base/files.hpp
#pragma once #include <sys/stat.h> #include <functional> #include <string_view> #include <string> #include <vector> #include <linux/fs.h> #include "misc.hpp" template <typename T> static inline T align_to(T v, int a) { static_assert(std::is_integral<T>::value); return (v + a - 1) / a * a; } template <typena...
3,015
C++
.h
76
37.157895
98
0.702943
topjohnwu/Magisk
47,255
11,960
25
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
70
xwrap.hpp
topjohnwu_Magisk/native/src/base/xwrap.hpp
#pragma once #include <unistd.h> #include <dirent.h> #include <stdio.h> #include <poll.h> #include <fcntl.h> extern "C" { FILE *xfopen(const char *pathname, const char *mode); FILE *xfdopen(int fd, const char *mode); int xopen(const char *pathname, int flags, mode_t mode = 0); int xopenat(int dirfd, const char *path...
2,765
C++
.h
58
46.086207
95
0.736959
topjohnwu/Magisk
47,255
11,960
25
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
71
logging.hpp
topjohnwu_Magisk/native/src/base/logging.hpp
#pragma once #include <cerrno> #include <cstdarg> void LOGD(const char *fmt, ...) __printflike(1, 2); void LOGI(const char *fmt, ...) __printflike(1, 2); void LOGW(const char *fmt, ...) __printflike(1, 2); void LOGE(const char *fmt, ...) __printflike(1, 2); #define PLOGE(fmt, args...) LOGE(fmt " failed with %d: %s\n"...
359
C++
.h
8
43.625
98
0.653295
topjohnwu/Magisk
47,255
11,960
25
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
72
misc.hpp
topjohnwu_Magisk/native/src/base/misc.hpp
#pragma once #include <pthread.h> #include <string> #include <functional> #include <string_view> #include <bitset> #include <random> #include <cxx.h> #include "xwrap.hpp" #define DISALLOW_COPY_AND_MOVE(clazz) \ clazz(const clazz&) = delete; \ clazz(clazz &&) = delete; #define ALLOW_MOVE_ONLY(clazz) \ clazz(c...
11,417
C++
.h
305
33.55082
97
0.642127
topjohnwu/Magisk
47,255
11,960
25
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
73
stream.hpp
topjohnwu_Magisk/native/src/base/include/stream.hpp
#pragma once #include <sys/uio.h> #include <cstdio> #include <memory> #include "../files.hpp" #define ENABLE_IOV 0 struct out_stream { virtual bool write(const void *buf, size_t len) = 0; #if ENABLE_IOV virtual ssize_t writev(const iovec *iov, int iovcnt); #endif virtual ~out_stream() = default; }; usi...
3,383
C++
.h
101
30.49505
77
0.67732
topjohnwu/Magisk
47,255
11,960
25
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
74
base.hpp
topjohnwu_Magisk/native/src/base/include/base.hpp
#pragma once #include "../xwrap.hpp" #include "../files.hpp" #include "../misc.hpp" #include "../logging.hpp" #include "../base-rs.hpp" using rust::xpipe2; using rust::fd_path;
178
C++
.h
8
21.125
25
0.692308
topjohnwu/Magisk
47,255
11,960
25
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
true
false
75
policy.hpp
topjohnwu_Magisk/native/src/sepolicy/policy.hpp
#pragma once // Internal APIs, do not use directly #include <map> #include <string_view> #include <sepol/policydb/policydb.h> #include <sepolicy.hpp> #include "policy-rs.hpp" struct sepol_impl : public sepolicy { avtab_ptr_t find_avtab_node(avtab_key_t *key, avtab_extended_perms_t *xperms); avtab_ptr_t ins...
1,796
C++
.h
32
52.1875
121
0.701824
topjohnwu/Magisk
47,255
11,960
25
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
76
sepolicy.hpp
topjohnwu_Magisk/native/src/sepolicy/include/sepolicy.hpp
#pragma once #include <stdlib.h> #include <string> #include <base.hpp> // sepolicy paths #define PLAT_POLICY_DIR "/system/etc/selinux/" #define VEND_POLICY_DIR "/vendor/etc/selinux/" #define PROD_POLICY_DIR "/product/etc/selinux/" #define ODM_POLICY_DIR "/odm/etc/selinux/" #define SYSEXT_POLICY_DIR ...
2,531
C++
.h
63
36.365079
75
0.704202
topjohnwu/Magisk
47,255
11,960
25
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
77
node.cpp
WerWolv_ImHex/lib/libimhex/source/data_processor/node.cpp
#include <hex/data_processor/node.hpp> #include <hex/helpers/fmt.hpp> #include <hex/api/localization_manager.hpp> #include <hex/providers/provider.hpp> namespace hex::dp { int Node::s_idCounter = 1; static std::atomic_bool s_interrupted; Node::Node(UnlocalizedString unlocalizedTitle, std::vector<Attrib...
6,961
C++
.cpp
147
37.585034
195
0.627721
WerWolv/ImHex
43,494
1,905
221
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
78
attribute.cpp
WerWolv_ImHex/lib/libimhex/source/data_processor/attribute.cpp
#include <hex/data_processor/attribute.hpp> namespace hex::dp { int Attribute::s_idCounter = 1; Attribute::Attribute(IOType ioType, Type type, UnlocalizedString unlocalizedName) : m_id(s_idCounter++), m_ioType(ioType), m_type(type), m_unlocalizedName(std::move(unlocalizedName)) { } Attribute::~Att...
569
C++
.cpp
14
34.285714
188
0.667883
WerWolv/ImHex
43,494
1,905
221
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
79
link.cpp
WerWolv_ImHex/lib/libimhex/source/data_processor/link.cpp
#include <hex/data_processor/link.hpp> namespace hex::dp { int Link::s_idCounter = 1; Link::Link(int from, int to) : m_id(s_idCounter++), m_from(from), m_to(to) { } void Link::setIdCounter(int id) { if (id > s_idCounter) s_idCounter = id; } }
283
C++
.cpp
9
26
82
0.592593
WerWolv/ImHex
43,494
1,905
221
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
80
tests.cpp
WerWolv_ImHex/lib/libimhex/source/test/tests.cpp
#include <hex/test/tests.hpp> namespace hex::test { std::map<std::string, Test> Tests::s_tests; bool initPluginImpl(std::string name) { if (name != "Built-in") { if(!initPluginImpl("Built-in")) return false; } hex::Plugin *plugin = hex::PluginManager::getPlugin(name); ...
698
C++
.cpp
19
28.421053
72
0.560651
WerWolv/ImHex
43,494
1,905
221
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
81
memory_provider.cpp
WerWolv_ImHex/lib/libimhex/source/providers/memory_provider.cpp
#include <hex/providers/memory_provider.hpp> #include <cstring> namespace hex::prv { bool MemoryProvider::open() { if (m_data.empty()) { m_data.resize(1); } return true; } void MemoryProvider::readRaw(u64 offset, void *buffer, size_t size) { auto actualSize =...
876
C++
.cpp
24
29.25
94
0.592637
WerWolv/ImHex
43,494
1,905
221
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
82
provider.cpp
WerWolv_ImHex/lib/libimhex/source/providers/provider.cpp
#include <hex/providers/provider.hpp> #include <hex.hpp> #include <hex/api/event_manager.hpp> #include <cmath> #include <cstring> #include <optional> #include <hex/helpers/magic.hpp> #include <wolv/io/file.hpp> #include <wolv/literals.hpp> #include <nlohmann/json.hpp> namespace hex::prv { using namespace wolv...
9,787
C++
.cpp
248
30.919355
196
0.605341
WerWolv/ImHex
43,494
1,905
221
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
83
stack.cpp
WerWolv_ImHex/lib/libimhex/source/providers/undo/stack.cpp
#include <hex/providers/undo_redo/stack.hpp> #include <hex/providers/undo_redo/operations/operation_group.hpp> #include <hex/providers/provider.hpp> #include <wolv/utils/guards.hpp> #include <atomic> namespace hex::prv::undo { namespace { std::atomic<bool> s_locked; std::mutex s_mutex; } ...
3,599
C++
.cpp
95
28.715789
95
0.577746
WerWolv/ImHex
43,494
1,905
221
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
84
toast.cpp
WerWolv_ImHex/lib/libimhex/source/ui/toast.cpp
#include <hex/ui/toast.hpp> #include <hex/helpers/auto_reset.hpp> namespace hex::impl { [[nodiscard]] std::list<std::unique_ptr<ToastBase>> &ToastBase::getQueuedToasts() { static AutoReset<std::list<std::unique_ptr<ToastBase>>> queuedToasts; return queuedToasts; } std::mutex& ToastBase::...
397
C++
.cpp
12
27.666667
87
0.668421
WerWolv/ImHex
43,494
1,905
221
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
85
imgui_imhex_extensions.cpp
WerWolv_ImHex/lib/libimhex/source/ui/imgui_imhex_extensions.cpp
#include <hex/ui/imgui_imhex_extensions.h> #include <imgui.h> #include <imgui_internal.h> #include <implot.h> #include <implot_internal.h> #include <cimgui.h> #include <opengl_support.h> #undef IMGUI_DEFINE_MATH_OPERATORS #define STB_IMAGE_IMPLEMENTATION #include <stb_image.h> #include <lunasvg.h> #include <set> #...
57,714
C++
.cpp
1,075
43.309767
260
0.634098
WerWolv/ImHex
43,494
1,905
221
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
86
view.cpp
WerWolv_ImHex/lib/libimhex/source/ui/view.cpp
#include <hex/ui/view.hpp> #include <imgui.h> #include <string> namespace hex { View::View(UnlocalizedString unlocalizedName, const char *icon) : m_unlocalizedViewName(std::move(unlocalizedName)), m_icon(icon) { } bool View::shouldDraw() const { return ImHexApi::Provider::isValid() && ImHexApi::Pro...
1,923
C++
.cpp
54
29.092593
137
0.662696
WerWolv/ImHex
43,494
1,905
221
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
87
popup.cpp
WerWolv_ImHex/lib/libimhex/source/ui/popup.cpp
#include <hex/ui/popup.hpp> #include <hex/helpers/auto_reset.hpp> namespace hex::impl { [[nodiscard]] std::vector<std::unique_ptr<PopupBase>> &PopupBase::getOpenPopups() { static AutoReset<std::vector<std::unique_ptr<PopupBase>>> openPopups; return openPopups; } std::mutex& PopupBase::g...
398
C++
.cpp
12
27.5
87
0.666667
WerWolv/ImHex
43,494
1,905
221
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
88
http_requests_emscripten.cpp
WerWolv_ImHex/lib/libimhex/source/helpers/http_requests_emscripten.cpp
#if defined(OS_WEB) #include <hex/helpers/http_requests.hpp> namespace hex { HttpRequest::HttpRequest(std::string method, std::string url) : m_method(std::move(method)), m_url(std::move(url)) { emscripten_fetch_attr_init(&m_attr); } HttpRequest::HttpRequest(HttpRequest &&other) noexcept { ...
1,634
C++
.cpp
42
31.904762
131
0.629442
WerWolv/ImHex
43,494
1,905
221
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
89
utils_linux.cpp
WerWolv_ImHex/lib/libimhex/source/helpers/utils_linux.cpp
#if defined(OS_LINUX) #include <hex/helpers/logger.hpp> #include <vector> #include <string> #include <unistd.h> namespace hex { void executeCmd(const std::vector<std::string> &argsVector) { std::vector<char*> cArgsVector; for (const auto &str : argsVector) { cArgsVector.push_back(con...
612
C++
.cpp
20
23.65
66
0.59792
WerWolv/ImHex
43,494
1,905
221
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
90
logger.cpp
WerWolv_ImHex/lib/libimhex/source/helpers/logger.cpp
#include <hex/helpers/logger.hpp> #include <hex/api/task_manager.hpp> #include <hex/api/event_manager.hpp> #include <hex/helpers/fs.hpp> #include <hex/helpers/fmt.hpp> #include <hex/helpers/default_paths.hpp> #include <wolv/io/file.hpp> #include <mutex> #include <chrono> #include <fmt/chrono.h> #if defined(OS_WIND...
4,913
C++
.cpp
123
28.772358
209
0.555509
WerWolv/ImHex
43,494
1,905
221
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
91
http_requests.cpp
WerWolv_ImHex/lib/libimhex/source/helpers/http_requests.cpp
#include <hex/helpers/http_requests.hpp> #include <hex/helpers/crypto.hpp> #include <hex/helpers/fmt.hpp> namespace hex { size_t HttpRequest::writeToVector(void *contents, size_t size, size_t nmemb, void *userdata) { auto &response = *static_cast<std::vector<u8>*>(userdata); auto startSize = resp...
1,699
C++
.cpp
45
27.422222
98
0.509744
WerWolv/ImHex
43,494
1,905
221
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
92
tar.cpp
WerWolv_ImHex/lib/libimhex/source/helpers/tar.cpp
#include <hex/helpers/tar.hpp> #include <hex/helpers/literals.hpp> #include <hex/helpers/logger.hpp> #include <hex/helpers/fmt.hpp> #include <wolv/io/file.hpp> #include <microtar.h> namespace hex { using namespace hex::literals; Tar::Tar(const std::fs::path &path, Mode mode) { int tarError = MTAR_E...
6,097
C++
.cpp
143
33.342657
100
0.576596
WerWolv/ImHex
43,494
1,905
221
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
93
encoding_file.cpp
WerWolv_ImHex/lib/libimhex/source/helpers/encoding_file.cpp
#include <hex/helpers/encoding_file.hpp> #include <hex/helpers/utils.hpp> #include <wolv/io/file.hpp> #include <wolv/utils/string.hpp> namespace hex { EncodingFile::EncodingFile() : m_mapping(std::make_unique<std::map<size_t, std::map<std::vector<u8>, std::string>>>()) { } EncodingFile::EncodingFile(c...
4,850
C++
.cpp
116
31.37931
124
0.564097
WerWolv/ImHex
43,494
1,905
221
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
94
opengl.cpp
WerWolv_ImHex/lib/libimhex/source/helpers/opengl.cpp
#include <hex/helpers/opengl.hpp> #include <opengl_support.h> #include <hex/helpers/utils.hpp> #include <hex/helpers/logger.hpp> #include <wolv/utils/guards.hpp> #include <numbers> namespace hex::gl { Matrix<float,4,4> GetOrthographicMatrix( float viewWidth, float viewHeight, float nearVal,float farVal, bool a...
23,710
C++
.cpp
558
32.876344
124
0.556641
WerWolv/ImHex
43,494
1,905
221
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
95
default_paths.cpp
WerWolv_ImHex/lib/libimhex/source/helpers/default_paths.cpp
#include <hex/helpers/default_paths.hpp> #include <hex/api/imhex_api.hpp> #include <hex/api/project_file_manager.hpp> #if defined(OS_WINDOWS) #include <windows.h> #include <shlobj.h> #elif defined(OS_LINUX) || defined(OS_WEB) #include <xdg.hpp> # endif namespace hex::paths { std::vector<std::fs::pat...
4,726
C++
.cpp
109
32.495413
117
0.587604
WerWolv/ImHex
43,494
1,905
221
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
96
debugging.cpp
WerWolv_ImHex/lib/libimhex/source/helpers/debugging.cpp
#include <hex/helpers/debugging.hpp> namespace hex::dbg { namespace impl { bool &getDebugWindowState() { static bool state = false; return state; } } }
205
C++
.cpp
9
15.888889
38
0.581152
WerWolv/ImHex
43,494
1,905
221
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
97
fs.cpp
WerWolv_ImHex/lib/libimhex/source/helpers/fs.cpp
#include <hex/helpers/fs.hpp> #include <hex/api/imhex_api.hpp> #include <hex/api/project_file_manager.hpp> #include <hex/helpers/logger.hpp> #include <hex/helpers/fmt.hpp> #include <hex/helpers/utils_linux.hpp> #include <hex/helpers/auto_reset.hpp> #if defined(OS_WINDOWS) #include <windows.h> #include <shlobj...
12,610
C++
.cpp
279
31.770609
194
0.538693
WerWolv/ImHex
43,494
1,905
221
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
98
patches.cpp
WerWolv_ImHex/lib/libimhex/source/helpers/patches.cpp
#include <hex/helpers/patches.hpp> #include <hex/helpers/utils.hpp> #include <hex/providers/provider.hpp> #include <cstring> #include <string_view> namespace hex { namespace { class PatchesGenerator : public hex::prv::Provider { public: explicit PatchesGenerator() = default; ...
11,213
C++
.cpp
240
33.145833
150
0.528061
WerWolv/ImHex
43,494
1,905
221
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
99
http_requests_native.cpp
WerWolv_ImHex/lib/libimhex/source/helpers/http_requests_native.cpp
#if !defined(OS_WEB) #include <hex/helpers/http_requests.hpp> namespace hex { namespace { std::string s_proxyUrl; bool s_proxyState; } HttpRequest::HttpRequest(std::string method, std::string url) : m_method(std::move(method)), m_url(std::move(url)) { AT_FIRST_TIME { ...
3,540
C++
.cpp
84
33.797619
131
0.622994
WerWolv/ImHex
43,494
1,905
221
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
100
magic.cpp
WerWolv_ImHex/lib/libimhex/source/helpers/magic.cpp
#include <hex/helpers/magic.hpp> #include <hex/helpers/utils.hpp> #include <hex/helpers/fs.hpp> #include <hex/helpers/logger.hpp> #include <hex/helpers/default_paths.hpp> #include <wolv/utils/guards.hpp> #include <wolv/utils/string.hpp> #include <hex/providers/provider.hpp> #include <filesystem> #include <optional>...
7,604
C++
.cpp
169
34.349112
120
0.56893
WerWolv/ImHex
43,494
1,905
221
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
101
crypto.cpp
WerWolv_ImHex/lib/libimhex/source/helpers/crypto.cpp
#include <hex/helpers/crypto.hpp> #include <hex/providers/provider.hpp> #include <wolv/utils/guards.hpp> #include <mbedtls/version.h> #include <mbedtls/base64.h> #include <mbedtls/bignum.h> #include <mbedtls/md5.h> #include <mbedtls/sha1.h> #include <mbedtls/sha256.h> #include <mbedtls/sha512.h> #include <mbedtls/ci...
17,328
C++
.cpp
428
30.495327
196
0.55878
WerWolv/ImHex
43,494
1,905
221
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
102
imgui_hooks.cpp
WerWolv_ImHex/lib/libimhex/source/helpers/imgui_hooks.cpp
#include <hex/api/event_manager.hpp> #include <imgui.h> #include <imgui_internal.h> #include <array> void ImGuiTestEngineHook_ItemAdd(ImGuiContext*, ImGuiID id, const ImRect& bb, const ImGuiLastItemData*) { std::array<float, 4> boundingBox = { bb.Min.x, bb.Min.y, bb.Max.x, bb.Max.y }; hex::EventImGuiElementR...
606
C++
.cpp
11
53.090909
105
0.766892
WerWolv/ImHex
43,494
1,905
221
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false