Back to blog
Aug 01, 2024
2 min read

Case: Pterodactyl

The script I created to install the pterodactyl panel.

Tinggal salin aja, ini script case. Kalo mau ubah ke plugin silahkan 👌🏻

Copy

//koi

const { Client } = require('ssh2');

case 'sudo': {
conn.sendMessage(m.chat, { react: { text: '🕒', key: m.key }})
try {
const steps = [
"bash <(curl -s https://pterodactyl-installer.se)",
"0",
"tes",
"tes",
"Asia/Jakarta",
"panel@gmail.com",
"panel123@gmail.com",
"admin",
"admin",
"admin",
"admin@gmail.com",
"y",
"y",
"y",
"y",
"y",
"yes",
"A",
"c",
"y"
];

const conn = new Client()

conn.on('ready', () => {
console.log('Client :: ready');
conn.shell((err, stream) => {
if (err) throw err;

let currentStep = 0;

stream.on('close', () => {
console.log('Stream :: close');
conn.end();
}).on('data', (data) => {
const response = data.toString('utf8').trim();

if (response.includes('(yes/no)')) {
stream.write(`${steps[currentStep]}\n`);
} else {
m.reply(response)
}

currentStep++;

if (currentStep === steps.length) {
stream.write('exit\n');
}
});
});
}).connect({
host: '',
port: 22,
username: '',
password: ''
});
m.reply('Sedang menjalankan instalasi Pterodactyl Panel...')
} catch (e) {
console.error(e);
await m.reply('Terjadi kesalahan dalam menjalankan permintaan Anda.')
}
}
break