
HTTP Protocol
The web is operated on port 80. You are most likely questioning what “port 80” is, right (whether you in fact are or otherwise is unimportant)? Well, the solution is very easy (not truly). See, the Internet and also the web are various. The Internet is the facilities (ie the physical cables, the web server equipment, and so on) and also the web is the concepts and also the software application. I claim concepts due to the fact that prior to the web the Internet was a mess of cables and also effective computer systems making use of POP3 and also SMTP for interaction, FTP for documents transfer, and also TELNET for remote covering gain access to, to name a few. Then the web went along, and also Internet utilize infected the house and also all throughout the globe. See, in simple terms, a web server programs HTML to all linked customers on port 80, so port 80 is the “HTTP port.” HTTP is the method, or collection of standards for port 80 and also its software application. The customer software application is your internet browser, (ie most likely Internet Explorer however ideally Firefox), and also the web server is something like Apache or IIS(uug). This associates with hacking, as you will certainly see later on, however initially you require to understand even more regarding HTTP (the rooms prior to the are placed in so this isn’t considered HTML).
message
If Apache is offering that, and also Firefox chooses it up, It will certainly change the , the , and so on. They “close” the tag. Tag is a term for anything in s, and also they have to be opened up (ie presented) and also shut (ie ). If you intend to find out HTML tagging, simply head over to our friend Google and also do a search.
Since you have not reached the shows area, and also presently I have not also composed it, I will certainly reveal you a web server instance in the most basic kind I can consider that will certainly work with any type of OS you are presently making use of. So the noticeable option is JAVA:
import java.net.*;
import java.io.*;
import java.util.*;
public course jhttp prolongs Thread {
Socket theConnection;
fixed File docroot;
fixed String indexfile = “index.html”;
public jhttp(Socket s) {
theConnection = s;
}
public fixed gap major(String[] args) {
int thePort;
ServerSocket ss;
// obtain the Document origin
attempt {
docroot = brand-new File(args[0]);
}
catch (Exception e) {
docroot = brand-new File(“.”);
}
// established the port to pay attention on
attempt {
thePort = Integer.parseInt(args[1]);
if (thePort 65535) thePort = 80;
}
catch (Exception e) {
thePort = 80;
}
attempt {
ss = brand-new ServerSocket(thePort);
System.out.println(“Accepting connections on port ”
+ ss.getLocalPort());
System.out.println(“Document Root:” + docroot);
while (real) {
jhttp j = brand-new jhttp(ss.accept());
j.start();
}
}
catch (IOException e) {
System.err.println(“Server aborted prematurely”);
}
}
public gap run() {
String approach;
String ct;
String variation = “”;
File theFile;
attempt {
PrintStream os = brand-new PrintStream(theConnection.getOutputStream());
DataInputStream is = brand-new DataInputStream(theConnection.getInputStream());
String obtain = is.readLine();
StringTokenizer st = brand-new StringTokenizer(obtain);
approach = st.nextToken();
if (method.equals(“GET”)) {
String documents = st.nextToken();
if (documents.endsWith(“/”)) file += indexfile;
ct = assumptionContentTypeFromName(documents);
if (st.hasMoreTokens()) {
variation = st.nextToken();
}
// loophole via the remainder of the input li
// nes
while ((obtain = is.readLine()) != null) {
if (get.trim().equates to(“”)) break;
}
attempt {
theFile = brand-new File(docroot, file.substring(1,file.length()));
FileInputStream fis = brand-new FileInputStream(theFile);
byte[] theData = brand-new byte[(int) theFile.length()];
// require to inspect the variety of bytes rea
// d right here
fis.read(theData);
fis.close();
if (version.startsWith(“HTTP/”)) { // send out a MIME header
os.print(“HTTP/1.0 200 OKrn”);
Date currently = brand-new Date();
os.print(“Date: ” + currently + “rn”);
os.print(“Server: jhttp 1.0rn”);
os.print(“Content-length: ” + theData.length + “rn”);
os.print(“Content-type: ” + ct + “rnrn”);
} // end shot
// send out the documents
os.write(theData);
os.close();
} // end shot
catch (IOException e) { // can not discover the documents
if (version.startsWith(“HTTP/”)) { // send out a MIME header
os.print(“HTTP/1.0 404 File Not Foundrn”);
Date currently = brand-new Date();
os.print(“Date: ” + currently + “rn”);
os.print(“Server: jhttp 1.0rn”);
os.print(“Content-type: text/html” + “rnrn”);
}
os.println(“File Not Found”);
os.println(“HTTP Error 404: File Not Found”);
os.close();
}
}
else { // approach does not equivalent “GET”
if (version.startsWith(“HTTP/”)) { // send out a MIME header
os.print(“HTTP/1.0 501 Not Implementedrn”);
Date currently = brand-new Date();
os.print(“Date: ” + currently + “rn”);
os.print(“Server: jhttp 1.0rn”);
os.print(“Content-type: text/html” + “rnrn”);
}
os.println(“Not Implemented”);
os.println(“HTTP Error 501: Not Implemented”);
os.close();
}
}
catch (IOException e) {
}
attempt {
theConnection.close();
}
catch (IOException e) {
}
}
public String assumptionContentTypeFromName(String name) name.endsWith(“.htm”)) return “text/html”;
else if (name.endsWith(“.txt”)
}
I discovered the fundamentals of JAVA web server shows from “JAVA Network Programming” by Elliotte Rusty Harold. Now you do not require to understand JAVA to be able to comprehend that, despite the fact that it may not appear like that initially. The important thing to look for when examining the code it the os.print(“”) commands. There is nothing fancy being used to get the data to the browser, you do not have to mutate the data, its sending plain HTML via a simple command. The plain and simple truth is that the browser is doing the majority of the difficult stuff, when speaking about this simple server. But in complicated servers there is server-side scripting, etc. Webs are much more complicated than just a simple server and Internet Explorer, such as Flash and JAVA Applets (run on clients machine in browser) and server-side stuff like PHP and PEARL (displayed on clients browser as plain HTML but executed as scripting on the server). T
The code above is a good way to learn the HTTP standards, even though the program itself ignores most of the regulations. The web browser not only understands HTML but also knows that incoming connection starting with 404 means that the page is missing, etc. It also knows that when “image/gif” is returned the file is an image of type gif. These are not terms the stupid server made up. They are web standards. Generally speaking, there are two standards. There is the w3 standard (ie the real standard based on the first web servers and browsers) and the Microsoft standard (ie the Internet Explorer, IIS and NT standards). The standards are there so anyone can make a server or client and have it be compatible with (nearly) everything else.
Hiding your Connection
If you have a copy of Visual Basic 6, making a web browser is easy, thanks to Winsock and the code templates included, so I will not put in an example of that. Instead I will explain cool and potentially dangerous things you can do to keep yourself safe. I understand those words put together doesn’t make sense (ie potentially dangerous and safe), but you will see in a moment. I’m talking about PROXIES. (anonymous proxy servers, to be exact).
You connect to the internet on port 80 through the proxy server, thus hiding your real IP. There are many obvious applications for this, but it is also the only really potentially dangerous point so far, so I will restate what I have written at the top: Whatever you do with this info is your responsibility. I provide information and absolutely nothing more. With that said, there is nothing illegal about using an anonymous proxy server as long as it is free and you are harming no one by using it. But if you think you are completely safe using one, you are deadly wrong. They can simply ask the owners of the proxy what your IP is if they really want to find you. If you join a high anonymous server, the chance of them releasing your IP is pretty low for something like stealing music, but if you do something that would actually warrant jail time, they probably will be able to find you. http://www.publicproxyservers.com is a good site for finding these servers.
The last trick related to web servers and port 80 is a straightforward one. First, find a free website host that supports PHP and also use the following code:
if ($password == “passwd”) {
$fp = fopen(“http://”.$destfile,”r”);
while (!feof($fp)) {
$fd = fread($fp,4096);
echo $fd;
}
fclose($fp);
}
exit;
?>
If the address of this file is http://file.com/script.php, to download the latest Fedora DVD you would go to the following address: http://file.com/script.php?destfile=linuxiso.org/download.php/611/FC3-i386-DVD.iso &password=passwd
You can change “passwd” to whatever password you want.
This will make any onlookers think you are connected to http://file.com. You are still limited to the speed of your connection, however you are using the bandwidth of the web host
Whatever you do with the over information is solely your obligation.
|
![]() |
![]() |