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 ...
随机推荐
- JS中AOP的实现和运用
在编写js的时候,我们有时会遇到针对某种场景做处理,比如在方法开始的时候校验参数,执行方法前检查权限,或是删除前给出确认提示等等.这些校验方法.权限检测.确认提示,规则可能都是相同的,在每个方法前去调 ...
- Git安装以及常用命令(图文详解)
**Git安装以及常用命令** 1.下载安装Git,傻瓜式安装相信大家都会. 官网下载地址:[https://git-scm.com/downloads] 2.Git基本操作 (1)git --ver ...
- [SDOI2017]天才黑客[最短路、前缀优化建图]
题意 一个 \(n\) 点 \(m\) 边的有向图,还有一棵 \(k\) 个节点的 trie ,每条边上有一个字符串,可以用 trie 的根到某个节点的路径来表示.每经过一条边,当前携带的字符串就会变 ...
- 朱晔的互联网架构实践心得S2E2:写业务代码最容易掉的10种坑
我承认,本文的标题有一点标题党,特别是写业务代码,大家因为没有足够重视一些细节最容易调的坑(侧重Java,当然,本文说的这些点很多是不限制于语言的). 1.客户端的使用 我们在使用Redis.Elas ...
- 常见的web攻击手段总结
xxs攻击(跨站脚本攻击) 攻击者在网页中嵌入恶意脚本程序,当用户打开该网页时脚本程序便在浏览器上执行,盗取客户端的cookie.用户名密码.下载执行病毒木马程 序 解决: 我们可以对用户输入的数据进 ...
- 计算机名称改名之后,tfs连接问题
计算机名称改名之后,我们发现tfs连接会有问题 打开vs下的“开发人员命令提示”执行下面两条语句: 1.tf workspaces 2.tf workspaces /collection:http:/ ...
- ImportError: DLL load failed: 找不到指定的模块。
这里用的anacoda,报错是找不到DLL,可能是该DLL的环境变量没配置,配置系统环境变量: 重启一下pycharm,OK.
- Tea Party CodeForces - 808C (构造+贪心)
Polycarp invited all his friends to the tea party to celebrate the holiday. He has ncups, one for ea ...
- anaconda 出现add 。。。进不去
找到.condarc 文件 C:\Users\leiyi内 把里面内容替换为 channels: - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pk ...
- 课程存储校对:程序设计思想、源程序代码、运行结果截图,以及开发过程中的项目计划日志、时间记录日志、缺陷记录日志(PSP0级记录)。
1.程序设计思想 ⑴将JDBC驱动jar包导入到WEB-INF的lib文件夹下 ⑵建立数据库,在数据库中建表,分别将课程名称.任课教师及上课地点录入到列中 ⑶首先写出加载驱动.关闭资源的工具类和异常处 ...