我的华为 USB 调制解调器在浏览任何网站时都会注入 JavaScript 代码

我的华为 USB 调制解调器在浏览任何网站时都会注入 JavaScript 代码

我正在使用 USB 调制解调器,并注意到在我浏览的每个网站的标签javascript前都添加了代码!</body>

<script type = 'text/javascript' id ='1as2ys' charset='utf-8' src='http://105.203.255.69:8080/www/default/base.js'></script>

我查看了base.js注入 URL 中的这个文件,发现了相关但不确定的http://105.203.255.69:8080/www/default/base.js代码Huawei Technologies此代码有何用途?因为它对我来说看起来很烦人。

更新这是里面的代码base.js

/**
 * Huawei Technologies http://www.huawei.com
 *(c) 2014-2015
 *@author Kunal 70924
 *@modified 11.12.2014
 *@usage The Web URL of this file is used in DMC Proxy Configuration to insert toolbar.
 */

/**
 * This anonymous function executes automatically to insert toolbar template & related resources.
 * It also parses the SCG specified parameters and passes it to TLBS
 *
 * @param None
 * @return None
 */
(function() {
    try {
        top.tlbscdr = {};
        top.retlbs = {};
        top.tlbscdr.jscdr = [];
        top.retlbs.status = false; //为true时表示刷新过tlbs
        top.retlbs.langStatus = false; //为true时表示已ç»è¿›å…¥è¿‡è¯­è¨€è®¾ç½®
        top.retlbs.langProcess = false; //为true时表示在语言设置过程中
        top.retlbs.rejs = function(){
            var tlbstoolbar = document.getElementById('tlbstoolbar');
            var iframe = document.getElementsByTagName('iframe')[0];
            var toolget = document.getElementById('toolget');
            var toolcomponentcss = document.getElementById('toolcomponentcss');
            var toolstyle = document.getElementById('toolstyle');
            var toolbarstyle = document.getElementById('toolbarstyle');
            document.body.removeChild(tlbstoolbar);
//            document.body.removeChild(iframe);
            document.head.removeChild(toolget);
            document.head.removeChild(toolcomponentcss);
            document.head.removeChild(toolstyle);
            document.head.removeChild(toolbarstyle);
            top.retlbs.status = true;
            top.tlbsEmbed = false;
            createjs();
        };

        var cdate = new Date();
        var startcdr = {
            'jsname': 'base.js',
            'jsexetype': '1',
            'btime': cdate
        };
        top.tlbscdr.jscdr.push(startcdr);
        /**
         * get url parameter.for examplate url:http://www.baidu.com?p1=1&p2=2
         * getparam('p1') ==1;
         */
        var getparam = function(name) {
            try {
                var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
                var r = top.window.location.search.substr(1).match(reg);
                if (r != null) return unescape(r[2]);
                return "";
            } catch (e) {}
        };
        /**
         * This function creates a new iFrame element in the service page and then adds all template resources
         * as given in the response from JSREQ
         *
         * @param None
         * @return None
         */
        var embedjs = function() {
            if (top.tlbs && !top.tlbsEmbed) {
                top.tlbsEmbed = true;
                var head = top.document.getElementsByTagName('head')[0];
                var tlbs = top.tlbs,
                    js = top.tlbs.iframejs.split("|"),
                    html = '<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />';
                for (var i = 0; i < js.length; i++) {
                    if (js[i].indexOf(".js") != -1) {
                        html += '<script src="' + js[i] + '" defer charset="UTF-8"></script>';
                    } else if (js[i].indexOf(".css") != -1) {
                        var link = document.createElement("link");
                        link.id = "toolcomponentcss";
                        link.rel = "stylesheet";
                        link.type = "text/css";
                        link.charset = "UTF-8";
                        link.href = js[i];
                        head.appendChild(link);
                    }
                }
                html += '</head></html>';
                var iframe = document.createElement("iframe");
                iframe.style.display = "none";
                document.body.appendChild(iframe);
                try {
                    var doc = iframe.contentWindow.document;
                    doc.write(html);
                    doc.close();

                } catch (e) {
                    if (/MSIE/g.test(navigator.userAgent)) {
                        if (location.href.indexOf('www.people.com.cn') >= 0 || location.href.indexOf('www.caijing.com.cn') >= 0) {
                            return;
                        }
                    }
                    iframe.src = "javascript:void((function(){document.open();document.domain='" + document.domain + "';document.write('" + html + "');document.close()})())";
                }
                /**To support angularJS ng-hide and show**/
                var angularstyle = document.createElement('style');
                angularstyle.id = "toolstyle";
                angularstyle.type = 'text/css';
                angularstyle.innerHTML = '@charset "UTF-8";[ng\\:cloak],[ng-cloak],[data-ng-cloak],[x-ng-cloak],.ng-cloak,.x-ng-cloak,.ng-hide:not(.ng-hide-animate){display:none !important;}ng\\:form{display:block;}';
                head.appendChild(angularstyle);
            } else {
                top.nobar = true;
            }
        };

        /**
         * This function calls embedjs function once browser is ready to load a script element.
         *
         * @param Script element
         * @return None
         */
        var loadjs = function(s) {
            if (s.readyState) {
                s.onreadystatechange = function() {
                    if (s.readyState == "loaded" || s.readyState == "complete") {
                        s.onreadystatechange = null;
                        embedjs();

                    }
                };
            } else {
                s.onload = function() {
                    embedjs();

                };
            }
        };

        /**
         * This function parses all SCG provided parameters and prepares attribute value pair in URI format
         *
         * @param Attribute List as array
         * @return parameter URL with AVPs
         */
        var getScgParams = function(attr) {
            var len = attr.length,
                p = '';
            for (var i = 0; i < len; i++) {
                if (!(/^(src|type|id)$/.test(attr[i].name)))
                    p = p + '&' + attr[i].name + "=" + attr[i].value;
            }
            return p;
        };


        /**
         * This function queries script element inserted by Proxy and calls other function to insert iFrame
         * and get list of SCG parameters. It also fetches the resource list from Resource Dispatcher and
         * adds to the head of the service page.
         *
         * @param Attribute List as array
         * @return parameter URL with AVPs
         */
        var createjs = function() {
            var d = document,
                t = d.getElementById('1qa2ws'),
                u = t.getAttribute("src"),
                h = d.head || d.getElementsByTagName("head")[0],
                a = t.attributes,

                scgparam = getScgParams(a);
            s = d.createElement("script");

            loadjs(s);
            top.apptlbs = {};
            s.id = "toolget";
            s.charset = "UTF-8";
            var Mytime = new Date();
            var Time = Mytime.getTime();
            var toolbarURL = u.split('www/')[0];
            var website = top.window.location ? top.window.location.hostname + (top.window.location.port ? ':' + top.window.location.port : '') : '';
            s.src = toolbarURL + "get?time=" + Time + "&tlbsip=" + toolbarURL + "&website=" + website + encodeURI(scgparam);
            var appkey = getparam('appkey');
            if (appkey && (('http://' + website + '/') == toolbarURL)) {
                s.src = s.src + "&appkey=" + appkey;
                top.apptlbs.appkey = appkey;
            }
            h.appendChild(s);
        };
        if (!top.basestate && parent == self) {
            if (top.window.location.href.indexOf("youm7.com") > 0 ) {
                setTimeout(createjs,5000);
            }else{
                createjs();
            }
            top.basestate = true;
        }

        cdate = new Date();
        var endcdr = {
            'jsname': 'base.js',
            'jsexetype': '2',
            'btime': cdate
        };
        top.tlbscdr.jscdr.push(endcdr);

        //TODO: Refer CDR writing in success cases of insertion
    } catch (e) {
        var d = document;
        var t = d.getElementById('1qa2ws');
        var u = t.getAttribute("src");
        var params = e.message;
        params += "&time=" + new Date().getTime();
        var js = document.createElement('script');
        js.onload = js.onreadystatechange = function() {
            if (!this.readyState || this.readyState === 'loaded' || this.readyState === 'complete') {
                js.onload = js.onreadystatechange = null;
                document.body.removeChild(js);
            }
        };
        //TODO: Uncoment below & Refer CDR writing in error cases of insertion
        //js.src = u.split('tlbsgui')[0] + "tlbsserver/stagelog?" + params; 
        //document.body.appendChild(js);
    }

})(window)

相关内容