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 ...
随机推荐
- Linq to XML操作XML文件
LINQ的类型 在MSDN官方文件中,LINQ分为几种类型: . LINQ to Objects(或称LINQ to Collection),这是LINQ的基本功能,针对集合对象进行查询处理,包括基本 ...
- WIFI智能配网 - SmartConfig
要开始IoT项目的第一步是什么?当然不是硬件,而是硬件与硬件的连接!即使有各种各样的通信协议没有好的连接方式绝对不行.那外设上没有的屏幕,没有键盘怎末输入密码怎末选择网络?对,这就是WIFI模块最重要 ...
- 朱晔的互联网架构实践心得S2E1:业务代码究竟难不难写?
注意,这是我的架构实践心得的第二季的系列文章,第一季有10篇你也可以回顾. 见https://www.cnblogs.com/lovecindywang/category/1296779.html 最 ...
- babel-polyfill使用与性能优化
文章首发于笔者的个人博客 文章概览 本文主要内容包括:什么是babel-polyfill,如何使用,如何通过按需加载进行性能优化. 本文所有例子可以在 笔者的github 找到. 什么是babel-p ...
- 八、xadmin自定义菜单栏顺序
xadmin默认是读取注册的app和所有注册到xadmin的mode来生成对应的菜单. nav_menu[app_key] = { 'title': app_title, 'menus': [mode ...
- H5 18-序选择器
18-序选择器 我是标题 我是段落1 我是段落2 我是段落3 我是段落4 我是段落5 我是段落6 我是段落7 我是段落8 --> 我是段落1 我是段落2 我是段落2 我是标题 <!DOCT ...
- Python Revisited Day 03 (组合数据类型)
目录 第三章 组合数据类型 3.1 序列类型 3.1.1 元组 3.1.2 命名的元组 (collections.nametuple()) 3.1.3 列表 (查询有关函数点这) 3.1.4 列表内涵 ...
- 关于对于system函数和c++标准下的新的变量定义方式{}
- 爬虫——cookies池的搭建
https://github.com/Python3WebSpider/cookiesPool
- 基于CRM跟进(活动)记录中关键字识别的客户跟进加权值的成单概率算法
1.提取销售人员的跟进记录,分析其中的骂人文字(负面情绪),将有负面情绪的客户的跟进排期,进行降权(权重)操作.重点跟进加权值较高的客户. 执行办法: 将销售与客户沟通的语音:电话,微信,QQ,通过调 ...