473,804 Members | 3,447 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Using SRP on TCPServer module

Hi all,

Below, you can see a class that when it receives a host connection, it
gets validated. Then, if the validation returns True, then process the
request. Also, if I want to stop the server, I simply access the
self.QuitFlag in lock mode, and set it to 1.

Now that you know what I have, I would like to add SRP functionality to
the validation of each new connection.
What I need to add to my code to get SRP to work? I don't know where to
start. The docs are poor.

Thanks

Daniel

------------------------------------------------------

class TCPServer(Socke tServer.Threadi ngTCPServer):

def __init__(self,s ocket,lock):
self.socket = socket
SocketServer.Th readingTCPServe r.__init__(self ,
socket,SocketSe rver.StreamRequ estHandler)
SocketServer.Th readingTCPServe r.allow_reuse_a ddress = True
self.timeout = 0.1
self.lock = lock
self.lock.acqui re()
self.QuitFlag = 0
self.lock.relea se()

def get_request(sel f):
socklist = [self.socket]
while 1:
# Select with a timeout, then poll a quit flag. An
alternate
# approach would be to let the master thread "wake us up"
# with a socket connection.
ready = select.select(s ocklist, [], [], self.timeout)
self.lock.acqui re()
time_to_quit = self.QuitFlag
self.lock.relea se()
if time_to_quit:
raise TimeToQuit # Get out now
if ready[0]: # A socket was ready to read
return
SocketServer.Th readingTCPServe r.get_request(s elf)
else: # We timed out, no connection yet
pass # Just go back to the select()

#Process the request
def process_request _thread(self,re quest,client_ad dress):
"""
This function gets triggered when the connection is accepted
"""
pass

#Verify the request
def verify_request( self,request,cl ient_address):
"""
This function triggers when some host wants to connect
"""
if DoValidationOf( client_address) :
return True
else:
return False

Oct 14 '05 #1
1 2341
"dcrespo" <dc*****@gmail. com> writes:
Now that you know what I have, I would like to add SRP functionality to
the validation of each new connection.
What I need to add to my code to get SRP to work? I don't know where to
start. The docs are poor.


I don't know of a Python SRP module that only does SRP. I've been
thinking of writing one.

TLSLite (http://trevp.net/tlslite) implements SRP as an extension to
TLS. Maybe it's what you should be using instead of just sending
cleartext through TCPServer. Connecting up TLSLite to TCPServer is
pretty straightforward and I think there's an example in the TLSLite docs.
Oct 14 '05 #2

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

Similar topics

3
2996
by: huy | last post by:
Hi All, Can someone explain why this bit of code can't keep up with some java code which spawns about 200 (threads) simultaneous connections each sending about 10 mesgs each. I basically don't get the 2000 connections i expect on the python side. I end up with some number very close on different runs eg. 1989, 1972, 1992 etc. Any ideas ?
2
6383
by: Tortelini | last post by:
I am making custom web server using HTTPServer and want to be able to access it simultaneously from different computers. To achieve multithreading, I have been experimenting with ThreadingMixIn from SocketServer, but it doesn't seem to work, when I freeze code in one instance it seems to be frozen in second one too (I experimented with time.sleep and while 1 loop). I am using python 2.4 on Windows XP. Does anyone have any suggestions? Do I...
1
2939
by: orit | last post by:
I have the following xml file: <?xml version="1.0" encoding="utf-8" ?> <course id="2555" title="Developing Microsoft .NET Applications for Windows (Visual C# .NET)" length="5 days" source="http://www.microsoft.com/learning/syllabi/en-us/2555Afinal.mspx"> <module id="1" title="Introducing Windows Forms" location="D:\Disk-C\Documents and Settings\orit_itzhar.ATRICA\My Documents\XML\csharp"> <lesson id="1.1"> <subject>Creating a...
0
1109
by: Glich via DotNetMonster.com | last post by:
#using <mscorlib.dll> #using <System.dll> #include "stdlib.h" #include "stdio.h" using namespace System; using namespace System::Text; using namespace System::IO; using namespace System::Net;
2
5293
by: Alpha | last post by:
Hi, I'm able to make connection to a server using socket connection. However, when I send a command string the server just ignores it. All command string needs to start with "0xF9" at Byte 0. During the run-time debug, I see it to be "u" with a "~" on top of it. Is that OxF9? Can someone tell me what I'm doing wrong? Thanks, Alpha private void Connect(String server, String message) { //Socket Connect
6
2521
by: Ant | last post by:
Hi all, I'm putting together a simple help module for my applications, using html files stored in the application directory somewhere. Basically it sets up a basic web server, and then uses the webbrowser module to display it in the users browser. I have it set up to call sys.exit(0) if the url quit.html is called, but for some reason (on Windows XP via the cmd.exe shell) python won't let me have the console back. I get the System Exit...
2
6614
by: Eric Spaulding | last post by:
Is there an easy way to pass arguments to a handler class that is used by the standard TCPServer? normally --srvr =SocketServer.TCPServer(('',port_num), TCPHandlerClass) I'd like to be able to: srvr =SocketServer.TCPServer(('',port_num), TCPHandlerClass, (arg1,arg2)) And have arg1, arg2 available via TCPHandlerClass.__init__ or some other way.
21
34447
KevinADC
by: KevinADC | last post by:
Note: You may skip to the end of the article if all you want is the perl code. Introduction Uploading files from a local computer to a remote web server has many useful purposes, the most obvious of which is the sharing of files. For example, you upload images to a server to share them with other people over the Internet. Perl comes ready equipped for uploading files via the CGI.pm module, which has long been a core module and allows users...
1
3797
by: =?Utf-8?B?RGFydGgtQ3ot?= | last post by:
Hi, I'm beginner in Visual C++ so I want to ask you a question. And I'm not good in English:D So I have the program which communicates over sockets. The program has to connect to the server and send and receive data. But when I start the program, there is one Socketexception - something like the program is unable to connect to the server or the server didn't answer... I apologize for my English... Thank you for advice...
0
9711
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
9591
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,...
0
10594
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. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10087
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
9166
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...
0
5529
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5667
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4306
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
3
3001
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 effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.