473,408 Members | 2,888 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,408 software developers and data experts.

block a network port

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.

Aug 29 '06 #1
5 5893
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
Aug 29 '06 #2
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?

Aug 30 '06 #3
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

Aug 30 '06 #4
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.
Aug 30 '06 #5
On 29 Aug 2006 20:43:49 -0700, alex23 <wu*****@gmail.comwrote:
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 :)
Aug 30 '06 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Alphamacaroon | last post by:
All, I'm wondering if anyone can help me with a strange problem I'm having. First off, here's what I'm trying to do: I'm developing a UDP network application that should allow the end user to...
12
by: ORC | last post by:
Shouldn't 'ReadFile' block when timeouts are specified even when running in overlapped mode or am I wrong ??? Thanks Ole
1
by: Frosty Madness | last post by:
I have the beginnings of a device emulator that sits on the network... ************** using System; using System.Threading; using System.Net; using System.Net.Sockets; using System.Text;
31
by: damacy | last post by:
hi, there. i have a problem writing a program which can obtain ip addresses of machines running in the same local network. say, there are 4 machines present in the network; , , and and if i...
1
by: Andrew | last post by:
Hello Everyone I am receiving an error in an application I am working on. The application when its done will be a Dungeons and Dragons Network game. I am having problems with the Networked...
20
by: simple25 | last post by:
I've been looking through sites to see if anyone could provide the correct steps to block port 1434, which is a MSSQL port. NOBODY and I mean NOBODY was smart enough to give a clear and simple...
13
by: 7stud | last post by:
I have the following two identical clients #test1.py:----------- import socket s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) host = 'localhost' port = 5052 #server port
4
by: james457 | last post by:
Hi all, I am writing a linux testbed for wireless sensor networks. The core objective is to test data transfer between any two nodes. The network runs using tree topology. One node in the network...
3
dlite922
by: dlite922 | last post by:
I have a proprietary software on two different internal networks. on one the client-side software can access the server, and the second network, they can't. I have no real clue which ports are...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.