forked from aboutcode-org/vulnerablecode
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Collect vulnerabilities from arch linux aboutcode-org#20
Signed-off-by: Ayush Lohani <lohani.ayush01@gmail.com>
- Loading branch information
1 parent
55a633d
commit 6b4ddf1
Showing
5 changed files
with
350 additions
and
0 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
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 |
---|---|---|
@@ -0,0 +1,77 @@ | ||
# | ||
# Copyright (c) 2017 nexB Inc. and others. All rights reserved. | ||
# http://nexb.com and https://github.com/nexB/vulnerablecode/ | ||
# The VulnerableCode software is licensed under the Apache License version 2.0. | ||
# Data generated with VulnerableCode require an acknowledgment. | ||
# | ||
# You may not use this software except in compliance with the License. | ||
# You may obtain a copy of the License at: http://apache.org/licenses/LICENSE-2.0 | ||
# Unless required by applicable law or agreed to in writing, software distributed | ||
# under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR | ||
# CONDITIONS OF ANY KIND, either express or implied. See the License for the | ||
# specific language governing permissions and limitations under the License. | ||
# | ||
# When you publish or redistribute any data created with VulnerableCode or any VulnerableCode | ||
# derivative work, you must accompany this data with the following acknowledgment: | ||
# | ||
# Generated with VulnerableCode and provided on an "AS IS" BASIS, WITHOUT WARRANTIES | ||
# OR CONDITIONS OF ANY KIND, either express or implied. No content created from | ||
# VulnerableCode should be considered or used as legal advice. Consult an Attorney | ||
# for any legal advice. | ||
# VulnerableCode is a free software code scanning tool from nexB Inc. and others. | ||
# Visit https://github.com/nexB/vulnerablecode/ for support and download. | ||
|
||
import json | ||
from urllib.request import urlopen | ||
|
||
|
||
ARCHLINUX_TRACKER_URL = 'https://security.archlinux.org/json' | ||
|
||
|
||
def extract_vulnerabilities(arch_data): | ||
""" | ||
Return a sequence of mappings for each existing combination of | ||
package and vulnerability from a mapping of arch linux vulnerabilities | ||
data. | ||
""" | ||
for item in arch_data: | ||
package_vulnerabilities = [] | ||
vulnerabilities = item['issues'] | ||
packages_name = item['packages'] | ||
|
||
if not vulnerabilities or not packages_name: | ||
continue | ||
|
||
for package in packages_name: | ||
affected_version = item['affected'] | ||
fixed_version = item['fixed'] | ||
for vulnerability in vulnerabilities: | ||
package_vulnerabilities.append({ | ||
'package_name': package, | ||
'vulnerability_id': vulnerability, | ||
'description': item['type'], | ||
'status': item['status'], | ||
'severity': item['severity'], | ||
'version': affected_version | ||
}) | ||
|
||
for vulnerability in vulnerabilities: | ||
if not fixed_version: | ||
fixed_version = '' | ||
package_vulnerabilities.append({ | ||
'package_name': package, | ||
'vulnerability_id': vulnerability, | ||
'description': item['type'], | ||
'status': item['status'], | ||
'severity': item['severity'], | ||
'version': fixed_version | ||
}) | ||
yield package_vulnerabilities | ||
|
||
|
||
def scrape_vulnerabilities(): | ||
""" | ||
Scrape arch linux' security tracker. | ||
""" | ||
json_content = urlopen(ARCHLINUX_TRACKER_URL).read() | ||
return extract_vulnerabilities(json.loads(json_content)) |
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 |
---|---|---|
@@ -0,0 +1,44 @@ | ||
[ | ||
{ | ||
"name": "AVG-837", | ||
"packages": [ | ||
"libarchive" | ||
], | ||
"status": "Vulnerable", | ||
"severity": "High", | ||
"type": "multiple issues", | ||
"affected": "3.3.3-1", | ||
"fixed": "3.3.3-2", | ||
"ticket": null, | ||
"issues": [ | ||
"CVE-2019-1000020", | ||
"CVE-2019-1000019", | ||
"CVE-2018-1000880", | ||
"CVE-2018-1000879", | ||
"CVE-2018-1000878", | ||
"CVE-2018-1000877" | ||
], | ||
"advisories": [] | ||
}, | ||
{ | ||
"name": "AVG-57", | ||
"packages": [ | ||
"python2-django", | ||
"python-django" | ||
], | ||
"status": "Fixed", | ||
"severity": "High", | ||
"type": "multiple issues", | ||
"affected": "1.10.2-1", | ||
"fixed": "1.10.3-1", | ||
"ticket": null, | ||
"issues": [ | ||
"CVE-2016-9014", | ||
"CVE-2016-9013" | ||
], | ||
"advisories": [ | ||
"ASA-201611-15", | ||
"ASA-201611-14" | ||
] | ||
} | ||
] |
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