简体   繁体   English

我在GitHub中看到了scapy ipsec.py python代码:如何安装和使用它?

[英]I see scapy ipsec.py python code in GitHub: how do I install and use it?

There is a python module to generate IPSec packets using scapy in GitHub, but that file is not in its own .git extension to download. GitHub中有一个python模块使用scapy生成IPSec数据包,但是该文件不在其自己的.git扩展名中进行下载。

Please find the link for the code: https://github.com/secdev/scapy/blob/master/scapy/layers/ipsec.py 请找到代码的链接: https : //github.com/secdev/scapy/blob/master/scapy/layers/ipsec.py

How can I use that script? 如何使用该脚本?

I suppose you would need to clone the full repo: 我想您需要克隆完整的仓库:

git clone https://github.com/secdev/scapy
cd scapy

From there, you can have access to the interactive shell : 从那里,您可以访问交互式shell

sudo ./run_scapy 
Welcome to Scapy
>>> p = IP(dst="github.com")/ICMP()
>>> r = sr1(p)
Begin emission:
.Finished to send 1 packets.

That would include all scapy features, including ipsec: 这将包括所有易受攻击的功能,包括ipsec:

>>> sa = SecurityAssociation(ESP, spi=0xdeadbeef, crypt_algo='AES-CBC',
...                          crypt_key='sixteenbytes key')
>>> p = IP(src='1.1.1.1', dst='2.2.2.2')
>>> p /= TCP(sport=45012, dport=80)
>>> p /= Raw('testdata')
>>> p = IP(raw(p))
>>> p

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM