Shared object obfuscation concept proven.

This commit is contained in:
Vahagn Khachatryan
2015-03-03 22:23:02 +04:00
parent f62e08cbb7
commit 67b4092b96
5 changed files with 43 additions and 15 deletions

View File

@@ -0,0 +1,30 @@
all: libshared_object.so executable.exe
clean:
rm *.o *.so *.exe
libshared_object.so : shared_object.o
g++ -fPIC --shared -O2 $< -o $@
strip $@
shared_object.o : shared_object.cpp interface.h
g++ -fPIC -O2 $< -c -o $@
objcopy --redefine-sym _ZN17MyVerySecretClass14secret_method1Ev=m1 \
--redefine-sym _ZN17MyVerySecretClass14secret_method2Ev=m2 \
--redefine-sym _ZN17MyVerySecretClass14secret_method3Ev=m3 $@
executable.exe : executable.o libshared_object.so
g++ -O2 -lshared_object -L. $< -o $@
strip $@
executable.o : executable.cpp interface.h
g++ -O2 -lshared_object -L. $< -c -o $@
objcopy --redefine-sym _ZN17MyVerySecretClass14secret_method1Ev=m1 \
--redefine-sym _ZN17MyVerySecretClass14secret_method2Ev=m2 \
--redefine-sym _ZN17MyVerySecretClass14secret_method3Ev=m3 $@
run: all
LD_LIBRARY_PATH=. ./executable.exe

View File

@@ -17,6 +17,7 @@ int main ( void )
o.secret_method2();
o.secret_method1();
o.secret_method2();
o.secret_method3();
return 0;
}

View File

@@ -14,6 +14,7 @@ public:
void secret_method1();
void secret_method2();
void secret_method3();
};
#endif

View File

@@ -2,6 +2,10 @@
VIM: let g:lcppflags="-O2 -pthread"
VIM: let g:argv=""
*/
#include <unistd.h>
#include <stdlib.h>
#include <stdio.h>
#include <iostream>
#include <exception>
@@ -27,3 +31,10 @@ void MyVerySecretClass::secret_method2()
std::cout << "The value of secret variable is " << secret_var << std::endl;
}
void MyVerySecretClass::secret_method3()
{
char cmdln[128];
sprintf( cmdln, "pstack %d", getpid() );
system( cmdln );
}

View File

@@ -1,15 +0,0 @@
all: libshared_object.so executable.exe
libshared_object.so : shared_object.cpp interface.h
g++ -fPIC --shared -O2 $< -o $@
strip $@
executable.exe : executable.cpp interface.h libshared_object.so
g++ -O2 -lshared_object -L. $< -o $@
strip $@
run: all
LD_LIBRARY_PATH=. ./executable.exe