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 ...
随机推荐
- 扒一扒: Java 中的枚举
目录 1. 枚举的定义 1.1 传统的非枚举方法 1.2 枚举方法 1.3 定义总结 2 枚举的本质 2.1 继承 java.lang.Enum 2.2 final 类型 2.3 枚举常量本身就是该类 ...
- WPF仿网易云音乐系列(序)
1.简介 由于之前做了一个播放器,苦于不懂界面设计,只得去借鉴借鉴一些成功的作品,网易云音乐就甚合朕心,哈哈,最后做出来的效果如下: 本系列文章就来和大家讨论以下,如何用WPF去仿制一个网易云音乐来: ...
- 朱晔和你聊Spring系列S1E3:Spring咖啡罐里的豆子
标题中的咖啡罐指的是Spring容器,容器里装的当然就是被称作Bean的豆子.本文我们会以一个最基本的例子来熟悉Spring的容器管理和扩展点. 阅读PDF版本 为什么要让容器来管理对象? 首先我们来 ...
- ab 压力测试
两个 Time per request ab有一个-c n参数,就是第一行的Concurrency Level,可以让ab创建n个并发连接进行测试. 第一个Time per request 代表每个链 ...
- 用Flask+Redis维护Cookies池
Redis数据库:存储微博账号密码 这里需要购买账号 登录后的cookies:键值对的形式保存 GitHub:https://github.com/LXL-YAN/CookiesPool 视频讲解:h ...
- 网站数据分析&初始来源
数据分析:如何追踪访客初始来源_搜索学院_百度搜索资源平台 https://ziyuan.baidu.com/college/articleinfo?id=260 网站数据分析:如何追踪访客初始来源 ...
- vmware can not be closed virtual machine is busy
VMware does not close when Windows Server 2003 ... |VMware Communities https://communities.vmware.co ...
- 注入技术--LSP劫持注入
1.原理 简单来说,LSP就是一个dll程序. 应用程序通过winsock2进行网络通信时,会调用ws2_32.dll的导出函数,如connect,accept等. 而后端通过LSP实现这些函数的底层 ...
- webdriver问题汇总
如果你的selenium是3.X版本的,火狐浏览器需要geckodriver这个组件的支持,而谷歌浏览器需要chromedriver的支持,selenium是2.X版本则不需要. 使用selenium ...
- C#复习笔记(3)--C#2:解决C#1的问题(进入快速通道的委托)
委托 前言:C#1中就已经有了委托的概念,但是其繁杂的用法并没有引起开发者太多的关注,在C#2中,进行了一些编译器上的优化,可以用匿名方法来创建一个委托.同时,还支持的方法组和委托的转换.顺便的,C# ...