Quantcast
Channel: MikroTik
Viewing all articles
Browse latest Browse all 15133

Scripting • cookie based auth using fetch

$
0
0
I am trying to convert some python code to a Mikrotik script. The code captures the current antenna strength from an ubiquiti lightbeam. The python code uses a session to pass cookie based auth between two calls. Is there any way to use the fetch tool to do this?

Here is what I have so far which successfully authenticates. But, the cookie is not in the received payload.
Code:
/tool{    :local username myuser    :local password mypass    :local ip 1.1.1.1    :local loginurl "https://$ip/api/auth"    :local statusurl "http://$ip/status.cgi"    fetch mode=https url=$loginurl http-method=post http-data="username=$username&password=$password"    #insert next fetch command using retrieved cookie} 

Statistics: Posted by snowdogging — Thu Dec 28, 2023 6:47 pm



Viewing all articles
Browse latest Browse all 15133

Trending Articles