block a network port

Discussion in 'Python' started by abcd, Aug 29, 2006.

  1. abcd

    abcd Guest

    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.
     
    abcd, Aug 29, 2006
    #1
    1. Advertising

  2. abcd

    Larry Bates Guest

    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
     
    Larry Bates, Aug 29, 2006
    #2
    1. Advertising

  3. abcd

    abcd Guest

    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?
     
    abcd, Aug 30, 2006
    #3
  4. abcd

    alex23 Guest

    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
     
    alex23, Aug 30, 2006
    #4
  5. 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.
     
    Butternut Squash, Aug 30, 2006
    #5
  6. abcd

    Tim Williams Guest

    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 :)
     
    Tim Williams, Aug 30, 2006
    #6
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. John T. Goodman

    Overhead of 4-port over 2-port SRAM

    John T. Goodman, Jan 25, 2005, in forum: VHDL
    Replies:
    0
    Views:
    619
    John T. Goodman
    Jan 25, 2005
  2. Sean Wolfe
    Replies:
    1
    Views:
    2,270
    Joerg Jooss
    Apr 28, 2005
  3. b3ny
    Replies:
    11
    Views:
    937
    Babu Kalakrishnan
    Nov 20, 2004
  4. Gerald Klix
    Replies:
    0
    Views:
    1,284
    Gerald Klix
    Oct 26, 2005
  5. morrell
    Replies:
    1
    Views:
    968
    roy axenov
    Oct 10, 2006
Loading...

Share This Page