Solved

Blocking ports

Posted on 2003-10-26
8
549 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

752 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