Skip to content

Instantly share code, notes, and snippets.

@Unitech
Created May 7, 2024 16:15
Show Gist options
  • Save Unitech/777fc682bd4e6db0d66b4c5d007d8bb8 to your computer and use it in GitHub Desktop.
Save Unitech/777fc682bd4e6db0d66b4c5d007d8bb8 to your computer and use it in GitHub Desktop.
glinet sid
const axios = require('axios')
const execSync = require('child_process').execSync;
axios.post('http://192.168.8.1/rpc', {
method: 'challenge',
id: '0',
params: {
username: 'root'
}
}).then((pkg) => {
let salt = pkg.data.result.salt
let nonce = pkg.data.result.nonce
let cipher_pass = execSync(`mkpasswd -m md5 -S '${salt}' 'password'`).toString().trim();
let login_hash = execSync(`echo -n 'root:${cipher_pass}:${nonce}' | md5sum | cut -d' ' -f1`).toString().\
trim()
let login_req = {
"method": "login",
"jsonrpc":"2.0",
id: 0,
params: {
username: 'root',
hash: login_hash
}
}
axios.post('http://192.168.8.1/rpc', login_req).then((pkg) => {
console.log(pkg.data.sid)
})
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment