Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > block a network port

Reply
Thread Tools

block a network port

 
 
abcd
Guest
Posts: n/a
 
      08-29-2006
any ideas on how to block a network port from being used, or one that
is currently in use? For example, say I want to block port 23 from
being used. by used, I mean allowing connections to or from it.

thanks in advance.

 
Reply With Quote
 
 
 
 
Larry Bates
Guest
Posts: n/a
 
      08-29-2006
abcd wrote:
> any ideas on how to block a network port from being used, or one that
> is currently in use? For example, say I want to block port 23 from
> being used. by used, I mean allowing connections to or from it.
>
> thanks in advance.
>

This is not really a Python question. Blocking ports is a function
of your firewall solution.

-Larry Bates
 
Reply With Quote
 
 
 
 
abcd
Guest
Posts: n/a
 
      08-30-2006
Larry Bates wrote:
> This is not really a Python question. Blocking ports is a function
> of your firewall solution.
>



ok, no of any python solutions? or command-line firewalls?

 
Reply With Quote
 
alex23
Guest
Posts: n/a
 
      08-30-2006
abcd wrote:
> ok, no of any python solutions? or command-line firewalls?


You did try searching Google for "python firewall", right?

http://www.google.com.au/search?q=python+firewall

The very first entry is a pointer to a solution for Windows.

You really need to provide more information if you want more detailed
advice, like what operating environment you're working with. You should
find something in the search results to help you, though.

-alex23

 
Reply With Quote
 
Butternut Squash
Guest
Posts: n/a
 
      08-30-2006
abcd wrote:

> Larry Bates wrote:
>> This is not really a Python question. Blocking ports is a function
>> of your firewall solution.
>>

>
>
> ok, no of any python solutions? or command-line firewalls?


So now you're question is how to write a firewall in python?

You can probably bind to all the ports and not open up any connections. That
would keep something else from using the port. Simple but effective.

Firewall software is a much better solution, though

Good luck.
 
Reply With Quote
 
Tim Williams
Guest
Posts: n/a
 
      08-30-2006
On 29 Aug 2006 20:43:49 -0700, alex23 <> wrote:
> abcd wrote:
> > ok, no of any python solutions? or command-line firewalls?

>
> You did try searching Google for "python firewall", right?
>
> http://www.google.com.au/search?q=python+firewall
>
> The very first entry is a pointer to a solution for Windows.


That first entry was my thread

IPFW is stable and runs as a Windows service, the rules can be
added/deleted/changed/viewed in real-time making it a good candidate
for pairing with Python.

I have used it to write servers that temporarily firewall themselves
against dubious connections.

My preferred method is something like

def ip_fw(fwcmd): #
try:
i,o,e = win32pipe.popen3('C:\\ipfw\\bin\\ipfw '+fwcmd)
return i,o,e
except:
print sys.exc_info()[0]

Nowadays I might use something other than popen3 depending on the
level of return status I needed.

(from memory, not tested, and not the best Python code )

HTH
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Fo:Block can you check to see if a block contains any text by using the block id? morrell XML 1 10-10-2006 07:18 PM
Problem with enterprise application block - data block Showjumper ASP .Net 1 03-19-2005 03:48 PM
Block DIV within a block DIV? Noozer HTML 3 01-06-2005 10:24 PM
XML schema validation of one xml block based on values from another xml block Andy XML 0 11-18-2004 11:04 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57