package com.pwn;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;

import com.jcraft.jsch.*;
import java.awt.*;
import javax.swing.*;
import java.io.*;


public class Connect extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_connect);
        JSch jsch=new JSch();
        String user="root@10.55.176.112";

        String host="127.0.0.1";
        UserInfo ui = new UserInfo() {
            @Override
            public String getPassphrase() {
                return null;
            }

            @Override
            public String getPassword() {
                return null;
            }

            @Override
            public boolean promptPassword(String s) {
                return false;
            }

            @Override
            public boolean promptPassphrase(String s) {
                return false;
            }

            @Override
            public boolean promptYesNo(String s) {
                return false;
            }

            @Override
            public void showMessage(String s) {

            }
        };


        try{
            Session session=jsch.getSession(host,user,22);
            session.setUserInfo(ui);
            session.connect();
            Channel channel=session.openChannel("exec");

            channel.setInputStream(null);

            String command = "dir";
            ((ChannelExec)channel).setCommand(command);

            ((ChannelExec)channel).setErrStream(System.err);
            channel.connect();




        }catch (JSchException je){
        System.out.println("ERROR ERROR "+ je);
        }



    }
}

@@ -407,17 +407,19 @@
 Sch jsch
-=
+ = 
 new JSch
@@ -441,17 +441,19 @@
 ing user
-=
+ = 
 %22root@10
@@ -486,17 +486,19 @@
 ing host
-=
+ = 
 %22127.0.0
@@ -1230,16 +1230,17 @@
      try
+ 
 %7B%0A      
@@ -1260,17 +1260,19 @@
  session
-=
+ = 
 jsch.get
@@ -1288,13 +1288,15 @@
 ost,
+ 
 user,
+ 
 22);
@@ -1391,17 +1391,19 @@
  channel
-=
+ = 
 session.
@@ -1521,32 +1521,33 @@
   ((ChannelExec)
+ 
 channel).setComm
@@ -1587,16 +1587,17 @@
 nelExec)
+ 
 channel)
@@ -1639,28 +1639,985 @@
     
-channel.connect();%0A%0A
+try %7B%0A                InputStream in = channel.getInputStream();%0A                channel.connect();%0A                byte%5B%5D tmp = new byte%5B1024%5D;%0A                while (true) %7B%0A                    while (in.available() %3E 0) %7B%0A                        int i = in.read(tmp, 0, 1024);%0A                        if (i %3C 0) break;%0A                        System.out.print(new String(tmp, 0, i));%0A                    %7D%0A                    if (channel.isClosed()) %7B%0A                        if (in.available() %3E 0) continue;%0A                        System.out.println(%22exit-status: %22 + channel.getExitStatus());%0A                        break;%0A                    %7D%0A                    try %7B%0A                        Thread.sleep(1000);%0A                    %7D catch (Exception ee) %7B%0A                    %7D%0A                %7D%0A%0A                channel.disconnect();%0A%0A                session.disconnect();%0A%0A            %7D catch (Exception e) %7B%0A%0A                System.out.println(e);%0A%0A            %7D
 %0A%0A%0A 
@@ -2650,16 +2650,22 @@
 on je)%7B%0A
+%0A%0A    
         
@@ -2689,20 +2689,15 @@
 n(%22E
-RROR ERROR %22
+rorr %22 
 + je

Connect 0.1