Spaces:
Paused

Mervvebulx commited on
Commit
f8106cb
·
verified ·
1 Parent(s): f87a6b6

Update bot.js

Browse files
Files changed (1) hide show
  1. bot.js +13 -15
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 socks = require("socks");
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 net = require("net");
78
- net.createServer((clientSocket) => {
79
- clientSocket.once("data", async (data) => {
80
- // SOCKS handshake'i burada basitçe atlıyoruz
81
- // proxy gelen bağlantıyı SSH üzerinden yönlendiriyor
82
- conn.forwardOut("127.0.0.1", 0, "testadamix.aternos.me", 25565, (err, stream) => {
83
- if (err) {
84
- console.error("forwardOut hatası:", err);
85
- clientSocket.end();
86
- return;
87
- }
88
- clientSocket.pipe(stream).pipe(clientSocket);
89
- });
90
  });
91
- }).listen(1080, "127.0.0.1", () => {
 
 
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
  });