Merge branch 'main' of https://github.com/Xargana/blahaj-srv
This commit is contained in:
commit
7bd0315fb3
|
@ -821,23 +821,19 @@ case "anime":
|
||||||
const maxHops = interaction.options.getInteger("hops") || 30;
|
const maxHops = interaction.options.getInteger("hops") || 30;
|
||||||
|
|
||||||
const { spawn } = require('child_process');
|
const { spawn } = require('child_process');
|
||||||
const traceroute = spawn('tracepath', ['-4', '-m', maxHops, target]);
|
const tracepath = spawn('tracepath', ['-4', target]); // tracepath with numeric output
|
||||||
|
|
||||||
let output = '';
|
let output = '';
|
||||||
|
|
||||||
traceroute.stdout.on('data', async (data) => {
|
tracepath.stdout.on('data', async (data) => {
|
||||||
// Process each line to make it more compact
|
|
||||||
const newData = data.toString()
|
const newData = data.toString()
|
||||||
.split('\n')
|
.split('\n')
|
||||||
.map(line => {
|
.map(line => line.trim())
|
||||||
// Remove extra spaces and asterisks
|
|
||||||
return line.replace(/\s+/g, ' ').replace(/\* \* \*/g, '*');
|
|
||||||
})
|
|
||||||
.join('\n');
|
.join('\n');
|
||||||
|
|
||||||
output += newData;
|
output += newData;
|
||||||
const traceEmbed = {
|
const traceEmbed = {
|
||||||
title: `Trace to ${target}`,
|
title: `Path to ${target}`,
|
||||||
description: `\`\`\`\n${output}\`\`\``,
|
description: `\`\`\`\n${output}\`\`\``,
|
||||||
color: 0x3498db,
|
color: 0x3498db,
|
||||||
timestamp: new Date(),
|
timestamp: new Date(),
|
||||||
|
@ -847,9 +843,9 @@ case "anime":
|
||||||
await interaction.editReply({ embeds: [traceEmbed] });
|
await interaction.editReply({ embeds: [traceEmbed] });
|
||||||
});
|
});
|
||||||
|
|
||||||
traceroute.on('close', async () => {
|
tracepath.on('close', async () => {
|
||||||
const finalEmbed = {
|
const finalEmbed = {
|
||||||
title: `Trace to ${target} - Complete`,
|
title: `Path to ${target} - Complete`,
|
||||||
description: `\`\`\`\n${output}\`\`\``,
|
description: `\`\`\`\n${output}\`\`\``,
|
||||||
color: 0x00ff00,
|
color: 0x00ff00,
|
||||||
timestamp: new Date(),
|
timestamp: new Date(),
|
||||||
|
@ -861,7 +857,7 @@ case "anime":
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error);
|
console.error(error);
|
||||||
await interaction.editReply({
|
await interaction.editReply({
|
||||||
content: "Failed to perform traceroute. Please check the target and try again.",
|
content: "Failed to trace path. Please check the target and try again.",
|
||||||
ephemeral: true
|
ephemeral: true
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue