用shell抓取某考试试题

一、背景

最近公司组织考信息安全,但考试机构没有整理出试题,只给了以下几个在线练习的链接,想着用博客整理下题库题型,奈何这个只能用拍照图片,然后用图片转文字的方式太慢,累死个人了,寻思着从接口读出所有试题。。

纯属技术分享,对试题感兴趣可以练习,都是信息安全知识


二、流程观察

1.在线的试题包括:单选题、多选题、判断题

单选 https://app3Audc5201856.h5.xiaoeknow.com/v1/evaluation_wechat/practice/wb_5e69a60334e2f_lfE62mBD?type=2

多选 https://app3Audc5201856.h5.xiaoeknow.com/v1/evaluation_wechat/practice/wb_5e69a4ce1e626_8KxgBZn5?type=2

判断 https://app3Audc5201856.h5.xiaoeknow.com/v1/evaluation_wechat/practice/wb_5e69982857d44_HcXQxLDv?type=2


2.做题过程

流程是:访问链接 - 微信扫码 - 做题界面 - 观察规律

单选题有100道,看着有4个选项(ABCD),序号从0到99.
多选题有100道,看着有4~ 4+个选项(ABCD or ABCDE...),序号从0到99.
判断题有100道,看着有2个选项(正确/错误),序号从0到99.

微信扫码如图:


做题界面:
单选题

多选题

判断题


3.接口返回

叫了开发工程师帮忙观察的, thank boy


按f12进入页面调试模式

谷歌浏览器

【网络(network)】 - 【停用缓存】|【保留日志】 - 【Fetch/XHR】

xhr,全称为XMLHttpRequest,用于与服务器交互数据,是ajax功能实现所依赖的对象,jquery中的ajax就是对 xhr的封装

大白话就是: 这是数据返回的结果

点我查看【 什么是xhr?】


f12调试模式如下图:

页面返回接口观察

发现 get_paper_question 接口有大量返回


发现0数组是第1道题目,0数组里面有0-3个数组是题目选项
也就是是 n数组就是题目n+1, n下有4个选项。

题目1选项1 [0]0 
题目1选项2 [0]1
题目1选项3 [0]2
题目1选项4 [0]3

题目2选项1 [1]0 
题目2选项2 [1]1
题目2选项3 [1]2
题目2选项4 [1]3


api接口观察

# curl 'https://app3audc5201856.h5.xiaoeknow.com/evaluation_wechat/practices/get_paper_question'   -H 'authority: app3audc5201856.h5.xiaoeknow.com'   -H 'accept: application/json, text/plain, */*'   -H 'accept-language: zh-CN,zh;q=0.9'   -H 'cache-control: no-cache'   -H 'content-type: application/x-www-form-urlencoded'   -H 'cookie: sensorsdata2015jssdkcross=%7B%22%24device_id%22%3A%2218257681c4c39e-0390a33cc29205-c4e7526-2073600-18257681c4dcfe%22%7D; sa_jssdk_2015_app3audc5201856_h5_xiaoeknow_com=%7B%22distinct_id%22%3A%2218257681c4c39e-0390a33cc29205-c4e7526-2073600-18257681c4dcfe%22%2C%22first_id%22%3A%22%22%2C%22props%22%3A%7B%22%24latest_traffic_source_type%22%3A%22%E7%9B%B4%E6%8E%A5%E6%B5%81%E9%87%8F%22%2C%22%24latest_search_keyword%22%3A%22%E6%9C%AA%E5%8F%96%E5%88%B0%E5%80%BC_%E7%9B%B4%E6%8E%A5%E6%89%93%E5%BC%80%22%2C%22%24latest_referrer%22%3A%22%22%7D%7D; ko_token=99b1450fc1b8cba28db705f4462ad155; xiaoe_loading_show=1; shop_version_type=4; dataUpJssdkCookie={"wxver":"","net":"","sid":"1659601468103_tlacsv"}; logintime=1659601475'   -H 'origin: https://app3audc5201856.h5.xiaoeknow.com'   -H 'pragma: no-cache'   -H 'referer: https://app3audc5201856.h5.xiaoeknow.com/evaluation_wechat/practice/enter/wb_5e69a60334e2f_lfE62mBD?show_title=0'   -H 'sec-ch-ua: ".Not/A)Brand";v="99", "Google Chrome";v="103", "Chromium";v="103"'   -H 'sec-ch-ua-mobile: ?0'   -H 'sec-ch-ua-platform: "Windows"'   -H 'sec-fetch-dest: empty'   -H 'sec-fetch-mode: cors'   -H 'sec-fetch-site: same-origin'   -H 'user-agent: Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/103.0.0.0 Safari/537.36'   -H 'x-requested-with: XMLHttpRequest'   --data 'bizData%5Bpractice_id%5D=wb_5e69a60334e2f_lfE62mBD&bizData%5Bjoin_id%5D=uwb_62eb7fb493cc7_vpsNd0yHPQ&bizData%5Bstart%5D=0&bizData%5Bend%5D=9'   --compressed

