Websocket JSON-RPC: Difference between revisions

From Monocle Security
Jump to navigation Jump to search
No edit summary
Line 7: Line 7:
echo '{"jsonrpc":"2.0","id":"id","params":{"jwttoken":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXUyJ9.eyJleHAiOjE3MDE5ODU4MjksImlhdCI6MTcwMTg5OTQyOSwiaXNzIjoiYXV0aDAiLCJ1c2VydG9rZW4iOiIxIn0.x1_luycGY5oTfqGNy1SF8xqcqKGKr_hsXoDGsMjAJkA"},"method":"subscribe"}' | ./websocat --no-close ws://127.0.0.1:9854/json
echo '{"jsonrpc":"2.0","id":"id","params":{"jwttoken":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXUyJ9.eyJleHAiOjE3MDE5ODU4MjksImlhdCI6MTcwMTg5OTQyOSwiaXNzIjoiYXV0aDAiLCJ1c2VydG9rZW4iOiIxIn0.x1_luycGY5oTfqGNy1SF8xqcqKGKr_hsXoDGsMjAJkA"},"method":"subscribe"}' | ./websocat --no-close ws://127.0.0.1:9854/json


<code>
{
{
   "jsonrpc": "2.0",
   "jsonrpc": "2.0",
Line 81: Line 80:
     }
     }
   ]
   ]
}</code>


<code>{"jsonrpc":"2.0","method":"fileUnmounting","params":{"token":"1319756543"}}</code>
<code>{"jsonrpc":"2.0","method":"fileUnmounting","params":{"token":"1319756543"}}</code>

Revision as of 14:15, 7 December 2023

Authenticate

echo '{"jsonrpc":"2.0","id":"id","params":{"username":"admin","password":"password"},"method":"authenticate"}' | ./websocat ws://127.0.0.1:9854/json

{"jsonrpc":"2.0","result":{"jwttoken":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXUyJ9.eyJleHAiOjE3MDE5ODU4MjksImlhdCI6MTcwMTg5OTQyOSwiaXNzIjoiYXV0aDAiLCJ1c2VydG9rZW4iOiIxIn0.x1_luycGY5oTfqGNy1SF8xqcqKGKr_hsXoDGsMjAJkA"},"id":"id"}

Subscribe

echo '{"jsonrpc":"2.0","id":"id","params":{"jwttoken":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXUyJ9.eyJleHAiOjE3MDE5ODU4MjksImlhdCI6MTcwMTg5OTQyOSwiaXNzIjoiYXV0aDAiLCJ1c2VydG9rZW4iOiIxIn0.x1_luycGY5oTfqGNy1SF8xqcqKGKr_hsXoDGsMjAJkA"},"method":"subscribe"}' | ./websocat --no-close ws://127.0.0.1:9854/json

{

 "jsonrpc": "2.0",
 "result": 1,
 "id": "id",
 "location": {
   "latitude": 53.5815,
   "longitude": -2.1778
 },
 "files": [
   {
     "token": "1319756543",
     "path": "D:\\file.dat",
     "state": "Mounted",
     "numchunks": 4096,
     "chunksize": 8388608,
     "automount": true
   }
 ],
 "receivers": [
   {
     "token": "1",
     "mediauri": "media://USBVideoDevice_MJPG_1920x1080",
     "username": "",
     "password": "",
     "parameters": "StreamingProtocol=TCPInterleaved"
   }
 ],
 "recordings": [
   {
     "tracks": [
       {
         "id": "10602418",
         "token": "VIDEO2_10602418",
         "description": "directshow",
         "digitalSignature": false,
         "encrypt": false,
         "fixedFiles": false,
         "flushFrequency": 60,
         "files": [],
         "totalTrackData": []
       }
     ],
     "jobs": [
       {
         "token": "6290858531577553758",
         "enabled": true,
         "name": "MonocleJob",
         "priority": 1,
         "sources": [
           {
             "token": "6199715978532858218",
             "receiverToken": "1",
             "sourceTracks": [
               {
                 "token": "3738472142918816058",
                 "trackid": 10602418,
                 "parameters": "Rotation=0",
                 "activeparameters": "",
                 "state": "Active",
                 "error": ""
               }
             ]
           }
         ]
       }
     ],
     "token": "6141235949812041025",
     "location": "",
     "name": "directshow",
     "retentionTime": 0,
     "activeJob": 6290858531577554000
   }
 ]

{"jsonrpc":"2.0","method":"fileUnmounting","params":{"token":"1319756543"}}