This repository has been archived on 2025-09-14. You can view files and clone it, but cannot push or open issues or pull requests.
Files
dongxiaoyan-tsg-autotest/01-TestCase/tsg_adc/multi_step/a_Deny_Http_Tests.robot
2021-05-17 13:24:29 +06:00

524 lines
39 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

*** Settings ***
Force Tags tsg_adc_wp adc_api security_policy
Library OperatingSystem
Resource ../../../02-Keyword/tsg_adc/SystemCommand.robot
Resource ../../../02-Keyword/tsg_bfapi/PolicyObject.robot
Resource ../../../02-Keyword/tsg_bfapi/LogVariable.robot
Resource ../../../02-Keyword/tsg_adc/FileOperation.robot
Resource ../../../02-Keyword/tsg_adc/FileOperation.robot
Resource ../../../02-Keyword/tsg_bfapi/policy_object/Policy.robot
*** Variables ***
${url} /v1/policy/profile/responsepages
*** Test Cases ***
SecurityPolicy-Deny-Http-00001
[Tags] fqdn完整匹配 update policy:source ip_geo,fqdn
Comment 创建fqdn
${addItemList1} Create Dictionary keywordArray=$www.lkong.net isHexbin=${0}
${addItemLists} Create list ${addItemList1}
${objectDict} Create Dictionary objectType=fqdn objectSubType=fqdn isValid=${1} addItemList=${addItemLists}
${rescode} ${objectId} AddObjects ${1} ${objectDict}
Comment 创建categories
${addItemList1} Create Dictionary fqdn=$www.lkong.net
${addItemLists} Create list ${addItemList1}
${objectDict} Create Dictionary categoryType=fqdn categoryName=lkong objectSubType=category isValid=${1} fqdnList=${addItemLists}
${rescode} ${categoryObjId} ${categoryId} AddCategories ${1} ${objectDict} add 200
Comment 创建ip geo
${addItemList1} Create Dictionary keywordArray=XXG地区.*
${addItemLists} Create list ${addItemList1}
${objectDict} Create Dictionary objectType=ip objectSubType=geo_location isValid=${1} addItemList=${addItemLists}
${rescode} ${objectId1} AddObjects ${1} ${objectDict}
Comment 创建fqdn2
${addItemList1} Create Dictionary keywordArray=*lkong.net isHexbin=${0}
${addItemLists} Create list ${addItemList1}
${objectDict} Create Dictionary objectType=fqdn objectSubType=fqdn isValid=${1} addItemList=${addItemLists}
${rescode} ${objectId2} AddObjects ${1} ${objectDict}
Comment 创建安全策略
${policyDict} Create Dictionary policyName=SecurityPolicy-Deny-Http-00001 policyType=tsg_security policyDesc=autotest action=deny userRegion={"protocol":"HTTP","method":"drop"} filterList=${objectId}|TSG_FIELD_HTTP_HOST,${categoryObjId}|TSG_FIELD_HTTP_HOST isValid=${1} appIdObjects=${HTTP_ID}
log ${policyDict}
${rescode} ${policyId} AddPolicies 1 ${policyDict} v2
${policyId} Get-Pids ${policyId}
${policyId} Set Variable ${policyId}[0]
insert_policyId_to_file1 deny_http_objectId ${objectId}
insert_policyId_to_file1 deny_http_objectId35 ${objectId1}
insert_policyId_to_file1 deny_http_objectId36 ${objectId2}
insert_policyId_to_file1 deny_http_policyId ${policyId}
insert_policyId_to_file1 deny_http_categoryId ${categoryId}
SecurityPolicy-Deny-Http-00002
[Tags] fqdn右匹配
Comment 创建fqdn
${addItemList1} Create Dictionary keywordArray=*bellaircraftmuseum.org isHexbin=${0}
${addItemLists} Create list ${addItemList1}
${objectDict} Create Dictionary objectType=fqdn objectSubType=fqdn isValid=${1} addItemList=${addItemLists}
${rescode} ${objectId} AddObjects ${1} ${objectDict}
Comment 创建安全策略
${policyDict} Create Dictionary policyName=SecurityPolicy-Deny-Http-00002 policyType=tsg_security policyDesc=autotest action=deny userRegion={"protocol":"HTTP","method":"rst"} filterList=${objectId}|TSG_FIELD_HTTP_HOST isValid=${1} appIdObjects=${HTTP_ID}
log ${policyDict}
${rescode} ${policyId} AddPolicies 1 ${policyDict} v2
${policyId} Get-Pids ${policyId}
${policyId} Set Variable ${policyId}[0]
insert_policyId_to_file1 deny_http_objectId1 ${objectId}
insert_policyId_to_file1 deny_http_policyId1 ${policyId}
SecurityPolicy-Deny-Http-00003
[Tags] url4种匹配
Comment 创建url
${addItemList1} Create Dictionary keywordArray=*/news/ isHexbin=${0}
${addItemList2} Create Dictionary keywordArray=www.gotohoroscope* isHexbin=${0}
${addItemList3} Create Dictionary keywordArray=$www.icbc.com.cn/ isHexbin=${0}
${addItemList4} Create Dictionary keywordArray=indexv isHexbin=${0}
${addItemLists} Create list ${addItemList1} ${addItemList2} ${addItemList3} ${addItemList4}
${objectDict} Create Dictionary objectType=url objectSubType=url isValid=${1} addItemList=${addItemLists}
${rescode} ${objectId} AddObjects ${1} ${objectDict}
#创建引用文件
${response} CreatePolicyFile2 ${url} ${responsePageFiles} 404english.html resPages
${profiledId} Get From Dictionary ${response} profileId
Comment 创建安全策略
${policyDict} Create Dictionary policyName=SecurityPolicy-Deny-Http-00003 policyType=tsg_security policyDesc=autotest action=deny userRegion={"protocol":"HTTP","method":"block","code":403,"html_profile":${profiledId}} filterList=${objectId}|TSG_FIELD_HTTP_URL isValid=${1} appIdObjects=${HTTP_ID}
log ${policyDict}
${rescode} ${policyId} AddPolicies 1 ${policyDict} v2
${policyId} Get-Pids ${policyId}
${policyId} Set Variable ${policyId}[0]
insert_policyId_to_file1 deny_http_objectId2 ${objectId}
insert_policyId_to_file1 deny_http_policyId2 ${policyId}
insert_policyId_to_file1 deny_http_profiledId ${profiledId}
SecurityPolicy-Deny-Http-00004
[Tags] 请求头左匹配 update policy:url 请求头
Comment user-agent,创建请求头
${addItemList1} Create Dictionary keywordArray=Mozilla/5.0* isHexbin=${0} district=User-Agent
${addItemLists} Create list ${addItemList1}
${objectDict} Create Dictionary objectType=http_signature objectSubType=http_signature isValid=${1} addItemList=${addItemLists}
${rescode} ${objectId} AddObjects ${1} ${objectDict}
Comment 创建url
${addItemList1} Create Dictionary keywordArray=*sveden isHexbin=${0}
${addItemLists} Create list ${addItemList1}
${objectDict} Create Dictionary objectType=url objectSubType=url isValid=${1} addItemList=${addItemLists}
${rescode} ${object_url_Id} AddObjects ${1} ${objectDict}
Comment user-agent,创建请求头2
${addItemList1} Create Dictionary keywordArray=Mozilla/5.0 isHexbin=${0} district=User-Agent
${addItemLists} Create list ${addItemList1}
${objectDict} Create Dictionary objectType=http_signature objectSubType=http_signature isValid=${1} addItemList=${addItemLists}
${rescode} ${objectId_req_Id} AddObjects ${1} ${objectDict}
Comment 创建url2
${addItemList1} Create Dictionary keywordArray=tsutmb isHexbin=${0}
${addItemLists} Create list ${addItemList1}
${objectDict} Create Dictionary objectType=url objectSubType=url isValid=${1} addItemList=${addItemLists}
${rescode} ${object_url_Id2} AddObjects ${1} ${objectDict}
Comment 创建安全策略
${policyDict} Create Dictionary policyName=SecurityPolicy-Deny-Http-00004 policyType=tsg_security policyDesc=autotest action=deny userRegion={"protocol":"HTTP","method":"block","code":404,"message":"yyyyy"} filterList=${objectId}|TSG_FIELD_HTTP_REQ_HDR,${object_url_Id}|TSG_FIELD_HTTP_URL isValid=${1} appIdObjects=${HTTP_ID}
log ${policyDict}
${rescode} ${policyId} AddPolicies 1 ${policyDict} v2
${policyId} Get-Pids ${policyId}
${policyId} Set Variable ${policyId}[0]
insert_policyId_to_file1 deny_http_objectId3 ${object_url_Id}
insert_policyId_to_file1 deny_http_objectId4 ${objectId}
insert_policyId_to_file1 deny_http_objectId37 ${objectId_req_Id}
insert_policyId_to_file1 deny_http_objectId38 ${object_url_Id2}
insert_policyId_to_file1 deny_http_policyId3 ${policyId}
SecurityPolicy-Deny-Http-00005
[Tags] 请求头完整匹配
Comment user-agent,创建请求头
${addItemList1} Create Dictionary keywordArray=$Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML like Gecko) Chrome/31.0.1650.63 Safari/537.36 isHexbin=${0} district=User-Agent
${addItemLists} Create list ${addItemList1}
${objectDict} Create Dictionary objectType=http_signature objectSubType=http_signature isValid=${1} addItemList=${addItemLists}
${rescode} ${objectId} AddObjects ${1} ${objectDict}
Comment 创建url
${addItemList1} Create Dictionary keywordArray=*a.com/cn/ isHexbin=${0}
${addItemLists} Create list ${addItemList1}
${objectDict} Create Dictionary objectType=url objectSubType=url isValid=${1} addItemList=${addItemLists}
${rescode} ${object_url_Id} AddObjects ${1} ${objectDict}
Comment 创建安全策略
${policyDict} Create Dictionary policyName=SecurityPolicy-Deny-Http-00005 policyType=tsg_security policyDesc=autotest action=deny userRegion={"protocol":"HTTP","method":"drop"} filterList=${objectId}|TSG_FIELD_HTTP_REQ_HDR,${object_url_Id}|TSG_FIELD_HTTP_URL isValid=${1} appIdObjects=${HTTP_ID}
log ${policyDict}
${rescode} ${policyId} AddPolicies 1 ${policyDict} v2
${policyId} Get-Pids ${policyId}
${policyId} Set Variable ${policyId}[0]
insert_policyId_to_file1 deny_http_objectId5 ${object_url_Id}
insert_policyId_to_file1 deny_http_objectId6 ${objectId}
insert_policyId_to_file1 deny_http_policyId4 ${policyId}
SecurityPolicy-Deny-Http-00006
[Tags] 请求头字串匹配
Comment user-agent,创建请求头
${addItemList1} Create Dictionary keywordArray=AppleWebKit isHexbin=${0} district=User-Agent
${addItemLists} Create list ${addItemList1}
${objectDict} Create Dictionary objectType=http_signature objectSubType=http_signature isValid=${1} addItemList=${addItemLists}
${rescode} ${objectId} AddObjects ${1} ${objectDict}
Comment 创建url
${addItemList1} Create Dictionary keywordArray=egypt.travel isHexbin=${0}
${addItemLists} Create list ${addItemList1}
${objectDict} Create Dictionary objectType=url objectSubType=url isValid=${1} addItemList=${addItemLists}
${rescode} ${object_url_Id} AddObjects ${1} ${objectDict}
Comment 创建安全策略
${policyDict} Create Dictionary policyName=SecurityPolicy-Deny-Http-00006 policyType=tsg_security policyDesc=autotest action=deny userRegion={"protocol":"HTTP","method":"alert","code":200,"message":"网站被阻断"} filterList=${objectId}|TSG_FIELD_HTTP_REQ_HDR,${object_url_Id}|TSG_FIELD_HTTP_URL isValid=${1} appIdObjects=${HTTP_ID}
log ${policyDict}
${rescode} ${policyId} AddPolicies 1 ${policyDict} v2
${policyId} Get-Pids ${policyId}
${policyId} Set Variable ${policyId}[0]
insert_policyId_to_file1 deny_http_objectId7 ${object_url_Id}
insert_policyId_to_file1 deny_http_objectId8 ${objectId}
insert_policyId_to_file1 deny_http_policyId5 ${policyId}
SecurityPolicy-Deny-Http-00007
[Tags] 请求头右匹配
Comment user-agent,创建请求头
${addItemList1} Create Dictionary keywordArray=*Safari/537.36 isHexbin=${0} district=User-Agent
${addItemLists} Create list ${addItemList1}
${objectDict} Create Dictionary objectType=http_signature objectSubType=http_signature isValid=${1} addItemList=${addItemLists}
${rescode} ${objectId} AddObjects ${1} ${objectDict}
Comment 创建url
${addItemList1} Create Dictionary keywordArray=*download.shtml isHexbin=${0}
${addItemLists} Create list ${addItemList1}
${objectDict} Create Dictionary objectType=url objectSubType=url isValid=${1} addItemList=${addItemLists}
${rescode} ${object_url_Id} AddObjects ${1} ${objectDict}
#创建引用文件
${response} CreatePolicyFile2 ${url} ${responsePageFiles} 404china.html resPages
${profiledId} Get From Dictionary ${response} profileId
Comment 创建安全策略
${policyDict} Create Dictionary policyName=SecurityPolicy-Deny-Http-00007 policyType=tsg_security policyDesc=autotest action=deny userRegion={"protocol":"HTTP","method":"alert","code":200,"html_profile":${profiledId}} filterList=${objectId}|TSG_FIELD_HTTP_REQ_HDR,${object_url_Id}|TSG_FIELD_HTTP_URL isValid=${1} appIdObjects=${HTTP_ID}
log ${policyDict}
${rescode} ${policyId} AddPolicies 1 ${policyDict} v2
${policyId} Get-Pids ${policyId}
${policyId} Set Variable ${policyId}[0]
insert_policyId_to_file1 deny_http_objectId9 ${object_url_Id}
insert_policyId_to_file1 deny_http_objectId10 ${objectId}
insert_policyId_to_file1 deny_http_policyId6 ${policyId}
insert_policyId_to_file1 deny_http_profiledId1 ${profiledId}
SecurityPolicy-Deny-Http-00008
[Tags] 应答头右匹配 update policy:应答头
Comment 创建url
${addItemList1} Create Dictionary keywordArray=*index.aspx isHexbin=${0}
${addItemLists} Create list ${addItemList1}
${objectDict} Create Dictionary objectType=url objectSubType=url isValid=${1} addItemList=${addItemLists}
${rescode} ${object_url_Id} AddObjects ${1} ${objectDict}
Comment 创建应答头Content-Type
${addItemList1} Create Dictionary keywordArray=*utf-8 isHexbin=${0} district=Content-Type
${addItemLists} Create list ${addItemList1}
${objectDict} Create Dictionary objectType=http_signature objectSubType=http_signature isValid=${1} addItemList=${addItemLists}
${rescode} ${objectId} AddObjects ${1} ${objectDict}
Comment 创建应答头2Content-Type
${addItemList1} Create Dictionary keywordArray=utf-8 isHexbin=${0} district=Content-Type
${addItemLists} Create list ${addItemList1}
${objectDict} Create Dictionary objectType=http_signature objectSubType=http_signature isValid=${1} addItemList=${addItemLists}
${rescode} ${objectId1} AddObjects ${1} ${objectDict}
Comment 创建安全策略
${policyDict} Create Dictionary policyName=SecurityPolicy-Deny-Http-00008 policyType=tsg_security policyDesc=autotest action=deny userRegion={"protocol":"HTTP","method":"rst"} filterList=${objectId}|TSG_FIELD_HTTP_RES_HDR,${object_url_Id}|TSG_FIELD_HTTP_URL isValid=${1} appIdObjects=${HTTP_ID}
log ${policyDict}
${rescode} ${policyId} AddPolicies 1 ${policyDict} v2
${policyId} Get-Pids ${policyId}
${policyId} Set Variable ${policyId}[0]
insert_policyId_to_file1 deny_http_objectId11 ${object_url_Id}
insert_policyId_to_file1 deny_http_objectId12 ${objectId}
insert_policyId_to_file1 deny_http_objectId39 ${objectId1}
insert_policyId_to_file1 deny_http_policyId7 ${policyId}
SecurityPolicy-Deny-Http-00009
[Tags] 应答头完整匹配
Comment 创建url
${addItemList1} Create Dictionary keywordArray=www.skycn.com isHexbin=${0}
${addItemLists} Create list ${addItemList1}
${objectDict} Create Dictionary objectType=url objectSubType=url isValid=${1} addItemList=${addItemLists}
${rescode} ${object_url_Id} AddObjects ${1} ${objectDict}
Comment 创建应答头Content-Type
${addItemList1} Create Dictionary keywordArray=$text/html isHexbin=${0} district=Content-Type
${addItemLists} Create list ${addItemList1}
${objectDict} Create Dictionary objectType=http_signature objectSubType=http_signature isValid=${1} addItemList=${addItemLists}
${rescode} ${objectId} AddObjects ${1} ${objectDict}
Comment 创建安全策略
${policyDict} Create Dictionary policyName=SecurityPolicy-Deny-Http-00009 policyType=tsg_security policyDesc=autotest action=deny userRegion={"protocol":"HTTP","method":"drop"} filterList=${objectId}|TSG_FIELD_HTTP_RES_HDR,${object_url_Id}|TSG_FIELD_HTTP_URL isValid=${1} appIdObjects=${HTTP_ID}
log ${policyDict}
${rescode} ${policyId} AddPolicies 1 ${policyDict} v2
${policyId} Get-Pids ${policyId}
${policyId} Set Variable ${policyId}[0]
insert_policyId_to_file1 deny_http_objectId13 ${object_url_Id}
insert_policyId_to_file1 deny_http_objectId14 ${objectId}
insert_policyId_to_file1 deny_http_policyId8 ${policyId}
SecurityPolicy-Deny-Http-00010
[Tags] 应答头字串匹配 update policy
Comment 创建url
${addItemList1} Create Dictionary keywordArray=www.avaxsearch.com isHexbin=${0}
${addItemLists} Create list ${addItemList1}
${objectDict} Create Dictionary objectType=url objectSubType=url isValid=${1} addItemList=${addItemLists}
${rescode} ${object_url_Id} AddObjects ${1} ${objectDict}
Comment 创建应答头Content-Type
${addItemList1} Create Dictionary keywordArray=text/html isHexbin=${0} district=Content-Type
${addItemLists} Create list ${addItemList1}
${objectDict} Create Dictionary objectType=http_signature objectSubType=http_signature isValid=${1} addItemList=${addItemLists}
${rescode} ${objectId} AddObjects ${1} ${objectDict}
Comment 创建安全策略
${policyDict} Create Dictionary policyName=SecurityPolicy-Deny-Http-00010 policyType=tsg_security policyDesc=autotest action=deny userRegion={"protocol":"HTTP","method":"drop"} filterList=${objectId}|TSG_FIELD_HTTP_RES_HDR,${object_url_Id}|TSG_FIELD_HTTP_URL isValid=${1} appIdObjects=${HTTP_ID}
log ${policyDict}
${rescode} ${policyId} AddPolicies 1 ${policyDict} v2
${policyId} Get-Pids ${policyId}
${policyId} Set Variable ${policyId}[0]
insert_policyId_to_file1 deny_http_objectId15 ${object_url_Id}
insert_policyId_to_file1 deny_http_objectId16 ${objectId}
insert_policyId_to_file1 deny_http_policyId9 ${policyId}
SecurityPolicy-Deny-Http-00011
[Tags] 应答头右匹配
Comment 创建url
${addItemList1} Create Dictionary keywordArray=finestquotes.com isHexbin=${0}
${addItemLists} Create list ${addItemList1}
${objectDict} Create Dictionary objectType=url objectSubType=url isValid=${1} addItemList=${addItemLists}
${rescode} ${object_url_Id} AddObjects ${1} ${objectDict}
Comment 创建应答头Content-Type
${addItemList1} Create Dictionary keywordArray=text* isHexbin=${0} district=Content-Type
${addItemLists} Create list ${addItemList1}
${objectDict} Create Dictionary objectType=http_signature objectSubType=http_signature isValid=${1} addItemList=${addItemLists}
${rescode} ${objectId} AddObjects ${1} ${objectDict}
Comment 创建安全策略
${policyDict} Create Dictionary policyName=SecurityPolicy-Deny-Http-00011 policyType=tsg_security policyDesc=autotest action=deny userRegion={"protocol":"HTTP","method":"drop"} filterList=${objectId}|TSG_FIELD_HTTP_RES_HDR,${object_url_Id}|TSG_FIELD_HTTP_URL isValid=${1} appIdObjects=${HTTP_ID}
log ${policyDict}
${rescode} ${policyId} AddPolicies 1 ${policyDict} v2
${policyId} Get-Pids ${policyId}
${policyId} Set Variable ${policyId}[0]
insert_policyId_to_file1 deny_http_objectId17 ${object_url_Id}
insert_policyId_to_file1 deny_http_objectId18 ${objectId}
insert_policyId_to_file1 deny_http_policyId10 ${policyId}
SecurityPolicy-Deny-Http-00012
[Tags] cookie字串匹配
Comment 创建请求头cookie
${addItemList1} Create Dictionary keywordArray=ipp_uid2 isHexbin=${0} district=Cookie
${addItemLists} Create list ${addItemList1}
${objectDict} Create Dictionary objectType=http_signature objectSubType=http_signature isValid=${1} addItemList=${addItemLists}
${rescode} ${objectId} AddObjects ${1} ${objectDict}
Comment 创建安全策略
${policyDict} Create Dictionary policyName=SecurityPolicy-Deny-Http-00012 policyType=tsg_security policyDesc=autotest action=deny userRegion={"protocol":"HTTP","method":"block","code":404,"message":"马上到周末"} filterList=${objectId}|TSG_FIELD_HTTP_REQ_HDR isValid=${1} appIdObjects=${HTTP_ID}
log ${policyDict}
${rescode} ${policyId} AddPolicies 1 ${policyDict} v2
${policyId} Get-Pids ${policyId}
${policyId} Set Variable ${policyId}[0]
insert_policyId_to_file1 deny_http_objectId19 ${objectId}
insert_policyId_to_file1 deny_http_policyId11 ${policyId}
SecurityPolicy-Deny-Http-00013
[Tags] set-cookie
Comment 创建fqdn
${addItemList1} Create Dictionary keywordArray=*nlr.ru isHexbin=${0}
${addItemList2} Create Dictionary keywordArray=$www.sinovision.net isHexbin=${0}
${addItemLists} Create list ${addItemList1} ${addItemList2}
${objectDict} Create Dictionary objectType=fqdn objectSubType=fqdn isValid=${1} addItemList=${addItemLists}
${rescode} ${objectId} AddObjects ${1} ${objectDict}
Comment 创建Set-Cookie
${addItemList1} Create Dictionary keywordArray=ASP.NET_SessionId=* isHexbin=${0} district=Set-Cookie
${addItemList2} Create Dictionary keywordArray=oKD0_802a* isHexbin=${0} district=Set-Cookie
${addItemList3} Create Dictionary keywordArray=PHPSESSID isHexbin=${0} district=Set-Cookie
${addItemLists} Create list ${addItemList1} ${addItemList2} ${addItemList3}
${objectDict} Create Dictionary objectType=http_signature objectSubType=http_signature isValid=${1} addItemList=${addItemLists}
${rescode} ${objectId1} AddObjects ${1} ${objectDict}
Comment 创建安全策略
${policyDict} Create Dictionary policyName=SecurityPolicy-Deny-Http-00013 policyType=tsg_security policyDesc=autotest action=deny userRegion={"protocol":"HTTP","method":"drop"} filterList=${objectId1}|TSG_FIELD_HTTP_RES_HDR,${objectId}|TSG_FIELD_HTTP_HOST isValid=${1} appIdObjects=${HTTP_ID}
log ${policyDict}
${rescode} ${policyId} AddPolicies 1 ${policyDict} v2
${policyId} Get-Pids ${policyId}
${policyId} Set Variable ${policyId}[0]
insert_policyId_to_file1 deny_http_objectId46 ${objectId}
insert_policyId_to_file1 deny_http_objectId20 ${objectId1}
insert_policyId_to_file1 deny_http_policyId12 ${policyId}
SecurityPolicy-Deny-Http-00014
[Tags] 请求体字串匹配 update policy:请求体
Comment 创建fqdn
${addItemList1} Create Dictionary keywordArray=*open.node.com isHexbin=${0}
${addItemLists} Create list ${addItemList1}
${objectDict} Create Dictionary objectType=fqdn objectSubType=fqdn isValid=${1} addItemList=${addItemLists}
${rescode} ${object_fqdn_Id} AddObjects ${1} ${objectDict}
Comment 创建请求体
${addItemList1} Create Dictionary keywordArray=testDenyHttp0014 isHexbin=${0}
${addItemLists} Create list ${addItemList1}
${objectDict} Create Dictionary objectType=keywords objectSubType=keywords isValid=${1} addItemList=${addItemLists}
${rescode} ${objectId} AddObjects ${1} ${objectDict}
Comment 创建请求体2
${addItemList1} Create Dictionary keywordArray=biubiubiud isHexbin=${0}
${addItemLists} Create list ${addItemList1}
${objectDict} Create Dictionary objectType=keywords objectSubType=keywords isValid=${1} addItemList=${addItemLists}
${rescode} ${objectId1} AddObjects ${1} ${objectDict}
Comment 创建安全策略
${policyDict} Create Dictionary policyName=SecurityPolicy-Deny-Http-00014 policyType=tsg_security policyDesc=autotest action=deny userRegion={"protocol":"HTTP","method":"drop"} filterList=${object_fqdn_Id}|TSG_FIELD_HTTP_HOST,${objectId}|TSG_FIELD_HTTP_REQ_CONTENT isValid=${0} appIdObjects=${HTTP_ID}
log ${policyDict}
${rescode} ${policyId} AddPolicies 1 ${policyDict} v2
${policyId} Get-Pids ${policyId}
${policyId} Set Variable ${policyId}[0]
insert_policyId_to_file1 deny_http_objectId431 ${object_fqdn_Id}
insert_policyId_to_file1 deny_http_objectId21 ${objectId}
insert_policyId_to_file1 deny_http_objectId40 ${objectId1}
insert_policyId_to_file1 deny_http_policyId13 ${policyId}
SecurityPolicy-Deny-Http-00015
[Tags] 应答体字串匹配 update policy:返回体
Comment 创建应答体
${addItemList1} Create Dictionary keywordArray=华彤公司 isHexbin=${0}
${addItemLists} Create list ${addItemList1}
${objectDict} Create Dictionary objectType=keywords objectSubType=keywords isValid=${1} addItemList=${addItemLists}
${rescode} ${objectId} AddObjects ${1} ${objectDict}
Comment 创建应答体2
${addItemList1} Create Dictionary keywordArray=华彤集团官网 isHexbin=${0}
${addItemLists} Create list ${addItemList1}
${objectDict} Create Dictionary objectType=keywords objectSubType=keywords isValid=${1} addItemList=${addItemLists}
${rescode} ${objectId1} AddObjects ${1} ${objectDict}
Comment 创建安全策略
${policyDict} Create Dictionary policyName=SecurityPolicy-Deny-Http-00015 policyType=tsg_security policyDesc=autotest action=deny userRegion={"protocol":"HTTP","method":"drop"} filterList=${objectId}|TSG_FIELD_HTTP_RES_CONTENT isValid=${1} appIdObjects=${HTTP_ID}
log ${policyDict}
${rescode} ${policyId} AddPolicies 1 ${policyDict} v2
${policyId} Get-Pids ${policyId}
${policyId} Set Variable ${policyId}[0]
insert_policyId_to_file1 deny_http_objectId22 ${objectId}
insert_policyId_to_file1 deny_http_objectId41 ${objectId1}
insert_policyId_to_file1 deny_http_policyId14 ${policyId}
SecurityPolicy-Deny-Http-00016
[Tags] 最大组合1
Comment 创建fqdn
${addItemList1} Create Dictionary keywordArray=*open.node.com isHexbin=${0}
${addItemLists} Create list ${addItemList1}
${objectDict} Create Dictionary objectType=fqdn objectSubType=fqdn isValid=${1} addItemList=${addItemLists}
${rescode} ${object_fqdn_Id} AddObjects ${1} ${objectDict}
Comment 创建url
${addItemList1} Create Dictionary keywordArray=open.node isHexbin=${0}
${addItemLists} Create list ${addItemList1}
${objectDict} Create Dictionary objectType=url objectSubType=url isValid=${1} addItemList=${addItemLists}
${rescode} ${object_url_Id} AddObjects ${1} ${objectDict}
Comment 创建请求头
${addItemList1} Create Dictionary keywordArray=Mozilla/5.0* isHexbin=${0} district=User-Agent
${addItemLists} Create list ${addItemList1}
${objectDict} Create Dictionary objectType=http_signature objectSubType=http_signature isValid=${1} addItemList=${addItemLists}
${rescode} ${object_qq_Id} AddObjects ${1} ${objectDict}
Comment 创建应答头Content-Type
${addItemList1} Create Dictionary keywordArray=charset isHexbin=${0} district=Content-Type
${addItemLists} Create list ${addItemList1}
${objectDict} Create Dictionary objectType=http_signature objectSubType=http_signature isValid=${1} addItemList=${addItemLists}
${rescode} ${object_yd_Id} AddObjects ${1} ${objectDict}
Comment 创建请求体
${addItemList1} Create Dictionary keywordArray=DenyHttp0016 isHexbin=${0}
${addItemLists} Create list ${addItemList1}
${objectDict} Create Dictionary objectType=keywords objectSubType=keywords isValid=${1} addItemList=${addItemLists}
${rescode} ${object_body_Id} AddObjects ${1} ${objectDict}
Comment 创建安全策略
${policyDict} Create Dictionary policyName=SecurityPolicy-Deny-Http-00016 policyType=tsg_security policyDesc=autotest action=deny userRegion={"protocol":"HTTP","method":"drop"} filterList=${object_fqdn_Id}|TSG_FIELD_HTTP_HOST,${object_url_Id}|TSG_FIELD_HTTP_URL,${object_qq_Id}|TSG_FIELD_HTTP_REQ_HDR,${object_yd_Id}|TSG_FIELD_HTTP_RES_HDR,${object_body_Id}|TSG_FIELD_HTTP_REQ_CONTENT isValid=${0} appIdObjects=${HTTP_ID}
log ${policyDict}
${rescode} ${policyId} AddPolicies 1 ${policyDict} v2
${policyId} Get-Pids ${policyId}
${policyId} Set Variable ${policyId}[0]
insert_policyId_to_file1 deny_http_objectId23 ${object_fqdn_Id}
insert_policyId_to_file1 deny_http_objectId24 ${object_url_Id}
insert_policyId_to_file1 deny_http_objectId25 ${object_qq_Id}
insert_policyId_to_file1 deny_http_objectId26 ${object_yd_Id}
insert_policyId_to_file1 deny_http_objectId27 ${object_body_Id}
insert_policyId_to_file1 deny_http_policyId15 ${policyId}
SecurityPolicy-Deny-Http-00017
[Tags] 最大组合2
Comment 创建fqdn
${addItemList1} Create Dictionary keywordArray=*smspunch.net isHexbin=${0}
${addItemLists} Create list ${addItemList1}
${objectDict} Create Dictionary objectType=fqdn objectSubType=fqdn isValid=${1} addItemList=${addItemLists}
${rescode} ${object_fqdn_Id} AddObjects ${1} ${objectDict}
Comment 创建url
${addItemList1} Create Dictionary keywordArray=*send-free-sms.aspx isHexbin=${0}
${addItemLists} Create list ${addItemList1}
${objectDict} Create Dictionary objectType=url objectSubType=url isValid=${1} addItemList=${addItemLists}
${rescode} ${object_url_Id} AddObjects ${1} ${objectDict}
Comment 创建cookie
${addItemList1} Create Dictionary keywordArray=_ym_isad=2 isHexbin=${0} district=Cookie
${addItemLists} Create list ${addItemList1}
${objectDict} Create Dictionary objectType=http_signature objectSubType=http_signature isValid=${1} addItemList=${addItemLists}
${rescode} ${object_qq_Id} AddObjects ${1} ${objectDict}
Comment 创建Set-Cookie
${addItemList1} Create Dictionary keywordArray=NET_SessionId isHexbin=${0} district=Set-Cookie
${addItemLists} Create list ${addItemList1}
${objectDict} Create Dictionary objectType=http_signature objectSubType=http_signature isValid=${1} addItemList=${addItemLists}
${rescode} ${object_yd_Id} AddObjects ${1} ${objectDict}
Comment 创建应答体
${addItemList1} Create Dictionary keywordArray=Cell No isHexbin=${0}
${addItemLists} Create list ${addItemList1}
${objectDict} Create Dictionary objectType=keywords objectSubType=keywords isValid=${1} addItemList=${addItemLists}
${rescode} ${object_body_Id} AddObjects ${1} ${objectDict}
Comment 创建安全策略
${policyDict} Create Dictionary policyName=SecurityPolicy-Deny-Http-00017 policyType=tsg_security policyDesc=autotest action=deny userRegion={"protocol":"HTTP","method":"drop"} filterList=${object_fqdn_Id}|TSG_FIELD_HTTP_HOST,${object_url_Id}|TSG_FIELD_HTTP_URL,${object_qq_Id}|TSG_FIELD_HTTP_REQ_HDR,${object_yd_Id}|TSG_FIELD_HTTP_RES_HDR,${object_body_Id}|TSG_FIELD_HTTP_RES_CONTENT isValid=${1} appIdObjects=${HTTP_ID}
log ${policyDict}
${rescode} ${policyId} AddPolicies 1 ${policyDict} v2
${policyId} Get-Pids ${policyId}
${policyId} Set Variable ${policyId}[0]
insert_policyId_to_file1 deny_http_objectId28 ${object_fqdn_Id}
insert_policyId_to_file1 deny_http_objectId29 ${object_url_Id}
insert_policyId_to_file1 deny_http_objectId30 ${object_qq_Id}
insert_policyId_to_file1 deny_http_objectId31 ${object_yd_Id}
insert_policyId_to_file1 deny_http_objectId32 ${object_body_Id}
insert_policyId_to_file1 deny_http_policyId16 ${policyId}
SecurityPolicy-Deny-Http-00018
[Tags] 多源ip对象
Comment 创建第二个源IP
${addItemList1} Create Dictionary isSession=endpoint ip=192.168.50.18 port=0-65535 direction=0 protocol=0 isInitialize=0
${addItemLists} Create list ${addItemList1}
${objectDict} Create Dictionary objectType=ip objectSubType=endpoint isValid=${1} addItemList=${addItemLists}
${rescode} ${objectId} AddObjects ${1} ${objectDict}
Comment 创建fqdn
${addItemList1} Create Dictionary keywordArray=$www.hebbank.com isHexbin=${0}
${addItemLists} Create list ${addItemList1}
${objectDict} Create Dictionary objectType=fqdn objectSubType=fqdn isValid=${1} addItemList=${addItemLists}
${rescode} ${object_fqdn_Id} AddObjects ${1} ${objectDict}
Comment 创建安全策略
${policyDict} Create Dictionary policyName=SecurityPolicy-Deny-Http-00018 policyType=tsg_security policyDesc=autotest action=deny userRegion={"protocol":"HTTP","method":"drop"} filterList=${object_fqdn_Id}|TSG_FIELD_HTTP_HOST isValid=${1} appIdObjects=${HTTP_ID} source=${objectId}|TSG_SECURITY_SOURCE_ADDR
log ${policyDict}
${rescode} ${policyId} AddPolicies 1 ${policyDict} v2
${policyId} Get-Pids ${policyId}
${policyId} Set Variable ${policyId}[0]
insert_policyId_to_file1 deny_http_objectId33 ${objectId}
insert_policyId_to_file1 deny_http_objectId34 ${object_fqdn_Id}
insert_policyId_to_file1 deny_http_policyId17 ${policyId}
SecurityPolicy-Deny-Http-00019
[Tags] the minimum match
${policyDict} Create Dictionary policyName=SecurityPolicy-Deny-Http-00019 policyType=tsg_security policyDesc=autotest action=deny userRegion={"protocol":"HTTP","method":"drop"} isValid=${0} appIdObjects=${HTTP_ID}
log ${policyDict}
${rescode} ${policyId} AddPolicies 1 ${policyDict} v2
${policyId} Get-Pids ${policyId}
${policyId} Set Variable ${policyId}[0]
insert_policyId_to_file1 deny_http_policyId18 ${policyId}
SecurityPolicy-Deny-Http-00020
[Tags] substring
Comment 创建url
${objectDict} Create Dictionary objectType=url isValid=${1} addItemList=$www.xinhuanet.com/
${rescode} ${object_url_Id} AddObject2 ${1} ${objectDict}
Comment cookie8个子串,创建请求头
${addItemList1} Create Dictionary keywordArray=7764,636964,756964,77646c617374,363964,3666653461,3462326663,38346463633835 isHexbin=${1} district=Cookie
${addItemLists} Create list ${addItemList1}
${objectDict} Create Dictionary objectType=http_signature objectSubType=http_signature isValid=${1} addItemList=${addItemLists}
${rescode} ${object_ck_Id} AddObjects ${1} ${objectDict}
Comment user-agent8个子串,创建请求头
${addItemList1} Create Dictionary keywordArray=4d6f7a696c6c612f352e30,57696e646f7773,57696e3634,783634,4170706c65,65624b6974,4b48544d4c,6c696b65 isHexbin=${1} district=User-Agent
${addItemLists} Create list ${addItemList1}
${objectDict} Create Dictionary objectType=http_signature objectSubType=http_signature isValid=${1} addItemList=${addItemLists}
${rescode} ${object_ua_Id} AddObjects ${1} ${objectDict}
Comment cont-Type8个子串,创建应答头:text/html
${addItemList1} Create Dictionary keywordArray=7465,7874,746578,657874,74657874,6874,6d6c,68746d isHexbin=${1} district=Content-Type
${addItemLists} Create list ${addItemList1}
${objectDict} Create Dictionary objectType=http_signature objectSubType=http_signature isValid=${1} addItemList=${addItemLists}
${rescode} ${object_ct_Id} AddObjects ${1} ${objectDict}
# Comment set-cookie8个子串,创建应答头
# ${addItemList1} Create Dictionary keywordArray=7465,78742f,6874,6d6c,68746d6c,63686172,736574,63686172736574 isHexbin=${1} district=Set-Cookie
# ${addItemLists} Create list ${addItemList1}
# ${objectDict} Create Dictionary objectType=http_signature objectSubType=http_signature isValid=${1} addItemList=${addItemLists}
# ${rescode} ${object_ct_Id} AddObjects ${1} ${objectDict}
Comment 创建安全策略
${policyDict} Create Dictionary policyName=SecurityPolicy-Deny-Http-00020 policyType=tsg_security policyDesc=autotest action=deny userRegion={"protocol":"HTTP","method":"drop"} filterList=${object_url_Id}|TSG_FIELD_HTTP_URL,${object_ck_Id}|TSG_FIELD_HTTP_REQ_HDR,${object_ct_Id}|TSG_FIELD_HTTP_RES_HDR,${object_ua_Id}|TSG_FIELD_HTTP_REQ_HDR isValid=${1} appIdObjects=${HTTP_ID}
log ${policyDict}
${rescode} ${policyId} AddPolicies 1 ${policyDict} v2
${policyId} Get-Pids ${policyId}
${policyId} Set Variable ${policyId}[0]
insert_policyId_to_file1 deny_http_objectId42 ${object_url_Id}
insert_policyId_to_file1 deny_http_objectId43 ${object_ck_Id}
insert_policyId_to_file1 deny_http_objectId44 ${object_ua_Id}
insert_policyId_to_file1 deny_http_objectId45 ${object_ct_Id}
insert_policyId_to_file1 deny_http_policyId19 ${policyId}