What is Nostr?
boerst
npub1lsn…klw3
2024-09-03 20:55:25
in reply to nevent1q…p0hz

boerst on Nostr: I played around with their firmware graphql endpoint a while back and I believe that ...

I played around with their firmware graphql endpoint a while back and I believe that they mainly use it for populating the web UI. Here’s some stuff to play around with if you’re curious…

This auths you and stores the session cookie in a cookie jar (cookies.txt)
```
curl 'http://10.1.45.21/graphql'; \
-H 'Accept: application/graphql-response+json, application/graphql+json, application/json, text/event-stream, multipart/mixed' \
-H 'Accept-Language: en' \
-H 'Content-Type: application/json' \
-H 'Priority: u=0' \
--data-raw '{"operationName":"RootLogin","query":"mutation RootLogin($username: String!, $password: String!) {\n auth {\n login(username: $username, password: $password) {\n ... on Error {\n message\n __typename\n }\n __typename\n }\n __typename\n }\n}","variables":{"password":"root","username":"root"}}' \
--compressed \
--insecure \
-c cookies.txt
```

Here's an instrospection query to return their schema:
```
curl 'http://10.1.45.21/graphql'; \
-H 'Accept: application/graphql-response+json, application/graphql+json, application/json, text/event-stream, multipart/mixed' \
-H 'Accept-Language: en' \
-H 'Content-Type: application/json' \
-H 'Priority: u=4' \
--data-raw '{"operationName":"IntrospectionQuery","query":"query IntrospectionQuery { __schema { queryType { name } mutationType { name } subscriptionType { name } types { ...FullType } directives { name description locations args { ...InputValue } } } } fragment FullType on __Type { kind name description fields(includeDeprecated: true) { name description args { ...InputValue } type { ...TypeRef } isDeprecated deprecationReason } inputFields { ...InputValue } interfaces { ...TypeRef } enumValues(includeDeprecated: true) { name description isDeprecated deprecationReason } possibleTypes { ...TypeRef } } fragment InputValue on __InputValue { name description type { ...TypeRef } defaultValue } fragment TypeRef on __Type { kind name ofType { kind name ofType { kind name ofType { kind name ofType { kind name ofType { kind name ofType { kind name ofType { kind name } } } } } } } }","variables":{}}' \
--compressed \
--insecure \
-b cookies.txt
```

…then based on the schema, you can figure out how to get the hashrate, for example:
```
curl 'http://10.1.45.21/graphql'; \
-H 'Accept: application/graphql-response+json, application/graphql+json, application/json, text/event-stream, multipart/mixed' \
-H 'Accept-Language: en' \
-H 'Content-Type: application/json' \
-H 'Priority: u=4' \
--data-raw '{"operationName":"RealHashrateQuery","query":"query RealHashrateQuery { bosminer { info { summary { realHashrate { mhsAv mhs5S mhs15S mhs30S mhs1M mhs5M mhs15M mhs30M mhs1H mhs24H mhsSinceRestart } } } } }","variables":{}}' \
--compressed \
--insecure \
-b cookies.txt
```
Author Public Key
npub1lsnwplwhg5kwylrj5mtttrlqtehqtxa226n8q0zz48hrl0sctj6s6zklw3