54bfdc8ef4b8ad7099e015d3b491062f906590f6,bin/db_mgmt_d2sec.py,,,#,92

Before Change


f = urlopen(d2securl)
i = info.find_one({"db": "d2sec"})
if i is not None:
    if f.headers["last-modified"] == i["last-modified"]:
        sys.exit("Not modified")
// parse xml and store in database
parser.parse(f)
bulk = d2sec.initialize_ordered_bulk_op()
for exploit in progressbar(ch.d2sec):
    print (exploit)
    if args.v:
        print (exploit)
    bulk.find({"id": exploit["id"]}).upsert().update({"$set": {"id": exploit["id"], "url": exploit["url"], "name": exploit["name"]}})
bulk.execute()

//update database info after successful program-run
info.update({"db": "d2sec"}, {"$set": {"last-modified": f.headers["last-modified"]}}, upsert=True)

After Change


// check modification date
f = urlopen(d2securl)
i = info.find_one({"db": "d2sec"})
last_modified = parse_datetime(f.headers["last-modified"])
if i is not None:
    if last_modified == i["last-modified"]:
        sys.exit("Not modified")
// parse xml and store in database
parser.parse(f)
bulk = d2sec.initialize_ordered_bulk_op()
for exploit in progressbar(ch.d2sec):
    print (exploit)
    if args.v:
        print (exploit)
    bulk.find({"id": exploit["id"]}).upsert().update({"$set": {"id": exploit["id"], "url": exploit["url"], "name": exploit["name"]}})
bulk.execute()

//update database info after successful program-run
info.update({"db": "d2sec"}, {"$set": {"last-modified": last_modified}}, upsert=True)
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 6

Non-data size: 10

Instances


Project Name: cve-search/cve-search
Commit Name: 54bfdc8ef4b8ad7099e015d3b491062f906590f6
Time: 2015-06-11
Author: mde@nbs-system.com
File Name: bin/db_mgmt_d2sec.py
Class Name:
Method Name:


Project Name: cve-search/cve-search
Commit Name: 54bfdc8ef4b8ad7099e015d3b491062f906590f6
Time: 2015-06-11
Author: mde@nbs-system.com
File Name: bin/db_mgmt_vendorstatements.py
Class Name:
Method Name:


Project Name: cve-search/cve-search
Commit Name: 54bfdc8ef4b8ad7099e015d3b491062f906590f6
Time: 2015-06-11
Author: mde@nbs-system.com
File Name: bin/db_mgmt_cpe_dictionary.py
Class Name:
Method Name:


Project Name: cve-search/cve-search
Commit Name: df4a4a99dd2a9634621858ed45bb6d4a5110f67c
Time: 2016-02-15
Author: mde@nbs-system.com
File Name: sbin/db_mgmt_d2sec.py
Class Name:
Method Name:


Project Name: cve-search/cve-search
Commit Name: 54bfdc8ef4b8ad7099e015d3b491062f906590f6
Time: 2015-06-11
Author: mde@nbs-system.com
File Name: bin/db_mgmt_capec.py
Class Name:
Method Name:


Project Name: cve-search/cve-search
Commit Name: 54bfdc8ef4b8ad7099e015d3b491062f906590f6
Time: 2015-06-11
Author: mde@nbs-system.com
File Name: bin/db_mgmt.py
Class Name:
Method Name: