vmspd (version VMSP server $Revision: 1.19 $, $Date: 2001/04/28 01:23:54 $)
index
vmspd.py

vmspd.py - Vendor Machine Simulation Protocol implementation.
 
Usage: %(program)s [options] localhost:port
 
Options:
 
    --nosetuid
    -n
        This program generally tries to setuid `nobody', unless this
        flag is set. The setuid call will fail if this program is not
        run as root (in which case, use this flag).
 
    --version
    -V
        Print the version number and exit.
 
    --class classname
    -c classname
        Use `classname' as the concrete VMSP lass. Uses
        `DebugServer' by default.
        
    --debug
    -d
        Turn on debugging prints.
 
    --help
    -h
        Print this message and exit.
 
Copyright (C) Sean Dwyer 2001 under GPL.
Version: %(__version__)s

 
Modules
            
Crypto.Hash.HMAC
Crypto.Hash.MD5
asynchat
asyncore
base64
errno
getopt
idauth
os
pwd
re
socket
string
sys
time
vmspdata
whrandom

 
Classes
            
Devnull
Options
asynchat.async_chat(asyncore.dispatcher)
VMSPChannel
asyncore.dispatcher
VMSPServer
DebugServer

 
class DebugServer(VMSPServer)
      basic server for testing, does nothing
 
  
__getattr__(self, attr) from asyncore.dispatcher
__init__(self, localaddr) from VMSPServer
__repr__(self) from asyncore.dispatcher
accept(self) from asyncore.dispatcher
add_channel(self, map=None) from asyncore.dispatcher
bind(self, addr) from asyncore.dispatcher
close(self) from asyncore.dispatcher
connect(self, address) from asyncore.dispatcher
create_socket(self, family, type) from asyncore.dispatcher
del_channel(self, map=None) from asyncore.dispatcher
handle_accept(self) from VMSPServer
handle_close(self) from asyncore.dispatcher
handle_connect(self) from asyncore.dispatcher
handle_error(self) from asyncore.dispatcher
handle_expt(self) from asyncore.dispatcher
handle_expt_event(self) from asyncore.dispatcher
handle_read(self) from asyncore.dispatcher
handle_read_event(self) from asyncore.dispatcher
handle_write(self) from asyncore.dispatcher
handle_write_event(self) from asyncore.dispatcher
listen(self, num) from asyncore.dispatcher
log(self, message) from asyncore.dispatcher
log_info(self, message, type='info') from asyncore.dispatcher
process_message(self, peer, data)
readable(self) from asyncore.dispatcher
recv(self, buffer_size) from asyncore.dispatcher
send(self, data) from asyncore.dispatcher
set_reuse_addr(self) from asyncore.dispatcher
set_socket(self, sock, map=None) from asyncore.dispatcher
writable(self) from asyncore.dispatcher

 
class Devnull
      fd flushing class
 
  
flush(self)
write(self, msg)

 
class Options
      helper option class
 
  

 
class VMSPChannel(asynchat.async_chat)
      Channel class, where the work is actually done.
 
This class is called by the main server.
PARAMETERS:
    - server:  server class
    - conn:    remote port
    - addr:    remote address
    - locaddr: local address (used for authentication)
Has the standard states of COMMAND, DATA and AUTH: READY is
implied.
 
The data file is initialised from vmspdata and its class
methods are also instansiated.
 
  
__getattr__(self, attr) from asyncore.dispatcher
__init__(self, server, conn, addr, locaddr, uptime)
__repr__(self) from asyncore.dispatcher
accept(self) from asyncore.dispatcher
add_channel(self, map=None) from asyncore.dispatcher
bind(self, addr) from asyncore.dispatcher
close(self) from asyncore.dispatcher
close_when_done(self) from asynchat.async_chat
collect_incoming_data(self, data)
implement base class method
connect(self, address) from asyncore.dispatcher
create_socket(self, family, type) from asyncore.dispatcher
decoderesp(self, clientstr)
Test the client's response to an AUTH challenge
del_channel(self, map=None) from asyncore.dispatcher
discard_buffers(self) from asynchat.async_chat
found_terminator(self)
implement base class method
get_terminator(self) from asynchat.async_chat
handle_accept(self) from asyncore.dispatcher
handle_close(self) from asynchat.async_chat
handle_connect(self) from asyncore.dispatcher
handle_error(self) from asyncore.dispatcher
handle_expt(self) from asyncore.dispatcher
handle_expt_event(self) from asyncore.dispatcher
handle_read(self) from asynchat.async_chat
handle_read_event(self) from asyncore.dispatcher
handle_write(self) from asynchat.async_chat
handle_write_event(self) from asyncore.dispatcher
initiate_send(self) from asynchat.async_chat
listen(self, num) from asyncore.dispatcher
log(self, message) from asyncore.dispatcher
log_info(self, message, type='Info', logfile=None)
override base class method for file logging
makechallenge(self)
generate a challenge string.
 
This is a timestamp, consisting of current GMT time
and a random 6-bit hex string.
old_HELP(self, arg)
single-command help. ignores arguments.
 
Response codes:
504 no such topic
214 successful help topic
push(self, msg)
override base class for convenience
push_with_producer(self, producer) from asynchat.async_chat
readable(self) from asynchat.async_chat
recv(self, buffer_size) from asyncore.dispatcher
refill_buffer(self) from asynchat.async_chat
rstring(self)
Make a random hex string for timestamping.
 
We use /dev/urandom, it's much much faster. Tack on an
extra random bit if necessary to make a 6-bit string.
send(self, data) from asyncore.dispatcher
serv_log(self, message, logfile, type='notice')
write entries to the server log
set_reuse_addr(self) from asyncore.dispatcher
set_socket(self, sock, map=None) from asyncore.dispatcher
set_terminator(self, term) from asynchat.async_chat
vmsp_AUTH(self, arg)
VMSP AUTH:
Only accepts CRAM-MD5 authentication. Checks syntax,
issues the challenge, and enters the AUTH state.
If an already successful AUTH has been made, no further
AUTH's are accepted.
 
Response codes:
501 bad syntax
503 already done authentication.
504 not yet introduced.
505 bad auth type
334 begin challenge
vmsp_EHLO(self, arg)
VMSP EHLO:
adds extended VMSP commands and a list of them,
with identd lookup.
 
Response codes:
501 bad syntax
503 already introduced
250 successful introduction
vmsp_GET(self, arg)
VMSP GET:
Gets item if possible, and logs result.
 
Response codes:
501 bad syntax
256 success
421 out of item
423 no such item.
vmsp_HELO(self, arg)
VMSP HELO:
Implements very basic identd lookup for reply.
 
Response codes:
501 bad syntax
503 already introduced
250 successful introduction
vmsp_HELP(self, arg)
General help menu.
All commands are gathered from vmsp_HELPER, except for
single command help, which is from old_HELP.
 
Response codes:
214 successful help list
vmsp_HELPER(self, arg)
Prints help message based on helpstuff_* data elements.
vmsp_LIST(self, arg)
VMSP LIST:
Returns server list data depending on access level.
 
Response codes:
501 bad syntax
504 not yet introduced.
252 successful admin list
254 successful client list
vmsp_NOOP(self, arg)
standard NOOP
 
Rssponse codes:
501 bad syntax
250 successful noop
vmsp_QUIT(self, arg)
standard QUIT
 
Response codes:
221 quit acknowlegement
writable(self) from asynchat.async_chat

 
class VMSPServer(asyncore.dispatcher)
      VMSP server class, uses VMSPChannel class
 
  
__getattr__(self, attr) from asyncore.dispatcher
__init__(self, localaddr)
__repr__(self) from asyncore.dispatcher
accept(self) from asyncore.dispatcher
add_channel(self, map=None) from asyncore.dispatcher
bind(self, addr) from asyncore.dispatcher
close(self) from asyncore.dispatcher
connect(self, address) from asyncore.dispatcher
create_socket(self, family, type) from asyncore.dispatcher
del_channel(self, map=None) from asyncore.dispatcher
handle_accept(self)
handle_close(self) from asyncore.dispatcher
handle_connect(self) from asyncore.dispatcher
handle_error(self) from asyncore.dispatcher
handle_expt(self) from asyncore.dispatcher
handle_expt_event(self) from asyncore.dispatcher
handle_read(self) from asyncore.dispatcher
handle_read_event(self) from asyncore.dispatcher
handle_write(self) from asyncore.dispatcher
handle_write_event(self) from asyncore.dispatcher
listen(self, num) from asyncore.dispatcher
log(self, message) from asyncore.dispatcher
log_info(self, message, type='info') from asyncore.dispatcher
process_message(self, peer, data)
Requiress a subclass to implement
readable(self) from asyncore.dispatcher
recv(self, buffer_size) from asyncore.dispatcher
send(self, data) from asyncore.dispatcher
set_reuse_addr(self) from asyncore.dispatcher
set_socket(self, sock, map=None) from asyncore.dispatcher
writable(self) from asyncore.dispatcher

 
Functions
            
parseargs()
command-line argument parser
usage(code, msg='')
command-line usage function

 
Data
             DEBUGSTREAM = <vmspd.Devnull instance>
EMPTYSTRING = ''
NEWLINE = '\012'
StringType = <type 'string'>
__author__ = 'Sean Dwyer <ewe2@can.org.au>'
__credits__ = '\012Barry Warsaw <bwarsaw@beopen.com> for smtpd.py and Sean\012Reifschneider for sockserv.py'
__date__ = '$Date: 2001/04/28 01:23:54 $'
__file__ = './vmspd.py'
__name__ = 'vmspd'
__simpleversion__ = 'VMSP server 1.14'
__version__ = 'VMSP server $Revision: 1.19 $'
program = ''
y = <SRE_Pattern object>
z = <SRE_Match object>

 
Author
             Sean Dwyer <ewe2@can.org.au>

 
Credits
            
Barry Warsaw <bwarsaw@beopen.com> for smtpd.py and Sean
Reifschneider for sockserv.py