August 9th, 2003, 02:32 PM
Introduction to the net! Pt. 2!
How are things?.. Great..
This is part two of my 'Introduction to the Net' series. If you haven't checked out part one go here...
This tutorial will center around the commonly known concept of ports. When I searched the archives I noted that there were a bunch of really nice tutorials on what the functions of port numbers do, but none of them really go in and describe...
What the heck a is port anyway?
There are a lot of other questions that branch off that one. I remember when I was a complete n00b the concept of ports was very hard for me to grasp because I allways thought that when you connected to a computer you connected... not the case, hopefully this tut will clear all that up for you if your thinking as I once did. But enough chit chat lets move.
1. <networking> A logical channel or channel endpoint in a
communications system. The Transmission Control Protocol
and User Datagram Protocol transport layer protocols used
on Ethernet use port numbers to distinguish between
(demultiplex) different logical channels on the same network
interface on the same computer.
taken from dicionary.com
Now your probly like, what the? But don't worry I've got a simple analogy for this whole thing.
What is a port? A port is like a door to a house, the house can be either a mansion (web-server) or it can be a middle class one (regular PC). The doors to these houses can either opened or closed, but hold on for a sec. these houses have up to 65,535 doors on them, each. Some opened, some closed, each door you enter is open for a specific reason.
For instance lets say you notice that the door marked 80 is open. Lets all step on in shall we? Ladies first. As soon as you enter you see tons of code being transfered from this house to other houses. This code is known as HTML, this house is most obviously a web-server becasue it is transfering data to other computers so that they may compile and display this servers web-site. Through this journey we can conclude that port 80 is a port used to retrive HTML output of a web-server. There not so bad when you break it down right?
Oh, no but if you don't get a move on your gonna be late for your friends invite to his IRC server. You read the invite and it says something like.
Hey man, come on down to my IRC (Internet Relay Chat) server. The server (or house number) is xxx.xxx.xxx.xxx <--- IP address, and the port number (door number) where we're all gonna be is port 6667. So you make your move from this web-server to your friends IRC server. When you step in here you notice tons of packets containing sentences and phrases being transfered to other computers. Now it's safe conclude that port 6667 on this server is used for chating.
If you haven't figured it out yet each port on a system has a certain function in which it performs and listens on. Here is an excellent list of ports and what certain port numbers listen for...
Now hopefully, you've got a good understanding of what ports are for on a computer and server alike and that you aren't just connecting to another computer but another port on that computer that performs that function that you requested. (Most commonly the HTML code to display another's website.)
If your using windows now a way to see what ports are listening on your computer is simple. Just hit...
Start-> run -> type 'command'-> then in the prompt type 'netstat -na'
After that if your feeling really confident you can have some fun with ports on your own computer with a program called 'Netcat.' Netcat is a powerful tool with many functions, but just to keep things easy we won't go into all that. (This is for windows users only but *nix users can do this to.)
**Warning you ARE putting your CPU at risk to attacks by doing this.***
*First get Netcat
*Now open it and type in...
nc -l -p 12345 -e cmd.exe
The nc, says runs the Netcat program, the -l says listen, the -p says listen on this port, the -e says to execute this shell when someone connects.
Now go to your command and type in... (don't type what's in the ()'s)
telnet xxx.xxx.xxx(<--your Ip address) 12345(<--port number to connect to)
Now you should have connected, and this is where you can have a safe and fun time navigating your computer and do many other things. Yes, you could have done this without the whole Netcat thing but the whole point of this is so you have a better understanding of ports, so there. Don't forget to close up when your done.
To wrap things up, ports are a very important part of all the major internet protocols. It is very important to have a good understanding of them when you go about defending your PC with firewalls. For a list on certain exploits that run on ports go here...
Well, I hope that this tut was as good as the last one I wrote. Hopefully, you'll do something good with the knowledge you've gained. If you told your girl-friend/boy-friend about it all durring a date like I suggested in pt.1 and she/he's still with ya... tell her/him all about this one! I'm sure they'll just love it! heh...heh...
The real question is not whether peace can be obtained, but whether or not mankind is mature enough for it...
October 20th, 2004, 12:01 PM
nice work and very usefull
but i'd like to ask if i can control these ports through any programming language like assembly