Created

Embed URL

HTTPS clone URL

SSH clone URL

You can clone with HTTPS or SSH.

Download Gist
View gist:af529233b026c7d2726b
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54
 
 
package becroutertest;
import java.io.*;
import java.net.Socket;
/**
*
* @author redacted
*/
public class BecRouterTest {
public Socket connect;
public InputStreamReader input;
public OutputStreamWriter output;
public BecRouterTest(InputStreamReader a, OutputStreamWriter b, Socket c){
connect = c;
input = a;
output = b;
}
public void readAndWrite() throws java.io.IOException {
int c;
char p;
while((c=input.read()) != -1){
p = (char) c;
System.out.print(p);
}
}
public static void main(String[] args) throws java.io.IOException{
String IPAddress = "<IP I'm Trying to access>";
int Port = 23; // Default port for Telnet
Socket connection = new Socket(IPAddress, Port);
connection.setKeepAlive(true); // Keep the connection alive
InputStreamReader in = new InputStreamReader(connection.getInputStream());
OutputStreamWriter out = new OutputStreamWriter(connection.getOutputStream());
BecRouterTest contact = new BecRouterTest(in, out, connection);
contact.readAndWrite();
contact.output.write("<Login Password>\r\n");
contact.output.flush();
contact.readAndWrite();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.