26.09.2018 Views

Antivirus hackers handbook

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Chapter 2 ■ Reverse-Engineering the Core 51<br />

__int64 a3, __int64 a4);<br />

//----------------------------------------------------------------------<br />

// Data declarations<br />

char *optarg;<br />

char *src;<br />

char verbose;<br />

__int64 g_base_component_0x20001;<br />

__int64 g_user_callbacks;<br />

CAEEngineDispatch *g_Engine;<br />

CFrameWork *g_FrameworkInstance;<br />

typedef int (__fastcall *FnCreateInstance_t)(_QWORD, _QWORD, _QWORD,<br />

CFrameWork **);<br />

int (__fastcall *FnCreateInstance)(<br />

_QWORD, _QWORD, _QWORD, CFrameWork **);<br />

void *hFrameworkSo;<br />

vtable_403310_t *vtable_403310;<br />

You are now done with the very basic version of the Comodo command-line<br />

scanner. You can compile it with the following command in a Linux machine:<br />

$ g++ cmdscan.c -o mycmdscan -fpermissive \<br />

-Wno-unused-local-typedefs -ldl<br />

In order to test it, you need to copy it to the /opt/COMODO directory, using the<br />

following command:<br />

$ sudo cp mycmdscan /opt/COMODO<br />

You can now test this program to see whether it is working like the original<br />

cmdscan from Comodo:<br />

$ /opt/COMODO/mycmdscan /home/joxean/malware/eicar.com.txt<br />

/home/joxean/malware/eicar.com.txt ---> Found Virus , \<br />

Malware Name is Malware<br />

Number of Scanned Files: 1<br />

Number of Found Viruses: 1<br />

It works! Now, it is time to print more information regarding the detected<br />

or undetected file. If you look at the SCANRESULT structure, you will find some<br />

interesting members:<br />

struct SCANRESULT<br />

{<br />

char bFound;<br />

int unSignID;<br />

char szMalwareName[64];<br />

int eFileType;<br />

int eOwnerFlag;

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!