elf dynamic symboles obfuscation.

This commit is contained in:
Vahagn Khachatryan
2015-03-03 12:09:18 +04:00
parent fdf7d3b430
commit 21dffa8a83
4 changed files with 98 additions and 0 deletions

View File

@@ -0,0 +1,15 @@
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

View File

@@ -0,0 +1,35 @@
/*
VIM: let g:lcppflags="-O2 -lshared_object -L."
VIM: let g:argv=""
*/
#include <iostream>
#include <exception>
#include "interface.h"
int main ( void )
{try{
MyVerySecretClass o;
o.secret_method1();
o.secret_method2();
o.secret_method1();
o.secret_method2();
o.secret_method1();
o.secret_method2();
return 0;
}
catch ( const std::exception& e )
{
std::cerr << std::endl
<< "std::exception(\"" << e.what() << "\")." << std::endl;
return 2;
}
catch ( ... )
{
std::cerr << std::endl
<< "unknown exception." << std::endl;
return 1;
}}

View File

@@ -0,0 +1,19 @@
#ifndef __INTERFACE_TO_MY_VERY_SECRET_CLASS__
#define __INTERFACE_TO_MY_VERY_SECRET_CLASS__
class MyVerySecretClass
{
private:
int secret_var;
public:
MyVerySecretClass();
~MyVerySecretClass();
void secret_method1();
void secret_method2();
};
#endif

View File

@@ -0,0 +1,29 @@
/*
VIM: let g:lcppflags="-O2 -pthread"
VIM: let g:argv=""
*/
#include <iostream>
#include <exception>
#include "interface.h"
MyVerySecretClass::MyVerySecretClass()
: secret_var(0)
{
}
MyVerySecretClass::~MyVerySecretClass()
{
secret_var = -1;
}
void MyVerySecretClass::secret_method1()
{
++secret_var;
}
void MyVerySecretClass::secret_method2()
{
std::cout << "The value of secret variable is " << secret_var << std::endl;
}