开始用于docker 在kali里面搭建环境
pwn入门教程——环境配置pwn入门教程——环境配置
以上是搭建环境的教程,教程虽然短,但是我也花了好长时间,因为中间不会那么顺利。
现在把中间遇到的一些问题罗列以下
1.kali安装 docker

https://blog.csdn.net/u010953692/article/details/91855640?utm_medium=distribute.pc_relevant.none-task-blog-BlogCommendFromBaidu-5&depth_1-utm_source=distribute.pc_relevant.none-task-blog-BlogCommendFromBaidu-5

curl -fsSL https://download.docker.com/linux/debian/gpg | sudo apt-key add -
echo ‘deb https://download.docker.com/linux/debian stretch stable’> /etc/apt/sources.list.d/docker.list
apt-get remove docker docker-engine docker.io containerd runc
apt-get install apt-transport-https ca-certificates curl gnupg2 software-properties-common
apt-get update
apt-get install docker-ce

原文链接:https://blog.csdn.net/u010953692/article/details/91855640

2.下载镜像

也可以从操作系统模板文件导入一个镜像,比如使用OpenVZ提供的模板创建,OPENVZ下载模板在:http://openvz.org/Download/template/precreated。

我尝试使用了Ubuntu14.04的模板:

wget http://download.openvz.org/template/precreated/ubuntu-14.04-x86_64-minimal.tar.gz
下载完之后就可以导入了:

sudo cat ubuntu–14.04–x86_64–minimal.tar.gz | docker import – ubuntu:14.04
其实只是两个命令,不过很显而易见,就不加解释了。成功的话,就会返回根据模板建立的镜像的长ID

3.创建容器

运行docker run -it -p 23946:23946 [镜像名称] /bin/bash
就可以以这个镜像创建一个容器,开启一个shell,并且将IDA调试服务器监听的23946端口转发到本地的
23946端口。

在这里会遇到一个端口没有映射成功的问题

安装iptable iptable-service

先检查是否安装了iptables
service iptables status

安装iptables
yum install -y iptables

升级iptables
yum update iptables

安装iptables-services
yum install iptables-services

iptables-services 和 iptables 是不一样的

安装了 services才有/etc/sysconfig/iptables

禁用/停止自带的firewalld服务

https://blog.csdn.net/zhengsaisai/article/details/81063598

4.测试环境是不是搭设成功了

成功搭建了docker环境之后,我们接下来熟悉一下IDA和IDA的远程调试环境搭建。首先我们在IDA所在的文件夹的dbgsrv文件夹下找到需要的调试服务器linux_server(32位)和linux_serverx64(64位)并复制到kali中。
pwn入门教程——环境配置

然后使用命令docker container cp linux_server ubuntu.17.04.i386:/root/linux_server 将linux_server复制到32位容器中的/root目录下。此时我们登录容器可以看到linux_server,运行该server会提示正在监听23946端口。
pwn入门教程——环境配置
接着我们打开32位的ida,载入一个后面会用于演示堆漏洞的程序heapTest_x86,在左侧的Functions
window中找到main函数,随便挑一行代码按F2下一个断点。然后通过Debugger->Process options…打开选项窗口设置远程调试选项。

相关文章: