Solved

Blocking ports

Posted on 2003-10-26
8
541 Views
Last Modified: 2007-12-19
How can i block ports using delphi and have the ability to turn them back on or off.

Also how can i monitor the connections on the computer like netstat

Thanks,
Hypoviax
0
Comment
Question by:Hypoviax
8 Comments
 
LVL 6

Expert Comment

by:swift99
ID: 9624989
You are talking about either (a) writing a firewall program, or (b) writing a TCP Proxy program.

If (a), then you need to learn tier 0 and tier 1 Windows system programming.  Most of the books on this are written for C programmers, but if you're up to this particular task the programming language won't really matter to you.  A faster, cheaper, and more reliable alternative would be to pick up a linux installation and use the linux OS provided tools. Why re-invent something that is core functionality of a free (or at least really cheap) tool?

if (b), then I suggest picking up ICS at http://overbyte.delphicenter.com  .  The entire suite is written from the ground up in Delphi, and there are even examples of functional proxies on the "user built" page that you could use as a starting point.
0
 
LVL 8

Expert Comment

by:gmayo
ID: 9625634
Or (c) you just want to block the ports. The easiest way is to simply dump a TServerSocket or TTCPServer or equivalent on to your form, set the port number to the one you want to block, and then activate it. Only one application can listen on a port so the port must be free for you to attach to.

There is a netstat-like component on http://www.torry.net/networks.htm (second one down).

Geoff M.
0
 
LVL 2

Expert Comment

by:123456
ID: 9626801
hi , i see a question as same as your question

see this link may be useful for you
http://www.experts-exchange.com/Programming/Programming_Languages/Delphi/Q_20751854.html#9493226

regards

0
Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

 
LVL 5

Author Comment

by:Hypoviax
ID: 9647236
Gmayo

I will have a look at your component. It is i think what i am looking for.

In regards to your other suggestion will this work if there already is a connection present on the port.

To Swift99

I am creating a security application that at the moment is very good at the desktop level, dealing with programs and files etc, however i need it so that it can control network flow in a way like a firewall but as gmayo said, all, at the moment that i want to do is block a specified port.
0
 
LVL 8

Expert Comment

by:gmayo
ID: 9648492
You won't be able to take over the port if something else already has it. However, I think the netstat is independant of the ports and won't actually block anything, just monitor it. If something else has grabbed the port before your app starts then you probably need to start at a service level, ie when Windows starts.

Geoff M.
0
 
LVL 5

Author Comment

by:Hypoviax
ID: 9655108
gmayo,

If this is so then i am satisfyed however, how will it be possible to apply a TServerSocket etc on more than one port. Is it possible to create a socket for each port? If so how is this done.

Also the component you are suggesting will not work for me. I am missing vcl30.bpl. It is not located in the delphi bin directory.

Thanks,

Hypoviax
0
 
LVL 8

Accepted Solution

by:
gmayo earned 250 total points
ID: 9656133
You will need one TServerSocket per port to be blocked. Set the port number and Active flag.

I can't help with the vcl30.bpl - does the component you want come with source code so you can rebuild it? Basically, whatever you were trying to use was compiled under Delphi 3.

Geoff M.
0
 
LVL 5

Author Comment

by:Hypoviax
ID: 9664759
Thanks for your help Geoff,

Hypoviax
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…

816 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now