Skip to content

cant get the Location modify by JS. #98

Open
@sgf

Description

@sgf

Bug Report

[Description of the bug]

the script not executed or its executed but i cant get the result.
the script is modify the location.but i cant get any change with

Steps to Reproduce

  1. [First Step]
<html>

<head>
    <script>
        function getName() {
            var caller = getName.caller; if (caller.name) { return caller.name }
            var str = caller.toString().replace(/[\s]*/g, "");
            var name = str.match(/^function([^\(]+?)\(/);
            if (name && name[1]) { return name[1]; } else { return ''; }
        }
        cD = '?';
        function tI() { 'return tI'; return '5' }
        t8 = '_';
        IsoT = function () { 'return IsoT'; return 'ign'; };
        Y8 = function () { 'Y8'; var _Y = function () { return '4' }; return _Y(); };
        AGjj = function () {
            'AGjj';
            var _A = function () { return 'thr' }; return _A();
        };
        _Fi30O = 'href';
        _bBbb3 = 'replace';
        Oh = 'e';
        ua2d = function () { 'ua2d'; var _u = function () { return '-1-' }; return _u(); };
        H0 = '/';
        function s2() { 's2'; function _s() { return '1' }; return _s(); }
        _AiXGg = window;
        UM = '1';
        _SOq5H = 'assign';
        _ai4mU = location;
        lIk = function (lIk_) { var _l = function (lIk_) { 'return lIk'; return lIk_; }; return _l(lIk_); };
        So = function () { 'So'; var _S = function () { return 'd' }; return _S(); };
        VP = function () { 'return VP'; return '='; };
		debugger
		 tmp1= H0 +
            AGjj() +
            Oh +
            (function () { 'return BgQP'; return (function () { return 'ad-'; })(); })() +
            UM +
            (function () { 'return nh'; return (function () { return '3'; })(); })() +
            tI() +
            (function (f9Z_) { return (function (f9Z_) { return f9Z_; })(f9Z_); })('87') +
            ua2d() +
            s2() +
            (function (RTD_) { return (function (RTD_) { return RTD_; })(RTD_); })('.h') +
            (function () { 'return w9'; return 't' })() +
            (function (s0o_) { return (function (s0o_) { return s0o_; })(s0o_); })('ml') +
            cD +
            t8 +
            So() +
            (function () { 'return WK'; return 's' })() +
            IsoT() +
            VP() +
            (function () { 'return gd'; return (function () { return 'b'; })(); })() +
            Y8() +
            (function (CPh_) { return (function (CPh_) { return CPh_; })(CPh_); })('60') +
            lIk('e6') +
            (function (S7H_) { return (function (S7H_) { return S7H_; })(S7H_); })('5b');
		
        location=tmp1;//modify here : location=“/thread-13587-1-1.html?_dsign=b460e65b”;
		 tmp2= H0 + AGjj() + Oh +
            (function () { 'return BgQP'; return (function () { return 'ad-'; })(); })() +
            UM +
            (function () { 'return nh'; return (function () { return '3'; })(); })() +
            tI() +
            (function (f9Z_) { return (function (f9Z_) { return f9Z_; })(f9Z_); })('87');
        _AiXGg[_Fi30O] =tmp2;//modify here  : window["href"] =“/thread-13587”;
    </script>
</head>

<body>
</body>
<html>
  1. [Second Step]
 var configWithJs = Configuration.Default
        //.Without<JsNavigationHandler>()
        .WithDefaultLoader().WithJs()
.WithConsoleLogger(ctx => new MyConsoleLogger(ctx));
    //var handler = new HttpClientHandler();
    //-handler.AllowAutoRedirect = true;
    //+handler.AllowAutoRedirect = false;
    //configWithJs.WithRequesters()
    //configWithJs.WithRequester < ()
    //This is our sample source, we will trigger the load event
    var source = @"<html><head><script type=""text/javascript"">B0=function(){'B0';var _B=function(){return '/'}; return _B();};mpiS='e65';function cTh8(){'return cTh8';return '1-1'}_R84h2 = 'replace';GZ='t';function Y9r(Y9r_){function tm(){return getName();};return tm();return 'Y9r'}function getName(){var caller=getName.caller;if(caller.name){return caller.name} var str=caller.toString().replace(/[\s]*/g,"""");var name=str.match(/^function([^\(]+?)\(/);if(name && name[1]){return name[1];} else {return '';}}function YNsE(YNsE_){function _Y(YNsE_){function b46(){return getName();}function YNsE_(){}return b46();return YNsE_}; return _Y(YNsE_);}function F5(){'return F5';return '?'}function zY(){'zY';function _z(){return '.'}; return _z();}gC=function(){'return gC';return '_';};I0=function(){'I0';var _I=function(){return 'l'}; return _I();};_cqkf1 = window;_UK8tv = 'assign';EZ='h';Hz2A='dsi';function YB(YB_){function h(){return getName();};return h();return 'YB'}cnJ=function(cnJ_){var _c=function(cnJ_){'return cnJ';return cnJ_;}; return _c(cnJ_);};_Ieo6L = 'href';_Fd5t2 = location;Yw='-';go=function(){'go';var _g=function(){return '7'}; return _g();};_Fd5t2[_Ieo6L]=B0()+GZ+YB('ZV')+cnJ('re')+(function(sFT_){'return sFT';return sFT_})('ad')+'-1'+(function(){'return kW0j';return (function(){return '358';})();})()+go()+Yw+cTh8()+zY()+EZ+Y9r('DZB')+I0()+F5()+gC()+Hz2A+(function(wnn_){'return wnn';return wnn_})('gn')+(function(){'return Hi';return '='})()+YNsE('F3T4')+(function(){'return B3';return '0'})()+mpiS+(function(QB7_){'return QB7';return QB7_})('b');_cqkf1.href=B0()+GZ+YB('ZV')+cnJ('re')+(function(sFT_){'return sFT';return sFT_})('ad')+'-1'+(function(){'return kW0j';return (function(){return '358';})();})()+go();</script></head><body></body></html>";

    var contextWithJs = BrowsingContext.New(configWithJs);

    await contextWithJs.OpenAsync(req =>
    {
        req.Content(source);
        req.Address(@"http://localhost:8080");

    }).WaitUntilAvailable();
    var threadDoc = contextWithJs.Active;
    var threadDocUrl = contextWithJs.Active.Url;
    var threadDoclocation= contextWithJs.Active.location;
  1. [and so on...]

Expected behavior: [What you expected to happen]

got the threadDoclocation : http://localhost:8080/thread-13587-1-1.html?_dsign=b460e65b

Actual behavior: [What actually happened]

Environment details: [OS, .NET Runtime, ...]

.net 8.0

Possible Solution

[Optionally, share your idea to fix the issue]

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions