Cookie extraction

This commit is contained in:
2025-10-23 21:13:41 +02:00
parent 292b368f1b
commit dc9dda1113
2 changed files with 32 additions and 1 deletions

View File

@@ -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";

25
request_example_1.txt Normal file
View File

@@ -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
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN">
<HTML lang="en">
<HEAD>
<TITLE></TITLE>
<meta http-equiv="Expires" content="0">
<meta http-equiv="Pragma" content="no-cache">
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
<meta content="text/javascript" http-equiv="Content-Script-Type">
<link rel="stylesheet" type="text/css" href="/wcd/default.css">
<script type="text/javascript" src="/wcd/init.js"></script>
<noscript>
<meta http-equiv="refresh" content="0; URL=/wcd/js_error.xml">
</noscript>
</HEAD>
<BODY BGCOLOR="#ffffff" LINK="#000000" ALINK="#ff0000" VLINK="#000000" onload="init('/wcd/system_device.xml','wcd','usr=;','','param=;',0);">
<input type="hidden" id="FUNCVER" value="11"/>
</BODY>
</HTML>