Jump to content

[Guide]Leech HTML codes


Recommended Posts

Hello once again,

im sure you know some programms out there that actually leech site's html codes.

So that's what ive made, but it only takes the html code from the url u have entered and saves it to the file requested not the images.

package com.test;

import java.io.*;
import java.net.URL;

/**
* @author Voqus
*/
public class HTMLeech {
public static void main(String args[]) {
	try {
		URL url = new URL("http://www.google.gr");
		// Read the text returned from the site
		BufferedReader br = new BufferedReader(new InputStreamReader(
				url.openStream()));
		String htmlcode;
		while ((htmlcode = br.readLine()) != null) {
			try {
				FileWriter fw = new FileWriter("HTMCode.txt");
				BufferedWriter bw = new BufferedWriter(fw);
				while ((htmlcode = br.readLine()) != null) {
					bw.write(htmlcode + "\n");
				}
				bw.close();
			} catch (IOException e) {
				e.printStackTrace();
			}
		}
		br.close();
	} catch (IOException e) {
		e.printStackTrace();
	}
}
}

Screen:

H5Pz7.png

LKIde.png

Tadaaaa!

Credits: Me

Link to comment
Share on other sites

You could of just done that. Every byte in that input stream is a char, your case is the worst case to use a buffer reader.

 

*Sigh*, you only needed 1 output stream writer not two >.>

		URL url = new URL("http://www.google.gr");
		InputStream io = url.openStream();
		byte[] data = new byte[io.available()];
		io.read(data);

		String result = new String(data);

Link to comment
Share on other sites

			URL url = new URL("http://www.google.gr");
		InputStream io = url.openStream();
		byte[] data = new byte[io.available()];
		io.read(data);

		String result = new String(data);
                        System.out.println(result);

Well yea that's true but ur code just prints out on the console not creating a file and write it.

Anyway thx.

 

Link to comment
Share on other sites

			URL url = new URL("http://www.google.gr");
		InputStream io = url.openStream();
		byte[] data = new byte[io.available()];
		io.read(data);

		String result = new String(data);
                        System.out.println(result);

Well yea that's true but ur code just prints out on the console not creating a file and write it.

Anyway thx.

 

I gave  you the string, then you can write it.

 

Take a look:

	URL url = new URL("http://www.google.gr");
	InputStream io = url.openStream();

	byte[] data = new byte[io.available()];
	io.read(data);

	FileOutputStream fs = new FileOutputStream(new File("index.html"));
	fs.write(data);
	fs.flush();

 

Later edit: Btw, i didn't see you use flush in your out stream writers, you always have to flush the data out after writing something in the stream, that's what saves it on your disk :)

 

Also buffer reader is used only when you wanna get a collection of strings, or parse an csv file, and so forth. And in a text file every byte in there is a char.

 

And finally the way a buffer reader is needed to eb set up is like this:

	BufferedReader br = new BufferedReader(new InputStreamReader(io));

	while(br.ready()) {
		String line = br.readLine();
	}

It's exactly like in l2js db connections, "while(rs.next);";

 

Hope it helps :)

Link to comment
Share on other sites

I gave  you the string, then you can write it.

 

Take a look:

	URL url = new URL("http://www.google.gr");
	InputStream io = url.openStream();

	byte[] data = new byte[io.available()];
	io.read(data);

	FileOutputStream fs = new FileOutputStream(new File("index.html"));
	fs.write(data);
	fs.flush();

 

Later edit: Btw, i didn't see you use flush in your out stream writers, you always have to flush the data out after writing something in the stream, that's what saves it on your disk :)

 

Also buffer reader is used only when you wanna get a collection of strings, or parse an csv file, and so forth. And in a text file every byte in there is a char.

 

And finally the way a buffer reader is needed to eb set up is like this:

	BufferedReader br = new BufferedReader(new InputStreamReader(io));

	while(br.ready()) {
		String line = br.readLine();
	}

It's exactly like in l2js db connections, "while(rs.next);";

 

Hope it helps :)

aham yep, i can see it now thanks  ;D.

Btw i'm not really into l2j crap so dont tell about how they use trove and stuff  ::)

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



  • Posts

    • Well my friend, I'm not going to stay here arguing anymore, because you won't give up and much less have the humility to accept something you did wrong, as you saw, I value the work of others, I know who really creates or even takes a block of code and does something better and different, but the subject here was about a guy, nicknamed Vraekar, who steals and SELLS interfaces as if they were his, and is that within your beliefs?, belief that if the guy creates something it has to be stolen and whoever stole it can profit from it?, that's what I'm talking about, you've fought a lot against this, and today you help a guy like that to do wrong, but anyway, you know what you're doing, I hope you reflect, the community knows who does and who helps the wrong. Stay with God, because six of the problems that go around.
    • You claim you thought I was a "serious" person before. Well, maybe you just never took the time to actually know me. People evolve, but I stay true to what I do and believe in. If you’re that hung up on what I’ve been doing, maybe it's time to stop speculating and start focusing on yourself. 🙂
    • Well, at least it's clear that you don't respect the work of others. Secondly, everyone knows that you code nothing. Your group has devs. known that you've asked for a lot of help and code exchange with some well-known BRs. there are chats and I can prove it, then don't come playing the good guy because you're not. So, Celestine, I'm not judging you. I'm saying that I know that your group helped vraekar steal the codes, and I have proof. In the past, I thought you were a serious, good-natured guy, but lately, you're a different person. Your text above speaks for you.
    • What I do or who I work with is none of your concern, and honestly, I couldn't care less. Lately, I've seen a lot of people trying to make a quick buck off scams, so let's not even mention names you wouldn't want them getting upset, right? 🙂  As for the projects I've been involved with, there's a server about to launch that I’m personally waiting for, and when it does, I’ll release the work publicly for free because people deserve better than what these so called "developers" are pushing. I’m not here to defend anyone, but if you had any real knowledge, you’d see how poorly written some of these scripts are. I’ve worked with Vraekar in the past, and I know for a fact he’s never sold anything I’ve created. So before you start running your mouth, ask yourself: why are you even juding me?
    • I didn't even want to touch on your name Celestine, but it took a while to want to protect it, right? But then I say, everyone knows that you and your group helped Vraekar in deobfuscating the interfaces, do you want me to post here the dates and videos of the releases of the OMG and Silence interfaces?, and then see Vraekar's?, do you want?, a blatant copy, even their variable names, the theft is blatant, and you who are an admin here at Max and say you are the right one, helped him decrypt and remove the code obfuscation, everyone knows that, and now you come and tell me that his code is not copied?, if you want I can put all the evidence here and this will be very ugly even for you, since those you helped Vraekar and the interface dev community know this, they know about the thefts, very ugly indeed my friend that you still come and tell such a lie.   ps. And just one more thing, did you say that all the code he wrote? you became a joker? Vraekar doesn't program a single line of code, the guy works as a data analyst, what he learned was to copy and paste ready-made codes, but he doesn't write a single line of code.
  • Topics

×
×
  • Create New...