NoNameCracksInc

Extended (parser)

Jan 18th, 2014
341
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 2.93 KB | None | 0 0
  1. import org.jsoup.*;
  2. import java.io.*;
  3. import org.jsoup.nodes.*;
  4. import java.net.*;
  5.  
  6. public class Analyser implements Runnable
  7. {
  8.     public boolean connected=false;
  9.     public String full_line;
  10.     public String command;
  11.     public Document con;
  12.     public String website;
  13.     public static int i;
  14.    
  15.     public static void main(String args[]) throws IOException,InterruptedException
  16.     {
  17.         Analyser obj=new Analyser();
  18.         obj.core();
  19.     }
  20.    
  21.     public void core() throws IOException
  22.     {
  23.         BufferedReader scan=new BufferedReader(new InputStreamReader(System.in));
  24.         Thread t=new Thread(new Analyser());
  25.        
  26.         t.start();
  27.         connect();     
  28.         do
  29.         {
  30.             command=scan.readLine();
  31.             switches();
  32.         }
  33.         while(!command.equals(":quit"));
  34.     }
  35.    
  36.     public void connect() throws IOException
  37.     {
  38.         System.out.print("$");
  39.         BufferedReader get=new BufferedReader(new InputStreamReader(System.in));
  40.        
  41.         do
  42.         {
  43.          full_line=get.readLine();
  44.          
  45.          if(full_line.contains(":connect"))
  46.          {
  47.              int length=full_line.length();
  48.              website=full_line.substring(10,length);
  49.              con=Jsoup.connect("http://"+website).get();
  50.              connected=true;
  51.              System.out.println("connected");
  52.              return;
  53.          }
  54.          else
  55.          {
  56.              System.out.println("Wrong syntax.Use command [:connect websitename].");
  57.          }
  58.         }
  59.         while(!full_line.contains(":connect"));
  60.     }
  61.    
  62.     public void switches() throws IOException
  63.     {
  64.         if(connected)
  65.         {
  66.             if(command.contains(":get"))
  67.             {
  68.                 if(command.contains("-node"))
  69.                 {
  70.                     System.out.println(con.nodeName());
  71.                 }  
  72.                
  73.                 if(command.contains("-tag"))
  74.                 {
  75.                     System.out.println(con.tagName());
  76.                 }
  77.                
  78.                 if(command.contains("-source"))
  79.                 {
  80.                     System.out.println(con.html());
  81.                 }
  82.                
  83.                 if(command.contains("-txt"))
  84.                 {
  85.                     System.out.println(con.text());
  86.                 }
  87.                 if(command.contains("-hash"))
  88.                 {
  89.                     System.out.println(con.hashCode());
  90.                 }
  91.                 if(command.contains("-title"))
  92.                 {
  93.                     System.out.println(con.title());
  94.                 }
  95.                 if(command.contains("-ip"))
  96.                 {
  97.                     InetAddress ip=InetAddress.getByName(website);
  98.                     System.out.println(ip);
  99.                 }
  100.                 if(command.contains("-session"))
  101.                 {
  102.                     System.out.println(Analyser.i+" seconds");
  103.                 }
  104.                 if(command.contains("jvs"))
  105.                 {
  106.                     String src=con.html();
  107.                    
  108.                     if(src.contains("<script>"))
  109.                     {
  110.                         System.out.println("Website uses javascript");
  111.                     }
  112.                     else
  113.                     {
  114.                         System.out.println("Website does not use javascript");
  115.                     }
  116.                 }
  117.             }
  118.             if(command.equals(":reload"))
  119.             {
  120.                 System.out.println("disconnected");
  121.                 connect();
  122.                 return;
  123.             }
  124.             if(command.equals("-cls"))
  125.             {
  126.                 for(int c=0;c<=100;c++)
  127.                 {
  128.                     System.out.println();
  129.                 }
  130.             }
  131.         }
  132.     }
  133.    
  134.     public void run()
  135.     {
  136.         try
  137.         {
  138.             for(i=0;i>=0;i++)
  139.             {
  140.                 Thread.sleep(1000);
  141.             }
  142.         }
  143.         catch(InterruptedException e)
  144.         {
  145.             System.out.println(e.getMessage()+" -thread interrupted");
  146.         }
  147.      }
  148. }
Advertisement
Add Comment
Please, Sign In to add comment