如何从wp-scan解析json?

时间:2016-07-28 06:23:18

标签: python python-2.7

{
"crius":{
"latest_version":null,"last_updated":null,"popular":false,"vulnerabilities":
    [{
    "id":7306,
    "title":"Crius - VideoJS Cross-Site Scripting Vulnerability",
    "created_at":"2014-08-01T10:59:16.000Z",
    "updated_at":"2015-05-15T13:48:44.000Z",
    "published_date":null,
    "references":{"url":["http://seclists.org/fulldisclosure/2013/May/77"],"secunia":["53427"]},"vuln_type":"XSS","fixed_in":null}]}
}

如何用python 2.7解析它们?感谢。

1 个答案:

答案 0 :(得分:0)

使用json.loads()

import json

s = '''{
"crius":{
"latest_version":null,"last_updated":null,"popular":false,"vulnerabilities":
    [{
    "id":7306,
    "title":"Crius - VideoJS Cross-Site Scripting Vulnerability",
    "created_at":"2014-08-01T10:59:16.000Z",
    "updated_at":"2015-05-15T13:48:44.000Z",
    "published_date":null,
    "references":{"url":["http://seclists.org/fulldisclosure/2013/May/77"],"secunia":["53427"]},"vuln_type":"XSS","fixed_in":null}]}
}'''

data = json.loads(s)

>>> data
{u'crius': {u'popular': False, u'vulnerabilities': [{u'title': u'Crius - VideoJS Cross-Site Scripting Vulnerability', u'created_at': u'2014-08-01T10:59:16.000Z', u'updated_at': u'2015-05-15T13:48:44.000Z', u'vuln_type': u'XSS', u'references': {u'url': [u'http://seclists.org/fulldisclosure/2013/May/77'], u'secunia': [u'53427']}, u'published_date': None, u'fixed_in': None, u'id': 7306}], u'last_updated': None, u'latest_version': None}}