Giter VIP home page Giter VIP logo

x-delete.github.io's People

Stargazers

Teru avatar Kasasa avatar towanoah avatar hatomato avatar lzx avatar たすくん avatar  avatar yasako avatar stepney141 avatar Shotaro Nakamura avatar �東�京� avatar Oriver K avatar  avatar Munieru avatar  avatar Sawa avatar rei avatar  avatar calloc134 avatar Risu avatar  avatar

Watchers

 avatar  avatar

x-delete.github.io's Issues

Uncaught ReferenceError: nonce is not defined

背景

当該スクリプトが動作しなかったため報告

エラー文の内容

Uncaught ReferenceError: nonce is not defined
    onload javascript:if("twitter.com"!=window.location.host)alert("Twitter(X)\u3092\u958b\u3044\u305f\u72b6\u614b\u3067\u5b9f\u884c\u3057\u3066\u304f\u3060\u3055\u3044");else{var start=document.createElement("div");start.innerText="\u8d77\u52d5\u4e2d";start.style.cssText="z-index:99999;width:30%;height:80px;line-height:80px;font-weight:bold;font-family:sans-serif;position:fixed;background-color:#fbf7f7;color:#000;inset:0;margin:auto;text-align:center;";document.body.appendChild(start);var xhr=new XMLHttpRequest;xhr.open("get","https://pbs.twimg.com/media/GHbAo4yaEAArAC4.png");xhr.responseType="blob";xhr.send();xhr.onreadystatechange=function(){if(4===xhr.readyState&&200===xhr.status){var f=document.createElement("canvas"),c=new Image;c.src=URL.createObjectURL(this.response);c.onload=function(){var b=f.getContext("2d",{willReadFrequently:!0}),d=c.width,g=c.height,a=[],l=!1,m="";f.setAttribute("width",d);f.setAttribute("height",g);b.drawImage(c,0,0,d,g);var e=0;a:for(;e<d*g;e++)for(var n=b.getImageData(Math.floor(e/d),e%d,1,1),h=0;3>h;h++){var k=n.data[h];if(l&&255==k)break a;a.push(k);l=255==k}for(b=0;b<(a.length-1)/2;b++)m+=String.fromCharCode(256*a[2*b]+a[2*b+1]);try{eval("")}catch(p){for(a=p.message.split("'"),b=0;b<a.length;b++)a[b].includes("nonce")&&(nonce=a[b].slice(6))}a=document.createElement("script");a.src="data:text/javascript;base64,"+btoa(unescape(encodeURIComponent(m)));a.onload=function(){start.remove();init()};a.nonce=nonce;document.body.appendChild(a)}}}};void+0:1

考えられる原因

        a.nonce = nonce;

ブックマークスクリプトを展開すると以下の通り

if ("twitter.com" != window.location.host)
  alert(
    "Twitter(X)\u3092\u958b\u3044\u305f\u72b6\u614b\u3067\u5b9f\u884c\u3057\u3066\u304f\u3060\u3055\u3044"
  );
else {
  var start = document.createElement("div");
  start.innerText = "\u8d77\u52d5\u4e2d";
  start.style.cssText =
    "z-index:99999;width:30%;height:80px;line-height:80px;font-weight:bold;font-family:sans-serif;position:fixed;background-color:#fbf7f7;color:#000;inset:0;margin:auto;text-align:center;";
  document.body.appendChild(start);
  var xhr = new XMLHttpRequest();
  xhr.open("get", "https://pbs.twimg.com/media/GKeVVCTasAAqNYU.png");
  xhr.responseType = "blob";
  xhr.send();
  xhr.onreadystatechange = function () {
    if (4 === xhr.readyState && 200 === xhr.status) {
      var f = document.createElement("canvas"),
        c = new Image();
      c.src = URL.createObjectURL(this.response);
      c.onload = function () {
        var b = f.getContext("2d", { willReadFrequently: !0 }),
          d = c.width,
          g = c.height,
          a = [],
          l = !1,
          m = "";
        f.setAttribute("width", d);
        f.setAttribute("height", g);
        b.drawImage(c, 0, 0, d, g);
        var e = 0;
        a: for (; e < d * g; e++)
          for (
            var n = b.getImageData(Math.floor(e / d), e % d, 1, 1), h = 0;
            3 > h;
            h++
          ) {
            var k = n.data[h];
            if (l && 255 == k) break a;
            a.push(k);
            l = 255 == k;
          }
        for (b = 0; b < (a.length - 1) / 2; b++)
          m += String.fromCharCode(256 * a[2 * b] + a[2 * b + 1]);
        try {
          eval("");
        } catch (p) {
          for (a = p.message.split("'"), b = 0; b < a.length; b++)
            a[b].includes("nonce") && (nonce = a[b].slice(6));
        }
        a = document.createElement("script");
        a.src =
          "data:text/javascript;base64," +
          btoa(unescape(encodeURIComponent(m)));
        a.onload = function () {
          start.remove();
          init();
        };
        a.nonce = nonce;
        document.body.appendChild(a);
      };
    }
  };
}
void 0;

これをコンソールで実行すると以下の通り

Uncaught ReferenceError: nonce is not defined
    onload debugger eval code:58
    onreadystatechange debugger eval code:20
    EventHandlerNonNull* debugger eval code:15
[debugger eval code:58:9](chrome://devtools/content/webconsole/debugger%20eval%20code)
    onload debugger eval code:58
    (非同期: EventHandlerNonNull)
    onreadystatechange debugger eval code:20
    (非同期: EventHandlerNonNull)
    <匿名> debugger eval code:15
    getEvalResult resource://devtools/server/actors/webconsole/eval-with-debugger.js:306
    evalWithDebugger resource://devtools/server/actors/webconsole/eval-with-debugger.js:218
    evaluateJS resource://devtools/server/actors/webconsole.js:953
    evaluateJSAsync resource://devtools/server/actors/webconsole.js:846
    makeInfallible resource://devtools/shared/ThreadSafeDevToolsUtils.js:103

修正方針

  • ナンスを取得できるようにスクリプトを修正する

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.