Función Enviar Archivo VirusTotal (Escanea)

Iniciado por Danyfirex, 15 Mayo 2013, 00:47 AM

0 Miembros y 1 Visitante están viendo este tema.

Danyfirex

Hola una función mas.  ;D
Envía muestra recuérdenlo!!!  >:D



Código (vb) [Seleccionar]
' =================================================================
' =================================================================
' => Autor: Pink
' => Upload file to VirusTotal.com For Scanning
' => Gracias VirusTotal.com
' => Fecha : 14|05|2013
' => Uso: VT_Scan("c:\hola.exe","your_APIKey")
' => Retorno:
'{"response_code": 1,
' "verbose_msg": "Scan request successfully queued, come back later for the report",
' "resource": "999f7d93aa3d4a1a94cccfb4ea96bc2e28fd48020a481aa2dc7e215f3ce27bc0",
' "scan_id": "999f7d93aa3d4a1a94cccfb4ea96bc2e28fd48020a481aa2dc7e215f3ce27bc0-1324376258",
' "permalink": "https://www.virustotal.com/file/999f7d93aa3d4a1a94cccfb4ea96bc2e28fd48020a481aa2dc7e215f3ce27bc0/analysis/1324376258/",
' "sha256": "999f7d93aa3d4a1a94cccfb4ea96bc2e28fd48020a481aa2dc7e215f3ce27bc0",
' "sha1": "2cc875bca8030d745adfd14388b8c001471c2474",
' "md5": "4a00e1a3a14e4fec6f2b353b4f20bb73"}
' =================================================================
' =================================================================
Option Explicit

Function VT_Scan(filepath As String, APIkey As String) As String
Dim boundary As String
Dim Post As String
Dim bytesfinal()  As Byte
Dim bytes() As Byte
Dim Url As String
Dim Http As Object
Dim filedata As String

Url = "https://www.virustotal.com/vtapi/v2/file/scan"
boundary = "--------Boundary"


Open filepath For Binary As #1
ReDim bytes(LOF(1) - 1)
Get #1, , bytes()
Close #1

filedata = StrConv(bytes(), vbUnicode)

Post = "--" & boundary & vbCrLf & _
"Content-Disposition: form-data; name=" & Chr(34) & "apikey" & Chr(34) & vbCrLf & vbCrLf & _
APIkey & vbCrLf & _
"--" & boundary & vbCrLf & _
"Content-Disposition: form-data; name=" & Chr(34) & "file" & Chr(34) & "; filename=" & Chr(34) & filename(filepath) & Chr(34) & vbCrLf & _
"Content-Type: application/octet-stream" & vbCrLf & vbCrLf & _
filedata & vbCrLf & _
"--" & boundary & "--" & vbCrLf

bytesfinal() = StrConv(Post, vbFromUnicode)

Set Http = CreateObject("winhttp.winhttprequest.5.1")
Http.Open "POST", Url, False
Http.SetRequestHeader "Content-Type", "multipart/form-data; " & "boundary=" & boundary
Http.Send (bytesfinal())
VT_Scan = Http.Responsetext
Set Http = Nothing
End Function


Function filename(cadena As String) As String
Dim cadenas() As String
cadenas() = Split(cadena, "\")
filename = cadenas(UBound(cadenas))
End Function


Saludos

Psyke1

Estaría guay que parsearas el JSON y devolvieras un objeto con las propiedades del mismo.

DoEvents! :P

BlackZeroX

Snif Snif Snif

ya no esta mi url en la firma Snif Snif

Dulces Lunas!¡
The Dark Shadow is my passion.