powershell - 如何使用 powershell 下载接受许可证的文件
问题描述
我正在尝试使用 powershell 从以下链接下载软件包。 https://www.tenable.com/downloads/nessus-agents 我没有这些包的直接链接,当我点击下载时,它要求同意。我能够使用下面显示的命令在 Linux 上做到这一点。请告诉我如何在Windows中做到这一点。
"wget --no-check-certificate --post-data='accept="I accept the terms of this license"&x=""&sid=5mcia8gchg28attkc9oarah153&p=NessusAgent-7.4.2-amzn.x86_64.rpm' 'https://www.tenable.com/downloads/nessus-agents' -O NessusAgent-7.4.2-amzn.x86_64.rpm"
无法使用 invoke-webrequest 找到任何尝试过的选项
调用-RestMethod -Uri ' https://www.tenable.com/downloads/nessus-agents '
解决方案
有一个 GET 查询字符串参数表示接受。
只需添加i_agree_to_tenable_license_agreement=true
到您的查询字符串参数。
Invoke-WebRequest -Uri 'https://www.tenable.com/downloads/api/v1/public/pages/nessus-agents/downloads/9762/download?i_agree_to_tenable_license_agreement=true' -OutFile 'NessusAgent-7.4.2-x64.msi'
您可以轻松地从其 API 端点获取其他文件的 ID,如下所示:
(Invoke-WebRequest -Uri 'https://www.tenable.com/downloads/api/v1/public/pages/nessus-agents' | ConvertFrom-Json).downloads | Format-Table -AutoSize
推荐阅读
- haskell - 在我的关系数据类型中实例化 Eq 时遇到问题
- python - 有没有办法在 Python 中使用循环自动执行用户函数?
- sql-server - 如何编写存储过程来查找和删除 SQL Server 中没有主键的重复项
- python-3.x - BeautifulSoup Access Denied 解析错误
- python - 如何从 RGBA 像素数组构造 PIL 图像?
- c++ - 我的后缀中缀程序给出了运行时错误
- javascript - 生成有效的 json 递归 javascript 函数时出错
- c# - 无法重置持续时间
- python - ImageDataGenerator 没有生成足够的样本
- php - 根据父字段的层次组织数组