fix
这个提交包含在:
500
CGI.js
500
CGI.js
@ -1,247 +1,253 @@
|
|||||||
const Key = "ONLINEAICORE";
|
const Key = "INITKEYRMl6EKk6";
|
||||||
const request = require("request");
|
const request = require("request");
|
||||||
const Core = require("./Core");
|
const Core = require("./Core");
|
||||||
const net = require("net");
|
const net = require("net");
|
||||||
const ServicePort = 8092;
|
const ServicePort = 18095;
|
||||||
var HOOK = false;
|
var HOOK = false;
|
||||||
var Session = "";
|
var Session = "";
|
||||||
console.log("["+new Date().toString()+"][./Core.js]服务器已启动");
|
console.log("["+new Date().toString()+"][./Core.js]服务器已启动");
|
||||||
global.DEBUG = {};
|
global.DEBUG = {};
|
||||||
global.DEBUG.Core = Core;
|
global.DEBUG.Core = Core;
|
||||||
var last = {};
|
var last = {};
|
||||||
|
|
||||||
exports.frame={
|
exports.frame={
|
||||||
raw: function(u,MData){
|
raw: function(u,MData){
|
||||||
var Req = new net.Socket();
|
var Req = new net.Socket();
|
||||||
var KData = MData.replace("@Session",Session);
|
var KData = MData.replace("@Session",Session);
|
||||||
var BData = Buffer.from(KData);
|
var BData = Buffer.from(KData);
|
||||||
console.log(KData)
|
console.log(KData)
|
||||||
var MainData = `POST /${u} HTTP/1.1\r\nHost: 127.0.0.1:${ServicePort}\r\nContent-Type: application/json; charset=UTF-8;\r\nContent-Length:${KData.length}\r\n\r\n`;
|
var MainData = `POST /${u} HTTP/1.1\r\nHost: 127.0.0.1:${ServicePort}\r\nContent-Type: application/json; charset=UTF-8;\r\nContent-Length:${KData.length}\r\n\r\n`;
|
||||||
console.log(MainData)
|
console.log(MainData)
|
||||||
Req.connect(ServicePort,"127.0.0.1",()=>{
|
Req.connect(ServicePort,"127.0.0.1",()=>{
|
||||||
Req.write(MainData);
|
Req.write(MainData);
|
||||||
Req.write(BData);
|
Req.write(BData);
|
||||||
Req.on("data",(data)=>{
|
Req.on("data",(data)=>{
|
||||||
console.log(data.toString());
|
console.log(data.toString());
|
||||||
});
|
});
|
||||||
Req.on("end",()=>{
|
Req.on("end",()=>{
|
||||||
Req.end();
|
Req.end();
|
||||||
});
|
});
|
||||||
Req.on("close",()=>{
|
Req.on("close",()=>{
|
||||||
Req.end();
|
Req.end();
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
SendImg: function(c,info,p){
|
SendImg: function(c,info,p){
|
||||||
this.SetHook(true);
|
this.SetHook(true);
|
||||||
|
|
||||||
if(info.group != undefined){
|
if(info.group != undefined){
|
||||||
var Kdata = JSON.stringify({
|
var Kdata = JSON.stringify({
|
||||||
sessionKey:Session,
|
sessionKey:Session,
|
||||||
group:info.group_id,
|
group:info.group_id,
|
||||||
messageChain:[{
|
messageChain:[{
|
||||||
type:"Image",
|
type:"Image",
|
||||||
path:p
|
path:p
|
||||||
}]
|
}]
|
||||||
});
|
});
|
||||||
}else{
|
}else{
|
||||||
var Kdata = JSON.stringify({
|
var Kdata = JSON.stringify({
|
||||||
sessionKey:Session,
|
sessionKey:Session,
|
||||||
qq:info.user_id,
|
qq:info.user_id,
|
||||||
messageChain:[{
|
messageChain:[{
|
||||||
type:"Image",
|
type:"Image",
|
||||||
path:p
|
path:p
|
||||||
}]
|
}]
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
var BData = Buffer.from(Kdata);
|
var BData = Buffer.from(Kdata);
|
||||||
var Ret = "";
|
var Ret = "";
|
||||||
var To = "Friend";
|
var To = "Friend";
|
||||||
if(info.group != undefined){
|
if(info.group != undefined){
|
||||||
To = "Group"
|
To = "Group"
|
||||||
}
|
}
|
||||||
var Req = new net.Socket();
|
var Req = new net.Socket();
|
||||||
console.log(Kdata);
|
console.log(Kdata);
|
||||||
console.log(Kdata);
|
console.log(Kdata);
|
||||||
var MainData = `POST /send${To}Message HTTP/1.1\r\nHost: 127.0.0.1:${ServicePort}\r\nContent-Type: application/json; charset=UTF-8;\r\nContent-Length:${BData.length}\r\n\r\n`;
|
var MainData = `POST /send${To}Message HTTP/1.1\r\nHost: 127.0.0.1:${ServicePort}\r\nContent-Type: application/json; charset=UTF-8;\r\nContent-Length:${BData.length}\r\n\r\n`;
|
||||||
Req.connect(ServicePort,"127.0.0.1",()=>{
|
Req.connect(ServicePort,"127.0.0.1",()=>{
|
||||||
Req.write(MainData);
|
Req.write(MainData);
|
||||||
Req.write(BData);
|
Req.write(BData);
|
||||||
Req.on("data",(data)=>{
|
Req.on("data",(data)=>{
|
||||||
console.log(data.toString());
|
console.log(data.toString());
|
||||||
});
|
});
|
||||||
Req.on("end",()=>{
|
Req.on("end",()=>{
|
||||||
Req.end();
|
Req.end();
|
||||||
});
|
});
|
||||||
Req.on("close",()=>{
|
Req.on("close",()=>{
|
||||||
Req.end();
|
Req.end();
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
SendURLImg: function(c,info,p){
|
SendURLImg: function(c,info,p){
|
||||||
this.SetHook(true);
|
this.SetHook(true);
|
||||||
|
|
||||||
if(info.group != undefined){
|
if(info.group != undefined){
|
||||||
var Kdata = JSON.stringify({
|
var Kdata = JSON.stringify({
|
||||||
sessionKey:Session,
|
sessionKey:Session,
|
||||||
group:info.group_id,
|
group:info.group_id,
|
||||||
messageChain:[{"type":"Plain","text":`IMG`},{
|
messageChain:[{"type":"Plain","text":`IMG`},{
|
||||||
type:"Image",
|
type:"Image",
|
||||||
url:p
|
url:p
|
||||||
}]
|
}]
|
||||||
});
|
});
|
||||||
}else{
|
}else{
|
||||||
var Kdata = JSON.stringify({
|
var Kdata = JSON.stringify({
|
||||||
sessionKey:Session,
|
sessionKey:Session,
|
||||||
qq:info.user_id,
|
qq:info.user_id,
|
||||||
messageChain:[{"type":"Plain","text":`IMG`},{
|
messageChain:[{"type":"Plain","text":`IMG`},{
|
||||||
type:"Image",
|
type:"Image",
|
||||||
url:p
|
url:p
|
||||||
}]
|
}]
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
var BData = Buffer.from(Kdata);
|
var BData = Buffer.from(Kdata);
|
||||||
var Ret = "";
|
var Ret = "";
|
||||||
var To = "Friend";
|
var To = "Friend";
|
||||||
if(info.group != undefined){
|
if(info.group != undefined){
|
||||||
To = "Group"
|
To = "Group"
|
||||||
}
|
}
|
||||||
var Req = new net.Socket();
|
var Req = new net.Socket();
|
||||||
console.log(Kdata);
|
console.log(Kdata);
|
||||||
console.log(Kdata);
|
console.log(Kdata);
|
||||||
var MainData = `POST /send${To}Message HTTP/1.1\r\nHost: 127.0.0.1:${ServicePort}\r\nContent-Type: application/json; charset=UTF-8;\r\nContent-Length:${BData.length}\r\n\r\n`;
|
var MainData = `POST /send${To}Message HTTP/1.1\r\nHost: 127.0.0.1:${ServicePort}\r\nContent-Type: application/json; charset=UTF-8;\r\nContent-Length:${BData.length}\r\n\r\n`;
|
||||||
Req.connect(ServicePort,"127.0.0.1",()=>{
|
Req.connect(ServicePort,"127.0.0.1",()=>{
|
||||||
Req.write(MainData);
|
Req.write(MainData);
|
||||||
Req.write(BData);
|
Req.write(BData);
|
||||||
Req.on("data",(data)=>{
|
Req.on("data",(data)=>{
|
||||||
console.log(data.toString());
|
console.log(data.toString());
|
||||||
});
|
});
|
||||||
Req.on("end",()=>{
|
Req.on("end",()=>{
|
||||||
Req.end();
|
Req.end();
|
||||||
});
|
});
|
||||||
Req.on("close",()=>{
|
Req.on("close",()=>{
|
||||||
Req.end();
|
Req.end();
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
SendMsg: function (connect, info, message) {
|
SendMsg: function (connect, info, message) {
|
||||||
|
|
||||||
this.SetHook(true);
|
this.SetHook(true);
|
||||||
|
|
||||||
if(info.group != undefined){
|
if(info.group != undefined){
|
||||||
var Kdata = JSON.stringify({
|
var Kdata = JSON.stringify({
|
||||||
sessionKey:Session,
|
sessionKey:Session,
|
||||||
group:info.group_id,
|
group:info.group_id,
|
||||||
messageChain:message
|
messageChain:message
|
||||||
});
|
});
|
||||||
}else{
|
}else{
|
||||||
var Kdata = JSON.stringify({
|
var Kdata = JSON.stringify({
|
||||||
sessionKey:Session,
|
sessionKey:Session,
|
||||||
qq:info.user_id,
|
qq:info.user_id,
|
||||||
messageChain:message
|
messageChain:message
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
var BData = Buffer.from(Kdata);
|
var BData = Buffer.from(Kdata);
|
||||||
var Ret = "";
|
var Ret = "";
|
||||||
var To = "Friend";
|
var To = "Friend";
|
||||||
if(info.group != undefined){
|
if(info.group != undefined){
|
||||||
To = "Group"
|
To = "Group"
|
||||||
}
|
}
|
||||||
var Req = new net.Socket();
|
var Req = new net.Socket();
|
||||||
console.log(Kdata);
|
console.log(Kdata);
|
||||||
console.log(Kdata);
|
console.log(Kdata);
|
||||||
var MainData = `POST /send${To}Message HTTP/1.1\r\nHost: 127.0.0.1:${ServicePort}\r\nContent-Type: application/json; charset=UTF-8;\r\nContent-Length:${BData.length}\r\n\r\n`;
|
var MainData = `POST /send${To}Message HTTP/1.1\r\nHost: 127.0.0.1:${ServicePort}\r\nContent-Type: application/json; charset=UTF-8;\r\nContent-Length:${BData.length}\r\n\r\n`;
|
||||||
Req.connect(ServicePort,"127.0.0.1",()=>{
|
Req.connect(ServicePort,"127.0.0.1",()=>{
|
||||||
Req.write(MainData);
|
Req.write(MainData);
|
||||||
Req.write(BData);
|
Req.write(BData);
|
||||||
Req.on("data",(data)=>{
|
Req.on("data",(data)=>{
|
||||||
console.log(data.toString());
|
console.log(data.toString());
|
||||||
});
|
});
|
||||||
Req.on("end",()=>{
|
Req.on("end",()=>{
|
||||||
Req.end();
|
Req.end();
|
||||||
});
|
});
|
||||||
Req.on("close",()=>{
|
Req.on("close",()=>{
|
||||||
Req.end();
|
Req.end();
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
SetHook:function(value){
|
SetHook:function(value){
|
||||||
exports.HOOK = value;
|
exports.HOOK = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var Active = ((force=false)=>{
|
var Active = ((force=false)=>{
|
||||||
if(Session != "" && !force){
|
if(Session != "" && !force){
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
request.post({
|
request.post({
|
||||||
url:`http://127.0.0.1:${ServicePort}/verify`,
|
url:`http://127.0.0.1:${ServicePort}/verify`,
|
||||||
body:JSON.stringify({verifyKey:Key})
|
headers:{
|
||||||
},(err,res)=>{
|
"Content-Type": "application/json"
|
||||||
if(res == null){
|
},
|
||||||
console.log("["+new Date().toString()+"][./Core.js]系统断线,十秒后重连");
|
body:JSON.stringify({verifyKey:Key})
|
||||||
setTimeout(()=>{
|
},(err,res)=>{
|
||||||
Active(true)
|
if(res == null){
|
||||||
},10000)
|
console.log("["+new Date().toString()+"][./Core.js]系统断线,十秒后重连");
|
||||||
return;
|
setTimeout(()=>{
|
||||||
}
|
Active(true)
|
||||||
Session = JSON.parse(res.body).session;
|
},10000)
|
||||||
request.post({
|
return;
|
||||||
url:`http://127.0.0.1:${ServicePort}/bind`,
|
}
|
||||||
body:JSON.stringify({
|
Session = JSON.parse(res.body).session;
|
||||||
sessionKey:Session,
|
request.post({
|
||||||
qq:2142562417
|
url:`http://127.0.0.1:${ServicePort}/bind`,
|
||||||
})
|
headers:{
|
||||||
},(err2,res2)=>{
|
"Content-Type": "application/json"
|
||||||
console.log("["+new Date().toString()+"][./Core.js]Session激活成功.");
|
},
|
||||||
console.log(`得到Session[${Session}]`);
|
body:JSON.stringify({
|
||||||
exports.HOOK = HOOK;
|
sessionKey:Session,
|
||||||
var STHandle = setInterval(()=>{
|
qq:2142562417
|
||||||
if(Session == ""){return}
|
})
|
||||||
request.get({
|
},(err2,res2)=>{
|
||||||
url:`http://127.0.0.1:${ServicePort}/fetchLatestMessage?sessionKey=${Session}&count=1`
|
console.log("["+new Date().toString()+"][./Core.js]Session激活成功.");
|
||||||
},(err,data)=>{
|
console.log(`得到Session[${Session}]`);
|
||||||
if(err){
|
exports.HOOK = HOOK;
|
||||||
console.error(err);
|
var STHandle = setInterval(()=>{
|
||||||
}
|
if(Session == ""){return}
|
||||||
if(data == null || data == undefined){return}
|
request.get({
|
||||||
if(data.body.toString().substr(0,1)!="{"){return;}
|
url:`http://127.0.0.1:${ServicePort}/fetchLatestMessage?sessionKey=${Session}&count=1`
|
||||||
var MainData = JSON.parse(data.body);
|
},(err,data)=>{
|
||||||
if(MainData == null || MainData == undefined){return};
|
if(err){
|
||||||
if(MainData.code != 0){
|
console.error(err);
|
||||||
console.log(MainData);
|
}
|
||||||
Session = "";
|
if(data == null || data == undefined){return}
|
||||||
console.log(`[${new Date().toString()}][CGI.JS]MIRAI端掉线,十秒后重连`)
|
if(data.body.toString().substr(0,1)!="{"){return;}
|
||||||
clearInterval(STHandle);
|
var MainData = JSON.parse(data.body);
|
||||||
setTimeout(()=>{
|
if(MainData == null || MainData == undefined){return};
|
||||||
Active(true)
|
if(MainData.code != 0){
|
||||||
},10000)
|
console.log(MainData);
|
||||||
}
|
Session = "";
|
||||||
if(MainData.data == null||MainData.data == undefined){return};
|
console.log(`[${new Date().toString()}][CGI.JS]MIRAI端掉线,十秒后重连`)
|
||||||
var data_obj = MainData.data[0];
|
clearInterval(STHandle);
|
||||||
if(data_obj == undefined){return};
|
setTimeout(()=>{
|
||||||
if(data_obj == last){
|
Active(true)
|
||||||
return
|
},10000)
|
||||||
}else{
|
}
|
||||||
if(data_obj["type"]=="BotOfflineEventActive"){
|
if(MainData.data == null||MainData.data == undefined){return};
|
||||||
Session = "";
|
var data_obj = MainData.data[0];
|
||||||
console.log(`[${new Date().toString()}][CGI.JS]MIRAI端掉线,十秒后重连`)
|
if(data_obj == undefined){return};
|
||||||
clearInterval(STHandle);
|
if(data_obj == last){
|
||||||
setTimeout(()=>{
|
return
|
||||||
Active(true)
|
}else{
|
||||||
},10000)
|
if(data_obj["type"]=="BotOfflineEventActive"){
|
||||||
}
|
Session = "";
|
||||||
Core.frame.CGI("",data_obj);
|
console.log(`[${new Date().toString()}][CGI.JS]MIRAI端掉线,十秒后重连`)
|
||||||
last = data_obj;
|
clearInterval(STHandle);
|
||||||
}
|
setTimeout(()=>{
|
||||||
});
|
Active(true)
|
||||||
},50);
|
},10000)
|
||||||
});
|
}
|
||||||
});}
|
Core.frame.CGI("",data_obj);
|
||||||
)
|
last = data_obj;
|
||||||
|
}
|
||||||
global.Active = Active;
|
});
|
||||||
Active();
|
},50);
|
||||||
|
});
|
||||||
|
});}
|
||||||
|
)
|
||||||
|
|
||||||
|
global.Active = Active;
|
||||||
|
Active();
|
||||||
|
|||||||
@ -1,4 +1,9 @@
|
|||||||
{
|
{
|
||||||
|
"AI":{
|
||||||
|
"Allow":true,
|
||||||
|
"FindIn":"fs",
|
||||||
|
"Path":"AI.js"
|
||||||
|
},
|
||||||
"远程执行测试": {
|
"远程执行测试": {
|
||||||
"Allow": false,
|
"Allow": false,
|
||||||
"FindIn": "fs",
|
"FindIn": "fs",
|
||||||
@ -54,10 +59,5 @@
|
|||||||
"Allow":true,
|
"Allow":true,
|
||||||
"FindIn":"fs",
|
"FindIn":"fs",
|
||||||
"Path":"农村.js"
|
"Path":"农村.js"
|
||||||
},
|
|
||||||
"GeoGeBra":{
|
|
||||||
"Allow":true,
|
|
||||||
"FindIn":"fs",
|
|
||||||
"Path":"GeoGeBra.js"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1 +1 @@
|
|||||||
{"固定资产":{"80000000":10000,"862869995":1550,"927980270":426387,"1285908631":500,"2044792347":23245,"2142562417":10000,"2284888681":899,"2645989614":550,"2868445034":1050,"3054331058":1100,"3162625498":26979,"3491504564":26623,"3569808588":1000,"@927980270":10000},"利息":{"862869995":"20206","927980270":"20231","2645989614":"20206","2868445034":"20206","3054331058":"20207","3162625498":"20230","3491504564":"20230"},"领工资":{"862869995":"202063","927980270":"202324","2284888681":"202064","2868445034":"202064","3054331058":"202072","3162625498":"202302","3491504564":"202313","3569808588":"202066"},"签到":{"862869995":"202063","927980270":"202324","1285908631":"202061","2044792347":"2022104","2284888681":"202064","2645989614":"202064","2868445034":"202061","3054331058":"202072","3162625498":"202302","3491504564":"202313","3569808588":"202066"},"RedPacketPool":20209,"SandBox":{"新春":"{\"927980270\":true,\"2044792347\":true,\"3162625498\":true}","a":"1"},"目标":{"3162625498":"927980270"},"AITalk":{"927980270":true,"2868445034":false,"3491504564":false,"Core":false},"板砖":{"927980270":0,"2044792347":null},"公会系统":{"927980270":"共学社"},"AIEnable":{"545541668":true,"588932037":true,"744368753":false,"776148636":true,"963936042":true,"966138955":true,"1012022482":true},"保镖[2022 0 3]":{"927980270":3},"保镖[2022 0 5]":{"927980270":5}}
|
{"固定资产":{"80000000":10000,"862869995":1550,"927980270":471672,"1285908631":500,"2044792347":23245,"2142562417":10000,"2284888681":899,"2645989614":550,"2868445034":1050,"3054331058":1100,"3162625498":26979,"3491504564":26623,"3569808588":1000,"@927980270":10000},"利息":{"862869995":"20206","927980270":"202511","2645989614":"20206","2868445034":"20206","3054331058":"20207","3162625498":"20230","3491504564":"20230"},"领工资":{"862869995":"202063","927980270":"2025115","2284888681":"202064","2868445034":"202064","3054331058":"202072","3162625498":"202302","3491504564":"202313","3569808588":"202066"},"签到":{"862869995":"202063","927980270":"2025116","1285908631":"202061","2044792347":"2022104","2284888681":"202064","2645989614":"202064","2868445034":"202061","3054331058":"202072","3162625498":"202302","3491504564":"202313","3569808588":"202066"},"RedPacketPool":19257,"SandBox":{"新春":"{\"927980270\":true,\"2044792347\":true,\"3162625498\":true}","a":"1"},"目标":{"3162625498":"927980270"},"AITalk":{"927980270":true,"2868445034":false,"3491504564":false,"Core":false},"板砖":{"927980270":0,"2044792347":null},"公会系统":{"927980270":"共学社"},"AIEnable":{"545541668":true,"588932037":true,"744368753":false,"776148636":true,"963936042":true,"966138955":true,"1012022482":true},"保镖[2022 0 3]":{"927980270":3},"保镖[2022 0 5]":{"927980270":5}}
|
||||||
在新工单中引用
屏蔽一个用户