Ver Mensaje Individual
  #5  
Antiguo 07-09-2015
Avatar de escafandra
[escafandra] escafandra is offline
Miembro Premium
 
Registrado: nov 2007
Posts: 2.211
Reputación: 22
escafandra Tiene un aura espectacularescafandra Tiene un aura espectacular
En Windows 10 si funciona, no lo he probado en Win7. Ese código es muy similar al de ExportVisor

Código PHP:
void __fastcall TForm1::Button2Click(TObject *Sender)
{
   
Memo1->Clear();
   
HMODULE hModule = LoadLibrary(ComboBox1->Text.c_str());
   if(!
hModule)
     
hModule = GetModuleHandle(ComboBox1->Text.c_str());
   if(!
hModule){
     
Memo1->Text = "Can't open module"; 
     return;
   }
   
DWORD ImageBase;
   
PIMAGE_EXPORT_DIRECTORY IED = ImageExportDirectory(hModule);
   
char* ModuleName = (char*)(IED->Name + (DWORD)hModule); 
   
Label1->Caption = "Exported data (.edata): " + String(ModuleName);
   
Label3->Caption = IntToStr((int)IED->NumberOfNames) + " Functions and variables";
   
Update();
   
char** Names = (char**)(IED->AddressOfNames + (DWORD)hModule);
   
DWORD* EntryPoints = (DWORD*)(IED->AddressOfFunctions + (DWORD)hModule);
   
WORD*  Index = (WORD*)(IED->AddressOfNameOrdinals + (DWORD)hModule);

   
// Listar las funciones exportadas:
   
ImageBase = (DWORD)hModule;
   if(
ComboBox1->Text == "ntoskrnl.exe" ||
      
ComboBox1->Text == "ntkrnlpa.exe" ||
      
ComboBox1->Text == "ntkrnlmp.exe" ||
      
ComboBox1->Text == "hal.dll") {
        
ImageBase = GetKernelBase();
        
Label5->Caption = "Kernel Base: 0x" + IntToHex((int)ImageBase, 8);
   }else
     
Label5->Caption = "hModule: 0x" + IntToHex((int)hModule, 8);

   for(
int n=0; n<IED->NumberOfNames; n++){
      if(
Index[n]>=IED->NumberOfFunctions) continue;
      
char* Name = Names[n] + (DWORD)hModule;
      if(
CheckBox1->Checked)
        
Memo1->Lines->Add("0x" + IntToHex((int)EntryPoints[Index[n]], 8) + ": " + String(Name));
      else
        
Memo1->Lines->Add("0x" + IntToHex((int)(EntryPoints[Index[n]]+ ImageBase), 8) + ": " + String(Name));
      
Application->ProcessMessages();
   }

   
FreeLibrary(hModule);
} 
Funciona en Win10. Algunas dll que aporta este código pertenecen al Kernel de WinXP y no existen en siguientes versiones.

Es preferible no cargar un módulo sino analizar el fichero a lo bruto, como lo hace IEDataVisor, aunque es mucho más complejo.


Saludos.

Última edición por escafandra fecha: 07-09-2015 a las 01:25:46.
Responder Con Cita