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

 

 


Tema destacado:


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


Desconectado Desconectado

Mensajes: 545



Ver Perfil
[Delphi] VirusTotal Scanner 0.1
« en: 1 Noviembre 2013, 16:51 pm »

Un simple programa en Delphi para usar el API de VirusTotal.

Una imagen :



El codigo :

Código
  1. // VirusTotal Scanner 0.1
  2. // (C) Doddy Hackman 2013
  3.  
  4. unit virus;
  5.  
  6. interface
  7.  
  8. uses
  9.  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  10.  Dialogs, sSkinManager, IdBaseComponent, IdComponent, IdTCPConnection,
  11.  IdTCPClient, IdHTTP, StdCtrls, sButton, sMemo, IdMultipartFormData, DBXJSON,
  12.  PerlRegEx, IdHashMessageDigest, idHash, sEdit, sGroupBox, ComCtrls, sListView,
  13.  sStatusBar, acPNG, ExtCtrls;
  14.  
  15. type
  16.  TForm1 = class(TForm)
  17.    IdHTTP1: TIdHTTP;
  18.    sSkinManager1: TsSkinManager;
  19.    PerlRegEx1: TPerlRegEx;
  20.    sGroupBox1: TsGroupBox;
  21.    sEdit1: TsEdit;
  22.    OpenDialog1: TOpenDialog;
  23.    sGroupBox2: TsGroupBox;
  24.    sListView1: TsListView;
  25.    sStatusBar1: TsStatusBar;
  26.    sGroupBox3: TsGroupBox;
  27.    sMemo1: TsMemo;
  28.    sGroupBox4: TsGroupBox;
  29.    sButton1: TsButton;
  30.    sButton2: TsButton;
  31.    sButton4: TsButton;
  32.    sButton5: TsButton;
  33.    Image1: TImage;
  34.  
  35.    procedure FormCreate(Sender: TObject);
  36.    procedure sButton1Click(Sender: TObject);
  37.    procedure sButton2Click(Sender: TObject);
  38.    procedure sButton4Click(Sender: TObject);
  39.    procedure sButton5Click(Sender: TObject);
  40.  
  41.  private
  42.  
  43.    { Private declarations }
  44.  public
  45.    { Public declarations }
  46.  end;
  47.  
  48. var
  49.  Form1: TForm1;
  50.  
  51. implementation
  52.  
  53. {$R *.dfm}
  54.  
  55. function convertirmd5(const archivo: string): string;
  56. var
  57.  valormd5: TIdHashMessageDigest5;
  58.  archivox: TFileStream;
  59. begin
  60.  
  61.  valormd5 := TIdHashMessageDigest5.Create;
  62.  archivox := TFileStream.Create(archivo, fmOpenRead);
  63.  Result := valormd5.HashStreamAsHex(archivox)
  64.  
  65. end;
  66.  
  67. procedure TForm1.FormCreate(Sender: TObject);
  68. var
  69.  dir: string;
  70. begin
  71.  sSkinManager1.SkinDirectory := ExtractFilePath(Application.ExeName) + 'Data';
  72.  sSkinManager1.SkinName := 'falloutstyle';
  73.  sSkinManager1.Active := True;
  74.  
  75. end;
  76.  
  77. procedure TForm1.sButton1Click(Sender: TObject);
  78. begin
  79.  OpenDialog1.InitialDir := GetCurrentDir;
  80.  if OpenDialog1.Execute then
  81.  begin
  82.    sEdit1.Text := OpenDialog1.filename;
  83.  end;
  84. end;
  85.  
  86. procedure TForm1.sButton2Click(Sender: TObject);
  87.  
  88. var
  89.  datos: TIdMultiPartFormDataStream;
  90.  code: string;
  91.  antivirus: string;
  92.  resultado: string;
  93.  
  94.  html: string;
  95.  
  96. begin
  97.  
  98.  if FileExists(sEdit1.Text) then
  99.  begin
  100.  
  101.    sMemo1.Clear;
  102.    sListView1.Clear;
  103.  
  104.    sStatusBar1.Panels[0].Text := '[+] Scanning ...';
  105.    Form1.sStatusBar1.Update;
  106.  
  107.    datos := TIdMultiPartFormDataStream.Create;
  108.    datos.AddFormField('resource', convertirmd5(sEdit1.Text));
  109.    datos.AddFormField('apikey',
  110.      'fuck you');
  111.  
  112.    code := IdHTTP1.Post('http://www.virustotal.com/vtapi/v2/file/report',
  113.      datos);
  114.  
  115.    code := StringReplace(code, '{"scans":', '', [rfReplaceAll, rfIgnoreCase]);
  116.  
  117.    PerlRegEx1.Regex :=
  118.      '"(.*?)": {"detected": (.*?), "version": (.*?), "result": (.*?), "update": (.*?)}';
  119.    PerlRegEx1.Subject := code;
  120.  
  121.    while PerlRegEx1.MatchAgain do
  122.    begin
  123.  
  124.      antivirus := PerlRegEx1.SubExpressions[1];
  125.      resultado := PerlRegEx1.SubExpressions[4];
  126.      resultado := StringReplace
  127.        (resultado, '"', '', [rfReplaceAll, rfIgnoreCase]);
  128.  
  129.      with sListView1.Items.Add do
  130.      begin
  131.        Caption := antivirus;
  132.        if (resultado = 'null') then
  133.        begin
  134.          SubItems.Add('Clean');
  135.        end
  136.        else
  137.        begin
  138.          SubItems.Add(resultado);
  139.        end;
  140.      end;
  141.  
  142.    end;
  143.  
  144.    PerlRegEx1.Regex := '"scan_id": "(.*?)"';
  145.    PerlRegEx1.Subject := code;
  146.  
  147.    if PerlRegEx1.Match then
  148.    begin
  149.      sMemo1.Lines.Add('[+] Scan_ID : ' + PerlRegEx1.SubExpressions[1]);
  150.    end;
  151.  
  152.    PerlRegEx1.Regex := '"scan_date": "(.*?)"';
  153.    PerlRegEx1.Subject := code;
  154.  
  155.    if PerlRegEx1.Match then
  156.    begin
  157.      sMemo1.Lines.Add('[+] Scan_Date : ' + PerlRegEx1.SubExpressions[1]);
  158.    end;
  159.  
  160.    PerlRegEx1.Regex := '"permalink": "(.*?)"';
  161.    PerlRegEx1.Subject := code;
  162.  
  163.    if PerlRegEx1.Match then
  164.    begin
  165.      sMemo1.Lines.Add('[+] PermaLink : ' + PerlRegEx1.SubExpressions[1]);
  166.    end;
  167.  
  168.    PerlRegEx1.Regex :=
  169.      '"verbose_msg": "(.*?)", "total": (.*?), "positives": (.*?),';
  170.    PerlRegEx1.Subject := code;
  171.  
  172.    if PerlRegEx1.Match then
  173.    begin
  174.      sMemo1.Lines.Add('[+] Founds : ' + PerlRegEx1.SubExpressions[3]
  175.          + '/' + PerlRegEx1.SubExpressions[2]);
  176.    end;
  177.    sStatusBar1.Panels[0].Text := '[+] Done';
  178.    Form1.sStatusBar1.Update;
  179.  end
  180.  else
  181.  begin
  182.    sStatusBar1.Panels[0].Text := '[-] File Not Found';
  183.    Form1.sStatusBar1.Update;
  184.  end;
  185. end;
  186.  
  187. procedure TForm1.sButton4Click(Sender: TObject);
  188. begin
  189.  ShowMessage('Contact to lepuke[at]hotmail[com]');
  190. end;
  191.  
  192. procedure TForm1.sButton5Click(Sender: TObject);
  193. begin
  194.  Form1.Close();
  195. end;
  196.  
  197. end.
  198.  
  199. // The End ?
  200.  

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
WTF!? Es posible!?(Virustotal) « 1 2 »
Seguridad
CAR3S? 15 9,716 Último mensaje 23 Octubre 2011, 18:36 pm
por 2Fac3R
[Perl] VirusTotal Scanner 0.1
Scripting
BigBear 4 3,000 Último mensaje 17 Mayo 2013, 18:43 pm
por BigBear
[Delphi] DH Port Scanner 0.2
Programación General
BigBear 0 1,735 Último mensaje 2 Agosto 2013, 23:50 pm
por BigBear
[C#] VirusTotal Scanner 0.1
.NET (C#, VB.NET, ASP)
BigBear 4 2,931 Último mensaje 28 Junio 2014, 03:54 am
por BigBear
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines