OverviewFilesCommitsIssuesDocsReleasesPeers

keet-cli / deobfuscated / api / v1 / inspector.js

74 lines · javascript ref:
const {
  Console,Server}
=require('bare-inspector');
const {
  once}
=require('bare-events');
class KeetInspector{
  constructor({port:port=-0xefa,host:host="localhost"}={}){
    _0x1b7f61={
      _0x146382:0xbf},_0x420aec={
      _0x3d9825:0xe3,_0x5ef41f:0x11b,_0x567520:0x223}
    ;
    this.port=port,this.host=host,this._server=null,this._url=null,this._bareConsole=null,this._oldConsole=global.console;
  }
get.key(){
  _0x4ab4b5={
    _0x2c8485:0x8e,_0x595524:0x149,_0xc6b70c:0x32e}
  ;
  return this._url;
}
._overrideConsole(){
  _0x8f3388={
    _0x5ee14e:0x573,_0x53df26:0x582,_0x135163:0x56f},_0xb9919b={
    _0x2e6120:0x190,_0x1017d9:0x18a},_0x31ac37={
    _0x52218a:0x1f0,_0x135c2c:0x45},_0x2b8a17={
    _0x462248:0x0,_0x40505b:0x1a,_0x3ebc33:0x277}
  ;
  if(!this._bareConsole)this._bareConsole=new Console();
  const _0x1ed961={
  }
;
for(const _0x5c0923 of Object.keys(this._bareConsole)){
  _0x1ed961[_0x5c0923]=(..._0x5351be)=>{
    this._bareConsole[_0x5c0923](..._0x5351be),this._oldConsole[_0x5c0923](..._0x5351be);
  }
;
}
global.console=_0x1ed961;
}
._resetConsole(){
  _0x513711={
    _0x2203ea:0x7d,_0xbd5af3:0xb7}
  ;
  global.console=this._oldConsole;
}
async.enable(){
  _0x3a5b4a={
    _0x269b6d:0x14f,_0x5c87ce:0x100},_0x15373f={
    _0x30aea4:0xe4,_0x10cde:0xe2},_0x2230b3={
    _0x16b648:0x171}
  ;
  this._server=new Server(this.port,this.host);
  this._server.on("close",()=>{this._resetConsole();}),await once(this._server,'listening'),this._overrideConsole();
  const {
    port:_0x5c243a}
  =this._server.address();
  return this._url="devtools://devtools/bundled/js_app.html?ws=localhost:"+_0x5c243a,console.log("Keet core inspector\x20url: "+this._url),this._url;
}
async.disable(){
  _0x3937ee={
    _0x24a344:0x194,_0x3edafd:0x281},_0x1b31a0={
    _0x3ef375:0xb1,_0x4647df:0x57,_0x3e621f:0x220},_0xe2db12={
    _0x332d97:0x4b3,_0x559b00:0x4b4,_0x15cc6d:0x4bc,_0x415181:0x4c2},_0x22de5b={
    _0x46a3d0:0x7e},_0x53de7b={
    _0x239e4e:0x83,_0x2de080:0x1bf}
  ;
  if(!this._server)return;
  await new Promise(_0xf38098=>{this._server.close(_0xf38098);});
  this._server=null,this._resetConsole();
  this._bareConsole=null,this._url=null;
}
}
module.exports=KeetInspector;