AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Zurück Delphi-PRAXiS Programmierung allgemein Netzwerke Delphi Datei nach VirusTotal mittels Indy
Thema durchsuchen
Ansicht
Themen-Optionen

Datei nach VirusTotal mittels Indy

Offene Frage von "Valle"
Ein Thema von stOrM · begonnen am 4. Jun 2011 · letzter Beitrag vom 10. Jun 2011
 
Benutzerbild von stOrM
stOrM

Registriert seit: 7. Jun 2003
Ort: Mülheim an der Ruhr
436 Beiträge
 
Delphi 10.3 Rio
 
#1

Datei nach VirusTotal mittels Indy

  Alt 4. Jun 2011, 12:45
Hi,
ich stehe gerade vor dem Problem, dass ich gerne eine Datei mittels Delphi an die Virustotal Webseite zwecks überprüfung dieser Datei senden würde. Bevorzugt würde ich dafür Indy einsetzen. Dumm daran ist das ich mit Indy selber bis auf die IdHTTP Komponente im Zusammenhang mit Dateidownload noch nie etwas gemacht habe.

Die Suche hier hat mich auch nicht wirklich dem Ziel nahegebracht, da ich nicht genau weiß woran das Problem nun genau liegt.

Folgendes zum Upload schreibt Virustotal:

Zitat:
This API call expects multipart/form-data parameters, the string part of the the call should have the following parameter:

key: your API key.
The file part of the call should contain the name of the submitted file and the file itself. We strongly encourage you to send the file with the name with which it was found in the wild since this is very rich metadata for the VirusTotal database. The API acts like a form with a file input field named file.
Gut dachte ich mir, versuch ich mal folgendes (Unwissenderweise)

Delphi-Quellcode:
procedure TForm1.Button1Click(Sender: TObject);
var
  stream : TIdMultipartFormDataStream;
  const
    aHost = 'http://www.virustotal.com';
    aSelector = 'http://www.virustotal.com/api/scan_file.json';
begin
  stream := TIdMultipartFormDataStream.Create;
  try
    idHttp1.Request.ContentType := stream.RequestContentType;
    // sha1 filehash
    stream.AddFormField('resource:', '60EC5990C3DD08481F94F85636BAC486F5C19CCD');
    // private api key
    stream.AddFormField('key:', aKey);
    // filename to be send including file
    stream.AddFile('file:Test.exe', 'C:\VirusTotal\Upload\Test.exe', '');
    // set stream to beginning
    stream.Position := 0;
    // send file to virustotal result into memo1
    Memo1.Lines.Text := idHttp1.Post(aHost, stream);
  finally
    stream.Free;
  end;
end;
Was mich verwirrt ist folgendes Script als Beispiel auf Virustotal

Code:
>>> import postfile
>>> host = "www.virustotal.com"
>>> selector = "https://www.virustotal.com/api/scan_file.json"
>>> fields = [("key", "1fe0ef5feca2f84eb450bc3617f839e317b2a686af4d651a9bada77a522201b0")]
>>> file_to_send = open("test.txt", "rb").read()
>>> files = [("file", "test.txt", file_to_send)]
>>> json = postfile.post_multipart(host, selector, fields, files)
>>> print json
{"scan_id": "cd1384c10baa2d5b96f397b986e2a1fc9535d2ef0e185a113fc610eca1c6fb0e-1271623480",
 "result": 1}
Wenn ich das richtig deute wird hier nicht nur die Url www.virustotal.com sondern auch noch https://www.virustotal.com/api/scan_file.json übergeben? Irgendwie blick ichs nicht!
Erst dachte ich gut vielleicht liegts daran das ich die ganze Sache über http anstelle von https aufrufe lt. dem Beispiel soll aber beides machbar sein.

Fehler 1: Wenn ich den Code mit aHost aufrufe bekomme ich ein 'Not allowed' zurück! Nehme ich den aSelector bekomme ich 500 "Internal error" zurück.
  Mit Zitat antworten Zitat
 


Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 05:54 Uhr.
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz