gpt4 book ai didi

python - 在 Python 中捕获 Scapy 函数 show_interfaces() 输出

转载 作者:太空宇宙 更新时间:2023-11-03 15:08:32 25 4
gpt4 key购买 nike

我找到了这个链接

Capturing Scapy function output in Python

但这对我没有帮助..

show_interfaces() 在 cmd 中运行良好。

但它在控制台中不起作用..

我想得到输出字符串 show_interfaces():

from scapy.arch.windows import show_interfaces
show_interfaces()

最佳答案

你可以看看Scapy的源码,你会发现 show_interfaces 函数。

def show_interfaces(resolve_mac=True):
"""Print list of available network interfaces"""
return IFACES.show(resolve_mac)

获取包含接口(interface)信息的 python 字典。我用过

IFACES.data

如果需要,您可以从这里将其转换为字符串。

关于python - 在 Python 中捕获 Scapy 函数 show_interfaces() 输出,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29937421/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com