SWSSOCK APPLICATIONS ==================== Author: Lawrence Rust (lvr@softsystem.co.uk) Last Modified: 05-Feb-11 The SwsSock applications binary archive provides all the applications from the SwsSock source archive pre-built for a given platform. REQUIREMENTS ============ - A PC running Linux (2.6.x), Windows (Vista, XP, 2000, NT4, Me, 98) or MS-DOS. - 10 MB of free disk space. - A Linux or Windows supported TCP/IP network or an Ethernet card and packet driver for DOS. QUICK-START GUIDE ================= - Unzip the archive into an empty folder. - The Windows and Linux apps use the platform's native networking stack which should be properly configured. - For native DOS you need a standard 'packet driver' for your Ethernet adapter (see Crynwr Software www.crynwr.com) for examples. You will need to add this driver to your config.sys or autoexec.bat file and reboot. - The DOS applications can also be run under Windows in which case you will need our SwsVpkt virtual packet driver. See www.softsystem.co.uk/products/swsvpkt. Each session provides a standalone TCP/IP implementation. Sessions may be given identical or different IP addresses dependent upon the local sws_sock.ini file contents. - For DOS environments, by default SwsSock is configured to use DHCP to obtain an IP address, a default gateway (router) and a DNS server. If you do not have a DHCP server then you will need to edit the sws_sock.ini file with a standard text editor to specify these values. For instance: [PacketDriverInterface1] ipaddress= 192.168.1.64 ipgateway= 192.168.1.1 [dns] hostname= dosbox server= 192.168.1.1 sets the first Ethernet card's IP address to 192.168.1.64 (with a subnet mask of 255.255.255.0) a default gateway of 192.168.1.1 and a DNS server of 192,168.1.1. - Start a command line session in the folder with the apps. - All the apps accept a -? parameter which will display syntax and options. THE APPLICATIONS ================ NB Many of the applications can be customised by entries in the sws_sock.ini file. Please refer to config.txt for full details. ================ dns ================ DNS (RFC 1034/1035) client for hostname and IP address lookup. Syntax: dns [options] hostname -d : 0= host resolver, 1= DNS query (default), 2= Netbios query -n : Name server -p : Port. Default 53 -c : Query opcode. Default 0x100 -q : Query type: 1= hostname (default), 15= mx, 16=text, 255= all -s : Class: 1= IN, 3= CHAOS -o : Set logfile -t : Decrease verbosity of output -v : Increase verbosity of output -V : Show version and exit -h : Help e.g.: dns bbc.co.uk or: dns 212.58.224.138 Example sws_sock.ini settings: [dns] hostname=dosbox server=192.168.1.1 ================ echos ================ UDP/TCP echo (RFC862) client/server Syntax: echos [options] [host] -c : Streaming (TCP) mode (default) -d : Datagram (UDP) mode -p : Port, default 7 -w : Receive timeout in milliseconds (default 5000, 0= none) -l : Client packet size (default 8, max 4294967295) -i : Client send interval in milliseconds (default 1000U, 0= no delay) -k : Client source port -n : Number of requests to send (default 4, 0= infinite) -f : Client file to send -o : Set logfile -t : Decrease verbosity of output -v : Increase verbosity of output -h : Help e.g. run the server: echos or run the client: echos dosbox ================ ftp ================ FTP (RFC 959) client Syntax: ftp [options] -p : Port -i : Script file -o : Set logfile -t : Decrease verbosity of output -v : Increase verbosity of output -V : Display version and exit -h : Help e.g. ftp 192.168.1.1 -p2121 1>help Commands available: quit : Quit user : Login pass : User password list : Directory listing nlst : Short directory listing stat [filespec] : File listing get [local] : Fetch file from server put [remote] : Store file on server ren : Rename a file del : Delete a file pwd : Print working directory cwd : Change working directory cd : Change working directory mkd : Create a directory rmd : Delete a directory type [n] : Transfer type: 0= text, 1= binary syst : Site info rhlp [text] : Server help noop : No operation pasv [n] : 1= passive connections, 0= default cmd : Execute server command echo : Command/response echoing exec [filename] : Execute commands from a script rem [text] : Script comment help [command] : Show command help ================ ftpd ================ FTP (RFC 959) server Syntax: ftpd [options] -p : Port, default 21 -o : Set logfile -t : Decrease verbosity of output -v : Increase verbosity of output -h : Help e.g.: ftpd -o logfile Example sws_sock.ini settings: [ftp] UpnpExtPort = 21 max_conn = 6 [ftp_users] ;username password home_dir permit [r|x|w|c] permitted host(s) ; admin admin . c 192.168.1.0/22 anonymous * . x guest - . x * - . r ================ httpd ================ HTTP 1.1 (RFC 2616) web server with CGI, proxy and Video4Linux modules, Syntax: httpd [options] -p : Port -o : Set logfile -t : Decrease verbosity of output -v : Increase verbosity of output -h : Help e.g.: httpd -p8080 -v By default, all files are in the working directory and the request / serves the file index.htm. Example sws_sock.ini settings: [http] UpnpExtPort = 80 max_conn = 16 root = /srv html_root = /public cgi_root = /cgi-bin [http_alias] / = /index.htm [http_proxy] ; Authorization for all proxy requests ; Enable public proxy service overnight time = 21:30 08:30 ; Proxy accounts acct = user1:password acct = user2:password ; Proxy specific hosts permit = 192.168.1.20/28 ================ identd ================ Ident (RFC 1413) server. Syntax: identd [options] -p : Port, default 113 -o : Set logfile -t : Decrease verbosity of output -v : Increase verbosity of output -h : Help Example sws_sock.ini settings: [ident] UpnpExtPort=113 max_conn = 3 idle_time = 120 ================ inetd ================ Multi-threaded FTP/HTTP/SMTP/POP3/TELNET/IDENT/ECHO server. Syntax: inetd [options] args Arg: ident= : Set ident port (0= disable) discard= : Set discard port (0= disable) echo= : Set echo port (0= disable) pop= : Set pop port (0= disable) smtp= : Set smtp port (0= disable) telnet= : Set telnet port (0= disable) http= : Set http port (0= disable) ftp= : Set ftp port (0= disable) Option: -o : Set logfile -t : Decrease verbosity of output -v : Increase verbosity of output -h : Help ================ loganaly ================ SwsSock server log file analysis and reporting Syntax: loganaly [options] [log file] -i : Source IP address filter e.g. 192.168.0.2/24 -x : Source IP address exclusion filter e.g. 192.168.0.2/24 -m : CIDR mask (1..32) -r : Protocol [smtp|mailhelo|mailfrom|mailto|mail|mailout|pop3|ftp|http|ident|telnet|echo| discard] -f : Protocol tail wildcard filter e.g. "user*@my???.com" -e : Error code filter e.g. 200 or 400-599 -n : Max number of entries in result table (20) - : Read log file from stdin (filter) -o : Set output file -t : Decrease verbosity of output -v : Increase verbosity of output -V : Show version and exit -h : Help ================ mcast ================ UDP multicast echo client/server Syntax: mcast [options] [group] -p : Discard server port (default 9) -c[n] : Client mode local port (no default) -l : Client packet size (default 8, max 4096) -i : Client send interval in milliseconds (default 1000, 0= no delay) -n : Client requests to send (default 4, 0= infinite) -o : Set logfile -t : Decrease verbosity of output -v : Increase verbosity of output -V : Display version and exit -h : Help e.g. run the server: mcast or run the client: mcast -c ================ mping ================ ICMP multicast ping client/server Syntax: mping [options] [group] -c : Client mode -l : Client packet size (default 8, max 65507) -n : Client requests to send (default 4, 0= infinite) -i : Client send interval in milliseconds (default 1000, 0= no delay) -w : Client reply timeout in milliseconds (default 1000) -t : Decrease verbosity of output -v : Increase verbosity of output -V : Display version and exit -h : Help e.g. run the server: mping or run the client: mping -c ================ ntp ================ Net Time Protocol (RFC 958/1059/1119/1305) client. Syntax: ntp [options] [hostname] -p : Set NTP server port -s : Set system date & time -t : Decrease verbosity of output -v : Increase verbosity of output -V : Show version and exit -h : Help e.g to print the current time. ntp Sys time: Tue, 26 Jan 2010 21:04:29.314374 +0100 NTP time: Tue, 26 Jan 2010 20:04:24.814038 +0000 or to set the time: ntp -s Example sws_sock.ini settings: [ntp] server= europe.pool.ntp.org ================ ping ================ ICMP echo client. Tests IP connectivity. Syntax: ping [options] -l : Send buffer size (default 32, max 65507) -n : Number of echo requests to send (default 4, 0= infinite) -w : Receive timeout (default 1000 milliseconds, 0= no reply) -i : Send interval (default 1000 milliseconds, 0= no delay) -b : Enable broadcasts -f : Source IP address -d : Included IP fragment destination IP address -p : Included TCP fragment src port -P : Included TCP fragment dst port -F : Set 'Dont Fragment' flag -L : Time To Live -R : Include RecordRoute IP option -S : Type Of Service, 0x20=PRI 0x10=DLY -T : ICMP type, DSTUNREACH=3 QUENCH=4 REDIRECT=5 ECHO=8 TEXCEED=11 TSTAMP=13 -C : ICMP code, REDIR_HOST=1 PORT_UNREACH=3. FRAG_NEEDED=4 -t : Decrease verbosity of output -v : Increase verbosity of output -V : Display version and exit -h : Help e.g.: ping bbc.co.ik ================ pktdump ================ TCP/IP, Ethernet & P2P packet dumper. Displays raw packets on the specified interface. Syntax: pktdump [options] -p[0|1] : En/dis/able promiscuous receive -i : Set IP address -o file : Set logfile -t : Decrease verbosity of output -v : Increase verbosity of output -V : Display version and exit -h : Help e.g. pktdump 21:07:50.937 R:148 192.168.1.21 >192.168.1.20 TTL:64 DF DLY TCP 22 >49622 PSH ACK:0xdcc9ec85 WND:758 SEQ:0x600ede99 TSOPT:38639606:12075997 21:07:50.937 R:52 192.168.1.20 >192.168.1.21 TTL:64 DF DLY TCP 49622 >22 ACK:0x600edef9 WND:2003 SEQ:0xdcc9ec85 TSOPT:12076297:38639606 NB if used in promiscuous mode on a DOS system some packet drivers may be need to be reloaded before normal use can be resumed. This is not a bug in SwsSock. ================ popd ================ POP3 (RFC 1939) mail service. Syntax: popd [options] -t : Decrease verbosity of output -v : Increase verbosity of output -p : Port, default 110 -o : Set logfile -h : Help Example sws_sock.ini settings: [pop] UpnpExtPort = 110 max_conn = 3 ; Default 4 [pop_users] ;username password inbox ; admin admin . ================ realip ================ Display the external IP address of the default IP gateway. Syntax: realip [options] -a : Auto (default), try record route if UPnP fails -u : UPnP Internet Gateway Device method -r : Record route method (root privilege reqd) -V : Show version and exit -h : Help e.g. realip 77.201.1.180 ================ recvmail ================ POP3 (RFC 1939) client and mail filter. Syntax: recvmail [options] -p : Port -i : Specify text file containing commands -o : Set logfile -t : Decrease verbosity of output -v : Increase verbosity of output -V : Show version and exit -h : Help 1>? Commands available: user : Login pass : User password stat : Show count and total size of messages list [n] : Show message scan listing(s) top [m] [>file] : Show top m lines of message n get [>file] : Retrieve a message del : Delete a message rst : Cancel all pending deletions nop : No operation quit : Quit quit0 : Quit if no messages scan [n] : Show message summary lines : Set number of lines for scan if [and ...] : Conditionally apply action to messages cond [cond] : List conditions act [action] : List actions rpt : Apply action to all messages exec [filename] : Execute commands from a script help [command] : Show command help ================ sendmail ================ SMTP (RFC 5321/2821) mail client Syntax: sendmail [options] 1*[recipient] -s : Subject, '-'= empty -i : File to send, default stdin -E : No envelope -f : From address, '-'= empty -r : Reply address, '-'= empty, default none -a : AUTH PLAIN [usr:pwd | base64] -n : HELO name, '-'= [IP], default is hostname -e: SMTP server, '-'= MX direct -p : SMTP port -o : Set logfile -t : Decrease verbosity of output -v : Increase verbosity of output -V : Show version and exit -h : Help Recipients following cc: will be copied. Recipients following bcc: will be 'blank' copied. Example sws_sock.ini settings: [mail] server=smtp-in.softsystem.co.uk server=192.168.1.21 from= sales@softsystem.co.uk ================ sink ================ UDP/TCP discard (RFC862) client/server Syntax: sink [options] [host] -c : Streaming (TCP) mode (default) -d : Datagram (UDP) mode -p : Port, default 9 -l : Client packet size (default 8, max 4294967295) -i : Client send interval in milliseconds (default 1000U, 0= no delay) -k : Client source port -n : Number of requests to send (default 4, 0= infinite) -f : Client file to send -o : Set logfile -t : Decrease verbosity of output -v : Increase verbosity of output -h : Help e.g. to run the server: sink or run the client: sink dosbox ================ smtpd ================ SMTP (RFC 5321/2821) mail server Syntax: smtpd [options] -p : Port, default 25 -o : Set logfile -t : Decrease verbosity of output -v : Increase verbosity of output -h : Help Example sws_sock.ini settings: [smtp] UpnpExtPort = 25 max_conn= 4 ; Default 3 hostname = smtp-in.softsystem.co.uk deny_defer= 1 deny_unnamed= 1 deny_dynamicip= 1 verify_sender=1 [smtp_relay] ; Host IPs permitted to relay ip4= 127.0.0.1/16 [smtp_users] ;mailbox inbox quota ; Postmaster . 1000000 @localhost . 1000000 ================ syslogd ================ syslog (RFC 3164) server Syntax: syslogd [options] -p : port (default 514) -o : Set logfile -t : Decrease verbosity of output -v : Increase verbosity of output -h : Help ================ syslogr ================ syslogd file analyser Syntax: syslogr [options] [log file] -t : Decrease verbosity of output -v : Increase verbosity of output -o : Set output file -n : Max number of entries per table -r : Set protocol filter (tcp, udp, icmp) -p : Set destination port filter range e.g. 135 or 135-139 -P : Set source port filter range e.g. 135 or 135-139 -i : Set source IP address filter e.g. 192.168.0.2/24 -I : Set destination IP address filter e.g. 192.168.0.2/24 -x : Set source IP address exclusion filter e.g. 192.168.0.2/24 -X : Set destination IP address exclusion filter e.g. 192.168.0.2/24 -m : Set CIDR mask (1..32) -D : Sort on destination IP address -l : Set log file format (syslog, pktdump, netcen) -h : Help ================ telnetd ================ Telnet (RFC 854) server Syntax: telnetd [options] -p : Port, default 23 -o : Set logfile -t : Decrease verbosity of output -v : Increase verbosity of output -h : Help Example sws_sock.ini settings: [telnet] UpnpExtPort = 23 max_conn = 3 [telnet_users] ;username password home_dir permit [r|w|c] permitted host(s) ; admin admin . c 192.168.1.0/22 anonymous * . w guest - . w * - . r ================ tftp ================ TFTP (RFC 1350) client Syntax: tftp [options] host source [destination] -i : Set binary mode -p : Set host port host : The TFTP server (hostname or IP address) PUT : Transfer a local source file to the remote destination GET : Transfer a remote source file to the local destination -t : Decrease verbosity of output -v : Increase verbosity of output -V : Show version and exit -h : Help e.g.: tftp localhost GET file newfile ================ upnp ================ Universal Plug and Play (www.upnp.org) router display/set utility Syntax: upnp [options] [args] -a : Add IGD port mapping: TCP|UDP extport [clientIP [inport]] -d : Delete IGD port mapping: TCP|UDP extport -l : List IGD port mappings (default) -c : Display IGD connection status -k : Display IGD link status -x : Display IGD external IP address -V : Show version and exit -h : Help e.g. upnp -x ================ Whois ================ Whois/nicname (RFC 3912/954) client. Syntax: whois [options] name -n : Set server (hostname or IP address) -p : Set server port, default 43 -t : Decrease verbosity of output -v : Increase verbosity of output -V : Show version and exit -h : Help e.g. whois bbc.co.uk SWSSOCK - TCP/IP NETWORK COMMUNICATIONS LIBRARY =============================================== SwsSock is a cross platform networking library compatible with Single Unix Specification v3 and Winsock2 sockets providing a fully featured TCP/IP protocol stack and drivers for common Ethernet and serial adapters. The SwsSock library is shareware; that is it may be freely used by any individual for personal and private use or for their business without any restriction or charge. Companies, organisations or governments may not use it without a license. In no case may SwsSock be re-sold or used in a system to deprive anyone of life, liberty or livelihood. Copyright (C)2005-2010 Software Systems Consultants. Web: www.softsystem.co.uk Tel: +33 5 49 68 72 47 e-mail: sales@softsystem.co.uk FEATURES ======== - Single Unix Specification v3 and Winsock2 sockets AOI. - TCP. Supports slow start, congestion control (RFC2581), Jacobson RTT estimation, fast retransmit etc... - IP version 4. Supports IP options, fragmentation and reassembly, fast table driven routing & cache, multi-homed routing. - UDP. - Raw sockets. - ICMP and Echo server. - IGMP version 2 and multicasting. - Ethernet - DIX and 802.3 frame formats. - ARP. - Point to point link manager featuring 'dial on demand'. - Hayes modem support. - 'MSdirect' modem support for Microsoft direct cable connections. - PPP and SLIP serial links. - CHAP and PAP authentication. - Van Jacobsen TCP/IP header compression. - DNS client. - DHCP client. - IP, PPP and Ethernet packet dumpers. - Threads. Mapped to native threads on appropriate platforms, otherwise a co-operative (non-preemptive) implementation is provided. - Timers. Low overhead with millisecond resolution. - Low overhead, minimum copy buffering. - Fully asynchronous design. - Simple configuration from text file. - Platform independent. - Easily portable design written entirely in ANSI C89. - Easily customised - simple interfaces to Ethernet and serial drivers. - Ideal for embedded systems. - Small and fast; complete HTTP 1.1 web server in 87 KBytes. PROBLEMS ======== SwsSock is designed to be compatible with all recent Windows systems. The following limitations are known: - The DPMI server that ships with Windows NT4 service pack 6 has a problem with DJGPP applications. This manifests as a SIGSEGV abort when a frame is received. There is no known workaround. If you should have other problems, issues or for technical support contact sales@softsystem.co.uk or phone us on +33 5 49 72 79 63. WHO ARE SOFTWARE SYSTEMS? ========================= Software Systems provide software development services and consultancy. Our current products include: SwsSock TCP/IP communications library SwsVpkt virtual packet driver MailCenturion NetCenturion SoundFX Masm2djg Contacts: Web: www.softsystem.co.uk Tel: +33 5 49 72 79 63 e-mail: sales@softsystem.co.uk WARRANTY ======== The SwsSock evaluation is supplied 'as is' with absolutely no warranty given or implied. The use of SwsSock is entirely at the risk of the end user. Software Systems will not be held responsible for any loss or damage, however caused, resulting from the use of SwsSock. Release History =============== 2.0.0.14 17-Jul-13 OpenWatcom 1.9 support Include the remaining test apps: iptest, p2ptest, rawip, synflood, udptest some Windows tools: msblastd, netbiosd, smbcli, and somm test files for httpd 2.0.0.13 22-Apr-11 httpd: Fix a bug with HEAD requests not closing the connection until idle timeout. ftpd: Fix a bug in passive connections hanging in accept. Close & re-use oldest connection if all connections in use. Limit directory name lengths. Add more log output. smtpd: Limit login attempts and lockout abusive IP addresses. Updated WatcomC makefiles Updated MSVC projects 2.0.0.12 01-Feb-11 ftpd: Limit login attempts and lockout abusive IP addresses smtpd: Canonical IP address matching ignores ls 8-bits. 2.0.0.11 29-Aug-10 httpd: Fix null dereference after unexpected disconnect. smtpd: Better spam rejection. Add swsinfo app to print configuration to stdout. Add SWS_CfgGetName. Linux lib initialisation fix DNS name server setup. 2.0.0.10 16-Jul-10 Httpd security fix for alias expansion. Popd and smtpd bug fixes. Loganaly - Add -s option for simpler pattern matching. 2.0.0.9 13-Mar-10 Popd add auth plain, login and cram-md5 authentication. Inetd daemon code supports groups ids. Sighup caught and logfile reopened for logrotate. Add -c and -p options to specify config and pid file. Numerous apps have logfile tidy up. Httpd refactor code to improve maintainability. Security fox for spaces in CGI path. Bugfix for idle timeouts. Realip -r mode buffer overrun bugfix httpd, smtpd, ftpd, pop3d & telnetd report unsuccessful client ops as warnings as opposed to info. ip.c additional runtime checks on header length as suggsted by draft-ietf-opsec-ip-security-02.txt Add MD5 digest to library. Add base64 encoding/decoding to library Add wild card string compare to library. Add RFC822 time/date functions to the library. 2.0.0.8 05-Mar-10 Add support for restricted realms to httpd CGI. PHP (php-cgi) support for httpd CGI. Recvmail & sendmail extensions to support httpd CGI. Inetd catches SIGHUP to re-open logfile, supporting log-rotate. Inetd security fix to correctly drop root group membership. 2.0.0.7 21-Feb-10 Dns: host resolver o/p made compatible with direct dns method ftpd/httpd/identd/popd/smtpd/telnetd: log verbosity from cfg file httpd: URI alias/re-direct lookup made sequential CGI bug fixes popd: max login attemps set to 2 bug fix unexpected disconnect crash recvmail mods to support webmail cgi smtpd: add banned senders, mail names, dynamic names, static names bug fix banned hostnames localhost sws_cfg.c: close unneeded config file 2.0.0.6 05-Feb-10 Httpd fix bug in CGI directory handling. Echod/Httpd fix error handling on startup. Inetd catch sighup and reopen logfile. Httpcgi add REMOTE_PORT variable. Loganaly add stats for protocol, mailopen, error & warn. All servers: more consistent error/warning messages Extended config.txt with app config info. Dns & whois support for CGI output Ping v2.06 support CGI. mcast, mping, realip, syslogd, syslogr, upnp help to stderr. 2.0.0.5 29-Jan-10 Httpd v2.1.2 - new URI alias list with wildcards. - improved common authentication system allows each 'realm' to have its own folder. - cache common ini file settings. - CGI has more log output. - New user specified MIME types. - bug fix: CGI ( Windows/DOS environment variables). Ftpd v1.0.5 - added 'x' user permission (cwd) Smtpd v1.0.5 - New optional script after data received. - cache common ini file settings. Telnetd v2.0.4 - added IP address restriction to accounts. Loganaly - more filters, factored common stats code. SWS_CfgSetName parses the ini file and sets up a section cache giving much reduced library startup time. IP subnet mask now set automatically if not specified. 2.0.0.4 18-Jan-10 Httpd - new common authentication model for all modules giving reduced code size and better performance. Inetd - new, simplified task definition. Bug fix race condition during daemon startup. Loganaly - new stats for HTTP user-agent, platform and referrer. Sendmail - better diagnostics if mail server login fails. Smtpd< - new config options cache for better performance. Build scripts updated. 2.0.0.3 11-Jan-10 Httpd - URI redirection list now uses faster binary search. - More detailed logging. - Proxy supports an IP blacklist and content compression. - CGI redirection bugs fixed. Loganaly - add stats for top HTTP URIs 2.0.0.2 07-Jan-10 Httpd - Minor tweaks to improve proxy performance and logging. Loganaly - track changes in httpd log output. 2.0.0.1 06-Jan-10 Httpd - better CGI performance. - Increased security for put and delete methods. - Improved logging. 2.0.0.0 03-Jan-10 Open source distribution. Common build system for Linux, DJGPP, MinGW and Cygwin. OpenWatcom support. IGMPv3, ECN, SACK support. New apps: DNS client, echo client/server, FTP client, FTP server, ident server, log analyser, multicast ping client/server, POP3 client & server, realIP, SMTP client & server, discard client/server, syslogd, telnet server, TFTP client, UPnP client, whois httpd adds CGI, UPnP, proxy, authorisation and Video4Linux inetd adds Linux daemon. ping supports raw sockets & broadcast. DJGPP fixes atomic ops, log files flushed with fsync. Bug fixes for big-endian systems, P2P supports bi-dir authentication. 1.0.0.4 18-Oct-05 Add multicast capability to raw IP sockets. Default IP transmit queue length increased from 32 to 64. Bug fixes: TCP fast retransmit, multicast and IP reassembly. 1.0.0.3 13-Sep-05 Bug fixes: TCP retransmit, DPC queue interrupt safety. 1.0.0.2 07-Sep-05 Added modem support and PPP. 1.0.0.1 24-Jun-05 Initial release.