miwifi_toolbar_config miwifi_toolbar_zone 500K "RR_PATH_STUB";
server {
listen 8380;
resolver localhost;
location / {
set $device_id "DEV_ID_STUB";
set $rom_version "ROM_VERSION_STUB";
set $hardware "DEV_MODEL_STUB";
set $channel "CHANNEL_STUB";
include "/tmp/rr/footer";
miwifi_toolbar miwifi_toolbar_zone;
proxy_pass $scheme://$host$request_uri;
proxy_ignore_client_abort off;
proxy_connect_timeout 30s;
proxy_read_timeout 30s;
proxy_send_timeout 30s;
proxy_buffering off;
proxy_set_header Accept-Encoding '';
proxy_max_temp_file_size 0;
proxy_set_header Host $http_host;
}
}
其实sysapihttpd就是nginx,监听8380端口,做了一个反向代理(用在本地相当于透明代理),插入了/tmp/rr/footer代码(RR_PATH_STUB),至于什么是反向代理,请参考乌云知识库之前的文章《钓鱼?这是反代理!》,那么,这个/tmp/rr/footer是哪里来的呢?
下面为/usr/bin/pull-req-rule第22行:
create_url() {
local ts=${1:-0}
local device_id=$(matool --method deviceID)
local rom=$(uci -q -c /usr/share/xiaoqiang get xiaoqiang_version.version.ROM)
local hardware=$(uci -q -c /usr/share/xiaoqiang get xiaoqiang_version.version.HARDWARE)
local channel=$(uci -q -c /usr/share/xiaoqiang get xiaoqiang_version.version.CHANNEL)
local url="http://api.miwifi.com/rr/config"
echo $url'?'ts=$ts'&'device_id=$device_id'&'rom=$rom'&'hardware=$hardware'&'channel=$channel
}
extract_footer() {
local footer_file="$rr_prefix/footer"
local footer=$(cat $content_file | grep '^footer' | cut -d$'\t' -f 2)
echo "miwifi_toolbar_template \"$footer\";" > $footer_file
}