Code to monitor port 135 on windows OS

Reply

Join Date: Mar 2005
Posts: 10
Reputation: amuarica is an unknown quantity at this point 
Solved Threads: 0
amuarica amuarica is offline Offline
Newbie Poster

Code to monitor port 135 on windows OS

 
0
  #1
Mar 22nd, 2005
I'am trying to develop a notification program to notify user on my
network that their computer have a worm . The program that I want to develop a can monitor port 135 on windows OS . The system will monitor port 135 on one computer and see wheter there is a computer that tried to connect to this computer by using that port . If there is a computer that trying to connect by using this port , the program will notify a user that their computer maybe have a worm .

From your opinion , what programming technique that suitable for this program . Is there anybody can guide me in developing this program . Thank you very much
Reply With Quote Quick reply to this message  
Join Date: Dec 2004
Posts: 2,413
Reputation: Comatose is a jewel in the rough Comatose is a jewel in the rough Comatose is a jewel in the rough Comatose is a jewel in the rough 
Solved Threads: 211
Team Colleague
Comatose's Avatar
Comatose Comatose is offline Offline
Taboo Programmer

Re: Code to monitor port 135 on windows OS

 
0
  #2
Mar 22nd, 2005
Well, You will need to use sockets..., and build a server program that listens on that port. I can code such a program, in VB6, but I don't have .NET, nor do I use it enough to know how sockets work in it. But, I will tell you that creating a socket on that port for listening is the way to go about doing what you would like.
Reply With Quote Quick reply to this message  
Join Date: Mar 2005
Posts: 10
Reputation: amuarica is an unknown quantity at this point 
Solved Threads: 0
amuarica amuarica is offline Offline
Newbie Poster

Re: Code to monitor port 135 on windows OS

 
0
  #3
Mar 22nd, 2005
thanks for reply me .

Actually I'am a beginner in VB . Is there any major different in VB6 and VB.net . If it is possible in writing the code in VB6 can you guide me on writing this code .
Can you explain more about socket programming . Is there any programming technique that I should learn if I want to write a code for socket/port listening.
Reply With Quote Quick reply to this message  
Join Date: Dec 2004
Posts: 2,413
Reputation: Comatose is a jewel in the rough Comatose is a jewel in the rough Comatose is a jewel in the rough Comatose is a jewel in the rough 
Solved Threads: 211
Team Colleague
Comatose's Avatar
Comatose Comatose is offline Offline
Taboo Programmer

Re: Code to monitor port 135 on windows OS

 
0
  #4
Mar 23rd, 2005
Do you have a copy of VB6, or just VB.Net? They are the same basic syntax, but the languages are completely different. There is still arguments and fuss about which is better and if vb6 is phasing out. I am a VB6 Advocate, And I don't much care for .NET, that it requires an installation of an entire platform. A good google search of sockets and VB (whichever one you choose) will give you a whole lot of good info. I prefer to use the catalyst socketwrench control: http://www.catalyst.com. I have no problem coding a small server app in VB6 with comments if you choose the VB6 route. If VB.Net is your option (maybe due availability) I can find a ton of resources to help you out. Let me know.
Reply With Quote Quick reply to this message  
Join Date: Mar 2005
Posts: 10
Reputation: amuarica is an unknown quantity at this point 
Solved Threads: 0
amuarica amuarica is offline Offline
Newbie Poster

Re: Code to monitor port 135 on windows OS

 
0
  #5
Mar 23rd, 2005
i'am so sorry . I dont know that vb6 and vb.net have a major different . I actually have VB 6.0 . Can I continue asking this question in VB.NET forum although i want to use vb6 as my programming technique . I'm really sorry about this .

Can you explain more about catalyst socketwrench control . As far as I know catalyst socketwrench control is a complete software . Is there possible to write a vb6.0 code that will monitor certain port and inform if there is any computer that want to connect to this computer by using that port . Can you please teach me in writing the code .
Reply With Quote Quick reply to this message  
Join Date: Dec 2004
Posts: 2,413
Reputation: Comatose is a jewel in the rough Comatose is a jewel in the rough Comatose is a jewel in the rough Comatose is a jewel in the rough 
Solved Threads: 211
Team Colleague
Comatose's Avatar
Comatose Comatose is offline Offline
Taboo Programmer

Re: Code to monitor port 135 on windows OS

 
0
  #6
Mar 23rd, 2005
I have moved this to the Legacy VB Thread. I will write and comment a server that listens on port 135, and warns the computer that a connection attempt has been made.
Reply With Quote Quick reply to this message  
Join Date: Dec 2004
Posts: 2,413
Reputation: Comatose is a jewel in the rough Comatose is a jewel in the rough Comatose is a jewel in the rough Comatose is a jewel in the rough 
Solved Threads: 211
Team Colleague
Comatose's Avatar
Comatose Comatose is offline Offline
Taboo Programmer