修改为访问第1道题 【使用jq做json解析】

# curl -s 'https://app3audc5201856.h5.xiaoeknow.com/evaluation_wechat/practices/get_paper_question'   -H 'authority: app3audc5201856.h5.xiaoeknow.com'   -H 'accept: application/json, text/plain, */*'   -H 'accept-language: zh-CN,zh;q=0.9'   -H 'cache-control: no-cache'   -H 'content-type: application/x-www-form-urlencoded'   -H 'cookie: sensorsdata2015jssdkcross=%7B%22%24device_id%22%3A%2218257681c4c39e-0390a33cc29205-c4e7526-2073600-18257681c4dcfe%22%7D; sa_jssdk_2015_app3audc5201856_h5_xiaoeknow_com=%7B%22distinct_id%22%3A%2218257681c4c39e-0390a33cc29205-c4e7526-2073600-18257681c4dcfe%22%2C%22first_id%22%3A%22%22%2C%22props%22%3A%7B%22%24latest_traffic_source_type%22%3A%22%E7%9B%B4%E6%8E%A5%E6%B5%81%E9%87%8F%22%2C%22%24latest_search_keyword%22%3A%22%E6%9C%AA%E5%8F%96%E5%88%B0%E5%80%BC_%E7%9B%B4%E6%8E%A5%E6%89%93%E5%BC%80%22%2C%22%24latest_referrer%22%3A%22%22%7D%7D; ko_token=99b1450fc1b8cba28db705f4462ad155; xiaoe_loading_show=1; shop_version_type=4; dataUpJssdkCookie={"wxver":"","net":"","sid":"1659601468103_tlacsv"}; logintime=1659601475'   -H 'origin: https://app3audc5201856.h5.xiaoeknow.com'   -H 'pragma: no-cache'   -H 'referer: https://app3audc5201856.h5.xiaoeknow.com/evaluation_wechat/practice/enter/wb_5e69a60334e2f_lfE62mBD?show_title=0'   -H 'sec-ch-ua: ".Not/A)Brand";v="99", "Google Chrome";v="103", "Chromium";v="103"'   -H 'sec-ch-ua-mobile: ?0'   -H 'sec-ch-ua-platform: "Windows"'   -H 'sec-fetch-dest: empty'   -H 'sec-fetch-mode: cors'   -H 'sec-fetch-site: same-origin'   -H 'user-agent: Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/103.0.0.0 Safari/537.36'   -H 'x-requested-with: XMLHttpRequest'   --data 'bizData%5Bpractice_id%5D=wb_5e69a60334e2f_lfE62mBD&bizData%5Bjoin_id%5D=uwb_62eb7fb493cc7_vpsNd0yHPQ&bizData%5Bstart%5D=0&bizData%5Bend%5D=0'   --compressed| jq .
{
  "code": 0,
  "msg": "success",
  "data": {
    "practice_list": [
      {
        "id": "qs_5e6f34e73f782_gmLix4D899",
        "content": "<p>以下哪一项不是补丁管理过程的一部分?( )</p>",
        "describ": "<p>以下哪一项不是补丁管理过程的一部分?( )</p>",
        "audio_urls": "",
        "question_library_id": "ql_5e68a077687be_JwjVBmjX",
        "is_material_question": 0,
        "type": 0,
        "correct_answer": [
          "op_90035e6f34e73f8b2_3APT1003"
        ],
        "analysis": "",
        "disorder_match": 0,
        "option": [
          {
            "app_id": "app3Audc5201856",
            "question_id": "qs_5e6f34e73f782_gmLix4D899",
            "id": "op_90005e6f34e73f7cf_qhAL1000",
            "content": "<p> 评估补丁</p>",
            "describ": " 评估补丁",
            "state": 0
          },
          {
            "app_id": "app3Audc5201856",
            "question_id": "qs_5e6f34e73f782_gmLix4D899",
            "id": "op_90015e6f34e73f81a_zjH21001",
            "content": "<p> 测试补丁</p>",
            "describ": " 测试补丁",
            "state": 0
          },
          {
            "app_id": "app3Audc5201856",
            "question_id": "qs_5e6f34e73f782_gmLix4D899",
            "id": "op_90025e6f34e73f862_b4Ke1002",
            "content": "<p> 部署所有补丁</p>",
            "describ": " 部署所有补丁",
            "state": 0
          },
          {
            "app_id": "app3Audc5201856",
            "question_id": "qs_5e6f34e73f782_gmLix4D899",
            "id": "op_90035e6f34e73f8b2_3APT1003",
            "content": "<p> 审计补丁</p>",
            "describ": " 审计补丁",
            "state": 0
          }
        ],
        "answer": [],
        "answer_state": "",
        "child": []
      }
    ],
    "practice_num": 100,
    "name": "网络信息运行管理员-单选题",
    "is_random": 0,
    "qes_num": 1,
    "question_setting": {
      "is_hide_audio_name": 1
    }
  }
}

变量调试(就是对这个json的字段获取kv)

赋值返回结果给data变量,并转json
# data=$(curl -s 'https://app3audc5201856.h5.xiaoeknow.com/evaluation_wechat/practices/get_paper_question'   -H 'authority: app3audc5201856.h5.xiaoeknow.com'   -H 'accept: application/json, text/plain, */*'   -H 'accept-language: zh-CN,zh;q=0.9'   -H 'cache-control: no-cache'   -H 'content-type: application/x-www-form-urlencoded'   -H 'cookie: sensorsdata2015jssdkcross=%7B%22%24device_id%22%3A%2218257681c4c39e-0390a33cc29205-c4e7526-2073600-18257681c4dcfe%22%7D; sa_jssdk_2015_app3audc5201856_h5_xiaoeknow_com=%7B%22distinct_id%22%3A%2218257681c4c39e-0390a33cc29205-c4e7526-2073600-18257681c4dcfe%22%2C%22first_id%22%3A%22%22%2C%22props%22%3A%7B%22%24latest_traffic_source_type%22%3A%22%E7%9B%B4%E6%8E%A5%E6%B5%81%E9%87%8F%22%2C%22%24latest_search_keyword%22%3A%22%E6%9C%AA%E5%8F%96%E5%88%B0%E5%80%BC_%E7%9B%B4%E6%8E%A5%E6%89%93%E5%BC%80%22%2C%22%24latest_referrer%22%3A%22%22%7D%7D; ko_token=99b1450fc1b8cba28db705f4462ad155; xiaoe_loading_show=1; shop_version_type=4; dataUpJssdkCookie={"wxver":"","net":"","sid":"1659601468103_tlacsv"}; logintime=1659601475'   -H 'origin: https://app3audc5201856.h5.xiaoeknow.com'   -H 'pragma: no-cache'   -H 'referer: https://app3audc5201856.h5.xiaoeknow.com/evaluation_wechat/practice/enter/wb_5e69a60334e2f_lfE62mBD?show_title=0'   -H 'sec-ch-ua: ".Not/A)Brand";v="99", "Google Chrome";v="103", "Chromium";v="103"'   -H 'sec-ch-ua-mobile: ?0'   -H 'sec-ch-ua-platform: "Windows"'   -H 'sec-fetch-dest: empty'   -H 'sec-fetch-mode: cors'   -H 'sec-fetch-site: same-origin'   -H 'user-agent: Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/103.0.0.0 Safari/537.36'   -H 'x-requested-with: XMLHttpRequest'   --data 'bizData%5Bpractice_id%5D=wb_5e69a60334e2f_lfE62mBD&bizData%5Bjoin_id%5D=uwb_62eb7fb493cc7_vpsNd0yHPQ&bizData%5Bstart%5D=0&bizData%5Bend%5D=1'   --compressed| jq .)

获取题目数组
# echo "${data}"|jq .data.practice_list|jq "keys" -r
[
  0,
  1
]

# echo "${data}"|jq .data.practice_list|jq "keys" -r|grep -Eio "[0-9]{0,11}"
0
1



获取指定题目内的题目/某个选项
(这是题目1以及选项)

# echo "${data}"|jq .data.practice_list|jq .[0].describ -r | sed 's#<p>##g'|sed 's#</p>##g'
以下哪一项不是补丁管理过程的一部分?( )

# echo "${data}"|jq .data.practice_list|jq .[0].option[0].describ -r
 评估补丁
# echo "${data}"|jq .data.practice_list|jq .[0].option[1].describ -r
 测试补丁
# echo "${data}"|jq .data.practice_list|jq .[0].option[2].describ -r
 部署所有补丁
# echo "${data}"|jq .data.practice_list|jq .[0].option[3].describ -r
 审计补丁


(这是题目2以及选项)

# echo "${data}"|jq .data.practice_list|jq .[1].describ -r | sed 's#<p>##g'|sed 's#</p>##g'
 以下哪一项是使用基线的一种有效的配置管理方法? ( )

# echo "${data}"|jq .data.practice_list|jq .[1].option[0].describ -r
 实施变更管理
# echo "${data}"|jq .data.practice_list|jq .[1].option[1].describ -r
 使用镜像
# echo "${data}"|jq .data.practice_list|jq .[1].option[2].describ -r
 实施漏洞管理
# echo "${data}"|jq .data.practice_list|jq .[1].option[3].describ -r
 实施补丁管理

三、脚本

单选题脚本

#!/bin/env bash
#*************************************
#Author:                1656126280@qq.com
#Email:                 1656126280@qq.com
#Version:               1.0
#Created Time:          2022-08-04 17:36:44
#description:           xxx script
#Copyright© 2016-2022   All Rights Reserved
#*************************************

source /etc/profile

data=$(curl -s 'https://app3audc5201856.h5.xiaoeknow.com/evaluation_wechat/practices/get_paper_question'   -H 'authority: app3audc5201856.h5.xiaoeknow.com'   -H 'pragma: no-cache'   -H 'cache-control: no-cache'   -H 'accept: application/json, text/plain, */*'   -H 'x-requested-with: XMLHttpRequest'   -H 'user-agent: Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.198 Safari/537.36'   -H 'content-type: application/x-www-form-urlencoded'   -H 'origin: https://app3audc5201856.h5.xiaoeknow.com'   -H 'sec-fetch-site: same-origin'   -H 'sec-fetch-mode: cors'   -H 'sec-fetch-dest: empty'   -H 'referer: https://app3audc5201856.h5.xiaoeknow.com/evaluation_wechat/practice/enter/wb_5e69a60334e2f_lfE62mBD?show_title=0'   -H 'accept-language: zh-CN,zh;q=0.9'   -H 'cookie: sensorsdata2015jssdkcross=%7B%22%24device_id%22%3A%221805eb1a77c4c4-09b6d8087fee2a-3e604809-2073600-1805eb1a77d976%22%7D; sa_jssdk_2015_app3audc5201856_h5_xiaoeknow_com=%7B%22distinct_id%22%3A%22182583ccd22867-0f956ea9a9ba2-3e604809-2073600-182583ccd23981%22%2C%22first_id%22%3A%22%22%2C%22props%22%3A%7B%22%24latest_traffic_source_type%22%3A%22%E7%9B%B4%E6%8E%A5%E6%B5%81%E9%87%8F%22%2C%22%24latest_search_keyword%22%3A%22%E6%9C%AA%E5%8F%96%E5%88%B0%E5%80%BC_%E7%9B%B4%E6%8E%A5%E6%89%93%E5%BC%80%22%2C%22%24latest_referrer%22%3A%22%22%7D%7D; shop_version_type=4; xiaoe_loading_show=1; ko_token=685c3b778be5407b7cad4e3c16c5a351; dataUpJssdkCookie={"wxver":"","net":"","sid":""}; logintime=1659601444'   --data 'bizData%5Bpractice_id%5D=wb_5e69a60334e2f_lfE62mBD&bizData%5Bjoin_id%5D=uwb_62eb7fb493cc7_vpsNd0yHPQ&bizData%5Bstart%5D=0&bizData%5Bend%5D=9'   --compressed| jq .)

pravtice_num=$(echo "$data"| jq .data.practice_num)

data=$(curl -s 'https://app3audc5201856.h5.xiaoeknow.com/evaluation_wechat/practices/get_paper_question'   -H 'authority: app3audc5201856.h5.xiaoeknow.com'   -H 'pragma: no-cache'   -H 'cache-control: no-cache'   -H 'accept: application/json, text/plain, */*'   -H 'x-requested-with: XMLHttpRequest'   -H 'user-agent: Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.198 Safari/537.36'   -H 'content-type: application/x-www-form-urlencoded'   -H 'origin: https://app3audc5201856.h5.xiaoeknow.com'   -H 'sec-fetch-site: same-origin'   -H 'sec-fetch-mode: cors'   -H 'sec-fetch-dest: empty'   -H 'referer: https://app3audc5201856.h5.xiaoeknow.com/evaluation_wechat/practice/enter/wb_5e69a60334e2f_lfE62mBD?show_title=0'   -H 'accept-language: zh-CN,zh;q=0.9'   -H 'cookie: sensorsdata2015jssdkcross=%7B%22%24device_id%22%3A%221805eb1a77c4c4-09b6d8087fee2a-3e604809-2073600-1805eb1a77d976%22%7D; sa_jssdk_2015_app3audc5201856_h5_xiaoeknow_com=%7B%22distinct_id%22%3A%22182583ccd22867-0f956ea9a9ba2-3e604809-2073600-182583ccd23981%22%2C%22first_id%22%3A%22%22%2C%22props%22%3A%7B%22%24latest_traffic_source_type%22%3A%22%E7%9B%B4%E6%8E%A5%E6%B5%81%E9%87%8F%22%2C%22%24latest_search_keyword%22%3A%22%E6%9C%AA%E5%8F%96%E5%88%B0%E5%80%BC_%E7%9B%B4%E6%8E%A5%E6%89%93%E5%BC%80%22%2C%22%24latest_referrer%22%3A%22%22%7D%7D; shop_version_type=4; xiaoe_loading_show=1; ko_token=685c3b778be5407b7cad4e3c16c5a351; dataUpJssdkCookie={"wxver":"","net":"","sid":""}; logintime=1659601444'   --data "bizData%5Bpractice_id%5D=wb_5e69a60334e2f_lfE62mBD&bizData%5Bjoin_id%5D=uwb_62eb7fb493cc7_vpsNd0yHPQ&bizData%5Bstart%5D=0&bizData%5Bend%5D=${pravtice_num}"   --compressed| jq .)

for i in `echo "$data" | jq .data.practice_list| jq "keys" -r|grep -Eio "[0-9]{0,11}"`
do


	let timu_num=${i}+1	
	timu=$(echo "$data"| jq .data.practice_list| jq .[${i}].describ -r|sed 's#<p>##g'|sed 's#</p>##g')

	echo "##${timu_num}.${timu}"

	for ii in `echo "$data"| jq .data.practice_list| jq .[${i}].option |jq "keys" -r|grep -Eio "[0-9]{0,11}"`
	do
		let option_num=${ii}+1
		option=$(echo "$data"| jq .data.practice_list| jq .[${i}].option[${ii}].describ -r)
		if [ ${ii} -eq 0 ];then
			echo "A ${option}"
		elif [ ${ii} -eq 1 ];then
			echo "B ${option}"
		elif [ ${ii} -eq 2 ];then
			echo "C ${option}"
		elif [ ${ii} -eq 3 ];then
			echo "D ${option}"
		elif [ ${ii} -eq 4 ];then
			echo "E ${option}"
		elif [ ${ii} -eq 5 ];then
			echo "F ${option}"
		elif [ ${ii} -eq 6 ];then
			echo "G ${option}"
		elif [ ${ii} -eq 7 ];then
			echo "H ${option}"
		fi
	done
	echo " "
	echo "<br />"
	echo " "
	timu_num=""
	option_num=" "
done

多选题脚本

#!/bin/env bash
#*************************************
#Author:                1656126280@qq.com
#Email:                 1656126280@qq.com
#Version:               1.0
#Created Time:          2022-08-04 17:36:44
#description:           xxx script
#Copyright© 2016-2022   All Rights Reserved
#*************************************

source /etc/profile

data=$(curl -s 'https://app3audc5201856.h5.xiaoeknow.com/evaluation_wechat/practices/get_paper_question' \
  -H 'authority: app3audc5201856.h5.xiaoeknow.com' \
  -H 'accept: application/json, text/plain, */*' \
  -H 'accept-language: zh-CN,zh;q=0.9' \
  -H 'cache-control: no-cache' \
  -H 'content-type: application/x-www-form-urlencoded' \
  -H 'cookie: sensorsdata2015jssdkcross=%7B%22%24device_id%22%3A%2218257681c4c39e-0390a33cc29205-c4e7526-2073600-18257681c4dcfe%22%7D; sa_jssdk_2015_app3audc5201856_h5_xiaoeknow_com=%7B%22distinct_id%22%3A%2218257681c4c39e-0390a33cc29205-c4e7526-2073600-18257681c4dcfe%22%2C%22first_id%22%3A%22%22%2C%22props%22%3A%7B%22%24latest_traffic_source_type%22%3A%22%E7%9B%B4%E6%8E%A5%E6%B5%81%E9%87%8F%22%2C%22%24latest_search_keyword%22%3A%22%E6%9C%AA%E5%8F%96%E5%88%B0%E5%80%BC_%E7%9B%B4%E6%8E%A5%E6%89%93%E5%BC%80%22%2C%22%24latest_referrer%22%3A%22%22%7D%7D; ko_token=99b1450fc1b8cba28db705f4462ad155; xiaoe_loading_show=1; shop_version_type=4; dataUpJssdkCookie={"wxver":"","net":"","sid":"1659600931592_jztpdl"}; logintime=1659606033' \
  -H 'origin: https://app3audc5201856.h5.xiaoeknow.com' \
  -H 'pragma: no-cache' \
  -H 'referer: https://app3audc5201856.h5.xiaoeknow.com/evaluation_wechat/practice/enter/wb_5e69a4ce1e626_8KxgBZn5?show_title=0' \
  -H 'sec-ch-ua: ".Not/A)Brand";v="99", "Google Chrome";v="103", "Chromium";v="103"' \
  -H 'sec-ch-ua-mobile: ?0' \
  -H 'sec-ch-ua-platform: "Windows"' \
  -H 'sec-fetch-dest: empty' \
  -H 'sec-fetch-mode: cors' \
  -H 'sec-fetch-site: same-origin' \
  -H 'user-agent: Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/103.0.0.0 Safari/537.36' \
  -H 'x-requested-with: XMLHttpRequest' \
  --data 'bizData%5Bpractice_id%5D=wb_5e69a4ce1e626_8KxgBZn5&bizData%5Bjoin_id%5D=uwb_62eb802595b82_uXAHmnnnxs&bizData%5Bstart%5D=0&bizData%5Bend%5D=9' \
  --compressed| jq .)

pravtice_num=$(echo "$data"| jq .data.practice_num)

data=$(curl -s  'https://app3audc5201856.h5.xiaoeknow.com/evaluation_wechat/practices/get_paper_question' \
  -H 'authority: app3audc5201856.h5.xiaoeknow.com' \
  -H 'accept: application/json, text/plain, */*' \
  -H 'accept-language: zh-CN,zh;q=0.9' \
  -H 'cache-control: no-cache' \
  -H 'content-type: application/x-www-form-urlencoded' \
  -H 'cookie: sensorsdata2015jssdkcross=%7B%22%24device_id%22%3A%2218257681c4c39e-0390a33cc29205-c4e7526-2073600-18257681c4dcfe%22%7D; sa_jssdk_2015_app3audc5201856_h5_xiaoeknow_com=%7B%22distinct_id%22%3A%2218257681c4c39e-0390a33cc29205-c4e7526-2073600-18257681c4dcfe%22%2C%22first_id%22%3A%22%22%2C%22props%22%3A%7B%22%24latest_traffic_source_type%22%3A%22%E7%9B%B4%E6%8E%A5%E6%B5%81%E9%87%8F%22%2C%22%24latest_search_keyword%22%3A%22%E6%9C%AA%E5%8F%96%E5%88%B0%E5%80%BC_%E7%9B%B4%E6%8E%A5%E6%89%93%E5%BC%80%22%2C%22%24latest_referrer%22%3A%22%22%7D%7D; ko_token=99b1450fc1b8cba28db705f4462ad155; xiaoe_loading_show=1; shop_version_type=4; dataUpJssdkCookie={"wxver":"","net":"","sid":"1659600931592_jztpdl"}; logintime=1659606033' \
  -H 'origin: https://app3audc5201856.h5.xiaoeknow.com' \
  -H 'pragma: no-cache' \
  -H 'referer: https://app3audc5201856.h5.xiaoeknow.com/evaluation_wechat/practice/enter/wb_5e69a4ce1e626_8KxgBZn5?show_title=0' \
  -H 'sec-ch-ua: ".Not/A)Brand";v="99", "Google Chrome";v="103", "Chromium";v="103"' \
  -H 'sec-ch-ua-mobile: ?0' \
  -H 'sec-ch-ua-platform: "Windows"' \
  -H 'sec-fetch-dest: empty' \
  -H 'sec-fetch-mode: cors' \
  -H 'sec-fetch-site: same-origin' \
  -H 'user-agent: Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/103.0.0.0 Safari/537.36' \
  -H 'x-requested-with: XMLHttpRequest' \
  --data "bizData%5Bpractice_id%5D=wb_5e69a4ce1e626_8KxgBZn5&bizData%5Bjoin_id%5D=uwb_62eb802595b82_uXAHmnnnxs&bizData%5Bstart%5D=0&bizData%5Bend%5D=${pravtice_num}" \
  --compressed| jq .)

