-
-
Notifications
You must be signed in to change notification settings - Fork 311
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #207 from LoRexxar/develop
KunLun-M 2.6.4
- Loading branch information
Showing
6 changed files
with
80 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,7 +7,7 @@ | |
__issue_page__ = 'https://github.com/LoRexxar/Kunlun-M/issues/new' | ||
__python_version__ = sys.version.split()[0] | ||
__platform__ = platform.platform() | ||
__version__ = '2.6.3' | ||
__version__ = '2.6.4' | ||
__author__ = 'LoRexxar' | ||
__author_email__ = '[email protected]' | ||
__license__ = 'MIT License' | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,13 @@ | ||
#!/usr/bin/env python | ||
# encoding: utf-8 | ||
''' | ||
""" | ||
@author: LoRexxar | ||
@contact: [email protected] | ||
@file: mofei.py | ||
@time: 2021/9/27 11:47 | ||
@desc: | ||
''' | ||
""" | ||
|
||
import json | ||
import requests | ||
|
@@ -25,7 +25,7 @@ def get_vulns_from_murphysec(language, package_name, version): | |
"version": version, | ||
"language": language, | ||
"filter":{ | ||
"level": "严重|高危|中危" | ||
"level": "严重|高危" | ||
} | ||
} | ||
|
||
|
@@ -40,37 +40,48 @@ def get_vulns_from_murphysec(language, package_name, version): | |
if r.status_code == 200: | ||
data = json.loads(r.content) | ||
|
||
if data['code'] == 400: | ||
if data["code"] == 400: | ||
logger.warning("[Vendor][Murphysec Scan] QPS limit.") | ||
return result | ||
|
||
elif data['code'] == 401: | ||
elif data["code"] == 401: | ||
logger.error("[Vendor][Murphysec Scan] Api Token error.") | ||
|
||
else: | ||
vuls = data['data']['vuln_info'] | ||
vuls = data["data"]["vuln_info"] | ||
|
||
for vul in vuls: | ||
vuln = {} | ||
vuln["vuln_id"] = vul['no'] | ||
vuln["title"] = vul['title'] | ||
vuln["vuln_id"] = vul["no"] | ||
vuln["title"] = vul["title"] | ||
# reference | ||
urls = [] | ||
for u in vul['references']: | ||
for u in vul["references"]: | ||
urls.append(u["url"]) | ||
|
||
vuln["reference"] = json.dumps(urls) | ||
vuln["description"] = vul['description'] | ||
vuln["description"] = """{} | ||
受影响的版本范围: {} | ||
存在危害的相关代码片段:\n {} | ||
""".format(vul["description"], vul["effect"][0]["affected_version"], vul["vuln_code_usage"]) | ||
|
||
# get cve | ||
cves = [vul['cve_id'], vul['cnvd_id']] | ||
cves = [vul["cve_id"], vul["cnvd_id"]] | ||
vuln["cves"] = json.dumps(cves) | ||
# get severity | ||
vuln["severity"] = int(vul['cvss']) | ||
|
||
# 如果非强烈建议修复,则减3分 | ||
severity = int(vul["cvss"]) | ||
if vul["suggest"] != "强烈建议修复": | ||
severity -= 3 | ||
|
||
vuln["severity"] = severity | ||
|
||
# affected_versions | ||
# affected_versions = [] | ||
# for av in vul['effect']: | ||
# affected_versions.append(av['version_end_excluding']) | ||
# for av in vul["effect"]: | ||
# affected_versions.append(av["version_end_excluding"]) | ||
|
||
vuln["affected_versions"] = [version] | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters