我正在使用Azure哨兵笔记本作为威胁情报。当试图配置msticpy使其连接到Azure哨兵时,却得到了“值错误”。下面是我使用的代码:
from msticpy.config import MpConfigEdit
import os
mp_conf = "msticpyconfig.yaml"
# check if MSTICPYCONFIG is already an env variable
mp_env = os.environ.get("MSTICPYCONFIG")
mp_conf = mp_env if mp_env and Path (mp_env).is_file() else mp_conf
if not Path(mp_conf).is_file():
print(
"No msticpyconfig.yaml was found!",
"Please check that there is a config.json file in your workspace folder.",
"If this is not there, go back to the Microsoft Sentinel portal and launch",
"this notebook from there.",
sep="\n"
)
else:
mpedit = MpConfigEdit(mp_conf)
mpedit.set_tab("AzureSentinel")
display(mpedit)
ValueError: File not found: 'None'.发布于 2022-05-10 10:41:59
在Azure终端中,在用户文件夹的根目录中创建nbuser_settings.py文件,这是带有用户名的文件夹。
在nbuser_settings.py文件中,添加以下行:
import os
os.environ["MSTICPYCONFIG"] = "~/msticpyconfig.yaml"参考文献
MSTICPy的某些元素需要配置参数。威胁情报提供者就是一个例子。这些参数和其他参数的值可以在msticpyconfig.yaml文件中设置。
包有一个默认配置文件,该文件存储在包目录中。您不需要直接编辑这个文件。相反,您可以使用自己的参数创建一个自定义文件--这些设置将与默认文件中的设置结合或覆盖。
默认情况下,自定义msticpyconfig.yaml是从当前目录读取的。可以使用环境变量MSTICPYCONFIG指定显式位置。
您还应该阅读MSTICPy设置编辑器文档,以了解如何使用朱庇特笔记本配置设置和交互用户界面。
!!!注意!对于Linux和Windows选项,您需要重新启动木星服务器,以获取您定义的环境变量。
发布于 2022-05-10 14:47:03
msticpy的作者已经在github上发布了这个问题&我们必须等待最新的发布。如欲了解更多详细信息,请按照该帖子:
https://stackoverflow.com/questions/72184418
复制相似问题