Feat: Add tmpfile spoofer for redirecting decrypted license file
This commit is contained in:
@@ -2,6 +2,7 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <dlfcn.h>
|
#include <dlfcn.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
static FILE *(*real_fopen)(const char *path, const char *mode) = NULL;
|
static FILE *(*real_fopen)(const char *path, const char *mode) = NULL;
|
||||||
|
|
||||||
@@ -38,3 +39,19 @@ FILE *fopen(const char *path, const char *mode) {
|
|||||||
|
|
||||||
return real_fopen(path, mode);
|
return real_fopen(path, mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
FILE *tmpfile(void) {
|
||||||
|
char path[] = "./tmpfile_XXXXXX";
|
||||||
|
int fd = mkstemp(path);
|
||||||
|
if (fd == -1) {
|
||||||
|
fprintf(stderr, "proc_redirect: mkstemp failed\n");
|
||||||
|
abort();
|
||||||
|
}
|
||||||
|
fprintf(stderr, "proc_redirect: tmpfile created at %s\n", path);
|
||||||
|
FILE *f = fdopen(fd, "w+");
|
||||||
|
if (!f) {
|
||||||
|
close(fd);
|
||||||
|
abort();
|
||||||
|
}
|
||||||
|
return f;
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user