linux-shell系列3-wafAPI
#!/bin/bash
datestr=`env LANG=en_US.UTF-8 date -u "+%a, %d %b %Y %H:%M:%S GMT"`
pwdstr=`echo -en ${datestr}| openssl dgst -sha1 -hmac "XXXXXXX" -binary| openssl enc -base64`
########1 安全防护安全状态汇总
total=http://XXXXXX
########2 安全防护攻击详细信息接口
att_info=http://XXXXX
########3 安全防护攻击次数详细信息接口
att_detail=http://XXXXXX
########4 安全防护攻击拦截趋势
hit_deny=http://XXXXXX
wafgetdata(){
datestr=`env LANG=en_US.UTF-8 date -u "+%a, %d %b %Y %H:%M:%S GMT"`
pwdstr=`echo -en ${datestr}| openssl dgst -sha1 -hmac "xxxxxx" -binary| openssl enc -base64`
curl -s -X POST \
-u cdtv:${pwdstr} \
-H "Accept:application/xml" \
-H "Date:${datestr}" \
-d "$body" $url
}
echo "datestr: $datestr"
echo "pwdstr: $pwdstr"
#for p in $@;do
# if [ $p == "k" ];then
# p="";fi
#done
body1=("channel=$1" "cust=$2" "region=$3" "startdate=$4" "enddate=$5" "resultType=$6")
body2=("channel=$1" "cust=$2" "region=$3" "startdate=$4" "enddate=$5" "attIp=$6")
body3=("channel=$1" "cust=$2" "region=$3" "startdate=$4" "enddate=$5" "alarmType=$6" "alarmIp=$7")
body4=("channel=$1" "cust=$2" "region=$3" "startdate=$4" "enddate=$5" "date=$6" "resultType=$7" "attackType=$8")
echo ${body1[*]}
for ((i=0;i<=$#-1;i++));do
x=($@)
if [ ${x[i]} == 'k' ];then
unset body1[i]
unset body2[i]
unset body3[i]
unset body4[i]
fi
done
str1=`echo ${body1[*]} |sed -e 's/ /\&/g'`
str2=`echo ${body1[*]} |sed -e 's/ /\&/g'`
str3=`echo ${body1[*]} |sed -e 's/ /\&/g'`
str4=`echo ${body1[*]} |sed -e 's/ /\&/g'`
echo $str1
if [ $7 == 1 ];then body=$str1;url=$total;fi
if [ $7 == 2 ];then body=$str2;url=$att_info;fi
if [ $8 == 3 ];then body=$str3;url=$att_detail;fi
if [ $9 == 4 ];then body=$str4;url=$hit_deny;fi
#body1="$channel&$cust&$region&$startdate&$enddate&$resultType"
# 1 参数6 channel cust region startdate enddate resultType
#body1=("channel=$1" "cust=$2" "region=$3" "startdate=$4" "enddate=$5" "resultType=$6")
# 2 参数6 channel cust region startdate enddate attIp
#body2="channel=$1&cust=$2®ion=$3&startdate=$4&enddate=$5&attIp=$6"
# 3 参数7 channel cust region startdate enddate alarmType alarmIp
#body3="channel=$1&cust=$2®ion=$3&startdate=$4&enddate=$5&alarmType=$6&alarmIp=$7"
# 4 参数8 channel cust region startdate enddate date resultType attackType
#body4="channel=$1&cust=$2®ion=$3&startdate=$4&enddate=$5&date=$6&resultType=$7&attackType=$8"
wafgetdata $body $url
linux-shell系列3-wafAPI的更多相关文章
- Linux Shell系列教程之(十七) Shell文件包含
本文是Linux Shell系列教程的第(十七)篇,更多Linux Shell教程请看:Linux Shell系列教程 通过文件包含,可以引用其他文件的内容,也可以将复杂内容分开,使程序结构更加清晰. ...
- Linux Shell系列教程之(十六) Shell输入输出重定向
本文是Linux Shell系列教程的第(十六)篇,更多Linux Shell教程请看:Linux Shell系列教程 Shell中的输出和输入的重定向是在使用中经常用到的一个功能,非常实用,今天就为 ...
- Linux Shell系列教程之(十五) Shell函数简介
本文是Linux Shell系列教程的第(十五)篇,更多Linux Shell教程请看:Linux Shell系列教程 函数可以将一个复杂功能划分成若干模块,从而使程序结构更加清晰,代码重复利用率更高 ...
- Linux Shell系列教程之(十四) Shell Select教程
本文是Linux Shell系列教程的第(十四)篇,更多Linux Shell教程请看:Linux Shell系列教程 在上一篇文章:Linux Shell系列教程之(十三)Shell分支语句case ...
- Linux Shell系列教程之(十三)Shell分支语句case … esac教程
本文是Linux Shell系列教程的第(十三)篇,更多Linux Shell教程请看:Linux Shell系列教程 分支语句非常实用,基本上高级语言都支持分支语句(python 没有),大多数都使 ...
- Linux Shell系列教程之(十二)Shell until循环
本文是Linux Shell系列教程的第(十二)篇,更多Linux Shell教程请看:Linux Shell系列教程 在上两篇文章Linux Shell系列教程之(十)Shell for循环和Lin ...
- (转)Linux Shell系列教程之(十四) Shell Select教程
本文属于<Linux Shell 系列教程>文章系列,该系列共包括以下 18 部分: Linux Shell系列教程之(一)Shell简介 Linux Shell系列教程之(二)第一个Sh ...
- Linux Shell系列教程
学习Linux Shell知识,就来Linux大学网(Linuxdaxue.com)! 本系列适合Linux初学者,属于Linux入门级教程,主要介绍了Shell的分类.语法格式以及脚本的使用和编写格 ...
- Linux Shell系列教程之(十一)Shell while循环
本文是Linux Shell系列教程的第(十一)篇,更多Linux Shell教程请看:Linux Shell系列教程 在上一篇Linux Shell系列教程之(十)Shell for循环中,我们已经 ...
- Linux Shell系列教程之(十)Shell for循环
本文是Linux Shell系列教程的第(十)篇,更多Linux Shell教程请看:Linux Shell系列教程 基本任何语言都有自己的循环语句,Shell当然也不例外,今天就为大家介绍下Shel ...
随机推荐
- 微信支付异常:appid and openid not match
上周调试微信小程序支付时遇到的问题,在调用统一下单接口获取微信支付的相关参数时,报了这么一个错误:appid and openid not match. 字面意思很容易理解,就是appid与openi ...
- 关于always块内for循环的执行方式
//该模块主要用来说明for结构在时序逻辑中的执行方式 :] eq_dly ); integer i; 'b1; always @(posedge clk_1 or negedge nrst) beg ...
- 容器化-Docker实战
导读:本文系统性介绍Docker安装.Docker组件.Docker命令.Dockerfile语法和Docker应用,通过上述介绍使我们已经对docker基本操作有一定了解. 一.前言 本文将系统性的 ...
- P66 整环的零元
R/I=0的零因子是0+I吗? 如果不是,那请问R/I的零因子是什么呢? R/I没有零因子 R/I的零元 是I中的元素定义的等价类 么 a是理想I的元素,自然也是R的元素
- mysql 查看版本
查看mysql版本的四种方法 - 风生水起 - 博客园 http://www.cnblogs.com/end/archive/2011/10/18/2216461.html 查看mysql数据库版本方 ...
- Jenkins deploy war to tomcat over https
ssl - HTTPS login with Spring Security redirects to HTTP - Stack Overflow https://stackoverflow.com/ ...
- oracle计算时间常用函数
--ddd:一年中的第几天 select to_char(sysdate,'ddd') from dual --d:一周中的第几天 星期天是第一天 所以要-1select to_char(sysdat ...
- MyBatis源码分析1 参数映射分析
首先我们拿出之前的代码,在如图位置打上断点,开始调试 我们规定了一个mapper接口,而调用了mapper接口的getEmpByIdAndLastName,我们并没有实现这个接口,这是因为Mybati ...
- npm install、npm install --save、npm install --save --dev、npm install -S、npm install -D的区别
npm install X: 会把X包安装到node_modules目录中 不会修改package.json 之后运行npm install命令时,不会自动安装X npm install X –sav ...
- hadoop分布式系统架构详解
hadoop 简单来说就是用 java写的分布式 ,处理大数据的框架,主要思想是 “分组合并” 思想. 分组:比如 有一个大型数据,那么他就会将这个数据按照算法分成多份,每份存储在 从属主机上,并且在 ...