姊妹篇:[https][tls] 如何使用wireshark查看tls/https加密消息

一,编译,启用strongswan的save-keys plugin

./configure --prefix=/root/OUTPUT --exec-prefix=/root/OUTPUT --enable-save-keys  CFLAGS="-g -O0"

运行之前验证一下,是否加载了这个插件

[root@T9 OUTPUT]# ./sbin/swanctl --stat |grep save
loaded plugins: charon aes save-keys des rc2 sha2 sha1 md5 mgf1 random nonce x509 revocation constraints pubkey
pkcs1 pkcs7 pkcs8 pkcs12 pgp dnskey sshkey pem fips-prf gmp curve25519 xcbc cmac hmac attr kernel-netlink
resolve socket-default stroke vici updown xauth-generic counters

二,增加如下配置

charon {
load_modular = yes
plugins {
include strongswan.d/charon/*.conf
save-keys {
esp = yes
ike = yes
load = yes
wireshark_keys = /root/OUTPUT/etc/keys
}
}

详细的解释,可以查man手册

       charon.plugins.save-keys.esp [no]
Whether to save ESP keys.
charon.plugins.save-keys.ike [no]
Whether to save IKE keys.
charon.plugins.save-keys.load [no]
Whether to load the plugin.
charon.plugins.save-keys.wireshark_keys []
Directory where the keys are stored in the format supported by Wireshark. IKEv1 keys are stored in the ikev1_decryption_table file.
IKEv2 keys are stored in the ikev2_decryption_table file.
Keys for ESP CHILD_SAs are stored in the esp_sa file.

三,正常运行之后,这个目录下,就会存着key了,同时把包抓下来

./sbin/swanctl --load-all
./sbin/ipsec up net-net

查看保存的key

[root@T9 OUTPUT]# ll etc/keys/
total
-rw-r--r-- root root Dec : esp_sa
-rw-r--r-- root root Dec : ikev2_decryption_table

四,配置wireshark

IKE:

edit->preferences->protocols->ISAKMP->IKEv2 Decryption Table->Edit

如图,看见这后边有个蓝色的文件名。

用前边获得的那个文件覆盖它。

cp ikev2_decryption_table /home/tong/.config/wireshark/ikev2_decryption_table

ESP:

edit->preferences->protocols->ESP->Edit

然后点加号,编辑

或者。直接cp进去到配置目录

cp esp_sa /home/tong/.config/wireshark/

五。用wirshark再次打开之前抓到的pcap包。

好了。现在的IKEV2和ESP都是解密过的了。

[ipsec][strongswan] 使用wireshark查看strongswan ipsec esp ikev1 ikev2的加密内容的更多相关文章

  1. [https][tls] 如何使用wireshark查看tls/https加密消息--使用keylog

    姊妹篇: [ipsec][strongswan] 使用wireshark查看strongswan ipsec esp ikev1 ikev2的加密内容 [https][tls] 如何使用wiresha ...

  2. tcpdump抓包和scp导出以及wireshark查看

    [命令和工具] tcpdump scp wireshark  (1)tcpdump sudo tcpdump -i eth0 -w /home/tcpdump/1.pcap host 10.214.1 ...

  3. [https][tls] 如何使用wireshark查看tls/https加密消息--使用私钥

    之前总结了使用keylog进行https流量分析的方法: [https][tls] 如何使用wireshark查看tls/https加密消息--使用keylog 今天总结一下使用服务器端证书私钥进行h ...

  4. Wireshark 查看指定进程的网络包

    Wireshark 查看指定进程的网络包 打开任务管理器,右键筛选列,选中PID(进程标识符): 找到该进程对应的PID,如1200: 在cmd中执行netstat -ano|findstr 1200 ...

  5. SQL点点滴滴_查看所有存储过程或视图的位置及内容

    代码:select a.name,a.[type],b.[definition] from sys.all_objects a,sys.sql_modules b where a.is_ms_ship ...

  6. Visual Studio Code 帮助查看器,指定的用于安装帮助内容的位置无效,或者您无权访问该位置

    今天有个C# 类库文件里面的属性想要了解下,想到了Vs的帮助文档,其实也就是微软的MSDN:提示帮助查看器,指定的用于安装帮助内容的位置无效,或者您无权访问该位置: 最近两天vs也没有更新,并且也没有 ...

  7. 下面哪些命令可以查看file1文件的第300-500行的内容?

    下面哪些命令可以查看file1文件的第300-500行的内容? cat file1 | tail -n +300 | head -n 200 cat file1| head -n 500 | tail ...

  8. [ipsec] 特别硬核的ike/ipsec NAT穿越机制分析

    〇 前言 这怕是最后一篇关于IKE,IPSEC的文字了,因为不能没完没了. 所以,我一直在想这个标题该叫什么.总的来说可以将其概括为:IKE NAT穿越机制的分析. 但是,同时它也回答了以下问题: ( ...

  9. Wireshark查看https的通讯

    如果有服务端的证书,那我们可以分析web下https的通讯情况,在特别的场景下有一定的用处,如外部审计 如下是在wireshark或tshark中配置查看https的设置 wireshark验证 ts ...

随机推荐

  1. maven 分隔环境

    在pom.xml 上 添加 把要分隔的环境 文件 弄成这样 打包 mvn clean package -Dmaven.test.skip=true -P+环境名 例子:mvn clean packag ...

  2. BIO 和 NIO

    一.阻塞(Block)和非阻塞(NonBlock) 阻塞和非阻塞是进程在访问数据的时候,数据是否准备就绪的一种处理方式,当数据没有准备的时候阻塞: 阻塞:往往需要等待缞冲区中的数据准备好过后才处理其他 ...

  3. Django跨域请求

    一.jsonp方式 同源策略会阻止ajaxa请求,但不阻止src. jsonp方式其实是利用了<script>标签可以直接跨域的性质,在body中生成一个<script>标签, ...

  4. linux各文件夹含义和作用

    原文链接:https://blog.csdn.net/okyoung188/article/details/76315774 1.linux下各文件夹的意义:     /bin:是binary的缩写, ...

  5. spring官网上下载历史版本的spring插件,springsource-tool-suite

    spring官网下载地址(https://spring.io/tools/sts/all),历史版本地址(https://spring.io/tools/sts/legacy). 注:历史版本下载的都 ...

  6. Number Sequence(周期是336!!不是48!!)

    1005 Number Sequence 时间限制: 1 Sec  内存限制: 60 MB 题目描述 A number sequence is defined as follows: f(1) = 1 ...

  7. 大一上c语言学习总结

    一: 近期C语言知识点易错点整理(1)main()----在c语言中称之为“主函数”,一个c程序有且仅有一个main函数,任何一个c程序总是从main函数开始执行,main函数后面的一对圆括号不能省略 ...

  8. James Munkres Topology: Theorem 16.3

    Theorem 16.3 If \(A\) is a subspace of \(X\) and \(B\) is a subspace of \(Y\), then the product topo ...

  9. 4.基于梯度的攻击——MIM

    MIM攻击原论文地址——https://arxiv.org/pdf/1710.06081.pdf 1.MIM攻击的原理 MIM攻击全称是 Momentum Iterative Method,其实这也是 ...

  10. newinstance和new的区别

    newinstance将对象创建分为两个步骤,解耦的手段,先调用class.forName加载类,然后再去实例化它 new可以不用加载,不是一定 newinstance作为依赖注入 https://b ...