Re: Code to monitor port 135 on windows OS

 
0
  #7
Mar 27th, 2005
Ok,

I have written, and commented a server written in VB6 with catalyst socketwrench. This program listens on port 135 for a connection. If it recieves a connection, it accepts the connection momentarily (long enough to grab the IP and the Hostname), then immediately disconnects. It Writes The Date, Time, IP Address and Hostname of the computer that tried to make the connection to a log file, and displays a "notification" window similar to that of MSN Messengers Notification window (when you recieve an IM, or someone logs on). I have attached and Included the needed socket control, the complete and commented source code, along with a zip file that contains an installation program should you feel more comfortable using it instead of compiling it yourself.

Now, Be Advised that this program will not work in windows XP as long as you have other programs that listen on port 135. This is the procedure that I had to follow in order to make sure that this program would listen on port 135 (otherwise, you'll get an error that says something along the lines of: this address is already in use). In XP Home edition:
Click Start
Click Run
Type in: services.msc
Then in the pane on the right, find: Distributed Transaction Coordinator
Right click on it, and choose properties, and set "Startup Type" to disabled.
and Hit ok. Do the same thing for:
TCP/IP NetBIOS Helper
Task Scheduler
and
Routing and Remote Access
Then you close out of services.

Then go to start again, run, type in: regedit
Once you are in the registry, on the left pane, open:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Rpc

Highlight Rpc, (the folder). Then on the right, doubleclick "DCOM Protocols"
and remove the line: ncacn_tcp, and make sure to move everything up a line if it's needed, then OK that window. Now, back to the left, to the folders. Open up Rpc, and there should be a folder called: ClientProtocols. Open that one up, and on the right, find and delete: ncacn_tcp, and ncadg_udp. Reboot Your computer, and port 135 should be closed, and able to run the server program I wrote.

However, Before you do ANY OF THAT, I want you to make a backup of your registry. Save it somewhere you won't lose it. You back up the registry, as follows:
click start, go to run
type in: regedit
click "file", then "Export"
At the bottom where it says "Export Range" set it to "all"
Find somewhere to save it, and give it a name. The registry is now backed up.

I realize that's a little bit complicated, so let me know if you need any additional help with disabling the services that windows has running on port 135.

Ps: Sorry about that, I tried to upload the source, AND a setup program... but for some reason I could only get the source to upload. If you need help compiling it, or getting it to load, just let me know.
Attached Files
File Type: zip WHSource.zip (54.5 KB, 107 views)
Reply With Quote Quick reply to this message  
Join Date: Mar 2005
Posts: 10
Reputation: amuarica is an unknown quantity at this point 
Solved Threads: 0
amuarica amuarica is offline Offline
Newbie Poster

Re: Code to monitor port 135 on windows OS

 
0
  #8
Apr 9th, 2005
The code work well . you are a great programmer , Comatose.

but can you explain to me about serversock function . i have a book about visual basic 6 and it doesnt even mention about serversock . where can i find a source that will explain about serversock ?
Reply With Quote Quick reply to this message  
Join Date: Dec 2004
Posts: 2,413
Reputation: Comatose is a jewel in the rough Comatose is a jewel in the rough Comatose is a jewel in the rough Comatose is a jewel in the rough 
Solved Threads: 211
Team Colleague
Comatose's Avatar
Comatose Comatose is offline Offline
Taboo Programmer

Re: Code to monitor port 135 on windows OS

 
0
  #9
Apr 9th, 2005
Originally Posted by amuarica
The code work well . you are a great programmer , Comatose.

but can you explain to me about serversock function . i have a book about visual basic 6 and it doesnt even mention about serversock . where can i find a source that will explain about serversock ?
Be Not confused. Serversock is not a function. It is the name of the socket control. Just like you can name command1 to cmdOkButton, Instead of the Name Socket, I chose Serversock. This was downloaded from Catalyst, and it is called SocketWrench. It is a control that allows communications over the internet. Those communications can be either as a server (a program that listens for a connection) or a client (a program that tries to make a connection). In our case, this socket was a server, as we were listening for a connection on port 135. To avoid confusion a socket is the means by which programs talk over the internet. Windows comes with a socket control called "winsock" but it's not as powerful or flexible as socketwrench. I hope this helps to give you a better understanding.
Reply With Quote Quick reply to this message  
Join Date: Mar 2005
Posts: 10
Reputation: amuarica is an unknown quantity at this point 
Solved Threads: 0
amuarica amuarica is offline Offline
Newbie Poster

Re: Code to monitor port 135 on windows OS

 
0
  #10
Jul 4th, 2005
hye comatose ...

i want to ask you a few question .

what is the different between accept and connect ?
In accept method , why we need a socketid/socket descriptor ?

thank you
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the Visual Basic 4 / 5 / 6 Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC