Eval Script

8/28/2022, 8:19:50 PM

目前为 2022-09-02 提交的版本。查看 最新版本

  1. // ==UserScript==
  2. // @name Eval Script
  3. // @namespace Wolfy0615
  4. // @match https://mppclone.com/*
  5. // @match https://multiplayerpiano.com/*
  6. // @grant none
  7. // @version 1.4
  8. // @author Wolfy0615
  9. // @require https://greasyfork.org/scripts/450595-utilinspectforbrowser/code/UtilInspectForBrowser.js
  10. // @description 8/28/2022, 8:19:50 PM
  11. // ==/UserScript==
  12.  
  13. function handleMessage(msg) {
  14. let client = MPP.client;
  15. let token = localStorage.token;
  16. if (client) {
  17. if (msg.a.startsWith(">") && msg.p._id == client.getOwnParticipant()._id) {
  18. try {
  19. let localStorage = {};
  20. window.localStorage = {};
  21. let evaled = eval(msg.a.substring(1).trim());
  22. client.sendArray([{
  23. m: 'a',
  24. message: `✔️ ${typeof evaled} ${window.inspect(evaled)}`.substring(0, 512).replaceAll(token, "[REDACTED]").replaceAll("\n", " ")
  25. }])
  26. } catch (err) {
  27. if (err) {
  28. client.sendArray([{
  29. m: 'a',
  30. message: `❌ ${typeof err} ${err}`
  31. }]);
  32. }
  33. }
  34. }
  35. }
  36. }
  37. function init() {
  38. MPP.client.on("a", msg => { handleMessage(msg); });
  39. }
  40. const checkInterval = setInterval(() => {
  41. if (window.MPP) {
  42. clearInterval(checkInterval);
  43. init();
  44. }
  45. }, 200);