Shared object obfuscation concept proven.
This commit is contained in:
30
linux/shared_object_obfuscation/Makefile
Normal file
30
linux/shared_object_obfuscation/Makefile
Normal 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
|
||||||
|
|
||||||
@@ -17,6 +17,7 @@ int main ( void )
|
|||||||
o.secret_method2();
|
o.secret_method2();
|
||||||
o.secret_method1();
|
o.secret_method1();
|
||||||
o.secret_method2();
|
o.secret_method2();
|
||||||
|
o.secret_method3();
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -14,6 +14,7 @@ public:
|
|||||||
|
|
||||||
void secret_method1();
|
void secret_method1();
|
||||||
void secret_method2();
|
void secret_method2();
|
||||||
|
void secret_method3();
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
@@ -2,6 +2,10 @@
|
|||||||
VIM: let g:lcppflags="-O2 -pthread"
|
VIM: let g:lcppflags="-O2 -pthread"
|
||||||
VIM: let g:argv=""
|
VIM: let g:argv=""
|
||||||
*/
|
*/
|
||||||
|
#include <unistd.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <exception>
|
#include <exception>
|
||||||
|
|
||||||
@@ -27,3 +31,10 @@ void MyVerySecretClass::secret_method2()
|
|||||||
std::cout << "The value of secret variable is " << secret_var << std::endl;
|
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 );
|
||||||
|
}
|
||||||
|
|
||||||
@@ -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
|
|
||||||
|
|
||||||
Reference in New Issue
Block a user