博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
限定user_agent -apache
阅读量:6913 次
发布时间:2019-06-27

本文共 1245 字,大约阅读时间需要 4 分钟。

限定user_agent

当服务器被***,并且查看到***的user_agent有规律,这时就需要限制user_agent

user_agent配置如下

[root@chy 111.com]# vim /usr/local/apache2.4/conf/extra/httpd-vhosts.conf  
RewriteEngine on RewriteCond %{HTTP_USER_AGENT} .*curl.* [NC,OR] RewriteCond %{HTTP_USER_AGENT} .*baidu.com.* [NC] RewriteRule .* - [F]
(增加如上配置,配置详解如下:
(这里需要用到rewrite模块) RewriteEngine on RewriteCond %{HTTP_USER_AGENT} .*curl.* [NC,OR] (OR是或者的意思,或者匹配curl,或者匹配baidu.com)(NC忽略大小写) RewriteCond %{HTTP_USER_AGENT} .*baidu.com.* [NC] RewriteRule .* - [F](F的含义‘forbidden F’ (force URL to be forbidden)重写为禁止访问

测试user_agent

[root@chy 111.com]# curl -A "chylinux chylinux" -x192.168.212.10:80 'http://www.111.com/123.php' -IHTTP/1.1 200 OKDate: Thu, 03 Aug 2017 22:43:50 GMTServer: Apache/2.4.27 (Unix) PHP/5.6.30X-Powered-By: PHP/5.6.30Content-Type: text/html; charset=UTF-8(curl -A 指定user_agent)[root@chy 111.com]# curl  -x192.168.212.10:80 'http://www.111.com/123.php' -IHTTP/1.1 403 ForbiddenDate: Thu, 03 Aug 2017 22:53:09 GMTServer: Apache/2.4.27 (Unix) PHP/5.6.30Content-Type: text/html; charset=iso-8859-1(这个如果不指定user_agent的结果)curl -e "http//" (指定)

转载于:https://blog.51cto.com/chy940405/2047960

你可能感兴趣的文章
XPath的使用[爬取知乎发现]文件存储[txt,json,csv,mongodb]
查看>>
Ubuntu init启动流程分析
查看>>
分润使用操作说明
查看>>
复利单利计算的代码
查看>>
批处理(bat)命令获得并格式化日期和时间
查看>>
golang垃圾回收
查看>>
sqlalchemy 无法显示中文的问题
查看>>
(原)Android到IOS开发的转换(一)
查看>>
JavaWeb项目如何实现热编译
查看>>
Cent6 安装 NTFS
查看>>
mysql数据库之表查询
查看>>
Django 中间件
查看>>
基于JDK动态代理和CGLIB动态代理的实现Spring注解管理事务(@Trasactional)到底有什么区别。...
查看>>
EL表达式里如何从list中取出list.size()?
查看>>
VS2013 MFC opencv 播放视频
查看>>
Oracle 和pl/sql以及pl/sql developer
查看>>
hibernate中复合主键的使用
查看>>
一级缓存和二级缓存的理解
查看>>
学以致用十六-----Centos7.2编译安装mysql5.6.22
查看>>
【python3的进阶之路二】因特网客户端编程 实战
查看>>