简体   繁体   English

我如何在 python 中安装 ipsec package

[英]how can i install ipsec package in python

I also tried vs code, pycharm and spyder but failed to install the ipsec package, how can I do it?我也试过 vs code、pycharm 和 spyder,但未能安装 ipsec package,我该怎么做?

I want to run a code like below我想运行如下代码

import ipsec

# Create a connection object
conn = ipsec.Connection()

# Set the connection properties
conn.remote_host = "192.168.1.100"
conn.remote_port = 500
conn.local_host = "192.168.1.200"
conn.local_port = 500
conn.auth_method = ipsec.AuthMethod.PSK
conn.psk = "secret_pre_shared_key"

# Connect to the remote host
conn.connect()

# Send some data
conn.send("Hello, world!")

# Receive some data
data = conn.recv(1024)

# Disconnect from the remote host
conn.disconnect()

# Print the received data
print(data)

I tried pip installer but got library not found error我尝试了 pip 安装程序,但出现找不到库的错误

It was probably imported as a local python file and you thought it was a package. Wherever you saw it, you should review it again.很可能是作为本地python文件导入的,你以为是package,哪里看到的,应该再复习一遍。 Because there is no such package. Probably this is a class and there are connection functions written using the socket and scapy libraries.因为没有这个package。大概这是一个class,里面有使用socket和scapy库写的连接函数。

You may install like;您可以像这样安装;

pip install sockets
pip install scapy

Under scapy.layers you may find ipsec module.在 scapy.layers 下你可以找到 ipsec 模块。

Official Scapy ipsec documentation Scapy ipsec 官方文档

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

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