Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package test.borrar;
- import java.io.ObjectInputStream;
- import java.io.ObjectOutputStream;
- import net.denrit.deployer.pentest.application.ApplicationInteraction;
- import net.denrit.deployer.pentest.application.msf.MSFClientInteraction;
- import org.silvertunnel.netlib.api.NetFactory;
- import org.silvertunnel.netlib.api.NetLayer;
- import org.silvertunnel.netlib.api.NetLayerIDs;
- import org.silvertunnel.netlib.api.NetSocket;
- import org.silvertunnel.netlib.api.util.TcpipNetAddress;
- public class ClientSocketTest {
- public static void main(String ... s) throws Exception {
- ApplicationInteraction returnApplicationInteraction = null;
- ObjectOutputStream oos = null;
- ObjectInputStream ois = null;
- // open a socket connection
- TcpipNetAddress remoteAddress = new TcpipNetAddress("127.0.0.1", 30000);
- NetLayer netLayer = NetFactory.getInstance().getNetLayerById(NetLayerIDs.TCPIP);
- netLayer.waitUntilReady();
- //
- // // open connection to remote address - this connection is tunneled through the TOR anonymity network
- NetSocket netSocket = netLayer.createNetSocket(null, null, remoteAddress);
- // socket = new Socket(remoteHost, remotePort);
- // open I/O streams for objects
- oos = new ObjectOutputStream(netSocket.getOutputStream());
- ois = new ObjectInputStream(netSocket.getInputStream());
- oos.writeObject(new MSFClientInteraction());
- oos.flush();
- // read an object from the server
- returnApplicationInteraction = (ApplicationInteraction) ois.readObject();
- oos.close();
- ois.close();
- System.out.println("returnApplicationInteraction"+returnApplicationInteraction);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement