diff --git a/01-TestCase/tsg_bfapi/Object/Category.robot b/01-TestCase/tsg_bfapi/Object/Category.robot new file mode 100644 index 0000000..d3ca8fd --- /dev/null +++ b/01-TestCase/tsg_bfapi/Object/Category.robot @@ -0,0 +1,75 @@ +*** Settings *** +Test Teardown DeletePolicyAndObject ${policyIds} ${objectids} ${categoryIds} +Resource ../../../02-Keyword/tsg_bfapi/PolicyObject.robot +Resource ../../../02-Keyword/tsg_bfapi/policy_object/Policy.robot +Resource ../../../02-Keyword/tsg_bfapi/policy_object/Object.robot +Resource ../../../02-Keyword/tsg_bfapi/policy_object/Log.robot +Resource ../../../02-Keyword/tsg_bfapi/Common.robot +Resource ../../../03-Variable/BifangApiVariable.txt +Library json +Library DateTime +*** Variables *** +${policyIds} ${EMPTY} +${objectids} ${EMPTY} +${categoryIds} ${EMPTY} +*** Test Cases *** +ForwardAddCategoriesOneFqdn + 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 + sleep ${policyModifySleepSeconds} + Comment query Max + QueryCategory pageSize=20&pageNo=1&categoryId=${categoryId}&orderBy=categoryId desc&categoryType=fqdn&categoryName=lkong&isInitialize=0&fqdn=lkong 200 + sleep ${policyModifySleepSeconds} + Comment update Category + ${addItemList1} Create Dictionary fqdn=*xinxin.lkong.net + ${addItemLists} Create list ${addItemList1} + ${objectDict} Create Dictionary objectId=${categoryObjId} categoryId=${categoryId} categoryType=fqdn categoryName=lkongchaoji objectSubType=category fqdnList=${addItemLists} + ${rescode} ${categoryObjId} ${categoryId} AddCategories ${1} ${objectDict} update 200 + ${categoryIds} set Variable ${categoryId} + +ForwardAddCategoriesMulFqdn + Comment 创建categories + ${addItemList1} Create Dictionary fqdn=$www.hao123.com + ${addItemList2} Create Dictionary fqdn=*huai123.com + ${addItemList3} Create Dictionary fqdn=*baidu.com + ${addItemList4} Create Dictionary fqdn=*kuxiu.com + ${addItemLists} Create list ${addItemList1} ${addItemList2} ${addItemList3} ${addItemList4} + ${objectDict} Create Dictionary categoryType=fqdn categoryName=lkong objectSubType=category isValid=${1} fqdnList=${addItemLists} + ${rescode} ${categoryObjId} ${categoryId} AddCategories ${1} ${objectDict} add 200 + ${categoryIds} set Variable ${categoryId} + +ReverseAddCategoriesMulFqdn1 + Comment 创建categories + ${addItemList1} Create Dictionary fqdn=cuowuwang.com + ${addItemLists} Create list ${addItemList1} + ${objectDict} Create Dictionary categoryType=fqdn categoryName=lkong objectSubType=category isValid=${1} fqdnList=${addItemLists} + ${rescode} ${categoryObjId} ${categoryId} AddCategories ${1} ${objectDict} add 40014018 + + Comment 创建categories + ${addItemList1} Create Dictionary fqdn=cuowuwang.com + ${addItemList2} Create Dictionary fqdn=*cuowuwang.com + ${addItemLists} Create list ${addItemList1} ${addItemList2} + ${objectDict} Create Dictionary categoryType=fqdn categoryName=lkong objectSubType=category isValid=${1} fqdnList=${addItemLists} + ${rescode} ${categoryObjId} ${categoryId} AddCategories ${1} ${objectDict} add 40014018 + +ReverseAddCategoriesMulFqdn2 + Comment 创建categories + ${addItemList1} Create Dictionary fqdn=*a + ${addItemLists} Create list ${addItemList1} + ${objectDict} Create Dictionary categoryType=fqdn categoryName=lkong objectSubType=category isValid=${1} fqdnList=${addItemLists} + ${rescode} ${categoryObjId} ${categoryId} AddCategories ${1} ${objectDict} add 40014006 + +ReverseSearchCategories1 + QueryCategory pageSize=20&pageNo=1&categoryId=abc 400 + +ReverseSearchCategories2 + QueryCategory pageSize=20&pageNo=1&categoryType=halala 40090025 + + + + + + \ No newline at end of file diff --git a/01-TestCase/tsg_bfapi/Object/Object_Compare.robot b/01-TestCase/tsg_bfapi/Object/Object_Compare.robot new file mode 100644 index 0000000..9ef01a1 --- /dev/null +++ b/01-TestCase/tsg_bfapi/Object/Object_Compare.robot @@ -0,0 +1,33 @@ +*** Settings *** +Test Teardown DeletePolicyAndGroupObject ${policyIds} ${objectIds} +Resource ../../../02-Keyword/tsg_bfapi/PolicyObject.robot +Resource ../../../02-Keyword/tsg_bfapi/policy_object/Policy.robot +Resource ../../../02-Keyword/tsg_bfapi/policy_object/Object.robot +Resource ../../../02-Keyword/tsg_bfapi/policy_object/Log.robot +Resource ../../../02-Keyword/tsg_bfapi/Common.robot +Resource ../../../03-Variable/ApplicationID.txt +Library ../../../04-CustomLibrary/Library/delUseless.py +Library ../../../04-CustomLibrary/Custometest/JsonDiff.py +Library json +Library DateTime +*** Variables *** +@{policyIds} +@{profiles} +${objectIds} ${EMPTY} +*** Test Cases *** +fqdn_001 + ${req_fqdn_data} Set Variable {"opAction":"add","refuseCode":true,"returnData":1,"objectList":{"objectType":"fqdn","objectSubType":"fqdn","isValid":1,"isInitialize":0,"isExclusion":0,"objectName":"hbn_test_fqdn","objectDesc":"","subObjectIds":[],"addItemList":[{"keywordArray":["*abcds"],"t":"16191477536650","itemId":"","isHexbin":0,"state":2}],"updateItemList":[],"deleteItemIds":[],"iconColor":"#31739C"}} + ${req_del_key} Create List objectType objectSubType + ${req_fqdn_data} deal ${req_fqdn_data} ${req_del_key} + log abcdefg + ${res_fqdn_data} Set Variable {"code":200,"msg":"Success","data":{"objectList":[{"addItemList":[{"isValid":1,"opUser":1527,"opTime":"2021-04-23 11:16:31","isInitialize":0,"itemName":null,"itemDesc":null,"isHexbin":0,"keywordArray":["abcds"],"itemId":4347060,"objectId":44552}],"deleteItemIds":[],"iconColor":"#31739C","isDisplay":null,"isExclusion":0,"isInitialize":0,"isValid":1,"memberType":1,"objectDesc":"","objectId":44552,"objectName":"hbn_test_fqdn","objectType":"fqdn","opTime":"2021-04-23 11:16:31","opUser":1527,"subObjectIds":[],"updateItemList":[]}]},"success":true} + ${res_del_key} Create List opUser opTime itemName itemDesc itemId objectId + ${res_fqdn_data} deal ${res_fqdn_data} ${res_del_key} + log ${res_fqdn_data} + ${res_code} json_diff ${req_fqdn_data} ${res_fqdn_data} + ${compare_code} Set Variable True + Should Be Equal As Strings ${res_code} ${compare_code} + log abcdesssssss + + + \ No newline at end of file diff --git a/02-Keyword/tsg_bfapi/LoginLogout.robot b/02-Keyword/tsg_bfapi/LoginLogout.robot index cc2ba15..7f9f5ba 100644 --- a/02-Keyword/tsg_bfapi/LoginLogout.robot +++ b/02-Keyword/tsg_bfapi/LoginLogout.robot @@ -16,7 +16,7 @@ InitPotocol ${appDict} Create Dictionary ${appVDict} Create Dictionary Connect To Database Using Custom Params pymysql ${mysqlHost} - ${app_id} query SELECT group_id,low_boundary,region_name FROM tsg_obj_app_id WHERE is_valid=1 + ${app_id} query SELECT group_id,low_boundary,region_name FROM tsg_obj_app_id WHERE is_valid=1 AND region_name='http' OR region_name='ssl' OR region_name='dns' OR region_name='ftp' OR region_name='mail' OR region_name='doh' OR region_name='rtp' OR region_name='sip' ${app_length} Get Length ${app_id} FOR ${n} IN RANGE ${app_length} log ${n} @@ -29,7 +29,43 @@ InitPotocol #供策略创建使用的appid SET GLOBAL VARIABLE ${objprotol} ${appDict} #供策略验证使用的appid - SET GLOBAL VARIABLE ${appportol} ${appVDict} + SET GLOBAL VARIABLE ${appportol} ${appVDict} + GetProtocol + +GetProtocol + ${HTTP_ID1} Get From Dictionary ${objprotol} http + ${RTP_ID1} Get From Dictionary ${objprotol} rtp + ${DNS_ID1} Get From Dictionary ${objprotol} dns + ${MAIL_ID1} Get From Dictionary ${objprotol} MAIL + ${FTP_ID1} Get From Dictionary ${objprotol} ftp + ${SIP_ID1} Get From Dictionary ${objprotol} sip + ${SSL_ID1} Get From Dictionary ${objprotol} ssl + ${DOH_ID1} Get From Dictionary ${objprotol} DoH + SET GLOBAL VARIABLE ${HTTP_ID} ${HTTP_ID1} + SET GLOBAL VARIABLE ${RTP_ID} ${RTP_ID1} + SET GLOBAL VARIABLE ${DNS_ID} ${DNS_ID1} + SET GLOBAL VARIABLE ${MAIL_ID} ${MAIL_ID1} + SET GLOBAL VARIABLE ${FTP_ID} ${FTP_ID1} + SET GLOBAL VARIABLE ${SIP_ID} ${SIP_ID1} + SET GLOBAL VARIABLE ${SSL_ID} ${SSL_ID1} + SET GLOBAL VARIABLE ${DOH_ID} ${DOH_ID1} + + ${HTTP_VID1} Get From Dictionary ${appportol} http + ${RTP_VID1} Get From Dictionary ${appportol} rtp + ${DNS_VID1} Get From Dictionary ${appportol} dns + ${MAIL_VID1} Get From Dictionary ${appportol} MAIL + ${FTP_VID1} Get From Dictionary ${appportol} ftp + ${SIP_VID1} Get From Dictionary ${appportol} sip + ${SSL_VID1} Get From Dictionary ${appportol} ssl + ${DOH_VID1} Get From Dictionary ${appportol} DoH + SET GLOBAL VARIABLE ${HTTP_VID} ${HTTP_VID1} + SET GLOBAL VARIABLE ${RTP_VID} ${RTP_VID1} + SET GLOBAL VARIABLE ${DNS_VID} ${DNS_VID1} + SET GLOBAL VARIABLE ${MAIL_VID} ${MAIL_VID1} + SET GLOBAL VARIABLE ${FTP_VID} ${FTP_VID1} + SET GLOBAL VARIABLE ${SIP_VID} ${SIP_VID1} + SET GLOBAL VARIABLE ${SSL_VID} ${SSL_VID1} + SET GLOBAL VARIABLE ${DOH_VID} ${DOH_VID1} Login [Tags] tsg_adc tsg_bf_api #[Arguments] ${username} ${password} ${authmode} ${authCode} ${ldapId} @@ -69,7 +105,7 @@ Login log ${token} SET GLOBAL VARIABLE ${headers} {"Contest-Type":"application/json","Authorization":"${token}"} #初始化接口中策略中引用协议和策略校验协议 - InitPotocol + Run Keyword If ${addPolicy}==1 InitPotocol #Return ${rescode} Logout [Tags] tsg_adc tsg_bf_api diff --git a/02-Keyword/tsg_bfapi/PolicyObject.robot b/02-Keyword/tsg_bfapi/PolicyObject.robot index 5fd0a3b..efd7f6d 100644 --- a/02-Keyword/tsg_bfapi/PolicyObject.robot +++ b/02-Keyword/tsg_bfapi/PolicyObject.robot @@ -4,7 +4,7 @@ Resource ../tsg_common/ManagePolicyBody.robot Resource ../tsg_common/ManageObjectBody.robot Resource ../../02-Keyword/tsg_bfapi/policy_file_interface/FunctionalKeywords.robot Resource ../../02-Keyword/tsg_bfapi/policy_object/Object.robot -Resource ../../02-Keyword/tsg_adc/FileOperation.robot +#Resource ../../02-Keyword/tsg_adc/FileOperation.robot Library REST http://${host}:${port} Library Collections Library RequestsLibrary @@ -348,11 +348,14 @@ DeleteProfiles Run Keyword If "${profile}"!="" and ${profile}!="${EMPTY}" DeleteProfile ${profile}[typeUrl] ${profile}[profileIds] END DeletePolicyAndObject - [Arguments] ${policyids} ${objectids} + [Arguments] ${policyids} ${objectids} ${categoriesId}=null #删除和对象 #2020-09-01修改,引用DeletePolicyAndGroupObject,避免分别维护并兼容之前用例 + # log ${categoriesId} ${objectId1} Create List [${objectids}] - DeletePolicyAndGroupObject ${policyIds} ${objectId1} + # log ${categoryId1} + ${categoryId1} Create List [${categoriesId}] + DeletePolicyAndGroupObject ${policyIds} ${objectId1} ${categoryId1} #删除策略 #log toDeletePolicy_DeletePolicyAndObject @@ -369,7 +372,7 @@ DeletePolicyAndObject # ... ELSE DeleteObject ${objectids} DeletePolicyAndGroupObject - [Arguments] ${policyids} ${objectids} + [Arguments] ${policyids} ${objectids} ${categoriesId} #引用此关键字,${objectids}参数必须是双层列表,eg:['[1]','[2,3]','[4,5,6,7]'] #删除和对象 #删除策略 @@ -380,9 +383,15 @@ DeletePolicyAndGroupObject #删除对象 log todeleteobj_DeletePolicyAndObject log ${objectids} + log ${categoriesId} Run Keyword If "${objectids}"=="${EMPTY}" log no Objects to del ... ELSE IF ${objectids}==['[]'] log no Objects to del - ... ELSE DeleteGroupObjects ${objectids} + # ... ELSE IF "${categoryids}"=="${EMPTY}" or ${categoryids}==['[]'] log no Categories to del + # ... ELSE IF ${categoryids}==['[]'] log no Categories to del + ... ELSE DeleteGroupObjects ${objectids} + log ${categoriesId} + Run Keyword If "${categoriesId}"=="${EMPTY}" or ${categoriesId}==['[null]'] or ${categoriesId}==['[]'] log no Categories to del + ... ELSE DeleteGroupCategories ${categoriesId} DeletePolicys [Arguments] ${policyids} ${listlenth}= Get Length ${policyids} @@ -391,20 +400,53 @@ DeletePolicys DeletePolicy ${policyids}[${var}] END DeleteGroupObjects - [Arguments] ${objectids} + [Arguments] ${objectids} FOR ${var} IN @{objectids} log ${var} DeleteGroupObject ${var} END + +DeleteGroupCategories + [Arguments] ${categoryids} + FOR ${var} IN @{categoryids} + log ${var} + DeleteGroupCategory ${var} + END + DeleteGroupObject - [Arguments] ${objectids} + [Arguments] ${objectids} #删除对象 - log todeleteobj + log todeleteobjAndCategory ${response} BaseDeleteRequest /${version}/policy/object {"objectIds":${objectids}} ${response_code} Get From Dictionary ${response} code Should Be Equal As Strings ${response_code} 200 ${response} Convert to String ${response} + # ${response} BaseDeleteRequest /${version}/policy/object {"objectIds":${objectids}} + # ${response_code} Get From Dictionary ${response} code + # Should Be Equal As Strings ${response_code} 200 + # ${response} Convert to String ${response} log ${response} + +DeleteGroupCategory + [Arguments] ${categoryids} + #删除对象 + log todeleteobjAndCategory + ${response} BaseDeleteRequest /${version}/category/dict {"categoryIds":${categoryids}} + ${response_code} Get From Dictionary ${response} code + Should Be Equal As Strings ${response_code} 200 + ${response} Convert to String ${response} + log ${response} + +DeleteCategory + [Arguments] ${categoryids} + #删除对象 + log todeleteobjAndCategory + ${response} BaseDeleteRequest /${version}/category/dict {"categoryIds":[${categoryids}]} + ${response_code} Get From Dictionary ${response} code + Should Be Equal As Strings ${response_code} 200 + ${response} Convert to String ${response} + log ${response} + DeletePolicyAndObjectAndProfile [Arguments] ${policyids} ${objectids} ${profiles} DeletePolicyAndObject ${policyids} ${objectids} @@ -413,7 +455,7 @@ DeleteAfterCase [Arguments] ${policyids} ${objectids} Run Keyword If '${testPart}'=='all' or '${testPart}'=='3' DeletePolicyAndObject ${policyids} ${objectids} DeletePolicyAndObject1 - [Arguments] ${policyids} ${objectids} ${url} ${profiledId} + [Arguments] ${policyids} ${objectids} ${url} ${profiledId} ${categoryIds}=null #删除策略 log toDeletePolicy_DeletePolicyAndObject ${listlenth}= Get Length ${policyids} @@ -429,6 +471,12 @@ DeletePolicyAndObject1 log todeleteobj_DeletePolicyAndObject Run Keyword If "${profiledId}"=="${EMPTY}" log no file to del ... ELSE DeletePolicyFile1 ${url} ${profiledId} + #删除Category + log ${categoryIds} + log todeleteCat_DeletePolicyAndObject + Run Keyword If "${categoryIds}"=="${EMPTY}" log no category to del + ... ELSE IF "${categoryIds}"=="null" log no category to del + ... ELSE DeleteCategory ${categoryIds} DeletePolicyAndObjectAndVpn [Arguments] ${policyids} ${objectids} ${wan_vpn} @@ -474,4 +522,13 @@ DeletePolicyAndObjectAndIPpoor log todelete_wan_vpn Run Keyword If "${wan_ippoor}"=="${EMPTY}" log no vpn to del ... ELSE DeleteWanIpPood ${wan_ippoor} + +GetIniCategoryId + [Arguments] ${categoryName} + Connect To Database Using Custom Params pymysql ${mysqlHost} + ${iniCategoryId} query SELECT group_id FROM tsg_obj_fqdn_cat WHERE low_boundary IN (SELECT category_id FROM tsg_category_dict WHERE category_name='${categoryName}') AND is_initialize=1 + Disconnect From Database + ${iniCategoryId} Set Variable ${iniCategoryId}[0][0] + [Return] ${iniCategoryId} + \ No newline at end of file diff --git a/02-Keyword/tsg_bfapi/policy_object/Object.robot b/02-Keyword/tsg_bfapi/policy_object/Object.robot index e852fe9..8458d47 100644 --- a/02-Keyword/tsg_bfapi/policy_object/Object.robot +++ b/02-Keyword/tsg_bfapi/policy_object/Object.robot @@ -284,15 +284,10 @@ AppIdTreeSearch Should Be Equal As Strings ${rescode} 200 [Return] ${response['data']} + AddCategories - [Arguments] ${returnData} ${categoryList} - [Documentation] 新增策略对象 - ... objectList,策略对象,可为list类型与dict类型 - ... addItemList自动过滤itemId - ... updateItemList自动过滤isInitialize(update时该字段引发异常) - ... ipItem格式为dict,自动过滤空的字段 - ... stringItem格式为dict,需要注意keywordArray字段应传入逗号分隔的字符串eg: keyword1,keyword2 - ... http_signature为代表的拓展关键字keywordArray字段也是以逗号分隔的 + [Arguments] ${returnData} ${categoryList} ${opAction} ${testCode}=null + [Documentation] 新增Category ... returnData,是否返回数据,固定为1 Comment 此处思路给category单独的另一套关键字,原因:地址与json串名称与Object部分不同了 ${returnData}= Run Keyword If '${returnData}' == '${EMPTY}' Set Variable 1 @@ -300,20 +295,37 @@ AddCategories #必选参数判定 Should Not Be Empty ${categoryList} ${dictType} = Evaluate type(${categoryList}) - ${body} Run Keyword If "${dictType}" == "" CategoryListOperation ${returnData} ${categoryList} add - ... ELSE IF "${dictType}" == "" CategoryOperation ${returnData} ${categoryList} add + ${body} Run Keyword If "${dictType}" == "" CategoryListOperation ${returnData} ${categoryList} ${opAction} + ... ELSE IF "${dictType}" == "" CategoryOperation ${returnData} ${categoryList} ${opAction} + ... ELSE Set Variable ${EMPTY} + + log ${body} + # ${response} BasePostRequestForV2 ${categoryUrl} ${body} ${version} + ${response} Run Keyword If "${opAction}"=="add" BasePostRequestForV2 ${categoryUrl} ${body} ${version} + ... ELSE IF "${opAction}"=="update" BaseEditRequestForV2 ${categoryUrl} ${body} ${version} + ${CategoryObjIds} Run Keyword If "${returnData}" == "1" and ${testCode} == 200 and "${opAction}"=="add" Get-CategoryObjIds ${response} + ... ELSE Set Variable ${EMPTY} + ${CategoryIds} Run Keyword If "${returnData}" == "1" and ${testCode} == 200 and "${opAction}"=="add" Get-CategoryIds ${response} ... ELSE Set Variable ${EMPTY} - ${response} BasePostRequestForV2 ${categoryUrl} ${body} ${version} - ${CategoryIds} Run Keyword If "${returnData}" == "1" Get-CategoryIds ${response} - ... ELSE Create List ${rescode} Set Variable ${response['code']} - Should Be Equal As Strings ${rescode} 200 - [Return] ${rescode} ${CategoryIds} + Should Be Equal As Strings ${rescode} ${testCode} + [Return] ${rescode} ${CategoryObjIds} ${CategoryIds} + + QueryUpadateRecord [Arguments] ${body} ${code} ${response} BaseGetRequestOK /${version}/system/feature/update body=${body} log ${response} ${rescode} Set Variable ${response['code']} - Shoule Be Equal As Strings ${rescode} ${code} + Should Be Equal As Strings ${rescode} ${code} [Return] ${rescode} + +QueryCategory + #hbn + [Arguments] ${body} ${code} + ${response} BaseGetRequest /${version}/category/dict body=${body} + log ${response} + ${rescode} Set Variable ${response['code']} + Should Be Equal As Strings ${rescode} ${code} + # [Return] ${rescode} ${response} diff --git a/02-Keyword/tsg_bfapi/policy_object/ProcessObjectBody.robot b/02-Keyword/tsg_bfapi/policy_object/ProcessObjectBody.robot index 858ce76..887ee58 100644 --- a/02-Keyword/tsg_bfapi/policy_object/ProcessObjectBody.robot +++ b/02-Keyword/tsg_bfapi/policy_object/ProcessObjectBody.robot @@ -130,7 +130,7 @@ CategoryOperation ${json} CategoryOrganize ${category} ${opAction} # 转为json结构并返回 - ${dict} Create Dictionary opAction=${opAction} returnData=${returnData} categoryList=replace:objectList + ${dict} Create Dictionary opAction=${opAction} returnData=${returnData} list=replace:objectList ${bodyJson} json.Dumps ${dict} ensure_ascii=False ${json} Replace String ${bodyJson} "replace:objectList" ${json} @@ -261,6 +261,7 @@ CategoryOrganize #新增时addItemList不能为空 Run Keyword If "${opAction}"=="add" Categorylistorone ${category} Run Keyword If "${opAction}"=="update" Should Not Be Empty ${category}[categoryId] + Run Keyword If "${opAction}"=="update" Should Not Be Empty ${category}[objectId] ${return} ${objectId} Run Keyword And Ignore Error Get From Dictionary ${category} objectId Run Keyword If "${return}"=="FAIL" or "${objectId}"=="${EMPTY}" Set To Dictionary ${returnDict} objectId=${EMPTY} ... ELSE Set To Dictionary ${returnDict} objectId=${objectId} @@ -297,14 +298,10 @@ CategoryOrganize ... ELSE Set To Dictionary ${returnDict} objectSubType=${Default_ObjectSubType} # 处理AddItemList ${return} ${addItemList} Run Keyword And Ignore Error Get From Dictionary ${category} fqdnList - Run Keyword If "${return}"!="FAIL" and "${addItemList}"!="${EMPTY}" ManageAddItemListNew ${addItemList} ${returnDict} ${categoryTypeV} ${objectSubType} + Run Keyword If "${opAction}"=="add" Should Not Be Empty ${addItemList} + # Run Keyword If "${return}"!="FAIL" and "${addItemList}"!="${EMPTY}" ManageAddItemListNew ${addItemList} ${returnDict} ${categoryTypeV} ${objectSubType} + ManageAddItemListNew ${addItemList} ${returnDict} ${categoryTypeV} ${objectSubType} - # 处理UpdateItemList - ${return} ${updateItemList} Run Keyword And Ignore Error Get From Dictionary ${category} updateItemList - Run Keyword If "${opAction}"=="update" and "${return}"!="FAIL" and "${updateItemList}"!="${EMPTY}" ManageUpdateItemList ${updateItemList} ${returnDict} ${objectTypeV} ${objectSubType} - # 处理deleteItemIds - ${return} ${deleteItemIds} Run Keyword And Ignore Error Get From Dictionary ${category} deleteItemIds - Run Keyword If "${opAction}"=="update" and "${return}"!="FAIL" and "${deleteItemIds}"!="${EMPTY}" ManageDeleteItemIds ${deleteItemIds} ${returnDict} # 删除无用判断key值objectSubType Remove From Dictionary ${returnDict} objectSubType # 转为json结构并返回 @@ -354,7 +351,7 @@ ManageUpdateItemList ${itemNew} Run Keyword If '${type}'=='ip' and '${subType}'=="geo_location" ManageGeoItem ${item} ${subType} update ... ELSE IF '${type}'=='ip' ManageIpItem ${item} ${subType} update - ... ELSE IF '${type}'=='url' or '${type}'=='fqdn' or '${type}'=='keywords' or '${type}'=='subscriberid' or '${type}'=='fqdn_category' or '${type}'=='account' or '${type}'=='app_id' + ... ELSE IF '${type}'=='url' or ('${type}'=='fqdn' and '${subType}'!='category') or '${type}'=='keywords' or '${type}'=='subscriberid' or '${type}'=='fqdn_category' or '${type}'=='account' or '${type}'=='app_id' ... ManageStrItem ${item} ${type} update ... ELSE IF '${type}'=='file_type' ManageFileItem ${item} ${type} update ... ELSE IF '${type}'=='http_signature' ManageExtensionStrItem ${item} ${type} update @@ -365,7 +362,9 @@ ManageUpdateItemList Remove From Dictionary ${itemNew} isInitialize Append To List ${itemList} ${itemNew} END - Set To Dictionary ${returnDict} updateItemList=${itemList} + # Set To Dictionary ${returnDict} updateItemList=${itemList} + Run Keyword If '${subType}'=='category' Set To Dictionary ${returnDict} fqdnList=${itemList} + ... ELSE Set To Dictionary ${returnDict} updateItemList=${itemList} ManageIpItem [Documentation] ... ip item处理 @@ -459,17 +458,8 @@ ManageCategory ${return} ${fqdn} Run Keyword And Ignore Error Set Variable ${item['fqdn']} ${fqdn} Run Keyword If "${return}"!="FAIL" Set Variable ${fqdn} ELSE Set Variable ${EMPTY} Run Keyword If "${action}"=="add" Should Not Be Empty ${fqdn} - ${fqdn} Evaluate re.split('[,]', '${fqdn}') re - - # ${return} ${isInitialize} Run Keyword And Ignore Error Set Variable ${item['isInitialize']} - # ${isInitialize} Run Keyword If "${return}"!="FAIL" Set Variable ${isInitialize} - # ... ELSE Set Variable ${EMPTY} - # ${return} ${itemName} Run Keyword And Ignore Error Set Variable ${item['isDelete']} - # ${itemName} Run Keyword If "${return}"!="FAIL" Set Variable ${isDelete} ${itemNew} Create Dictionary Run Keyword If "${fqdn}"!="${EMPTY}" Set To Dictionary ${itemNew} fqdn=${fqdn} - # Run Keyword If "${isInitialize}"!="${EMPTY}" Set To Dictionary ${itemNew} isInitialize=${isInitialize} - # Run Keyword If "${isDelete}"!="${EMPTY}" Set To Dictionary ${itemNew} isDelete=${isDelete} [Return] ${itemNew} ManageFileItem @@ -526,11 +516,29 @@ Get-ObjectIds ${json} Remove String ${json} ] [Return] ${json} +Get-CategoryObjIds + [Documentation] + ... 获取Category结果中的对象ID + [Arguments] ${value} + Log Call Get-CategoryObjectIds + ${CategoryObjIds} Create List + ${CategoryTemp} Set Variable ${EMPTY} + ${return} ${data} Run Keyword And Ignore Error Get From Dictionary ${value} data + Return From Keyword If "${return}"=="FAIL" ${CategoryTemp} + + FOR ${category} IN @{value['data']['list']} + Append To List ${CategoryObjIds} ${category['objectId']} + END + ${json} json.Dumps ${CategoryObjIds} ensure_ascii=False + ${json} Remove String ${json} [ + ${json} Remove String ${json} ] + [Return] ${json} + Get-CategoryIds [Documentation] - ... 获取结果中的对象ID + ... 获取Category结果中的对象ID [Arguments] ${value} - Log Call Get-ObjectIds + Log Call Get-CategoryObjectIds ${CategoryIds} Create List ${CategoryTemp} Set Variable ${EMPTY} ${return} ${data} Run Keyword And Ignore Error Get From Dictionary ${value} data @@ -542,4 +550,4 @@ Get-CategoryIds ${json} json.Dumps ${CategoryIds} ensure_ascii=False ${json} Remove String ${json} [ ${json} Remove String ${json} ] - [Return] ${json} \ No newline at end of file + [Return] ${json} \ No newline at end of file diff --git a/05-Other/curl/command/ProxyPolicy_allow_00003_3.bat b/05-Other/curl/command/ProxyPolicy_allow_00003_3.bat index 5a86d19..0c200af 100644 --- a/05-Other/curl/command/ProxyPolicy_allow_00003_3.bat +++ b/05-Other/curl/command/ProxyPolicy_allow_00003_3.bat @@ -1 +1 @@ -curl -kv https://lunar.pw/| iconv -f utf-8 -t gbk \ No newline at end of file +curl -kv https://russia.payu.com/ \ No newline at end of file diff --git a/05-Other/curl/command/ProxyPolicy_allow_00010_L.bat b/05-Other/curl/command/ProxyPolicy_allow_00010_L.bat index fae8a0e..d13cfe8 100644 --- a/05-Other/curl/command/ProxyPolicy_allow_00010_L.bat +++ b/05-Other/curl/command/ProxyPolicy_allow_00010_L.bat @@ -1 +1 @@ -curl http://www.gf.com.cn/about/intro | iconv -f utf-8 -t gbk \ No newline at end of file +curl http://www.gf.com.cn/about/intro -f utf-8 -t gbk \ No newline at end of file diff --git a/05-Other/curl/command/ProxyPolicy_allow_00012_2L.bat b/05-Other/curl/command/ProxyPolicy_allow_00012_2L.bat index 9c7e078..193c7fb 100644 --- a/05-Other/curl/command/ProxyPolicy_allow_00012_2L.bat +++ b/05-Other/curl/command/ProxyPolicy_allow_00012_2L.bat @@ -1 +1 @@ -curl -kv --cookie "UM_distinctid=177195d2f67c6b-06a24c7c217958-31346d-384000-177195d2f68bcf; CNZZDATA1279340671=485789824-1611035725-null%7C1611035725; Hm_lvt_76131d7573faf448cb1cfa2a37e6e3ff=1611038274; Hm_lpvt_76131d7573faf448cb1cfa2a37e6e3ff=1611038274; _csrfToken=hcK679WZm6N2HCbL4lEBi8VIc5GD6d3nVrFPZTDP; newstatisticUUID=1611038276_1033864685" --referer 'https://www.baidu.com/' https://www.hongxiu.com/ \ No newline at end of file +curl -kv --cookie "UM_distinctid=177195d2f67c6b-06a24c7c217958-31346d-384000-177195d2f68bcf; CNZZDATA1279340671=485789824-1611035725-null%7C1611035725; Hm_lvt_76131d7573faf448cb1cfa2a37e6e3ff=1611038274; Hm_lpvt_76131d7573faf448cb1cfa2a37e6e3ff=1611038274; _csrfToken=hcK679WZm6N2HCbL4lEBi8VIc5GD6d3nVrFPZTDP; newstatisticUUID=1611038276_1033864685" --referer 'https://www.baidu.com/' https://www.hongxiu.com/ | iconv -f utf-8 -t gbk \ No newline at end of file diff --git a/05-Other/curl/command/ProxyPolicy_allow_00012_3L.bat b/05-Other/curl/command/ProxyPolicy_allow_00012_3L.bat index ba1f5ff..836f8a6 100644 --- a/05-Other/curl/command/ProxyPolicy_allow_00012_3L.bat +++ b/05-Other/curl/command/ProxyPolicy_allow_00012_3L.bat @@ -1 +1 @@ -curl -kv --cookie "_csrfToken=qjRd8SBOkzGEgOrCAvpDpRLD0hqTSIoNDVZ6DpbU; newstatisticUUID=1611038238_1406562325" --referer 'https://www.baidu.com/' https://www.readnovel.com/ \ No newline at end of file +curl -kv --cookie "_csrfToken=qjRd8SBOkzGEgOrCAvpDpRLD0hqTSIoNDVZ6DpbU; newstatisticUUID=1611038238_1406562325" --referer 'https://www.baidu.com/' https://www.readnovel.com/ | iconv -f utf-8 -t gbk \ No newline at end of file diff --git a/05-Other/curl/command/ProxyPolicy_allow_00013.bat b/05-Other/curl/command/ProxyPolicy_allow_00013.bat index 2f09304..bfad619 100644 --- a/05-Other/curl/command/ProxyPolicy_allow_00013.bat +++ b/05-Other/curl/command/ProxyPolicy_allow_00013.bat @@ -1 +1 @@ -curl -kv https://russia.payu.com/orange-data/ | iconv -f utf-8 -t gbk \ No newline at end of file +curl -kv https://russia.payu.com/ \ No newline at end of file diff --git a/05-Other/curl/command/ProxyPolicy_hijack_00005.bat b/05-Other/curl/command/ProxyPolicy_hijack_00005.bat index 51eb208..7f022c5 100644 --- a/05-Other/curl/command/ProxyPolicy_hijack_00005.bat +++ b/05-Other/curl/command/ProxyPolicy_hijack_00005.bat @@ -1,2 +1,2 @@ -curl -kv --user-agent "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.85 Safari/537.36" --referer 'https://www.baidu.com/' https://www.ixigua.com/channel/dianying/ | iconv -f utf-8 -t gb2312 +curl -kv --user-agent "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML like Gecko) Chrome/31.0.1650.63 Safari/537.36" --referer 'https://www.baidu.com/' https://www.ixigua.com/channel/dianying/ | iconv -f utf-8 -t gb2312 diff --git a/05-Other/curl/command/ProxyPolicy_hijack_00005_L.bat b/05-Other/curl/command/ProxyPolicy_hijack_00005_L.bat index 846f6bd..6336a26 100644 --- a/05-Other/curl/command/ProxyPolicy_hijack_00005_L.bat +++ b/05-Other/curl/command/ProxyPolicy_hijack_00005_L.bat @@ -1 +1 @@ -curl -kv --user-agent "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML like Gecko) Chrome/31.0.1650.63 Safari/537.36" --referer 'https://www.baidu.com/' https://www.ixigua.com/channel/dianying/ \ No newline at end of file +curl -kv --user-agent "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML like Gecko) Chrome/31.0.1650.63 Safari/537.36" --referer 'https://www.baidu.com/' https://www.ixigua.com/channel/dianying/ | iconv -f utf-8 -t gbk \ No newline at end of file diff --git a/05-Other/curl/command/ProxyPolicy_hijack_00012_L.bat b/05-Other/curl/command/ProxyPolicy_hijack_00012_L.bat index 3350a28..f01d33d 100644 --- a/05-Other/curl/command/ProxyPolicy_hijack_00012_L.bat +++ b/05-Other/curl/command/ProxyPolicy_hijack_00012_L.bat @@ -1 +1 @@ -curl -kv --cookie "lQfQ_2132_saltkey=t8WY1oPe; lQfQ_2132_lastvisit=1595381790; lQfQ_2132_sid=vqXOg6; lQfQ_2132_lastact=1595385400%09forum.php%09image" --referer 'https://www.baidu.com/' https://www.reval.com/corporates/ \ No newline at end of file +curl -kv --cookie "lQfQ_2132_saltkey=t8WY1oPe; lQfQ_2132_lastvisit=1595381790; lQfQ_2132_sid=vqXOg6; lQfQ_2132_lastact=1595385400%09forum.php%09image" --referer 'https://www.baidu.com/' https://www.reval.com/corporates/ | iconv -f utf-8 -t gbk \ No newline at end of file diff --git a/05-Other/curl/command/ProxyPolicy_insert_00009_L.bat b/05-Other/curl/command/ProxyPolicy_insert_00009_L.bat index b414970..4fbd77e 100644 --- a/05-Other/curl/command/ProxyPolicy_insert_00009_L.bat +++ b/05-Other/curl/command/ProxyPolicy_insert_00009_L.bat @@ -1 +1 @@ -curl -kv http://www.world-guides.com/north-america/usa/nevada/las-vegas/ \ No newline at end of file +curl -kv http://www.world-guides.com/north-america/usa/nevada/las-vegas/ | iconv -f utf-8 -t gbk \ No newline at end of file diff --git a/05-Other/curl/command/ProxyPolicy_insert_00010_L.bat b/05-Other/curl/command/ProxyPolicy_insert_00010_L.bat index cb2166a..75a3a14 100644 --- a/05-Other/curl/command/ProxyPolicy_insert_00010_L.bat +++ b/05-Other/curl/command/ProxyPolicy_insert_00010_L.bat @@ -1 +1 @@ -curl -kv http://news.cnstock.com/kcb | iconv -f utf-8 -t gbk \ No newline at end of file +curl -kv http://news.cnstock.com/kcb | iconv -f utf-8 -t unicode \ No newline at end of file diff --git a/05-Other/curl/command/ProxyPolicy_replace_00003_1L.bat b/05-Other/curl/command/ProxyPolicy_replace_00003_1L.bat new file mode 100644 index 0000000..a374795 --- /dev/null +++ b/05-Other/curl/command/ProxyPolicy_replace_00003_1L.bat @@ -0,0 +1 @@ +curl -kv https://www.pjpugliese.com/ | iconv -f utf-8 -t gbk \ No newline at end of file diff --git a/05-Other/curl/command/ProxyPolicy_replace_00003_2L.bat b/05-Other/curl/command/ProxyPolicy_replace_00003_2L.bat new file mode 100644 index 0000000..c77a6e2 --- /dev/null +++ b/05-Other/curl/command/ProxyPolicy_replace_00003_2L.bat @@ -0,0 +1 @@ +curl -kv --user-agent "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.70 Safari/537.36" https://carblog.co.za/ | iconv -f utf-8 -t gbk \ No newline at end of file diff --git a/05-Other/curl/command/ProxyPolicy_replace_00003_3L.bat b/05-Other/curl/command/ProxyPolicy_replace_00003_3L.bat new file mode 100644 index 0000000..6595a3c --- /dev/null +++ b/05-Other/curl/command/ProxyPolicy_replace_00003_3L.bat @@ -0,0 +1 @@ +curl -kv https://www.ornithomedia.com/ | iconv -f utf-8 -t gbk \ No newline at end of file diff --git a/05-Other/curl/command/ProxyPolicy_replace_00003_L.bat b/05-Other/curl/command/ProxyPolicy_replace_00003_L.bat new file mode 100644 index 0000000..bb10de7 --- /dev/null +++ b/05-Other/curl/command/ProxyPolicy_replace_00003_L.bat @@ -0,0 +1 @@ +curl -kv --user-agent "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.70 Safari/537.36" https://umcfa.webs.com/ | iconv -f utf-8 -t gbk \ No newline at end of file diff --git a/05-Other/curl/command/ProxyPolicy_replace_00014.bat b/05-Other/curl/command/ProxyPolicy_replace_00014.bat index 2a0e4ea..d00db1e 100644 --- a/05-Other/curl/command/ProxyPolicy_replace_00014.bat +++ b/05-Other/curl/command/ProxyPolicy_replace_00014.bat @@ -1 +1 @@ -curl -kv -L --user-agent "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML like Gecko) Chrome/31.0.1650.63 Safari/537.36" --cookie "__cfduid=d5c21129d57e7124b729fd86dc82abdcd1596020306; __stripe_sid=2940d4d5-6822-4daf-8b38-9cd18d745beb; __stripe_mid=dd118cd8-845c-4b6e-98ce-81e8d5bdd52c" --referer 'https://www.baidu.com/' \ https://www.engadget.com/gaming/ | iconv -f utf-8 -t gbk \ No newline at end of file +curl -kv -L --user-agent "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML like Gecko) Chrome/31.0.1650.63 Safari/537.36" --cookie "__cfduid=d5c21129d57e7124b729fd86dc82abdcd1596020306; __stripe_sid=2940d4d5-6822-4daf-8b38-9cd18d745beb; __stripe_mid=dd118cd8-845c-4b6e-98ce-81e8d5bdd52c" --referer 'https://www.baidu.com/' https://www.engadget.com/gaming/ | iconv -f utf-8 -t gbk \ No newline at end of file diff --git a/05-Other/curl/command/SecurityPolicy_Deny_HTTP_00013_1.bat b/05-Other/curl/command/SecurityPolicy_Deny_HTTP_00013_1.bat index 0f0eaf7..3f6b22b 100644 --- a/05-Other/curl/command/SecurityPolicy_Deny_HTTP_00013_1.bat +++ b/05-Other/curl/command/SecurityPolicy_Deny_HTTP_00013_1.bat @@ -1 +1 @@ -curl --connect-timeout 5 -m 10 -w %{http_code} blog.cnstock.com | iconv -f utf-8 -t gbk \ No newline at end of file +curl --connect-timeout 5 -m 10 -kv http://blog.cnstock.com/ | iconv -f utf-8 -t gbk \ No newline at end of file diff --git a/05-Other/curl/command/SecurityPolicy_Deny_SSL_00004_L.bat b/05-Other/curl/command/SecurityPolicy_Deny_SSL_00004_L.bat index 4bf7153..43ca002 100644 --- a/05-Other/curl/command/SecurityPolicy_Deny_SSL_00004_L.bat +++ b/05-Other/curl/command/SecurityPolicy_Deny_SSL_00004_L.bat @@ -1 +1 @@ -curl --connect-timeout 5 -m 10 -kv --referer 'http://www.baidu.com/' https://www.prlib.ru \ No newline at end of file +curl --connect-timeout 5 -m 10 -kv --referer 'http://www.baidu.com/' https://www.prlib.ru | iconv -f utf-8 -t ISO8859-1 \ No newline at end of file diff --git a/05-Other/curl/command/SecurityPolicy_Intercept_HTTP_00004_L.bat b/05-Other/curl/command/SecurityPolicy_Intercept_HTTP_00004_L.bat new file mode 100644 index 0000000..8a6f1a6 --- /dev/null +++ b/05-Other/curl/command/SecurityPolicy_Intercept_HTTP_00004_L.bat @@ -0,0 +1 @@ +curl http://www.zongheng.com/ | iconv -f utf-8 -t gbk \ No newline at end of file diff --git a/05-Other/curl/command/SecurityPolicy_Monitor_HTTP_00001.bat b/05-Other/curl/command/SecurityPolicy_Monitor_HTTP_00001.bat index d915c72..35efb31 100644 --- a/05-Other/curl/command/SecurityPolicy_Monitor_HTTP_00001.bat +++ b/05-Other/curl/command/SecurityPolicy_Monitor_HTTP_00001.bat @@ -1 +1 @@ -curl http://nerdreactor.com/latest-posts/ | iconv -f utf-8 -t gbk \ No newline at end of file +curl http://www.jrj.com.cn/ | iconv -f gbk -t gbk \ No newline at end of file diff --git a/05-Other/curl/command/SecurityPolicy_Monitor_HTTP_00006.bat b/05-Other/curl/command/SecurityPolicy_Monitor_HTTP_00006.bat index f425a3f..824eed9 100644 --- a/05-Other/curl/command/SecurityPolicy_Monitor_HTTP_00006.bat +++ b/05-Other/curl/command/SecurityPolicy_Monitor_HTTP_00006.bat @@ -1 +1 @@ -curl -kv --user-agent "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.70 Safari/537.36" --referer 'http://www.baidu.com/' \ curl http://ww1.dollshouseforum.com/ | iconv -f utf-8 -t gbk \ No newline at end of file +curl -kv --user-agent "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.70 Safari/537.36" http://licaike.hexun.com/self_search?fundType=01 | iconv -f utf-8 -t gbk \ No newline at end of file diff --git a/05-Other/curl/command/SecurityPolicy_Monitor_HTTP_00008.bat b/05-Other/curl/command/SecurityPolicy_Monitor_HTTP_00008.bat index 73edfe9..2460749 100644 --- a/05-Other/curl/command/SecurityPolicy_Monitor_HTTP_00008.bat +++ b/05-Other/curl/command/SecurityPolicy_Monitor_HTTP_00008.bat @@ -1 +1 @@ -curl http://www.tccb.com.cn/grjr/index.shtml | iconv -f utf-8 -t gbk \ No newline at end of file +curl -kv --user-agent "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.70 Safari/537.36" http://www.tccb.com | iconv -f utf-8 -t gbk \ No newline at end of file diff --git a/05-Other/curl/command/SecurityPolicy_Monitor_SSL_00004.bat b/05-Other/curl/command/SecurityPolicy_Monitor_SSL_00004.bat index 5738134..0762f9f 100644 --- a/05-Other/curl/command/SecurityPolicy_Monitor_SSL_00004.bat +++ b/05-Other/curl/command/SecurityPolicy_Monitor_SSL_00004.bat @@ -1 +1 @@ -curl --user-agent "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.70 Safari/537.36" https://www.iqiyi.com/ | iconv -f utf-8 -t gbk \ No newline at end of file +curl --user-agent "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.70 Safari/537.36" https://nerdreactor.com/ | iconv -f utf-8 -t gbk \ No newline at end of file