'IPsec server in Python using scapy lib

Hello I would like to build a P2P application using IPsec in communication. I wanted to use scapa to generate packets, but have trouble receiving and decoding them. The processor on the 2nd machine shows that ESP packets are arriving but I am not able to process them in the code. I would be grateful for help.

I used this code to try send messenges sa = SecurityAssociation(ESP, spi=0xdeadbeef, crypt_algo='AES-CBC', crypt_key=b'-\xbd\xb6Q\xa6\x7f6c\x08\xb7\x0coU\xcfg\xcd') p = IP(src='192.168.1.1', dst='192.168.1.2')

p /= UDP(sport=81, dport=80) p /= Raw('testdata') p = IP(raw(p))

e = sa.encrypt(p)

send(e)



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source