SOCO-Java-CodeBERTa-MNRL-Triplets-100

1
by
buelfhood
Embedding Model
OTHER
1705.00652B params
New
1 downloads
Early-stage
Edge AI:
Mobile
Laptop
Server
3811GB+ RAM
Mobile
Laptop
Server
Quick Summary

AI model with specialized capabilities.

Device Compatibility

Mobile
4-6GB RAM
Laptop
16GB RAM
Server
GPU
Minimum Recommended
1588GB+ RAM

Code Examples

Usagebash
pip install -U sentence-transformers
Usagepython
from sentence_transformers import SentenceTransformer

# Download from the 🤗 Hub
model = SentenceTransformer("buelfhood/SOCO-Java-CodeBERTa-MNRL-Triplets-100")
# Run inference
sentences = [
    'import java.net.*;\nimport java.io.*;\n\npublic class BruteForce {\n  private String strUserName;\n  private String strURL;\n  private int iAttempts;\n  \n  public BruteForce(String strURL,String strUserName) {\n    this.strURL = strURL;\n    this.strUserName = strUserName;\n    this.iAttempts = 0 ;\n\n  }\n  \n  public String getPassword(){\n      URL u;\n      String result ="";\n      PassGenBrute PG = new PassGenBrute(3);\n      URLConnection uc;\n      String strPassword = new String();\n      String strEncode;\n      try{\n        while (result.compareTo("HTTP/1.1 200 OK")!=0){\n        \n          strEncode = PG.getNewPassword();\n          u = new URL(strURL);\n          uc = u.openConnection();\n          uc.setDoInput(true);\n          uc.setDoOutput(true);\n          strPassword = strEncode;\n          strEncode =  strUserName + ":" + strEncode;\n        \n          strEncode = new String(Base64.encode(strEncode.getBytes()));\n          uc.setRequestProperty("Authorization"," " + strEncode);\n        \n          result = uc.getHeaderField(0);\n          uc = null;\n          u = null;\n          iAttempts++;\n        }\n\n      }\n      catch (Exception me) {\n      System.out.println("MalformedURLException: "+me);\n      }\n      return(strPassword);\n  }\n  \n  public int getAttempts(){\n    return (iAttempts);\n  };\n  \n  public static void main (String arg[]){\n     timeStart = 0;\n     timeEnd = 0;\n    \n    if (arg.length == 2) {\n       BruteForce BF = new BruteForce(arg[0],arg[1]);\n       System.out.println("Processing ... ");\n       timeStart = System.currentTimeMillis();\n       \n       System.out.println("Password = " + BF.getPassword());\n       timeEnd = System.currentTimeMillis();\n       System.out.println("Total Time Taken = " + (timeEnd - timeStart) + " (msec)");\n       System.out.println("Total Attempts  = " + BF.getAttempts());\n    }\n    else {\n       System.out.println("[Usage] java BruteForce <URL> <USERNAME>");\n\n    }\n\n  }\n}\n\nclass PassGenBrute {\n  private char[] password;\n  public PassGenBrute(int lenght) {\n    password = new char[lenght];\n    for (int i = 0; i < lenght; i++){\n      password[i] = 65;\n    }\n    password[0]--;\n  }\n  \n  public String getNewPassword()\n    throws PasswordFailureException{\n    password[0]++;\n\n    try {\n      for (int i=0; i<password.length ; i++){\n        if (password[i] == 90) {\n          password[i] = 97;\n        }\n        if (password[i] > 122) {\n          password[i] = 65;\n          password[i+1]++;\n        }\n      }\n    }\n    catch (RuntimeException re){\n      throw new PasswordFailureException ();\n    }\n    return new String(password);\n  }\n}\n\nclass PasswordFailureException extends RuntimeException {\n\n  public PasswordFailureException() {\n  }\n}',
    'import java.net.*;\nimport java.io.*;\n\n\npublic class Dictionary {\n  private String strUserName;\n  private String strURL;\n  private String strDictPath;\n  private int iAttempts;\n\n    \n    public Dictionary(String strURL,String strUserName,String strDictPath) {\n    this.strURL = strURL;\n    this.strUserName = strUserName;\n    this.iAttempts = 0 ;\n    this.strDictPath = strDictPath;\n    }\n  \n\n  public String getPassword(){\n      URL u;\n      String result ="";\n      PassGenDict PG = new PassGenDict(3,strDictPath);\n      URLConnection uc;\n      String strPassword = new String();\n      String strEncode;\n        try{\n        while (result.compareTo("HTTP/1.1 200 OK")!=0){\n      \n          strEncode = PG.getNewPassword();\n          u = new URL(strURL);\n          uc = u.openConnection();\n          uc.setDoInput(true);\n          uc.setDoOutput(true);\n          strPassword = strEncode;\n          strEncode =  strUserName + ":" + strEncode;\n          \n        strEncode = new String(Base64.encode(strEncode.getBytes()));\n          uc.setRequestProperty("Authorization"," " + strEncode);\n            \n      result = uc.getHeaderField(0);\n          uc = null;\n          u = null;\n          iAttempts++;\n        }\n\n      }\n      catch (Exception me) {\n      System.out.println("MalformedURLException: "+me);\n      }\n      return(strPassword);\n  }\n \n   public int getAttempts(){\n    return (iAttempts);\n  };\n  \n  public static void  main(String arg[]){\n     timeStart = 0;\n     timeEnd = 0;\n    \n    if (arg.length == 3) {\n    Dictionary BF = new Dictionary(arg[0],arg[1],arg[2]);\n\n    System.out.println("Processing ... ");\n    timeStart = System.currentTimeMillis();\n    System.out.println("Password = " + BF.getPassword());\n    timeEnd = System.currentTimeMillis();\n    System.out.println("Total Time Taken = " + (timeEnd - timeStart) + " (msec)");\n    System.out.println("Total Attempts  = " + BF.getAttempts());\n    }\n    else {\n       System.out.println("[Usage] java BruteForce <URL> <USERNAME> <Dictionary path>");\n\n    }\n\n  }\n}\n\n\nclass PassGenDict {\n\n  private char[] password;\n  private String line;\n  int iPassLenght;\n  private BufferedReader inputFile;\n  public PassGenDict(int lenght, String strDictPath) {\n    try{\n      inputFile = new BufferedReader(new FileReader(strDictPath));\n    }\n    catch (Exception e){\n    }\n    iPassLenght = lenght;\n  }\n   \n public String getNewPassword()\n    throws PasswordFailureException{\n    try {\n      {\n        line = inputFile.readLine();\n      }while (line.length() != iPassLenght);\n\n    }\n    catch (Exception e){\n      throw new PasswordFailureException ();\n    }\n    return (line);\n  }\n}\n\nclass PasswordFailureException extends RuntimeException {\n\n  public PasswordFailureException() {\n  }\n}',
    'import java.util.*;\nimport java.io.*;\nimport javax.swing.text.html.*;\n\n\npublic class WatchDog {\n\n  public WatchDog() {\n\n  }\n  public static void main (String args[]) {\n    DataInputStream newin;\n\n    try{\n      System.out.println("ishti");\n\n      System.out.println("Downloading first copy");\n      Runtime.getRuntime().exec("wget http://www.cs.rmit.edu./students/ -O oldfile.html");\n      String[] cmdDiff = {"//sh", "-c", "diff oldfile.html newfile.html > Diff.txt"};\n      String[] cmdMail = {"//sh", "-c", "mailx -s \\"Diffrence\\" \\"@cs.rmit.edu.\\" < Diff.txt"};\n      while(true){\n            Thread.sleep(24*60*60*1000);\n            System.out.println("Downloading new copy");\n            Runtime.getRuntime().exec("wget http://www.cs.rmit.edu./students/ -O newfile.html");\n            Thread.sleep(2000);\n            Runtime.getRuntime().exec(cmdDiff);\n            Thread.sleep(2000);\n            newin = new DataInputStream( new FileInputStream( "Diff.txt"));\n            if (newin.readLine() != null){\n               System.out.println("Sending Mail");\n               Runtime.getRuntime().exec(cmdMail);\n               Runtime.getRuntime().exec("cp newfile.html oldfile.html");\n\n            }\n        }\n\n    }\n    catch(Exception e){\n      e.printStackTrace();\n    }\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]

Deploy This Model

Production-ready deployment in minutes

Together.ai

Instant API access to this model

Fastest API

Production-ready inference API. Start free, scale to millions.

Try Free API

Replicate

One-click model deployment

Easiest Setup

Run models in the cloud with simple API. No DevOps required.

Deploy Now

Disclosure: We may earn a commission from these partners. This helps keep LLMYourWay free.