最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

python環(huán)境功能強大的pip-audit安全漏洞掃描工具

 更新時間:2022年02月19日 09:37:38   作者:kali_Ma  
這篇文章主要為大家介紹了python環(huán)境中功能強大的pip-audit安全漏洞掃描工具的功能介紹及安裝使用說明,有需要的朋友可以借鑒參考下,希望能夠有所幫助

關(guān)于pip-audit

pip-audit是一款功能強大的安全漏洞掃描工具,該工具主要針對Python環(huán)境,可以幫助廣大研究人員掃描和測試Python包中的已知安全漏洞。pip-audit使用了PythonPackagingAdvisory數(shù)據(jù)庫PyPIJSONAPI作為漏洞報告源。

功能介紹

  • 1、支持對本地環(huán)境和依賴組件(requirements風(fēng)格文件)進(jìn)行安全審計;
  • 2、支持多種漏洞服務(wù)(PyPI、OSV);
  • 3、支持以CycloneDX XML或JSON格式發(fā)送SBOM;
  • 4、提供人類和機(jī)器均可讀的輸出格式(columnar、JSON);
  • 5、無縫接入 / 重用本地pip緩存;

工具安裝

pip-audit基于Python開發(fā),且要求本地環(huán)境為Python 3.7或更新版本。安裝并配置好Python環(huán)境之后,就可以使用下列命令并通過pip來安裝pip-audit了:

python -m pip install pip-audit

第三方包

pip-audit的正常運行需要使用到多個第三方包,具體組件包名稱和版本如下圖所示:

在這里插入圖片描述

除此之外,我們還可以通過conda來安裝pip-audit:

conda install -c conda-forge pip-audit
 

工具使用

我們可以直接將pip-audit以獨立程序運行,或通過“python -m”運行:

pip-audit --help

python -m pip_audit --help
usage: pip-audit [-h] [-V] [-l] [-r REQUIREMENTS] [-f FORMAT] [-s SERVICE]
                 [-d] [-S] [--desc [{on,off,auto}]] [--cache-dir CACHE_DIR]
                 [--progress-spinner {on,off}] [--timeout TIMEOUT]
                 [--path PATHS] [-v] [--fix] [--require-hashes]
audit the Python environment for dependencies with known vulnerabilities

optional arguments:
  -h, --help            show this help message and exit
  -V, --version         show program's version number and exit
  -l, --local           show only results for dependencies in the local
                        environment (default: False)
  -r REQUIREMENTS, --requirement REQUIREMENTS
                        audit the given requirements file; this option can be
                        used multiple times (default: None)
  -f FORMAT, --format FORMAT
                        the format to emit audit results in (choices: columns,
                        json, cyclonedx-json, cyclonedx-xml) (default:
                        columns)
  -s SERVICE, --vulnerability-service SERVICE
                        the vulnerability service to audit dependencies
                        against (choices: osv, pypi) (default: pypi)
  -d, --dry-run         without `--fix`: collect all dependencies but do not
                        perform the auditing step; with `--fix`: perform the
                        auditing step but do not perform any fixes (default:
                        False)
  -S, --strict          fail the entire audit if dependency collection fails
                        on any dependency (default: False)
  --desc [{on,off,auto}]
                        include a description for each vulnerability; `auto`
                        defaults to `on` for the `json` format. This flag has
                        no effect on the `cyclonedx-json` or `cyclonedx-xml`
                        formats. (default: auto)
  --cache-dir CACHE_DIR
                        the directory to use as an HTTP cache for PyPI; uses
                        the `pip` HTTP cache by default (default: None)
  --progress-spinner {on,off}
                        display a progress spinner (default: on)
  --timeout TIMEOUT     set the socket timeout (default: 15)
  --path PATHS          restrict to the specified installation path for
                        auditing packages; this option can be used multiple
                        times (default: [])
  -v, --verbose         give more output; this setting overrides the
                        `PIP_AUDIT_LOGLEVEL` variable and is equivalent to
                        setting it to `debug` (default: False)
  --fix                 automatically upgrade dependencies with known
                        vulnerabilities (default: False)
  --require-hashes      require a hash to check each requirement against, for
                        repeatable audits; this option is implied when any
                        package in a requirements file has a `--hash` option.
                        (default: False)

退出代碼

任務(wù)完成后, pip-audit將會退出運行,并返回一個代碼以顯示其狀態(tài),其中:

0:未檢測到已知漏洞;

1:檢測到了一個或多個已知漏洞;

工具使用樣例

審計當(dāng)前Python環(huán)境中的依賴:

$ pip-audit
No known vulnerabilities found

審計給定requirements文件的依賴:

$ pip-audit -r ./requirements.txt
No known vulnerabilities found

審計一個requirements文件,并排除系統(tǒng)包:

$ pip-audit -r ./requirements.txt -l
No known vulnerabilities found

審計依賴中發(fā)現(xiàn)的安全漏洞:

$ pip-audit
Found 2 known vulnerabilities in 1 package
Name  Version ID             Fix Versions
----  ------- -------------- ------------
Flask 0.5     PYSEC-2019-179 1.0
Flask 0.5     PYSEC-2018-66  0.12.3

審計依賴(包含描述):

$ pip-audit --desc

Found 2 known vulnerabilities in 1 package

Name  Version ID             Fix Versions Description

----  ------- -------------- ------------ --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Flask 0.5     PYSEC-2019-179 1.0          The Pallets Project Flask before 1.0 is affected by: unexpected memory usage. The impact is: denial of service. The attack vector is: crafted encoded JSON data. The fixed version is: 1\. NOTE: this may overlap CVE-2018-1000656.

Flask 0.5     PYSEC-2018-66  0.12.3       The Pallets Project flask version Before 0.12.3 contains a CWE-20: Improper Input Validation vulnerability in flask that can result in Large amount of memory usage possibly leading to denial of service. This attack appear to be exploitable via Attacker provides JSON data in incorrect encoding. This vulnerability appears to have been fixed in 0.12.3\. NOTE: this may overlap CVE-2019-1010083.

審計JSON格式依賴:

$ pip-audit -f json | jq
Found 2 known vulnerabilities in 1 package
[
{
"name": "flask",
"version": "0.5",
"vulns": [
{
"id": "PYSEC-2019-179",
"fix_versions": [
"1.0"
],
"description": "The Pallets Project Flask before 1.0 is affected by: unexpected memory usage. The impact is: denial of service. The attack vector is: crafted encoded JSON data. The fixed version is: 1\. NOTE: this may overlap CVE-2018-1000656."
},
{
"id": "PYSEC-2018-66",
"fix_versions": [
"0.12.3"
],
"description": "The Pallets Project flask version Before 0.12.3 contains a CWE-20: Improper Input Validation vulnerability in flask that can result in Large amount of memory usage possibly leading to denial of service. This attack appear to be exploitable via Attacker provides JSON data in incorrect encoding. This vulnerability appears to have been fixed in 0.12.3\. NOTE: this may overlap CVE-2019-1010083."
}
]
},
{
"name": "jinja2",
"version": "3.0.2",
"vulns": []
},
{
"name": "pip",
"version": "21.3.1",
"vulns": []
},
{
"name": "setuptools",
"version": "57.4.0",
"vulns": []
},
{
"name": "werkzeug",
"version": "2.0.2",
"vulns": []
},
{
"name": "markupsafe",
"version": "2.0.1",
"vulns": []
}
]

審計并嘗試自動審計存在漏洞的依賴:

$ pip-audit --fix

Found 2 known vulnerabilities in 1 package and fixed 2 vulnerabilities in 1 package

Name  Version ID             Fix Versions Applied Fix

----- ------- -------------- ------------ ----------------------------------------

flask 0.5     PYSEC-2019-179 1.0          Successfully upgraded flask (0.5 => 1.0)

flask 0.5     PYSEC-2018-66  0.12.3       Successfully upgraded flask (0.5 => 1.0)

許可證協(xié)議

本項目的開發(fā)與發(fā)布遵循 Apache 2.0開源許可證協(xié)議。

以上就是python環(huán)境功能強大的pip-audit安全漏洞掃描工具的詳細(xì)內(nèi)容,更多關(guān)于pip-audit安全漏洞掃描工具的資料請關(guān)注腳本之家其它相關(guān)文章!

相關(guān)文章

  • Python+OpenCV六種實時圖像處理詳細(xì)講解

    Python+OpenCV六種實時圖像處理詳細(xì)講解

    OpenCV常用的圖像處理為閾值二值化、邊緣檢測、輪廓檢測、高斯濾波、色彩轉(zhuǎn)換、調(diào)節(jié)對比度。本文主要介紹了利用Python和OpenCV對實時圖像進(jìn)行上述六種操作的詳細(xì)講解,感興趣的可以了解一下。
    2021-11-11
  • python獲取域名ssl證書信息和到期時間

    python獲取域名ssl證書信息和到期時間

    這篇文章主要為大家詳細(xì)介紹了如何利用python實現(xiàn)獲取域名ssl證書信息和到期時間,文中的示例代碼講解詳細(xì),感興趣的小伙伴可以跟隨小編一起了解一下
    2023-09-09
  • 使用LibTorch進(jìn)行C++調(diào)用pytorch模型方式

    使用LibTorch進(jìn)行C++調(diào)用pytorch模型方式

    這篇文章主要介紹了使用LibTorch進(jìn)行C++調(diào)用pytorch模型方式,具有很好的參考價值,希望對大家有所幫助。如有錯誤或未考慮完全的地方,望不吝賜教
    2022-12-12
  • OpenCV-Python給圖像去除水印多種方法

    OpenCV-Python給圖像去除水印多種方法

    這篇文章主要給大家介紹了關(guān)于OpenCV-Python給圖像去除水印的多種方法,文中介紹的每種方法都有其適用場景和實現(xiàn)步驟,具體實現(xiàn)需要根據(jù)實際情況選擇和調(diào)整,需要的朋友可以參考下
    2024-12-12
  • python中int與str互轉(zhuǎn)方法

    python中int與str互轉(zhuǎn)方法

    最近學(xué)習(xí)python中的數(shù)據(jù)類型時,難免聯(lián)想到j(luò)ava中的基本型數(shù)據(jù)類型與引用型數(shù)據(jù)類型。接下來通過本文給大家介紹python中int與str互轉(zhuǎn),需要的朋友可以參考下
    2018-07-07
  • 詳解如何在ChatGPT內(nèi)構(gòu)建一個Python解釋器

    詳解如何在ChatGPT內(nèi)構(gòu)建一個Python解釋器

    這篇文章主要為大家詳細(xì)介紹了如何在ChatGPT內(nèi)構(gòu)建一個Python解釋器,文中的示例代碼講解詳細(xì),具有一定的學(xué)習(xí)價值,需要的可以參考一下
    2023-02-02
  • Playwright設(shè)置base_url的三種方式

    Playwright設(shè)置base_url的三種方式

    本文主要介紹了三種在使用Playwright或pytest-playwright進(jìn)行Web自動化測試時設(shè)置base_url的方法,文中通過示例代碼介紹的非常詳細(xì),對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧
    2026-01-01
  • python如何將文件a.txt的內(nèi)容復(fù)制到b.txt中

    python如何將文件a.txt的內(nèi)容復(fù)制到b.txt中

    這篇文章主要介紹了python如何將文件a.txt的內(nèi)容復(fù)制到b.txt中,具有很好的參考價值,希望對大家有所幫助。如有錯誤或未考慮完全的地方,望不吝賜教
    2022-12-12
  • pandas使用函數(shù)批量處理數(shù)據(jù)(map、apply、applymap)

    pandas使用函數(shù)批量處理數(shù)據(jù)(map、apply、applymap)

    這篇文章主要介紹了pandas使用函數(shù)批量處理數(shù)據(jù)(map、apply、applymap),文中通過示例代碼介紹的非常詳細(xì),對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧
    2020-11-11
  • 一文全面詳解Python變量作用域

    一文全面詳解Python變量作用域

    變量作用域是Python中非常重要的概念,它決定了在哪里可以訪問變量,下面我將用通俗易懂的方式,結(jié)合代碼示例和圖表,帶你全面了解Python變量作用域,需要的朋友可以參考下
    2025-06-06

最新評論

来宾市| 陆河县| 岳普湖县| 连州市| 镇康县| 平凉市| 额敏县| 怀化市| 逊克县| 三原县| 宁乡县| 平阳县| 中江县| 长白| 兴义市| 台安县| 师宗县| 秦皇岛市| 清涧县| 中阳县| 陕西省| 哈尔滨市| 营山县| 科技| 通城县| 南郑县| 无锡市| 辉县市| 武定县| 保德县| 阜平县| 汾西县| 肇州县| 云和县| 湖北省| 理塘县| 湄潭县| 井研县| 怀化市| 寻乌县| 阳朔县|