- Enter base64 encoded password on line 9
- Save router.js to your bitbar plugins folder
- Run
chmod +x router.js
- Enjoy
Last active
October 15, 2017 11:47
-
-
Save gbougakov/7ba6dc874ffb5858b6e917c78ead9767 to your computer and use it in GitHub Desktop.
This file contains 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 characters
#!/usr/bin/env /usr/local/bin/node | |
const bitbar = require('bitbar'); | |
const request = require('request'); | |
request.post({ | |
url: 'http://192.168.0.1/goform/goform_set_cmd_process', | |
form: { | |
isTest: 'false', | |
goformId: 'LOGIN', | |
password: '' // Enter base64 encoded password here | |
} | |
}, function () { | |
request('http://192.168.0.1/goform/goform_get_cmd_process?isTest=false&cmd=station_list&_=1499974191779', function (error, response, stList) { | |
request('http://192.168.0.1/goform/goform_get_cmd_process?multi_data=1&isTest=false&sms_received_flag_flag=0&sts_received_flag_flag=0&cmd=modem_main_state%2Cpin_status%2Cloginfo%2Cnew_version_state%2Ccurrent_upgrade_state%2Cis_mandatory%2Csignalbar%2Cnetwork_type%2Cnetwork_provider%2Cppp_status%2CEX_SSID1%2Csta_ip_status%2CEX_wifi_profile%2Cm_ssid_enable%2CRadioOff%2Csimcard_roam%2Clan_ipaddr%2Cstation_mac%2Cbattery_charging%2Cbattery_vol_percent%2Cbattery_pers%2Cspn_display_flag%2Cplmn_display_flag%2Cspn_name_data%2Cspn_b1_flag%2Cspn_b2_flag%2Crealtime_tx_bytes%2Crealtime_rx_bytes%2Crealtime_time%2Crealtime_tx_thrpt%2Crealtime_rx_thrpt%2Cmonthly_rx_bytes%2Cmonthly_tx_bytes%2Cmonthly_time%2Cdate_month%2Cdata_volume_limit_switch%2Cdata_volume_limit_size%2Cdata_volume_alert_percent%2Cdata_volume_limit_unit%2Croam_setting_option%2Cupg_roam_switch%2Cap_station_mode%2Cfota_package_already_download%2Csms_received_flag%2Csts_received_flag%2Csms_unread_num&_=1499972651215', function (error, response, miscData) { | |
miscData = JSON.parse(miscData); | |
var bars = "•"; | |
for (i = 0; i < miscData.signalbar; i++) { | |
bars += "❫" | |
} | |
//bars += " " + miscData["network_provider"]; | |
bars += " " + miscData["network_type"]; | |
var output = [ | |
{ | |
text: bars, | |
color: 'white', | |
dropdown: false | |
}, | |
bitbar.sep, | |
{ | |
text: "Network provider" | |
}, | |
{ | |
text: miscData["network_provider"], | |
color: "white" | |
}, | |
bitbar.sep, | |
{ | |
text: "Battery" | |
} | |
]; | |
if (miscData.battery_charging != "0") { | |
output.push({ | |
text: "Charging", | |
color: "white" | |
}); | |
output.push({ | |
text: miscData.battery_vol_percent+"% charged", | |
color: "white" | |
}); | |
} else { | |
output.push({ | |
text: miscData.battery_vol_percent+"% charged", | |
color: "white" | |
}); | |
} | |
output.push(bitbar.sep); | |
for (i = 0; i < JSON.parse(stList).station_list.length; i++) { | |
var station = JSON.parse(stList).station_list[i]; | |
output.push({ | |
text: station.hostname, | |
submenu: [ | |
{ | |
text: "MAC address" | |
}, | |
{ | |
text: station.mac_addr, | |
color: 'white' | |
}, | |
{ | |
text: "IP address" | |
}, | |
{ | |
text: station.ip_addr, | |
color: 'white' | |
} | |
] | |
}) | |
}; | |
bitbar(output); | |
}); | |
}); | |
}); |
Bougakov
commented
Oct 15, 2017
- You can encode the plaintext pass to Base64 for the user
- Use unicode symbol's digital code instead of symbol in case user would copy&paste your code as ASCII and break things.
- Provide easy shortcut to reconnect command.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment