Show Posts
|
Pages: [1]
|
Hi Everyone, cant post the full js code snippets as they are too long and I get empty body error. I got things to work like OP suggested. I found the following js file miner.b0d88d.js in the www/js folder. It handles the request to set_miner_conf.cgi, only showing the relavent snippet: 68: function(e, n, t) { "use strict"; t.r(n); var r = t(0), o = (t(5), t(3), r.a); o.loadProperties(), new Vue({ el: "#MinerSet", data: () => ({ showLoading: !1, minerForm: { "bitmain-fan-ctrl": !1, "bitmain-fan-pwm": "100", "miner-mode": 0, "freq-level": 100, pools: [{ url: "", user: "", pass: "" }, { url: "", user: "", pass: "" }, { url: "", user: "", pass: "" }] }, modeList: [{ text: "", id: 0 }, { text: "", id: 1 }] }), created() { this.initData(); let e = window.ee; e && (e.removeEvent("lang-changed"), e.addListener("lang-changed", this.updateModeList)) }, mounted() { this.doMinerType() }, computed: { trShow() { return 2 === this.minerForm["miner-mode"] } }, methods: { doMinerType() { $.ajax({ url: "/cgi-bin/get_system_info.cgi", dataType: "json", type: "GET", timeout: 3e3, async: !0, processData: !1, contentType: !1, success: function(e) { -1 != e.minertype.indexOf("Hydro") && (document.querySelector(".miner-machine-form table.table-form tbody tr:first-of-type").style.display = "none") } }) }, initData() { var e = this; this.updateModeList(), $.ajax({ url: "/cgi-bin/get_miner_conf.cgi", dataType: "json", type: "GET", async: !1, processData: !1, contentType: !1, success: function(n) { if (n) { for (i = 0; i < 3; i++) e.minerForm.pools[i].url = n.pools[i].url, e.minerForm.pools[i].user = n.pools[i].user, e.minerForm.pools[i].pass = n.pools[i].pass; e.minerForm["bitmain-fan-ctrl"] = n["bitmain-fan-ctrl"], e.minerForm["bitmain-fan-pwm"] = n["bitmain-fan-pwm"], e.minerForm["miner-mode"] = n["bitmain-work-mode"], e.minerForm["freq-level"] = n["bitmain-freq-level"] } }, error: function() { o.showWarn("error", "commonCode") } }) }, updateModeList() { this.modeList[0].text = $.i18[Suspicious link removed]op("modeNormal"), this.modeList[1].text = $.i18[Suspicious link removed]op("modeSleep") }, modeSelectChange(e) { this.minerForm["miner-mode"] = e }, checkFun(e) { this.$set(this.minerForm, e, !this.minerForm[e]) }, saveMineSet() { var e = JSON.stringify(this.minerForm), n = this; n.showLoading = !0, $.ajax({ url: "/cgi-bin/set_miner_conf.cgi", dataType: "json", type: "POST", async: !0, data: e, processData: !1, contentType: !1, success: function(e) { n.showLoading = !1; var t = e; "success" === t.stats ? o.showWarn("success",[Suspicious link removed]de) : o.showWarn("error",[Suspicious link removed]de), r.a.loadInner("miner") }, error: function(e) { n.showLoading = !1, o.showWarn("error", "commonCode"), r.a.loadInner("miner") }
where the function saveMineSet(), does just post a JSON formatted string to set_miner_conf.cgi. I ended up using something like: import requests from requests.auth import HTTPDigestAuth import json
confData = {} confData['pools']= [] confData['pools'].append({"url": configInfo['url1'], "user": configInfo['user1'], "pass": configInfo['pass1']}) confData['pools'].append({"url": configInfo['url2'], "user": configInfo['user2'], "pass": configInfo['pass2']}) confData['pools'].append({"url": configInfo['url3'], "user": configInfo['user3'], "pass": configInfo['pass3']})
confPayload = json.dumps(confData) setConfAddr = '/cgi-bin/set_miner_conf.cgi' try: r = requests.post('http://' + self.ip + setConfAddr, auth=HTTPDigestAuth(self.webUserName, self.webPassword), data=confPayload) except: self.error("post ant miner configuration failed.")
in python. The js file should give you insight on how to change some of the other configuration variables if needed. Setting network configuration is similar, and how to format the JSON that is posted to set_network_conf.cgi can be seen in the ip.1cc6a.js file (also in www/js/), again only showing relevant snippet: ! 69: function(n, e, t) { "use strict"; t.r(e); var r = t(0), o = (t(5), t(3), r.a); o.loadProperties(), new Vue({ el: "#ipSet", data: () => ({ showLoading: !1, ipForm: { ipHost: "", ipPro: 1, ipAddress: "", ipSub: "", ipGateway: "", ipDns: "" }, ipInfo: { ip: "", mac: "", mask: "" }, sltList: [{ text: "DHCP", id: 1 }, { text: "Static", id: 2 }] }), created() { this.initData() }, computed: { trShow() { return 2 === this.ipForm.ipPro } }, mounted() {}, methods: { initData() { var n = this; $.ajax({ url: "/cgi-bin/get_network_info.cgi", dataType: "json", type: "GET", async: !1, processData: !1, contentType: !1, success: function(e) { e && (n.ipForm.ipHost = e.conf_hostname, n.ipForm.ipPro = "DHCP" == e.conf_nettype ? 1 : 2, n.ipForm.ipAddress = e.conf_ipaddress, n.ipForm.ipSub = e.conf_netmask, n.ipForm.ipGateway = e.conf_gateway, n.ipForm.ipDns = e.conf_dnsservers, n.ipInfo.ip = e.ipaddress, n.ipInfo.mac = e.macaddr, n.ipInfo.mask = e.netmask) }, error: function() { r.a.showWarn("error") } }) }, proSelectChange(n) { this.ipForm.ipPro = n }, saveIpSet() { var n = JSON.stringify(this.ipForm), e = this; e.showLoading = !0, $.ajax({ url: "/cgi-bin/set_network_conf.cgi", dataType: "json", type: "POST", async: !0, data: n, processData: !1, contentType: !1, success: function(n) { e.showLoading = !1; var t = n; "success" === t.stats ? o.showWarn("success",[Suspicious link removed]de) : o.showWarn("error",[Suspicious link removed]de), r.a.loadInner("ip") }, error: function(n) { e.showLoading = !1, o.showWarn("error", "commonCode"), r.a.loadInner("ip") }
I hope this helps anyone in the future from having to unpack the firmware and figure out how the web interface communicates with the cgi-bin files.
|
|
|
I guess the the new cgi_get_POST_vars function accepts POST message in a different way than before, I am no bash expert and cant exactly decipher what is accepted by the cgi script. The set_network_conf file from the unpacked firmware is: #!/bin/sh
function cgi_get_POST_vars() { # check content type # FIXME: not sure if we could handle uploads with this.. [ "${CONTENT_TYPE}" != "application/x-www-form-urlencoded" ] && \ echo "Warning: you should probably use MIME type "\ "application/x-www-form-urlencoded!" 1>&2 # save POST variables (only first time this is called) [ -z "$QUERY_STRING_POST" \ -a "$REQUEST_METHOD" = "POST" -a ! -z "$CONTENT_LENGTH" ] && \ read -n $CONTENT_LENGTH QUERY_STRING_POST return }
function update_network_conf_file() { config_file="/config/network.conf" if [ "${ant_conf_nettype}" == "1" ]; then echo "dhcp=true" > $config_file echo "hostname=${ant_conf_hostname}" >> $config_file else echo "hostname=${ant_conf_hostname}" > $config_file echo "ipaddress=${ant_conf_ipaddress}" >> $config_file echo "netmask=${ant_conf_netmask}" >> $config_file echo "gateway=${ant_conf_gateway}" >> $config_file echo "dnsservers=${ant_conf_dnsservers}" >> $config_file fi }
function check_param() { if ! echo "$ant_conf_hostname" | egrep -q "$regex_hostname"; then return 1 fi
if [ "${ant_conf_nettype}" == "2" ]; then if ! echo "${ant_conf_ipaddress}" | egrep -q "$regex_ip"; then return 2 fi if ! echo "${ant_conf_netmask}" | egrep -q "$regex_ip" ; then return 3 fi if ! echo "${ant_conf_gateway}" | egrep -q "$regex_ip"; then return 4 fi if ! echo "${ant_conf_dnsservers}" | egrep -q "$regex_ip"; then return 5 fi fi return 0 }
ant_conf_nettype= ant_conf_hostname= ant_conf_ipaddress= ant_conf_netmask= ant_conf_gateway= ant_conf_dnsservers= stats="error" err_flag=0 msg=
regex_ip="^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$" regex_hostname="^(([a-zA-Z]|[a-zA-Z][a-zA-Z0-9-]*[a-zA-Z0-9])\.)*([A-Za-z]|[A-Za-z][A-Za-z0-9-]*[A-Za-z0-9])$"
cgi_get_POST_vars #echo $QUERY_STRING_POST > /tmp/a #QUERY_STRING_POST=`cat /tmp/a` ant_conf_nettype=`echo $QUERY_STRING_POST | jq -r ".ipPro"` ant_conf_hostname=`echo $QUERY_STRING_POST | jq -r ".ipHost"` if [ "${ant_conf_nettype}" == "2" ];then ant_conf_ipaddress=`echo $QUERY_STRING_POST | jq -r ".ipAddress"` ant_conf_netmask=`echo $QUERY_STRING_POST | jq -r ".ipSub"` ant_conf_gateway=`echo $QUERY_STRING_POST | jq -r ".ipGateway"` ant_conf_dnsservers=`echo $QUERY_STRING_POST | jq -r ".ipDns"` fi
check_param err_flag=$?
if [ $err_flag -eq 0 ]; then msg="OK!" stats="success" fi if [ $err_flag -eq 1 ]; then msg="Hostname invalid!" fi if [ $err_flag -eq 2 ]; then msg="IP invalid!" fi if [ $err_flag -eq 3 ]; then msg="Netmask invalid!" fi if [ $err_flag -eq 4 ]; then msg="Gateway invalid!" fi if [ $err_flag -eq 5 ]; then msg="DNS invalid!" fi
echo "{\"stats\":\"$stats\",\"code\":\"N00$err_flag\",\"msg\":\"$msg\"}"
if [ $err_flag -eq 0 ];then update_network_conf_file sync sleep 1s sudo /etc/init.d/S38network restart > /dev/null 2>&1 & fi
for completeness. Is the get POST variables function specifying to the exact JSON styled message as OP suggests?
|
|
|
I have previously always sent a payload using urllib.parse.urlencode through request for S9 generation miners, I am getting an illegal request error using the same where the set_miner_conf.cgi file I unpacked from a 2021 April firmware is : #!/bin/sh
function cgi_get_POST_vars() { [ "${CONTENT_TYPE}" != "application/x-www-form-urlencoded" ] && \ echo "Warning: you should probably use MIME type "\ "application/x-www-form-urlencoded!" 1>&2 [ -z "$QUERY_STRING_POST" \ -a "$REQUEST_METHOD" = "POST" -a ! -z "$CONTENT_LENGTH" ] && \ read -n $CONTENT_LENGTH QUERY_STRING_POST return }
function update_config_file() { config_file="/config/cgminer.conf" echo "{" > $config_file echo "\"pools\" : [" >> $config_file echo "{" >> $config_file echo "\"url\" : \"$ant_pool1url\"," >> $config_file echo "\"user\" : \"$ant_pool1user\"," >> $config_file echo "\"pass\" : \"$ant_pool1pw\"" >> $config_file echo "}," >> $config_file echo "{" >> $config_file echo "\"url\" : \"$ant_pool2url\"," >> $config_file echo "\"user\" : \"$ant_pool2user\"," >> $config_file echo "\"pass\" : \"$ant_pool2pw\"" >> $config_file echo "}," >> $config_file echo "{" >> $config_file echo "\"url\" : \"$ant_pool3url\"," >> $config_file echo "\"user\" : \"$ant_pool3user\"," >> $config_file echo "\"pass\" : \"$ant_pool3pw\"" >> $config_file echo "}" >> $config_file echo "]" >> $config_file echo "," >> $config_file echo "\"api-listen\" : true," >> $config_file echo "\"api-network\" : true," >> $config_file echo "\"api-groups\" : \"A:stats:pools:devs:summary:version\"," >> $config_file echo "\"api-allow\" : \"A:0/0,W:*\"," >> $config_file echo "\"bitmain-fan-ctrl\" : $ant_fan_customize_value," >> $config_file echo "\"bitmain-fan-pwm\" : \"$ant_fan_customize_switch\"," >> $config_file echo "\"bitmain-use-vil\" : true," >> $config_file echo "\"bitmain-freq\" : \"$ant_freq\"," >> $config_file echo "\"bitmain-voltage\" : \"$ant_voltage\"," >> $config_file echo "\"bitmain-ccdelay\" : \"$ant_ccdelay\"," >> $config_file echo "\"bitmain-pwth\" : \"$ant_pwth\"," >> $config_file echo "\"bitmain-work-mode\" : \"$ant_miner_mode\"," >> $config_file echo "\"bitmain-freq-level\" : \"$ant_freq_level\"" >> $config_file #echo "\"miner-mode\" : \"$ant_work_mode\"," >> $config_file #echo "\"freq-level\" : \"$ant_freq_level\"" >> $config_file echo "}" >> $config_file }
function parse_configs() { echo $1 | jq -r $2 }
function old_configs() { cat /config/cgminer.conf | jq -r $1 } reload=false cgi_get_POST_vars
#echo $QUERY_STRING_POST > /tmp/aaa #QUERY_STRING_POST=`cat /tmp/aaa`
echo $QUERY_STRING_POST | jq > /dev/null
if [[ $? -eq 0 ]]&&[[ ! "$QUERY_STRING_POST"x == ""x ]]; then QUERY_STRING_POST=`echo $QUERY_STRING_POST | jq -c` ret=`parse_configs $QUERY_STRING_POST ".pools[0].url"` if [ "$ret"x == "null"x ];then ant_pool1url=`old_configs ".pools[0].url"` else ant_pool1url=$ret fi ret=`parse_configs $QUERY_STRING_POST ".pools[0].user"` if [ "$ret"x == "null"x ];then ant_pool1user=`old_configs ".pools[0].user"` else ant_pool1user=$ret fi ret=`parse_configs $QUERY_STRING_POST ".pools[0].pass"` if [ "$ret"x == "null"x ];then ant_pool1pw=`old_configs ".pools[0].pass"` else ant_pool1pw=$ret fi ret=`parse_configs $QUERY_STRING_POST ".pools[1].url"` if [ "$ret"x == "null"x ];then ant_pool2url=`old_configs ".pools[1].url"` else ant_pool2url=$ret fi ret=`parse_configs $QUERY_STRING_POST ".pools[1].user"` if [ "$ret"x == "null"x ];then ant_pool2user=`old_configs ".pools[1].user"` else ant_pool2user=$ret fi ret=`parse_configs $QUERY_STRING_POST ".pools[1].pass"` if [ "$ret"x == "null"x ];then ant_pool2pw=`old_configs ".pools[1].pass"` else ant_pool2pw=$ret fi ret=`parse_configs $QUERY_STRING_POST ".pools[2].url"` if [ "$ret"x == "null"x ];then ant_pool3url=`old_configs ".pools[2].url"` else ant_pool3url=$ret fi ret=`parse_configs $QUERY_STRING_POST ".pools[2].user"` if [ "$ret"x == "null"x ];then ant_pool3user=`old_configs ".pools[2].user"` else ant_pool3user=$ret fi ret=`parse_configs $QUERY_STRING_POST ".pools[2].pass"` if [ "$ret"x == "null"x ];then ant_pool3pw=`old_configs ".pools[2].pass"` else ant_pool3pw=$ret fi ret=`parse_configs $QUERY_STRING_POST '."bitmain-fan-ctrl"'` if [ "$ret"x == "null"x ];then ant_fan_customize_value=`old_configs '."bitmain-fan-ctrl"'` else ant_fan_customize_value=$ret fi ret=`parse_configs $QUERY_STRING_POST '."bitmain-fan-pwm"'` if [ "$ret"x == "null"x ];then ant_fan_customize_switch=`old_configs '."bitmain-fan-pwm"'` else ant_fan_customize_switch=$ret fi ret=`parse_configs $QUERY_STRING_POST '."miner-mode"'` if [[ "$ret"x == "null"x ]]||([[ $ret -ne 0 ]]&&[[ $ret -ne 1 ]]);then ant_miner_mode=`old_configs '."bitmain-work-mode"'` reload=true else old_ant_miner_mode=`old_configs '."bitmain-work-mode"'` ant_miner_mode=$ret if [ $old_ant_miner_mode == $ret ];then reload=true fi fi ret=`parse_configs $QUERY_STRING_POST '."freq-level"'` if [ "$ret"x == "null"x ];then ant_freq_level=`old_configs '."bitmain-freq-level"'` else ant_freq_level=$ret fi ant_ccdelay=`old_configs '."bitmain-ccdelay"'` ant_pwth=`old_configs '."bitmain-pwth"'` ant_freq=`old_configs '."bitmain-freq"'` ant_voltage=`old_configs '."bitmain-voltage"'` # ret=`parse_configs $QUERY_STRING_POST '."bitmain-freq"'` # if [ "$ret"x == "null"x ];then # ant_freq=`old_configs '."bitmain-freq"'` # else # ant_freq=$ret # fi # ret=`parse_configs $QUERY_STRING_POST '."bitmain-voltage"'` # if [ "$ret"x == "null"x ];then # ant_voltage=`old_configs '."bitmain-voltage"'` # else # ant_voltage=$ret # fi # ret=`parse_configs $QUERY_STRING_POST '."bitmain-ccdelay"'` # if [ "$ret"x == "null"x ];then # ant_ccdelay=`old_configs '."bitmain-ccdelay"'` # else # ant_ccdelay=$ret # fi # ret=`parse_configs $QUERY_STRING_POST '."bitmain-pwth"'` # if [ "$ret"x == "null"x ];then # ant_pwth=`old_configs '."bitmain-pwth"'` # else # ant_pwth=$ret # fi
update_config_file sync sleep 1s if [ $reload == true ];then cgminer-api {\"command\":\"reload\",\"new_api\":true} > /dev/null & else sudo /etc/init.d/S70cgminer restart > /dev/null & fi
echo "{\"stats\":\"success\",\"code\":\"M000\",\"msg\":\"OK!\"}" else echo "{\"stats\":\"error\",\"code\":\"M001\",\"msg\":\"Illegal request!\"}" fi Are you saying to just literally post what you provided in your own response to set_miner_conf.cgi instead? I also need to use set_network_conf to update hostname, so would like to replicate exactly what the web interface sends to its own cgi files when manually submitting a manual input. Anyone had any luck with this? I get the following response <?xml version="1.0" encoding="iso-8859-1"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" " http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns=" http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <title>500 - Internal Server Error</title> </head> <body> <h1>500 - Internal Server Error</h1> </body> </html> when sending what I always had to S9 (and equivalent), to the set_network_conf,cgi file as well. Any more insite would be great! Thanks!
|
|
|
So I wanted to contribute by showing how I did this using requests, but I have a little snag EDIT: FIXED. Everything works except for the working mode never updates. The config file that is loaded when loading the configuration page gives No matter what I place into the '_ant_multi_level' field, it's always blank, and this forces Working Mode to be set to Normal via the get_miner_conf javascript function. I unpacked the newest firmware, and found the set_miner_config.cgi file. It looks like this: #!/bin/sh #set -x
ant_pool1url= ant_pool1user= ant_pool1pw= ant_pool2url= ant_pool2user= ant_pool2pw= ant_pool3url= ant_pool3user= ant_pool3pw= ant_nobeeper= ant_notempoverctrl= ant_fan_customize_value= ant_fan_customize_switch= ant_freq= ant_voltage= ant_asic_boost= ant_low_vol_freq= ant_economic_mode= ant_low_vol=
ant_input=`cat /dev/stdin` ant_tmp=${ant_input//&/ } i=0 for ant_var in ${ant_tmp} do ant_var=${ant_var//+/ } ant_var=${ant_var//%23/#} ant_var=${ant_var//%24/$} ant_var=${ant_var//%25/%} ant_var=${ant_var//%26/&} ant_var=${ant_var//%2C/,} ant_var=${ant_var//%2B/+} ant_var=${ant_var//%3A/:} ant_var=${ant_var//%3B/;} ant_var=${ant_var//%3C/<} ant_var=${ant_var//%3D/=} ant_var=${ant_var//%3E/>} ant_var=${ant_var//%3F/?} ant_var=${ant_var//%40/@} ant_var=${ant_var//%5B/[} ant_var=${ant_var//%5D/]} ant_var=${ant_var//%5E/^} ant_var=${ant_var//%7B/\{} ant_var=${ant_var//%7C/|} ant_var=${ant_var//%7D/\}} ant_var=${ant_var//%2F/\/} #ant_var=${ant_var//%22/\"} #ant_var=${ant_var//%5C/\\} case ${i} in 0 ) ant_pool1url=${ant_var/_ant_pool1url=/} ;; 1 ) ant_pool1user=${ant_var/_ant_pool1user=/} ;; 2 ) ant_pool1pw=${ant_var/_ant_pool1pw=/} ;; 3 ) ant_pool2url=${ant_var/_ant_pool2url=/} ;; 4 ) ant_pool2user=${ant_var/_ant_pool2user=/} ;; 5 ) ant_pool2pw=${ant_var/_ant_pool2pw=/} ;; 6 ) ant_pool3url=${ant_var/_ant_pool3url=/} ;; 7 ) ant_pool3user=${ant_var/_ant_pool3user=/} ;; 8 ) ant_pool3pw=${ant_var/_ant_pool3pw=/} ;; 9 ) ant_nobeeper=${ant_var/_ant_nobeeper=/} ;; 10 ) ant_notempoverctrl=${ant_var/_ant_notempoverctrl=/} ;; 11 ) ant_fan_customize_switch=${ant_var/_ant_fan_customize_switch=/} ;; 12 ) ant_fan_customize_value=${ant_var/_ant_fan_customize_value=/} ;; 13 ) ant_freq=${ant_var/_ant_freq=/} ;; 14 ) ant_voltage=${ant_var/_ant_voltage=/} ;; 15 ) ant_asic_boost=${ant_var/_ant_asic_boost=/} ;; 16 ) ant_low_vol_freq=${ant_var/_ant_low_vol_freq=/} ;; 17 ) ant_economic_mode=${ant_var/_ant_economic_mode=/} ;; 18 ) ant_low_vol=${ant_var/_ant_multi_level=/} ;; esac i=`expr $i + 1` done
echo "{" > /config/bmminer.conf echo "\"pools\" : [" >> /config/bmminer.conf echo "{" >> /config/bmminer.conf echo "\"url\" : \"${ant_pool1url}\"," >> /config/bmminer.conf echo "\"user\" : \"${ant_pool1user}\"," >> /config/bmminer.conf echo "\"pass\" : \"${ant_pool1pw}\"" >> /config/bmminer.conf echo "}," >> /config/bmminer.conf echo "{" >> /config/bmminer.conf echo "\"url\" : \"${ant_pool2url}\"," >> /config/bmminer.conf echo "\"user\" : \"${ant_pool2user}\"," >> /config/bmminer.conf echo "\"pass\" : \"${ant_pool2pw}\"" >> /config/bmminer.conf echo "}," >> /config/bmminer.conf echo "{" >> /config/bmminer.conf echo "\"url\" : \"${ant_pool3url}\"," >> /config/bmminer.conf echo "\"user\" : \"${ant_pool3user}\"," >> /config/bmminer.conf echo "\"pass\" : \"${ant_pool3pw}\"" >> /config/bmminer.conf echo "}" >> /config/bmminer.conf echo "]" >> /config/bmminer.conf echo "," >> /config/bmminer.conf echo "\"api-listen\" : true," >> /config/bmminer.conf echo "\"api-network\" : true," >> /config/bmminer.conf echo "\"api-groups\" : \"A:stats:pools:devs:summary:version\"," >> /config/bmminer.conf echo "\"api-allow\" : \"A:0/0,W:*\"," >> /config/bmminer.conf if [ "${ant_nobeeper}" = "true" ]; then echo "\"bitmain-nobeeper\" : "true"," >> /config/bmminer.conf fi if [ "${ant_notempoverctrl}" = "true" ]; then echo "\"bitmain-notempoverctrl\" : "true"," >> /config/bmminer.conf fi
if [ "${ant_fan_customize_switch}" = "true" ]; then echo "\"bitmain-fan-ctrl\" : "true"," >> /config/bmminer.conf echo "\"bitmain-fan-pwm\" : \"${ant_fan_customize_value}\"," >> /config/bmminer.conf
fi echo "\"bitmain-use-vil\" : "true"," >> /config/bmminer.conf echo "\"bitmain-freq\" : \"${ant_freq}\"," >> /config/bmminer.conf #if [ "${ant_asic_boost}" = "true" ]; then # echo "\"bitmain-close-asic-boost\" : true," >> /config/bmminer.conf #fi if [ "${ant_low_vol_freq}" = "true" ]; then echo "\"bitmain-close-low-vol-freq\" : true," >> /config/bmminer.conf fi if [ "${ant_economic_mode}" = "true" ]; then echo "\"bitmain-economic-mode\" : true," >> /config/bmminer.conf fi
echo "\"bitmain-low-vol\" : \"${ant_low_vol}\"," >> /config/bmminer.conf
echo "\"bitmain-voltage\" : \"0706\"" >> /config/bmminer.conf echo "}" >> /config/bmminer.conf sync & sleep 1s
# cp /www/pages/cgi-bin/minerConfiguration2.cgi /www/pages/cgi-bin/minerConfiguration.cgi -f sync
/etc/init.d/bmminer.sh restart >/dev/null 2>&1
sleep 5s
echo "ok"
It seems like the code I provide below should work. Are there any suggestions or thoughts? Note: The URLEncode line below my dictionary converts the dictionary into the same format as Tim's data. EDIT: There was one field missing '_ant_voltage', in both Tim's and my data payload. This missing field caused the set_miner_conf.cgi bash script to improperly read what was sent after the '_ant_freq' field. I have updated the code below to working code, along with a working payload for curl.from requests.auth import HTTPDigestAuth import requests import urllib.parse
ip = 'ip' url = 'http://' + ip + '/cgi-bin/set_miner_conf.cgi' data = {} data['_ant_pool1url'] = 'url1' data['_ant_pool1user'] = 'user1' data['_ant_pool1pw'] = 'x' data['_ant_pool2url'] = 'url2' data['_ant_pool2user'] = 'user2' data['_ant_pool2pw'] = 'x' data['_ant_pool3url'] = 'url3' data['_ant_pool3user'] = 'user3' data['_ant_pool3pw'] = 'x' data['_ant_nobeeper'] = 'false' data['_ant_notempoverctrl'] = 'false' data['_ant_fan_customize_switch'] = 'false' data['_ant_fan_customize_value'] = '' data['_ant_freq'] = '' data['_ant_voltage'] = '' data['_ant_asic_boost'] = 'false' data['_ant_low_vol_freq'] = 'false' data['_ant_economic_mode'] = 'false' data['_ant_multi_level'] = '240' payload = urllib.parse.urlencode(data) r = requests.post(url, auth=HTTPDigestAuth('root', 'root'), data=payload)
The payload is the string: _ant_pool1url=url1&_ant_pool1user=user1&_ant_pool1pw=x&_ant_pool2url=url2&_ant_pool2user=user2&_ant_pool2pw=x&_ant_pool3url=url3&_ant_pool3user=user3&_ant_pool3pw=x&_ant_nobeeper=false&_ant_notempoverctrl=false&_ant_fan_customize_switch=false&_ant_fan_customize_value=&_ant_freq=&_ant_voltage=&_ant_asic_boost=false&_ant_low_vol_freq=true&_ant_economic_mode=false&_ant_multi_level=240
The above string can be used with curl, as shown by Tim in the original post.
|
|
|
What are the advantages of performing this hack? What can we do with it that cannot be done without it?
The newest bitmain firmware disables ssh on boot, therefore you can not ssh into machines. Its not a big deal if you have a few machines, but there are many farms out there with hundreds or thousands of miners that automate configuration and reboots using software, this new firmware removes the ability. They quote "security", but its bologna. Why not give the end user a choice to turn ssh on or off through portal. Any end user with a couple machines can turn ssh off, and farms that tunnel through firewalls can leave it on, our choice. They are purposely making larger mining operations lives harder to get an upper hand.
|
|
|
I can automate the configuration of machines. Using web portal is time consuming and tedious if you have many machines. ... What is there that you can do with SSH that you can't do through the web portal?
|
|
|
Hi, I wanted the extra overclocking capabilities of the new May31 s9 firmware, but keep the ssh capabilities of the older firmwares. I unpacked the newest firmware and moved the bmminer file to /usr/bin, the factory bmminer.conf to /config and replaced the pages folder in www in the old firmware using scp.
Bmminer seems to work fine miner side, with the overclocks working properly. The issue is there are now 2.5 times as many stale shares as accepted on average. Pool side I get about 4TH instead of 15.5, and 3.5TH instead of 13.5 in normal mode.
I have an s9 running the newest firmware and it works fine. Its not the network, which is what most google searches lead to.
I ran bmminer through ssh to see the log and there are lots of "lost x shares due to no stratum share response from pool 0", among the accepted share messages.
Has anyone come across this issue? Is there a another file I missed copying over? Or maybe a setting for bmminer in /etc/init.d/bmminer.sh that I should change? I copied the bmminer.sh file from init.d in the new firmware over to the old afterwards as well with no luck.
If it makes any difference, I noticed it takes a few minutes before the lost shares start to show. Any insight is appreciated.
Thanks!
|
|
|
I did, and they told me that it probably got patched. The other guy with the red "exploited" stuff tells me his still works.
|
|
|
FYI
The asicseer "SSH Restore" does not work with newest firmware for s9. It runs, says it was successful, but port 22 is still closed.
|
|
|
For the exploit, I searched and tried the few exploits on exploit-db. I haven't found anything thats a windowns script. The others didin't seem to work (were for older versions than lighttpd 1.4.32, which is whats on the newest firmware.) Has anyone else had more luck?
Thanks
|
|
|
I can't seem to find any previous posts about this. Has anyone cracked the ssh login password for the 24TH Innosilicon t2 turbo? Thanks in advance.
|
|
|
Hi,
Say I have several different miner and different Bitmain models, trying to automate inventory and set up. I am scanning the ip's after they are connected in batches and logging in through SSH using a script. Is there any way I can use linux commands to figure out what model the miner is? (S9,S9i,T9 etc).
The miners use Angstrom linux distributions that lack many hardware checking commands. I check the kernel log but still cant differentiate between a T9 and S9. The best I can think of is to check the default frequency and pools, keep database of which corresponds to which and figure it out accordingly. I know many models use the same controllers, so I have to check either some firmware version or info on the actual card hardware.
TLDR: is there a way to uniquely identify the model of a miner through some hardware/firmware check in the linux command line?
|
|
|
I'm working with an altcoin Universal Currency, but I didn't know where else to ask, and figured there are people with S9 experience here.
I'm trying to figure out how to use BFGminer as a proxy where I point several S9's to BFGminer and BFGminer has a local connection to the wallet server.
BFGminer has a good connection with the local wallet in server mode right now and is accepting information from the wallet, so this isn't the issue.
I set up either an http or stratum port in BFGMiner and for the life of me, using exactly what makes sense in the S9 configuration, the S9 cant communicate with BFGminer.
The desktop with BFG and wallet are on the same computer, the computer is on the same local network as the S9. S9 pings the computer fine. If i try to connect to BFGMiner using chrome when its in http port mode, I get the appropriate JSON data back, and a PXY 0 shows up in BFGMiner. So, I think BFGMiner is working properly.
The S9's I have been testing all connect properly to public pools.
I first of all would like to just connect one S9 straight to the wallet. The same issue occurs as with BFGMiner using the appropriate credentials. I have the right rpc ports being used and allowed, and also the the same rpc passwords/usernames set up.
Have any of you tried similar tests and succeeded? Is there something really dumb I am missing?
|
|
|
Having a very hard time trying to connect an S9 to the unit qt wallet in server mode. All the credentials are correct, we allow the ip of the S9 in config, we set rpc port to 14157, use rpc pass/user.
What is the protocol of the unit wallet? Is it GBT?
We also tried using an intermediate proxy BFGminer, which connected to the wallet fine, but then the S9 cant connect to BFGminer either. Is there some extra steps that need to be made pointing S9 to a local server vs a pool, the S9 works perfectly connected to any pool otherwise.
Thank you in advance.
|
|
|
|