Created
May 7, 2024 16:15
-
-
Save Unitech/777fc682bd4e6db0d66b4c5d007d8bb8 to your computer and use it in GitHub Desktop.
Revisions
-
Unitech created this gist
May 7, 2024 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,34 @@ 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) }) })