diff --git a/pull_info.sh b/pull_info.sh index e559a13..c658749 100644 --- a/pull_info.sh +++ b/pull_info.sh @@ -1,5 +1,11 @@ -#curl -X GET http://192.168.1.42/wcd/system_consumable.xml -H "Cookie: ID=vGeeQa3qLQtd7sxYwl2jFOFUmQqIbuYN" +echo "Get request cookie" +#cookie=$(curl -D - -X GET http://192.168.1.42/wcd/index.html) +cookie=$(cat request_example_1.txt) #testing +cookie=$(echo "$cookie" | grep Set-Cookie | grep -oP "ID=\K[^.]+" ) +echo "$cookie" + echo "Start extract from system_counter" +#data=$(curl -X GET http://192.168.1.42/wcd/system_counter.xml -H "Cookie: ID=\"$cookie\"") data=$(cat system_counter.xml) data=$(echo "$data" | xq ".MFP.Count.UserCounterInfo.TotalCounterList.TotalCounter | .[]") for key in "Total" "DuplexTotal" "Document" "Paper" "TotalLarge" "PaperSizeA3" "PaperSizeA4"; diff --git a/request_example_1.txt b/request_example_1.txt new file mode 100644 index 0000000..1462256 --- /dev/null +++ b/request_example_1.txt @@ -0,0 +1,25 @@ +HTTP/1.1 200 OK +Content-Type: text/html +Set-Cookie: ID=ogehdSN1daHKnkAfskA31LnyuOKYrDrG +Expires: Thu, 01 Jan 1970 00:00:00 GMT +X-Frame-Options: SAMEORIGIN +Content-Length: 760 + + + + + + + + + + + + + + + + + \ No newline at end of file