常用的shell脚本(安全方向)
更多shell脚本参考:https://blog.51cto.com/zero01/2046242
1、拒绝密码撞库攻击的ip
shell脚本:实现对登录主机失败10次以上的ip进行拒绝登录
#! /bin/bash
cat /var/log/secure|awk '/Failed/{print $(NF-3)}'|sort|uniq -c|awk '{print $2"="$1;}' > /usr/local/bin/black.txt
for i in `cat /usr/local/bin/black.txt`
do
IP=`echo $i |awk -F= '{print $1}'`
NUM=`echo $i|awk -F= '{print $2}'`
if [ $NUM -gt 10 ];then
grep $IP /etc/hosts.deny > /dev/null
if [ $? -gt 0 ];then
echo "sshd:$IP:deny" >> /etc/hosts.deny
fi
fi
done
常用的shell脚本(安全方向)的更多相关文章
- 【转】常用的shell脚本
from:http://blog.sina.com.cn/s/blog_4152a9f501013r6c.html 常用的shell脚本 (2012-10-10 22:09:07) 转载▼ 标签: 杂 ...
- Linux Shell 高级编程技巧4----几个常用的shell脚本例子
4.几个常用的shell脚本例子 4.0.在写脚本(同样适用在编程的时候),最好写好完善的注释 4.1.kill_processes.sh(一个杀死进程的脚本) #!/bin/bash c ...
- 常用linux shell脚本记录
遍历目录下所有的文件是目录还是文件 for file in ./* do if test -f $file then echo $file 是文件 fi if test -d $file then e ...
- 程序猿的日常——工作中常用的Shell脚本
工作当中总是会有很多常用的linux或者命令,这里就做一个总结 文件远程拷贝 如果想把文件从本机拷贝到远程,或者从远程下载文件到本地. # 把本地的jar拷贝到远程机器xxxip的/home/sour ...
- 18个一线工作中常用的Shell脚本
1.检测两台服务器指定目录下的文件一致性 #!/bin/bash ###################################### 检测两台服务器指定目录下的文件一致性 ######### ...
- 常用的shell脚本
[root@WEB1-live sh]# cat licai_fabu.sh #!/bin/bash pid=` ps -ef | grep java | grep '8011' | awk '{pr ...
- 10个实战及面试常用Linux Shell脚本编写
来自:http://blog.51cto.com/lizhenliang/1929044 注意事项 1)开头加解释器:#!/bin/bash 2)语法缩进,使用四个空格:多加注释说明. 3)命名建议规 ...
- 9个常用的Shell脚本
1.Dos 攻击防范(自动屏蔽攻击 IP) #!/bin/bash DATE=$(date +%d/%b/%Y:%H:%M) LOG_FILE=/usr/local/nginx/logs/demo2. ...
- spring boot 以jar的方式启动常用shell脚本
用spring boot框架做的项目,将第三方包全部打在jar里面,通过shell脚本启动和停止服务,常用的shell脚本模板如下: #!/bin/bashJAVA_OPTIONS_INITIAL=- ...
随机推荐
- net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting head
使用docker 拉镜像的时候,出现下面的错误: net/http: request canceled while waiting for connection (Client.Timeout exc ...
- Mac和Windows中常见中文字体的英文名称
我们在给HTML元素设置字体的时候经常会有类似 “ font-family:"微软雅黑", "黑体" ” 这样的写法,尤其是在使用Dreamweaver.Apt ...
- android rom开发
How to Build Android ROMs on Ubuntu 16.04https://www.digitalocean.com/community/tutorials/how-to-bui ...
- Unity 给Mono脚本添加Try Catch工具
using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Run ...
- IOS Https适配摸索
转:http://www.jianshu.com/p/f312a84a944c https封面 在WWDC 2016开发者大会上,苹果宣布了一个最后期限:到2017年1月1日 App Store中的所 ...
- react-snippets
rcjc class componentName extends Component { render() { return ( <div> </div> ); } } con ...
- Redis----整理
--------------------------------------------------------------------redis--------------------------- ...
- base标签浏览器兼容问题
<% String path = request.getContextPath(); String basePath = request.getScheme() + "://" ...
- 洛谷P1433 吃奶酪【dfs】【剪枝】
题目:https://www.luogu.org/problemnew/show/P1433 题意: 给定n个坐标,要求从(0,0)开始走遍所有点,最少经过的路程. 思路: 刚开始想像数字三角形一样适 ...
- GIS软件相关安装(持续更新)
软件安装是GIS专业的必修课,总会忘记步骤,在此汇总 1.oracle ①无法登录 管理员登录 sqlplus sys/密码 as sysdba https://www.linuxidc.com/li ...