for i in `echo "$data" | jq .data.practice_list| jq "keys" -r|grep -Eio "[0-9]{0,11}"`
do


	let timu_num=${i}+1	
	timu=$(echo "$data"| jq .data.practice_list| jq .[${i}].describ -r|sed 's#<p>##g'|sed 's#</p>##g')

	echo "##${timu_num}.${timu}"

	for ii in `echo "$data"| jq .data.practice_list| jq .[${i}].option |jq "keys" -r|grep -Eio "[0-9]{0,11}"`
	do
		let option_num=${ii}+1
		option=$(echo "$data"| jq .data.practice_list| jq .[${i}].option[${ii}].describ -r)
		if [ ${ii} -eq 0 ];then
			echo "A ${option}"
		elif [ ${ii} -eq 1 ];then
			echo "B ${option}"
		elif [ ${ii} -eq 2 ];then
			echo "C ${option}"
		elif [ ${ii} -eq 3 ];then
			echo "D ${option}"
		elif [ ${ii} -eq 4 ];then
			echo "E ${option}"
		elif [ ${ii} -eq 5 ];then
			echo "F ${option}"
		elif [ ${ii} -eq 6 ];then
			echo "G ${option}"
		elif [ ${ii} -eq 7 ];then
			echo "H ${option}"
		fi
	done
	echo " "
	echo "<br />"
	echo " "
	timu_num=""
	option_num=" "
done

判断题脚本

data=$(curl -s 'https://app3audc5201856.h5.xiaoeknow.com/evaluation_wechat/practices/get_paper_question' \
  -H 'authority: app3audc5201856.h5.xiaoeknow.com' \
  -H 'accept: application/json, text/plain, */*' \
  -H 'accept-language: zh-CN,zh;q=0.9' \
  -H 'cache-control: no-cache' \
  -H 'content-type: application/x-www-form-urlencoded' \
  -H 'cookie: sensorsdata2015jssdkcross=%7B%22%24device_id%22%3A%2218257681c4c39e-0390a33cc29205-c4e7526-2073600-18257681c4dcfe%22%7D; sa_jssdk_2015_app3audc5201856_h5_xiaoeknow_com=%7B%22distinct_id%22%3A%2218257681c4c39e-0390a33cc29205-c4e7526-2073600-18257681c4dcfe%22%2C%22first_id%22%3A%22%22%2C%22props%22%3A%7B%22%24latest_traffic_source_type%22%3A%22%E7%9B%B4%E6%8E%A5%E6%B5%81%E9%87%8F%22%2C%22%24latest_search_keyword%22%3A%22%E6%9C%AA%E5%8F%96%E5%88%B0%E5%80%BC_%E7%9B%B4%E6%8E%A5%E6%89%93%E5%BC%80%22%2C%22%24latest_referrer%22%3A%22%22%7D%7D; ko_token=99b1450fc1b8cba28db705f4462ad155; xiaoe_loading_show=1; shop_version_type=4; dataUpJssdkCookie={"wxver":"","net":"","sid":"1659600993498_rmilrr"}; logintime=1659606554' \
  -H 'origin: https://app3audc5201856.h5.xiaoeknow.com' \
  -H 'pragma: no-cache' \
  -H 'referer: https://app3audc5201856.h5.xiaoeknow.com/evaluation_wechat/practice/enter/wb_5e69982857d44_HcXQxLDv?show_title=1' \
  -H 'sec-ch-ua: ".Not/A)Brand";v="99", "Google Chrome";v="103", "Chromium";v="103"' \
  -H 'sec-ch-ua-mobile: ?0' \
  -H 'sec-ch-ua-platform: "Windows"' \
  -H 'sec-fetch-dest: empty' \
  -H 'sec-fetch-mode: cors' \
  -H 'sec-fetch-site: same-origin' \
  -H 'user-agent: Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/103.0.0.0 Safari/537.36' \
  -H 'x-requested-with: XMLHttpRequest' \
  --data 'bizData%5Bpractice_id%5D=wb_5e69982857d44_HcXQxLDv&bizData%5Bjoin_id%5D=uwb_62e88ef21dd79_uCBLskpNJe&bizData%5Bstart%5D=0&bizData%5Bend%5D=9' \
  --compressed|jq .)

