473,555 Members | 2,290 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 5904
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.popen 3('C:\\ipfw\\bi n\\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
2826
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 choose the network interface they want to send and receive UDP packets on. Simple enough. If the computer has a single network card and IP...
12
6882
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
1786
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
3534
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 run my program on , it should be able to find "host names" and "ip addresses" of the other machines; , and ? i have read some threads posted on...
1
1779
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 Canvas basically for drawing the dungeon maps If I initialize two of the Tkinter Canvas widgets with in the same window I can draw across the network,...
20
13607
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 answer. The question again is... HOW DO I BLOCK PORT 1434? *** answers include the following: Go to your firewall.... You don't need to block...
13
3913
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
2917
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 is the "Driver". This node is connected using serial port to a linux PC. What I am trying to write is the software on this linux PC that will drive...
3
2371
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 needed, 1. What's the best way to find out? will telnet x.x.x.x port# work? 2. Does one side (server) have to be listening on a port to be able...
0
7825
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8060
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7588
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
6176
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5452
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3575
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2037
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1159
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
865
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.