• XSS.stack #1 – первый литературный журнал от юзеров форума

Напиши скрипт

вот что написал Claude

Код:
const { exec } = require("child_process");

// Array of commands to run every hour
const commands = [
  "dir C:\\",
  "npm update",
  // Add more commands here 
];

setInterval(() => {
  // Loop through each command
  commands.forEach(command => {
    // Execute the command in the shell
    exec(command, (error, stdout, stderr) => {
      if (error) {
        console.error(`Error executing ${command}`, error);
        return;
      }
      console.log(`Ran ${command} successfully`);
      console.log(stdout);
    });
  });
}, 3600000); // Repeat every hour (3600000 milliseconds)

console.log("Started running hourly commands");

To explain what this does:


  • We use the setInterval method to run a callback function every hour
  • In the callback, we loop through the commands array and execute each one
  • We use the child_process.exec method to run the command in a shell
  • We handle any errors and logging to console

The key things you'd need to provide are:


  • The commands to run in the commands array
  • Potentially any arguments those commands need
 
Пожалуйста, обратите внимание, что пользователь заблокирован
const cron = require('node-cron');
const { exec } = require('child_process');

cron.schedule('0 * * * *', () => {
console.log('Запуск cmd');
exec('cmd', (error, stdout, stderr) => {
if (error) {
console.error(`exec error: ${error}`);
return;
}
console.log(`stdout: ${stdout}`);
console.error(`stderr: ${stderr}`);
});
});

Депсек вот что говорит
 


Напишите ответ...
  • Вставить:
Прикрепить файлы
Верх