"use strict";

const Base = require("../base");
const LANG = require("../../language"); // 插件语言库
const LANG_T = antSword["language"]["toastr"]; // 通用通知提示
class BaseInfo extends Base {
  exploit() {
    let self=this;
    self.core = this.top.core;
    let args = this.getArgs();
    let data = this.genPayload(args);
    let cellA = this.layout.cells("a");
    let cellB = this.layout.cells("b");
    self.core
      .request(data)
      .then((_ret) => {
        let res = antSword.unxss(_ret["text"], false);
        if (res === "") {
          res = "output is empty.";
        }
        switch(self.shelltype){
          case 'php':
            self.safeHTML(cellA, res);
            break;
          default:
            self.editor.session.setValue(res);
            break;

        }
        toastr.success(LANG["success"], LANG_T["success"]);
        
      })
      .catch((e) => {
        console.log(e);
        toastr.error(e.constructor === Object?JSON.stringify(e):e, "Error");
      });
  }

}
module.exports = BaseInfo;
