HTTP protocol

The web runs on port 80. You’re probably wondering what “port 80” is, right (whether it really is or not is irrelevant)? Well the answer is easy (not really). See, the Internet and the web are different. The Internet is the infrastructure (ie the physical cables, server hardware, etc.) and the web is the ideas and software. I say ideas because before the web, the Internet was a mess of cables and powerful computers that used POP3 and SMTP for communication, FTP for file transfers, and TELNET for remote access, among others. Then the web appeared and the use of the Internet spread to the home and to the whole world. See, in simple terms, a web server broadcasts HTML to all connected clients on port 80, so port 80 is the “HTTP port”. HTTP is the protocol or set of standards for port 80 and its software. The client software is your browser (ie probably Internet Explorer but hopefully Firefox), and the server is something like Apache or IIS (uug). This is related to hacking, as you’ll see later, but first you need to know more about HTTP (the spaces before are placed so this isn’t considered HTML).

text

If Apache is serving that, and Firefox picks it up, it will replace the , the , etc. They “close” the label. Label is a term for anything in s, and they must be opened (ie entered) and closed (ie ). If you want to learn HTML tagging, just head over to our close friend Google and do a search.

Since you haven’t gotten to the programming section, and I haven’t even written it currently, I’m going to show you an example web server in the simplest form I can think of that will work on whatever operating system you’re currently using. So the obvious choice is JAVA:

</p> <p>import java.net.*; import java.io.*; import java.util.*; public class jhttp extends Thread { Socket theConnection; docroot static file; static string index file = &#8220;index.html&#8221;; public jhttp(Socket s) { theConnection = s; } public static void main(String[] arguments) { int thePort; ServerSocket ss; // get the document root try { docroot = new File(args[0]); } catch (Exception e) { docroot = new File(&#8220;.&#8221;); } // set the port to listen on when trying { thePort = Integer.parseInt(args[1]); if (thePort 65535) thePort = 80; } catch (Exception e) { thePort = 80; } try { ss = new ServerSocket(thePort); System.out.println(&#8220;Accepting connections on port&#8221; + ss.getLocalPort()); System.out.println(&#8220;Document root:&#8221; + docroot); while (true) { jhttp j = new jhttp(ss.accept()); j.start(); } } catch (IOException e) { System.err.println(&#8220;Server terminated prematurely&#8221;); } } public void run() { Method String; ct chain; String version = &#8220;&#8221;; Archive theFile; try { PrintStream os = new PrintStream(theConnection.getOutputStream()); DataInputStream is = new DataInputStream(theConnection.getInputStream()); String get = is.readLine(); StringTokenizer st = new StringTokenizer(get); method = st.nextToken(); if (method.equals(&#8220;GET&#8221;)) { String file = st.nextToken(); if (file.endsWith(&#8220;/&#8221;)) file += indexfile; ct = guessNameContentType(file); if (st.hasMoreTokens()) { version = st.nextToken(); } // loop through the rest of the input line // nes while ((get = is.readLine()) != null) { if (get.trim().equals(&#8220;&#8221;)) break; } try { theFile = new File(docroot, file.substring(1,file.length())); FileInputStream fis = new FileInputStream(theFile); byte[] theData = new byte[(int) theFile.length()]; // need to check the number of bytes rea // d here fis.read(theData); fis.close(); if (version.startsWith(&#8220;HTTP/&#8221;)) { // send a MIME header os.print(&#8220;HTTP/1.0 200 OKrn&#8221;); Date now = new Date(); os.print(&#8220;Date: &#8221; + now + &#8220;rn&#8221;); os.print(&#8220;Server: jhttp 1.0rn&#8221;); os.print(&#8220;Content-length: &#8221; + theData.length + &#8220;rn&#8221;); os.print(&#8220;Content type: &#8221; + ct + &#8220;rnrn&#8221;); } // end the attempt // send the file os.write(theData); os.close(); } // end catch attempt (IOException e) { // cannot find file if (version.startsWith(&#8220;HTTP/&#8221;)) { // send MIME header os.print(&#8220;HTTP/1.0 404 File Not Found &#8220;); Date now = new Date(); os.print(&#8220;Date: &#8221; + now + &#8220;rn&#8221;); os.print(&#8220;Server: jhttp 1.0rn&#8221;); os.print(&#8220;Content type: text/html&#8221; + &#8220;rnrn&#8221;); } os.println(&#8220;File not found&#8221;); os.println(&#8220;HTTP Error 404: File not found&#8221;); os.close(); } } else { // method is not equal to &#8220;GET&#8221; if (version.startsWith(&#8220;HTTP/&#8221;)) { // send a MIME header os.print(&#8220;HTTP/1.0 501 Not Implementedrn&#8221;); Date now = new Date(); os.print(&#8220;Date: &#8221; + now + &#8220;rn&#8221;); os.print(&#8220;Server: jhttp 1.0rn&#8221;); os.print(&#8220;Content type: text/html&#8221; + &#8220;rnrn&#8221;); } os.println(&#8220;Not implemented&#8221;); os.println(&#8220;HTTP Error 501: Not Implemented&#8221;); os.close(); } } catch (IOException e) { } try { theConnection.close(); } catch (IOException e) { } } public String guessContentTypeFromName(String name) { if (name.endsWith(&#8220;.html&#8221;) || name.endsWith(&#8220;.htm&#8221;)) return &#8220;text/html&#8221;; else if (name.endsWith(&#8220;.txt&#8221;) || name.endsWith(&#8220;.java&#8221;)) return &#8220;text/plain&#8221;; otherwise, if (name.endsWith(&#8220;.gif&#8221;) ) returns &#8220;image/gif&#8221;; otherwise, if (name.endsWith(&#8220;.class&#8221;) ) returns &#8220;application/octet-stream&#8221;; otherwise if (name.endsWith(&#8220;.jpg&#8221;) || name.endsWith(&#8220;.jpeg&#8221;)) return &#8220;image/jpeg&#8221;; otherwise, return &#8220;plain/text&#8221;; } }<br />

I learned the basics of JAVA web server programming from “JAVA Network Programming” by Elliotte Rusty Harold. Now you don’t need to know JAVA to be able to understand that, even if it doesn’t seem like it at first. The important thing to note when examining the code are the os.print(“”) commands. Nothing fancy is used to get the data into the browser, you don’t have to mutate the data, you’re just sending plain HTML via a simple command. The plain old truth is that the browser is doing most of the hard stuff, when talking about this simple server. But on complicated servers there are server side scripts etc. Webs are much more complicated than just a server and Internet Explorer, like Flash and JAVA Applets (which run on the client’s machine in the browser) and server-side stuff like PHP and PEARL (which are displayed in the client’s browser). client as plain HTML but run as scripts on the server). you

The above code is a good way to learn HTTP standards, although the program itself ignores most of the regulations. The web browser not only understands HTML, but also knows that the incoming connection starting with 404 means 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 made up by your stupid server. They are web standards. Generally speaking, there are two standards. There is the w3 standard (ie the actual standard based on early 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 make it compatible with (almost) everything else.

Hide your connection

If you have a copy of Visual Basic 6, making a web browser is easy, thanks to Winsock and the included code templates, so I won’t give an example of that. Instead, I’ll explain cool and potentially dangerous things you can do to stay safe. I know those words together don’t make sense (ie potentially dangerous and safe), but you’ll 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’s also the only potentially dangerous thing so far, so I’ll restate what I’ve written at the top: whatever you do with this information is your own responsibility. I give information and nothing else. That being said, there is nothing illegal about using an anonymous proxy server as long as it is free and you do not harm anyone by using it. But if you think that you are completely safe using one, you are totally wrong. They can simply ask the proxy owners what its IP is if they really want to find it. If you join a server with a high level of anonymity, the chance of your IP being released is pretty low to steal music, but if you do something that actually warrants jail time, chances are they can find you. http://www.publicproxyservers.com is a good place to find these servers.

The last trick related to web servers and port 80 is simple. First, find a free website host that supports PHP and use the following code:

<eml></p> <p>if ($password == &#8220;password&#8221;) { $fp = fopen(&#8220;http://&#8221;.$destfile,&#8221;r&#8221;); while (!feof($fp)) { $fd = fread($fp,4096); echo $fd; } fclose($fp); } exit; ?><br /> </eml>

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=password

You can change “passwd” to any password you want.

This will make any viewer think they are connected to http://file.com. You are still limited to your connection speed, but you are using the web server’s bandwidth

Anything you do with the above information is solely your responsibility.

RELATED ARTICLES

Can Flex Circuit Boards Bend?

Flex Circuit Boards In addition to being used in the electronic industry in calculators, cell phones and LCD televisions, flex circuit boards can also be found in medical devices such as heart monitors and pacemakers. They are also used in industrial products such as robotic…

Flexible PCBs for Space Applications

Flexible PCBs for Space The harsh environments in space pose a formidable challenge for the development of electronic systems. Engineers must strike a balance between size and functionality to make sure that the systems can operate in these extreme conditions without fail. Achieving this goal…

Leave a Reply

Your email address will not be published. Required fields are marked *