分享一个shell脚本代码,用于创建bind的zone文件,即域文件。 首先,需要自定义配置文件如下。 示例ns.profile.it.net.cn配置文件 定义你的默认TTL,电子邮件ID和其他的东西。 此外,设置您的邮件服务器和域名服务器的IP使用bash阵列。 保存如下ns.profile.it...
本节分享的这段shell脚本,实现对数字的递增排序。 代码: #!/bin/bash # 对数字进行递增排序 file= echo -n 输入文件名称 : read file if [ ! -f $file ] then echo $file 不是一个文件 exit 1 fi sort -n $file...
一段shell脚本,用于实现mysql的纯文本格式备份。 所谓的mysql纯文本格式数据,是在数据表中没有insert into这样的查询sql语句的存在,而只有类似如下: 123,xxx,xxx,xxx 123,xxx,xxx,xxx 123,xxx,xxx,xxx 123,xxx,xxx,xxx 的纯数据结构。 此种备份方式,可以...
写了一段shell脚本,用来清除c代码中的注释,不敢独享,分享给大伙。 运行示例:Run this script as follows: cat file.c | ./script.sh 1,c代码示例 file.c: #includestdio.h /* This is a test program * Version 1.0 * */ int main(){ printf(This is a...
分享一个可用于IPv6的iptables防火墙脚本,适用于 CentOS/Debian/RHEL/及其它 Linux 平台。 代码: #!/bin/bash # IPv6 iptables防火墙脚本 # -------- IPT6=/sbin/ip6tables # Interfaces PUB_IF=eth1 PUB_LO=lo0 PUB_VPN=eth0 # Custom chain names CHAINS...
shell结合iptables自动拒绝恶意连接ssh的方法及实现代码 本脚本实现: 1,增加自动释放被锁定的IP地址功能 2,增加自动执行时间,无需在任务计划中修改 3,不会频繁报警 调用方法: #nohup ./ssh 在后台不间断运行。 停止方法: #ps aux | grep ./ssh |grep -...
一个shell脚本,结合iptables实现防止ssh的暴力破解。 这段防止ssh暴力破解的脚本,不使用file2ban hostdeny pam_abl.so模块等软件,而是使用我们熟知的iptables。 代码: #!/bin/bsah # filename:ipt_ssh.sh # iptables防止ssh的暴力破解 # /sbin/iptables...
二个不错的iptables脚本,是学习iptables用法以及shell编程的好例子。 1,iptables脚本一 代码: #!/bin/sh # modprobe ipt_MASQUERADE modprobe ip_conntrack_ftp modprobe ip_nat_ftp iptables -F iptables -t nat -F iptables -X iptables -t nat -X #----...
一段不错的shell脚本,用于防止CC攻击,有用到的朋友,研究下吧。 代码: #!/bin/bash #script info: # Analysis access_log.abc log for a certain period of time to visit the suffix: mp3, # and more than a certain number of requests an IP address,...
如何用shell判断iptables服务是否开启呢? 问题:有如下的脚本,判断iptables是否开启,不知道是否正确? 代码: /sbin/service iptables status 1/dev/null 21 if [ $? -ne 0 ]; then _firewall_status=stopped fi 解答: 此脚本可以判断iptables服务是否开...