批量创建用户名脚本:

 #########################################################################
# File Name: create-user.sh
# Author: kingle
# Mail: kingle122@vip.qq.com
# Created Time: Mon 06 Aug 2018 04:17:12 PM CST
#########################################################################
#!/bin/bash
user="kingle"
passfile="./passwd.txt"
for i in `seq -w `
do
useradd $user$i
"`echo "$RANDOM"|md5sum|cut -c5-15`" = pass
echo "$pass"|passwd --stdin $user$num
echo -e "user:$user$num\tpasswd:$pass" >>$passfile
done
echo --------------------------ok--------------------
cat $passfile

批量删除用户:

#########################################################################
# File Name: deluser.sh
# Author: kingle
# Mail: kingle122@vip.qq.com
# Created Time: Mon 06 Aug 2018 04:17:12 PM CST
######################################################################### #!/bin/sh
for user in kingle{..}
do
userdel -r $user
echo "delete $user is ok"
done

扫描内网存活主机

 #########################################################################
# File Name: scan_ip.sh
# Author: kingle
# Mail: kingle122@vip.qq.com
# Created Time: Mon 06 Aug 2018 04:17:12 PM CST
#########################################################################
#!/bin/bash
Ip_file=./scan_ip.txt
>$Ip_file
for i in 10.0..{..}
do
ping -c -W $i &>/dev/null && \
if [ $? -eq ];then
echo "chunzhu: $i" &>>$Ip_file fi &
done
echo "hahhahah:"

nmap扫描:

 #########################################################################
# File Name: namp.sh
# Author: kingle
# Mail: kingle122@vip.qq.com
# Created Time: Mon 06 Aug 2018 04:17:12 PM CST
#########################################################################
#!/bin/bash
CMD="nmap -sP"
IP="10.0.0.0/24"
CMD2="nmap -sS"
$CMD $IP|awk '/Nmap scan report for/ {print $NF}'

测试网站通否:

 #########################################################################
# File Name: test——url.sh
# Author: kingle
# Mail: kingle122@vip.qq.com
# Created Time: Mon 06 Aug 2018 04:17:12 PM CST
#########################################################################
#!/bin/bash
. /etc/init.d/functions
check_count=
url_list=(
http://10.0.0.200
http://10.0.0.201
http://10.0.0.202
http://www.baidu.com
)
function wait(){
echo -n 'waitting 3 misth--------';
for ((i=;i<;i++))
do
echo -n ".";sleep
done
echo
}
function check_url(){
wait
for ((i=; i<`echo ${#url_liset[*]}`; i++))
do
wget -o /dev/null -T --tries= --spider ${url_list[$i]} >/dev/null
if [ $? -eq ]
then
action "${url_list[$i]}" /bin/true
else
action "${url_list[$i]}" /bin/false
fi
done
((check_count++)) }
main(){
while true
do
check_url
echo "-------check count:${check_count}"
sleep
done
}
main

IPddos:

 #########################################################################
# File Name: namp.sh
# Author: kingle
# Mail: kingle122@vip.qq.com
# Created Time: Mon 06 Aug 2018 04:17:12 PM CST
#########################################################################
#!/bin/bash
file=$
JudgeExt(){
if expr "$1" : ".*\.log" &>/dev/null
then
:
else
echo $"usage:$0 *.log"
exit
fi
}
IpCount(){
grep "ESTABLISHED" $|awk -F "[ :]+" '{ ++S[$(NF-3)]}END {for(key in S)print S[key],key}'|sort -rn -k1|head - >/tmp/tmp.log
}
ipt (){
local ip=$
if [ `iptables -L -n|grep "$ip"|wc -l` -lt ]
then
iptables -I INPUT -s $ip -j DROP
echo "$line is dropped" >>/tmp/droplist_$(date +%F).log
fi
}
main(){
JudgeExt $file
while true
do
IpCount $file
while read line
do
ip=`echo $line |awk `{print $}``
count=`echo $line|awk '{print $1}'`
if [ $count -gt ]
then
ipt $ip
fi
done</tmp/tmp.log
sleep
done
}
main

