virustotal api 的 Json 解析结果

发布于 2024-11-11 18:47:12 字数 1887 浏览 4 评论 0原文

我今天在玩弄virustotal api,同时以这种形式返回结果

{ "permalink" : "http://www.virustotal.com/file-scan/report.html?id=7b6b268cbca9d421aabba5f08533d3dcaba50e0f7887b07ef2bd66bf218b35ff-1304089592",
  "report" : [ "2011-04-29 15:06:32",
      { "AVG" : "Exploit_c.TVH",
        "AhnLab-V3" : "PDF/Exploit",
        "AntiVir" : "EXP/Pidief.UK",
        "Antiy-AVL" : "Trojan/win32.agent",
        "Avast" : "JS:Pdfka-gen",
        "Avast5" : "JS:Pdfka-gen",
        "BitDefender" : "Exploit.PDF-JS.Gen",
        "CAT-QuickHeal" : "",
        "ClamAV" : "",
        "Comodo" : "Exploit.JS.Pidief.~AWQ",
        "DrWeb" : "",
        "Emsisoft" : "Exploit.JS.Pdfka!IK",
        "F-Prot" : "",
        "F-Secure" : "Exploit:W32/Pidief.DEE",
        "Fortinet" : "",
        "GData" : "",
        "Ikarus" : "Exploit.JS.Pdfka",
        "Jiangmin" : "",
        "K7AntiVirus" : "",
        "Kaspersky" : "Exploit.JS.Pdfka.dnc",
        "McAfee" : "",
        "McAfee-GW-Edition" : "",
        "Microsoft" : "Exploit:Win32/Pdfjsc.NJ",
        "NOD32" : "PDF/Exploit.Pidief.PGD",
        "Norman" : "",
        "PCTools" : "Trojan.Pidief",
        "Panda" : "",
        "Prevx" : "",
        "Rising" : "",
        "SUPERAntiSpyware" : "",
        "Sophos" : "Troj/PDFJs-RD",
        "Symantec" : "Trojan.Pidief",
        "TheHacker" : "",
        "TrendMicro" : "TROJ_PIDIEF.VTG",
        "TrendMicro-HouseCall" : "TROJ_PIDIEF.VTG",
        "VBA32" : "",
        "VIPRE" : "Exploit.PDF-JS.Gen (v)",
        "ViRobot" : "PDF.S.Exploit.74634",
        "VirusBuster" : "",
        "eSafe" : "",
        "eTrust-Vet" : ""
      }
    ],
  "result" : 1
}

我想知道如何解析这个结果来填写备忘录,例如:

Memo1.Lines.Add(Format('Antivirus: %0s Result: %1s', [...]));

,我真的不知道所有可能存在的 JSon 组件,也许有人可以指导我这里正确的方向?

最诚挚的问候,

H.Meiser

I was playing around with the virustotal api today while becoming back the result in this form:

{ "permalink" : "http://www.virustotal.com/file-scan/report.html?id=7b6b268cbca9d421aabba5f08533d3dcaba50e0f7887b07ef2bd66bf218b35ff-1304089592",
  "report" : [ "2011-04-29 15:06:32",
      { "AVG" : "Exploit_c.TVH",
        "AhnLab-V3" : "PDF/Exploit",
        "AntiVir" : "EXP/Pidief.UK",
        "Antiy-AVL" : "Trojan/win32.agent",
        "Avast" : "JS:Pdfka-gen",
        "Avast5" : "JS:Pdfka-gen",
        "BitDefender" : "Exploit.PDF-JS.Gen",
        "CAT-QuickHeal" : "",
        "ClamAV" : "",
        "Comodo" : "Exploit.JS.Pidief.~AWQ",
        "DrWeb" : "",
        "Emsisoft" : "Exploit.JS.Pdfka!IK",
        "F-Prot" : "",
        "F-Secure" : "Exploit:W32/Pidief.DEE",
        "Fortinet" : "",
        "GData" : "",
        "Ikarus" : "Exploit.JS.Pdfka",
        "Jiangmin" : "",
        "K7AntiVirus" : "",
        "Kaspersky" : "Exploit.JS.Pdfka.dnc",
        "McAfee" : "",
        "McAfee-GW-Edition" : "",
        "Microsoft" : "Exploit:Win32/Pdfjsc.NJ",
        "NOD32" : "PDF/Exploit.Pidief.PGD",
        "Norman" : "",
        "PCTools" : "Trojan.Pidief",
        "Panda" : "",
        "Prevx" : "",
        "Rising" : "",
        "SUPERAntiSpyware" : "",
        "Sophos" : "Troj/PDFJs-RD",
        "Symantec" : "Trojan.Pidief",
        "TheHacker" : "",
        "TrendMicro" : "TROJ_PIDIEF.VTG",
        "TrendMicro-HouseCall" : "TROJ_PIDIEF.VTG",
        "VBA32" : "",
        "VIPRE" : "Exploit.PDF-JS.Gen (v)",
        "ViRobot" : "PDF.S.Exploit.74634",
        "VirusBuster" : "",
        "eSafe" : "",
        "eTrust-Vet" : ""
      }
    ],
  "result" : 1
}

