Spaces:
Paused
Paused
Update bot.js
Browse files
bot.js
CHANGED
|
@@ -8,7 +8,7 @@ const util = require("util");
|
|
| 8 |
|
| 9 |
const { Client } = require("ssh2");
|
| 10 |
const { SocksProxyAgent } = require("socks-proxy-agent");
|
| 11 |
-
const
|
| 12 |
|
| 13 |
const config = require("./settings.json");
|
| 14 |
const loggers = require("./logging.js");
|
|
@@ -74,22 +74,20 @@ function connectWithSSH() {
|
|
| 74 |
conn.on("ready", () => {
|
| 75 |
console.log(`SSH bağlantısı başarılı: ${server.host}`);
|
| 76 |
usingFallback = false;
|
| 77 |
-
const
|
| 78 |
-
|
| 79 |
-
|
| 80 |
-
|
| 81 |
-
|
| 82 |
-
|
| 83 |
-
|
| 84 |
-
console.error("forwardOut hatası:", err);
|
| 85 |
-
clientSocket.end();
|
| 86 |
-
return;
|
| 87 |
-
}
|
| 88 |
-
clientSocket.pipe(stream).pipe(clientSocket);
|
| 89 |
-
});
|
| 90 |
});
|
| 91 |
-
})
|
|
|
|
|
|
|
| 92 |
console.log("SOCKS proxy 127.0.0.1:1080 üzerinden çalışıyor");
|
|
|
|
|
|
|
| 93 |
const agent = new SocksProxyAgent("socks5://127.0.0.1:1080");
|
| 94 |
createBot(agent);
|
| 95 |
});
|
|
|
|
| 8 |
|
| 9 |
const { Client } = require("ssh2");
|
| 10 |
const { SocksProxyAgent } = require("socks-proxy-agent");
|
| 11 |
+
const { SocksServer } = require("socks");
|
| 12 |
|
| 13 |
const config = require("./settings.json");
|
| 14 |
const loggers = require("./logging.js");
|
|
|
|
| 74 |
conn.on("ready", () => {
|
| 75 |
console.log(`SSH bağlantısı başarılı: ${server.host}`);
|
| 76 |
usingFallback = false;
|
| 77 |
+
const server = SocksServer.createServer((info, accept, deny) => {
|
| 78 |
+
conn.forwardOut(info.srcAddr, info.srcPort, info.dstAddr, info.dstPort, (err, stream) => {
|
| 79 |
+
if (err) return deny();
|
| 80 |
+
const clientSocket = accept(true);
|
| 81 |
+
if (clientSocket) {
|
| 82 |
+
stream.pipe(clientSocket).pipe(stream);
|
| 83 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 84 |
});
|
| 85 |
+
});
|
| 86 |
+
|
| 87 |
+
server.listen(1080, "127.0.0.1", () => {
|
| 88 |
console.log("SOCKS proxy 127.0.0.1:1080 üzerinden çalışıyor");
|
| 89 |
+
|
| 90 |
+
// Mineflayer’i proxy üzerinden bağlat
|
| 91 |
const agent = new SocksProxyAgent("socks5://127.0.0.1:1080");
|
| 92 |
createBot(agent);
|
| 93 |
});
|