Jump to content

Closing Ports! - Help

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
20 replies to this topic

#1
travy92

travy92

    Learning Programmer

  • Members
  • PipPipPip
  • 76 posts
Hey, does anyone know how to close a port/ports?

If so then could you please post how?

Thanks in advance.

#2
o0TheNerd0o

o0TheNerd0o

    Learning Programmer

  • Members
  • PipPipPip
  • 61 posts
Make a winsock control on your form. Then set it to listen to a specific port, on connection request, set it to close. Example:

Private Sub Form_Load()
Winsock1.Port = 2314
Winsock1.Listen
End Sub

Private Sub Winsock1_ConnectionRequest(ByVal requestID As Long)
Winsock1.Close
Winsock1.Port = 2314
Winsock1.Listen
End Sub
Option Explicit
:cool:

#3
travy92

travy92

    Learning Programmer

  • Members
  • PipPipPip
  • 76 posts

o0TheNerd0o said:

Make a winsock control on your form. Then set it to listen to a specific port, on connection request, set it to close. Example:

Private Sub Form_Load()
Winsock1.Port = 2314
Winsock1.Listen
End Sub

Private Sub Winsock1_ConnectionRequest(ByVal requestID As Long)
Winsock1.Close
Winsock1.Port = 2314
Winsock1.Listen
End Sub

So if i opened visual basic, made a win sock control and added that code, it would close my port permanently? Or just close it until i close Visual basic?

That's what i need.

#4
o0TheNerd0o

o0TheNerd0o

    Learning Programmer

  • Members
  • PipPipPip
  • 61 posts
Until you close the vb application.
Option Explicit
:cool:

#5
travy92

travy92

    Learning Programmer

  • Members
  • PipPipPip
  • 76 posts
Oh ok, thanks.

Now i'll just make it run on start-up and then make it in system tray and then i'm done.

Thanks so much!

#6
Lop

Lop

    Speaks fluent binary

  • Members
  • PipPipPipPipPipPipPipPip
  • 1,172 posts
If the port is open this won't work though. So "blocking" would be the wrong word to use. If it isn't open it is already blocked.

Also, by opening the ports you can create a port scanner (for your local machine). If you open the port and receive an exception the port is open. Just thought I would throw that in there.

#7
o0TheNerd0o

o0TheNerd0o

    Learning Programmer

  • Members
  • PipPipPip
  • 61 posts
You're welcome. I hope it works. Lop is correct for the most part. Its not really "blocking" the port, it just denies connection requests.
Option Explicit
:cool:

#8
Lop

Lop

    Speaks fluent binary

  • Members
  • PipPipPipPipPipPipPipPip
  • 1,172 posts
Is it possible to get as low as intercepting packets with VB?

#9
o0TheNerd0o

o0TheNerd0o

    Learning Programmer

  • Members
  • PipPipPip
  • 61 posts
I'm sure it is. I've never done it. I used the methodology when blocking aim direct connect requests. It worked great. So I'm not exactly sure if its packet level or not.
Option Explicit
:cool:

#10
Lop

Lop

    Speaks fluent binary

  • Members
  • PipPipPipPipPipPipPipPip
  • 1,172 posts
So basically Travy92, you would need to load this application before any other apps open the ports you want to block. Is that how you did it TheNerd?

#11
o0TheNerd0o

o0TheNerd0o

    Learning Programmer

  • Members
  • PipPipPip
  • 61 posts
Kind of... It doesn't really matter when you load the application. It will listen on the port regardless. And when a connection request comes in, it will close it then set itself to listen again.
Option Explicit
:cool:

#12
travy92

travy92

    Learning Programmer

  • Members
  • PipPipPip
  • 76 posts
Ummm, how would i load it before any other app?

Would i use like a .bat file to execute it with autoexec? Or something like that?


EDIT: Oh and what do you mean "make a winsock control" on your form?
Do you mean ctrl+T>Microsoft Winsock controls 6.0?
Or?

P.S - When i click Ctrl+T>Microsoft Win sock Controls 6.0 and then the button that looks like a computer with a red cable to another computer (On the tool bar to the left of the Form) and try to add it to the form it says:

"License information for this component not found. You do not have an appropriate license to use this functionality in this environment."

Help?