shell的常用脚本一的更多相关文章

  1. shell常用脚本

    shell常用脚本 author:headsen chen  2017-10-17 15:36:17 个人原创,转载请注明,否则依法追究法律责任 1,vim  name.grep.sh 2,cat   ...

  2. 常用脚本语言Perl,Python,Ruby,Javascript一 Perl,Python,Ruby,Javascript

    常用脚本语言Perl,Python,Ruby,Javascript一 Perl,Python,Ruby,Javascript Javascript现阶段还不适合用来做独立开发,它的天下还是在web应用 ...

  3. shell中常用的特殊符号

    在shell中常用的特殊符号罗列如下: # ; ;; . , / \ 'string'| ! $ ${} $? $$ $* "string"* ** ? : ^ $# $@ `co ...

  4. Bash Shell启动配置脚本的顺序

    1.Bash检查环境变量文件的方式,取决于系统运行Shell的方式,通常系统运行Shell有3种方式: )通过系统用户登陆后默认运行的Shell )非登陆交互式运行Shell )执行脚本运行非交互式S ...

  5. Shell编程-01-Shell脚本初步入门

    目录 什么是Shell 什么是Shell脚本 Shell脚本语言的种类 常用操作系统默认Shell Shell 脚本的建立和执行 脚本规范 什么是Shell     简单来说Shell其实就是一个命令 ...

  6. linux Shell中常用的条件判断

    linux Shell中常用的条件判断 -b file            若文件存在且是一个块特殊文件,则为真 -c file            若文件存在且是一个字符特殊文件,则为真 -d ...

  7. 生产力工具:shell 与 Bash 脚本

    生产力工具:shell 与 Bash 脚本 作者:吴甜甜 个人博客网站: wutiantian.github.io 注意:本文只是我个人总结的学习笔记,不适合0基础人士观看. 参考内容: 王顶老师 l ...

  8. oracle 常用脚本以及语句

    oracle 常用脚本以及语句 一.oracle 安装10G 单机初始化环境: #!/bin/bash #关闭selinuxsed -i 's\SELINUX=enforcing\SELINUX=di ...

  9. -Shell 教程 Bash 脚本 基础语法 MD

    目录 目录 Shell 简介 Shell 脚本 Shell 环境 第一个shell脚本 Shell 变量 定义变量 使用变量 只读变量 删除变量 Shell 字符串 单引号 双引号 字符串基本操作 S ...

随机推荐

  1. bash/shell的字符串trim实现

    #!/bin/sh trim() {     trimmed=$1     trimmed=${trimmed%% }     trimmed=${trimmed## }     echo $trim ...

  2. 献上一款漂亮的手写PHP验证码

    献上一款漂亮的PHP验证码,可以根据个人需求作调整,代码如下(审美观不同,欢迎吐槽): <?php /** * Author: xiongwei * Email: 695704253@qq.co ...

  3. Map存储容量及内存占用测试

    Integer a = 1; long start = 0; long end = 0; // 先垃圾回收 System.gc(); start = Runtime.getRuntime().free ...

  4. 国外物联网平台(5):Exosite Murano

    国外物联网平台(5)——Exosite Murano 马智 定位 Murano是一个基于云的IoT软件平台,提供安全.可扩展的基础设施,支持端到端的生态系统,帮助客户安全.可扩展地开发.部署和管理应用 ...

  5. 数组中 reduce累计运算

    let arr = [1,2,3,4]; let sum = (a, b) => a + b; arr.reduce(sum, 0); 最后输出10

  6. 函数返回值string与返回值bool区别------c++程序设计原理与实践(进阶篇)

    为什么find_from_addr()和find_subject()如此不同?比如,find_from_addr()返回bool值,而find_subject()返回string.原因在于我们想说明: ...

  7. 玩转php缓存memcache

    记录 一.本地安装 链接:https://www.cnblogs.com/jkko123/p/6294669.html 二.linux安装

  8. Kylin -- Dup key found 问题

    kylin 构建 cube 时,抛出了如下的错误: org.apache.kylin.engine.mr.exception.HadoopShellException: java.lang.Runti ...

  9. loj#6041. 「雅礼集训 2017 Day7」事情的相似度(后缀自动机+启发式合并)

    题面 传送门 题解 为什么成天有人想搞些大新闻 这里写的是\(yyb\)巨巨说的启发式合并的做法(虽然\(LCT\)的做法不知道比它快到哪里去了--) 建出\(SAM\),那么两个前缀的最长公共后缀就 ...

  10. Hibernate的工作流程以及三种状态

    Hibernate的工作流程: 1. 读取并解析配置文件 2.读取并解析映射信息,创建SessionFactory 3. 打开Sesssion 4.创建事务Transation 5. 持久化操作 6. ...