Non-interactive text proxy lists download for java6

Non-interactive text proxy lists download for java6


CODE for java6
[ perl | python | java6 | wget | curl | java ]
  • with Java 6+, JDK 1.6+ and java.net.CookieManager:
    
    
    import java.net.URL;
    import java.net.HttpURLConnection;
    import java.io.File;
    import java.io.InputStream;
    import java.io.OutputStream;
    import java.io.OutputStreamWriter;
    import java.io.FileOutputStream;
    import java.net.CookieHandler;
    import java.net.CookieManager;
    
    public class GetLists {
    
     public static void main(String args[]) throws Exception {
      String base = "http://rosinstrument.com/cgi-bin/";
      String lists[] = {"http1000", "httpanon500", "https500", "socks1000"};
      java.net.CookieManager cm = new CookieManager();
      cm.setCookiePolicy(java.net.CookiePolicy.ACCEPT_ALL);
      CookieHandler.setDefault(cm);
      URL loginUrl = new URL(base + "login.pl");
      loginUrl.openConnection().getContent();
    
      HttpURLConnection con =
        (HttpURLConnection) loginUrl.openConnection();
      con.setRequestMethod("POST");
      con.setDoOutput(true);
      con.setRequestProperty("Content-Type",
        "application/x-www-form-urlencoded");
    
      OutputStreamWriter wr =
        new OutputStreamWriter(con.getOutputStream());
      wr.write("login=USER&passwd=PASSWORD");
      wr.flush();
      con.getContent();
    
      byte buf[] = new byte[1024];
      int read;
      for (String file : lists) {
       InputStream is = new URL(base + "tl.pl?" + file).openConnection().
         getInputStream();
       OutputStream os = new FileOutputStream(new File(file + ".txt"));
       while ((read = is.read(buf, 0, buf.length)) >= 0) {
        os.write(buf, 0, read);
       }
      }
     }
    }
    
    
    
Results has been placed in text files http1000.txt, httpanon500.txt, https500.txt, socks1000.txt.