Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import org.jsoup.*;
- import java.io.*;
- import org.jsoup.nodes.*;
- import java.net.*;
- public class Analyser extends Adapter implements Runnable
- {
- public String command;
- public static int i;
- public static void main(String args[]) throws IOException,InterruptedException
- {
- Analyser obj=new Analyser();
- obj.core();
- }
- public void core() throws IOException
- {
- BufferedReader scan=new BufferedReader(new InputStreamReader(System.in));
- Thread time=new Thread(new Analyser());
- time.start();
- connect("");
- do
- {
- command=scan.readLine();
- switches();
- }
- while(!command.equals(":quit"));
- }
- public void switches() throws IOException
- {
- if(connected)
- {
- if(command.contains(":get"))
- {
- if(command.contains("-node"))
- {
- System.out.println(con.nodeName());
- }
- if(command.contains("-tag"))
- {
- System.out.println(con.tagName());
- }
- if(command.contains("-source"))
- {
- System.out.println(con.html());
- }
- if(command.contains("-txt"))
- {
- System.out.println(con.text());
- }
- if(command.contains("-hash"))
- {
- System.out.println(con.hashCode());
- }
- if(command.contains("-title"))
- {
- System.out.println(con.title());
- }
- if(command.contains("-ip"))
- {
- InetAddress ip=InetAddress.getByName(website);
- System.out.println(ip);
- }
- if(command.contains("-session"))
- {
- System.out.println(i+" seconds");
- }
- if(command.contains("-jvs"))
- {
- String src=con.html();
- if(src.contains("<script>"))
- {
- System.out.println("jvs: true");
- }
- else
- {
- System.out.println("jvs: false");
- }
- }
- if(command.contains("-css"))
- {
- String src=con.html();
- if(src.contains("<style>"))
- {
- System.out.println("css: true");
- }
- else
- {
- System.out.println("css: false");
- }
- }
- }
- if(command.equals(":reload"))
- {
- disconnect();
- }
- if(command.equals(":cls"))
- {
- for(int c=0;c<=100;c++)
- {
- System.out.println();
- }
- }
- if(command.contains(":arg"))
- {
- int length=command.length();
- String arg=command.substring(5,length);
- connect(arg);
- }
- }
- }
- public void run()
- {
- try
- {
- for(i=0;i>=0;i++)
- {
- Thread.sleep(1000);
- }
- }
- catch(InterruptedException e)
- {
- System.out.println(e.getMessage()+" -thread interrupted");
- }
- }
- }
- class Adapter
- {
- public static boolean connected=false;
- public static String input;
- public static String website;
- public static Document con;
- public static void connect(String argument) throws IOException
- {
- BufferedReader get=new BufferedReader(new InputStreamReader(System.in));
- do
- {
- System.out.print("["+argument+"]"+" $");
- input=get.readLine();
- if(input.contains(":connect www"))
- {
- int length=input.length();
- website=input.substring(9,length);
- con=Jsoup.connect("http://"+website+argument).get();
- connected=true;
- System.out.println("connected\n");
- return;
- }
- else
- {
- System.out.println("Wrong syntax.Use command [:connect websitename]");
- }
- }
- while(!connected==true);
- }
- public static void disconnect() throws IOException
- {
- System.out.println("disconnected\n");
- connected=false;
- connect("");
- return;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment