@@ -80,6 +80,8 @@ private int executeUdpClient(Meterpreter meterpreter, TLVPacket request, TLVPack
8080 }
8181 Channel channel = new DatagramSocketChannel (meterpreter , ds );
8282 response .add (TLVType .TLV_TYPE_CHANNEL_ID , channel .getID ());
83+ response .add (TLVType .TLV_TYPE_LOCAL_HOST , ds .getLocalAddress ().getHostAddress ());
84+ response .add (TLVType .TLV_TYPE_LOCAL_PORT , ds .getLocalPort ());
8385 return ERROR_SUCCESS ;
8486 }
8587
@@ -89,14 +91,15 @@ private int executeTcpServer(Meterpreter meterpreter, TLVPacket request, TLVPack
8991 ServerSocket ss = getSocket (localHost , localPort );
9092 Channel channel = new ServerSocketChannel (meterpreter , ss );
9193 response .add (TLVType .TLV_TYPE_CHANNEL_ID , channel .getID ());
94+ response .add (TLVType .TLV_TYPE_LOCAL_HOST , ss .getInetAddress ().getHostAddress ());
95+ response .add (TLVType .TLV_TYPE_LOCAL_PORT , ss .getLocalPort ());
9296 return ERROR_SUCCESS ;
9397 }
9498
9599 protected ServerSocket getSocket (String localHost , int localPort ) throws UnknownHostException , IOException {
96100 return new ServerSocket (localPort , 50 , InetAddress .getByName (localHost ));
97101 }
98102
99-
100103 private int executeTcpClient (Meterpreter meterpreter , TLVPacket request , TLVPacket response ) throws Exception {
101104 String peerHost = request .getStringValue (TLVType .TLV_TYPE_PEER_HOST );
102105 int peerPort = request .getIntValue (TLVType .TLV_TYPE_PEER_PORT );
@@ -124,6 +127,8 @@ private int executeTcpClient(Meterpreter meterpreter, TLVPacket request, TLVPack
124127 Channel channel = new SocketChannel (meterpreter , socket );
125128 channel .startInteract ();
126129 response .add (TLVType .TLV_TYPE_CHANNEL_ID , channel .getID ());
130+ response .add (TLVType .TLV_TYPE_LOCAL_HOST , socket .getLocalAddress ().getHostAddress ());
131+ response .add (TLVType .TLV_TYPE_LOCAL_PORT , socket .getLocalPort ());
127132 return ERROR_SUCCESS ;
128133 }
129134}
0 commit comments