473,748 Members | 4,030 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 5927
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
2849
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 address this all works
12
6901
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
1794
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
3558
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 this group, however, they only work for localhost, not the entire network.
1
1790
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, however if I open a second instance of the Application and initialize the canvas, on windows I recv
20
13641
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 it... Technically you don't want to block it...
13
3929
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
2926
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 data transfer in the network. The "Driver" node, taking commands from the software running on...
3
2381
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 to detect that it is open? If it doesn't listen, than requests end up no where. right? 3. For...
0
8991
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8831
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
9325
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 most users, this new feature is actually very convenient. If you want to control the update process,...
0
9249
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8244
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 launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6796
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 instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6076
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4876
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3315
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

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.