pravtice_num=$(echo "$data"| jq .data.practice_num)


data=$(curl -s 'https://app3audc5201856.h5.xiaoeknow.com/evaluation_wechat/practices/get_paper_question' \
  -H 'authority: app3audc5201856.h5.xiaoeknow.com' \
  -H 'accept: application/json, text/plain, */*' \
  -H 'accept-language: zh-CN,zh;q=0.9' \
  -H 'cache-control: no-cache' \
  -H 'content-type: application/x-www-form-urlencoded' \
  -H 'cookie: sensorsdata2015jssdkcross=%7B%22%24device_id%22%3A%2218257681c4c39e-0390a33cc29205-c4e7526-2073600-18257681c4dcfe%22%7D; sa_jssdk_2015_app3audc5201856_h5_xiaoeknow_com=%7B%22distinct_id%22%3A%2218257681c4c39e-0390a33cc29205-c4e7526-2073600-18257681c4dcfe%22%2C%22first_id%22%3A%22%22%2C%22props%22%3A%7B%22%24latest_traffic_source_type%22%3A%22%E7%9B%B4%E6%8E%A5%E6%B5%81%E9%87%8F%22%2C%22%24latest_search_keyword%22%3A%22%E6%9C%AA%E5%8F%96%E5%88%B0%E5%80%BC_%E7%9B%B4%E6%8E%A5%E6%89%93%E5%BC%80%22%2C%22%24latest_referrer%22%3A%22%22%7D%7D; ko_token=99b1450fc1b8cba28db705f4462ad155; xiaoe_loading_show=1; shop_version_type=4; dataUpJssdkCookie={"wxver":"","net":"","sid":"1659600993498_rmilrr"}; logintime=1659606554' \
  -H 'origin: https://app3audc5201856.h5.xiaoeknow.com' \
  -H 'pragma: no-cache' \
  -H 'referer: https://app3audc5201856.h5.xiaoeknow.com/evaluation_wechat/practice/enter/wb_5e69982857d44_HcXQxLDv?show_title=1' \
  -H 'sec-ch-ua: ".Not/A)Brand";v="99", "Google Chrome";v="103", "Chromium";v="103"' \
  -H 'sec-ch-ua-mobile: ?0' \
  -H 'sec-ch-ua-platform: "Windows"' \
  -H 'sec-fetch-dest: empty' \
  -H 'sec-fetch-mode: cors' \
  -H 'sec-fetch-site: same-origin' \
  -H 'user-agent: Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/103.0.0.0 Safari/537.36' \
  -H 'x-requested-with: XMLHttpRequest' \
  --data "bizData%5Bpractice_id%5D=wb_5e69982857d44_HcXQxLDv&bizData%5Bjoin_id%5D=uwb_62e88ef21dd79_uCBLskpNJe&bizData%5Bstart%5D=0&bizData%5Bend%5D=${pravtice_num}" \
  --compressed|jq .)


for i in `echo "$data" | jq .data.practice_list| jq "keys" -r|grep -Eio "[0-9]{0,11}"`
do
	let timu_num=${i}+1	
	timu=$(echo "$data"| jq .data.practice_list| jq .[${i}].describ -r|sed 's#<p>##g'|sed 's#</p>##g')

        echo "##${timu_num}.${timu}"
        echo "A 正确"
        echo "B 错误"

        echo " "
        echo "<br />"
        echo " "
        timu_num=""
        option_num=" "
done

四、题库整理


信息安全应用工程师(高级)考试-12期

posted @ 2022-08-04 16:45  爱折腾的大臭臭  阅读(376)  评论(0编辑  收藏  举报