I would like to know how one can parse this result to fill a memo like:

Memo1.Lines.Add(Format('Antivirus: %0s Result: %1s', [...]));

Well, I really have no clue about all the JSon components which might be around to maybe someone can direct me to the right direction here?

Kindest regards,

H.Meiser

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

真心难拥有 2024-11-18 18:47:12

解析Json字符串并不难,可以使用DBXJSON自 delphi 2010 起包含单元。

检查此示例代码

Uses
  DBXJSON;

procedure TForm1.ParseString(const AString: string);
var
  json          : TJSONObject;
  jPair         : TJSONPair;
  jValue        : TJSONValue;
  jcValue       : TJSONValue;
  l,i           : Integer;
begin
    json    := TJSONObject.ParseJSONValue(TEncoding.ASCII.GetBytes(AString),0) as TJSONObject;
  try
    //get the pair to evaluate in this case the index is 1
    jPair   := json.Get(1);
    //cast the JsonValue to TJSONArray to access the elements of the array
    jValue := TJSONArray(jPair.JsonValue).Get(1);
    l:=TJSONArray(jValue).Size;
    for i:=0 to l-1 do
    begin
     //get the i element of the array 
     jcValue := TJSONArray(jValue).Get(i);
     //get the pair pointing to the i element 
     jPair   := TJSONPair(jcValue);
     //show the result 
     Memo1.Lines.Add(Format('Antivirus %s Result %s',[jPair.JsonString.Value,jPair.JsonValue.Value]));
    end;
  finally
     json.Free;
  end;
end;

作为附加建议,您必须阅读 Json 教程以了解如何解释 Json 格式,这样您必须准备好使用任何可用的库。

Parsing Json string is not difficult, you can use the DBXJSON unit included since delphi 2010.

check this sample code

Uses
  DBXJSON;

procedure TForm1.ParseString(const AString: string);
var
  json          : TJSONObject;
  jPair         : TJSONPair;
  jValue        : TJSONValue;
  jcValue       : TJSONValue;
  l,i           : Integer;
begin
    json    := TJSONObject.ParseJSONValue(TEncoding.ASCII.GetBytes(AString),0) as TJSONObject;
  try
    //get the pair to evaluate in this case the index is 1
    jPair   := json.Get(1);
    //cast the JsonValue to TJSONArray to access the elements of the array
    jValue := TJSONArray(jPair.JsonValue).Get(1);
    l:=TJSONArray(jValue).Size;
    for i:=0 to l-1 do
    begin
     //get the i element of the array 
     jcValue := TJSONArray(jValue).Get(i);
     //get the pair pointing to the i element 
     jPair   := TJSONPair(jcValue);
     //show the result 
     Memo1.Lines.Add(Format('Antivirus %s Result %s',[jPair.JsonString.Value,jPair.JsonValue.Value]));
    end;
  finally
     json.Free;
  end;
end;

As additional recommendation you must read a Json tutorial to learn how interpret the Json format and in this way you must be preparated to use any library available.

原野 2024-11-18 18:47:12

我推荐开源 JSON 库 SuperObject 和在线 JSON 检查器,例如 http://jsonviewer.stack.hu/http://json.parser.online.fr/(此编辑器有一个非常有用的选项,可以将类型信息添加到视图中)

I recommend the open source JSON library SuperObject and online JSON inspectors like http://jsonviewer.stack.hu/ or http://json.parser.online.fr/ (this editor has a very useful option which adds type information to the view)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文