sudo tar -zxvf arpd-0.2.tar.gz cd arpd-0.2 sudo ./configure #报错:error:expected’)’ before string constant #解决:在arpd.c文件中添加#define __FUNCTION__ "" #vim arpd.c添加定义 sudo make sudo make install
4.安装蜜罐工具Honeyd:
1 2 3 4 5 6 7 8 9
#注释头
sudo tar -zxvf honeyd-1.5c.tar.gz cd honeyd-1.5c sudo ./configure #报错:configure: error: Couldn't figure out how to access libc #解决:sudo ln -s /lib/x86_64-linux-gnu/libc.so.6 /usr/lib/libc.so sudo make sudo make install
5.先将arpd运行起来:
(1)运行后显示链接不存在:
(2)解决办法:找到libevent-1.4.so.2的位置,然后将位置加到定位的文件中
whereis libevent-1.4.so.2
sudo vim /etc/ld.so.conf
sudo ldconfig #重新加载链接
(3)之后选定网卡,即可模拟IP,伪装IP的MAC地址
sudo arpd -i ens33 192.168.1.71
▲这里的ens33是ubuntu下用ip addr查到的,不同系统可能不同。
6.检测Honeyd是否可以运行:
(1)设置启动参数vim honeyd.conf:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
#注释头
# Example of a simple host template and its binding create windows
#创建一个windows xp系统的蜜罐 set windows personality "Microsoft Windows XP Professional SP1"
#开启80端口web服务且侦听脚本为honeyd-1.5c/scripts/web.sh add windows tcp port 80 "sh /home/hacker/Desktop/Web/Honey/honeyd- 1.5c/scripts/web.sh"
#关闭默认的tcp,udp连接 set windows default tcp action reset set windows default udp action reset
#将windows这个蜜罐的ip绑定为192.168.40.150 bind 192.168.40.150 windows
def leak(address): count = 0 data = '' payload = xxx p.send(payload) print p.recvuntil('xxxn') #一定要在puts前释放完输出 up = "" while True: #由于接收完标志字符串结束的回车符后,就没有其他输出了,故先等待0.1秒钟,如果确实接收不到 了,就说明输出结束了 #这里为了不与标志字符串结束的回车符(0x0A)混淆,所以有两个判断条件。这也利用了recv函数的timeout参数,即当timeout结束后仍得不到输出,则直接返回空字符串”” c = p.recv(numb=1, timeout=0.1) count += 1 if up == '\n' and c == "": #接收到的上一个字符为回车符,而当前接收不到新字符,则 buf = buf[:-1] #删除puts函数输出的末尾回车符 buf += "x00" break else: buf += c up = c data = buf[:4] #取指定字节数 log.info("%#x => %s" % (address, (data or '').encode('hex'))) return data
def leak(address): count = 0 data = '' payload = xxx p.send(payload) print p.recvuntil('xxxn') #一定要在puts前释放完输出 up = "" while True: #由于接收完标志字符串结束的回车符后,就没有其他输出了,故先等待1秒钟,如果确实接收不到了,就说明输出结束了 #不与标志字符串结束的回车符(0x0A)混淆,这也利用了recv函数的timeout参数,即当timeout结束后仍得不到输出,则直接返回空字符串”” c = p.recv(numb=1, timeout=1) count += 1 if up == 'n' and c == "X": #接收到的上一个字符为回车符,下一个字符开头是X,那就结束输出。 buf = buf[:-1] #删除puts函数输出的末尾回车符 buf += "x00" break else: buf += c up = c data = buf[:4] #从put输出开头取指定字节数 log.info("%#x => %s" % (address, (data or '').encode('hex'))) return data
defadd(idx, size, context): sla(menu, "1") sla("input the index\n", str(idx)) sla("input the size\n", str(size)) sa("now you can write something\n", context)
defdelete(idx): sla(menu, "2") sla("input the index\n", str(idx))
#Elf32_Sym结构体:大小为0x10 typedef struct { Elf32_Word st_name; // Symbol name(string tbl index) Elf32_Addr st_value; // Symbol value Elf32_Word st_size; // Symbol size unsigned char st_info; // Symbol type and binding unsigned char st_other; // Symbol visibility under glibc>=2.2 Elf32_Section st_shndx; // Section index } Elf32_Sym;
#Elf64_Rela结构体:大小为0x18 typedef struct { Elf64_Addr r_offset; /(0x08)* Address */ Elf64_Xword r_info; /(0x08)* Relocation type and symbol index */ Elf64_Sxword r_addend; /(0x08)* Addend */ } Elf64_Rela;
#Elf64_Sym结构体:大小为0x18 typedef struct { Elf64_Word st_name; /(0x04)* Symbol name (string tbl index) */ unsigned char st_info; /(0x01)* Symbol type and binding */ unsigned char st_other; /(0x01)* Symbol visibility */ Elf64_Section st_shndx; /(0x02)* Section index */ Elf64_Addr st_value; /(0x08)* Symbol value */ Elf64_Xword st_size; /(0x08)* Symbol size */ } Elf64_Sym;