PSX

This is a Perl client for Scour eXchange, a distributed file sharing system. It supports all major features of the SX system, includeing file searching, downloading, sharing, and hotlists. It supports multiple concurrent downloads and uploads. It is licensed under the GPL.
Main site - UCLA
Sourceforge mirror
Mailing lists, CVS, etc... are held at sourceforge.net

Installation:
Download the perl script. Make it executable (chmod +x psx.pl). Make sure the path to Perl is correct (first line in script).
Install a configuration file. Be sure to set your username and password.
Make sure you have MD5 and Base64 installed. MD5 is in the default RedHat install. If not present, you can install them with:

su
perl -MCPAN -e shell (you may have to configure perl's CPAN client, defaults work for me)
install MD5
install MIME::Base64
Make sure you support FIONREAD.
Run it with ./psx.pl, or if in your path, just psx.pl.
Use the -n option the first time to register with the server.
Type help at the prompt after logging in to get a list of these commands:
Commands:
search  - do a search, blank cancels the last search
results  - get details on file from last search
next - get next page of last search
get  - get from the last result set
kill [upload|download]  - kill transfer
resume  - resume download
add  - share it
trans (up|down|number|cur|all) (number) - show transfer progress
user  - add to hotlist, then search user's files
del  - take off hotlist
who - show hotlist status
filetype  - change default search file type
logoff - log off server
reconnect - reconnect to server
quit - leave

Download:
PSX 0.11a

Configuration:
Sample psx.cfg file
The app looks for this in ~/.psxrc, /etc/psxrc, and psx.cfg (in the current directory), in that order.
Run psx.pl --help to get a list of command-line configurable options.
The syntax is as follows:

Username [username]
Password [password]
Email [email address, required to register new user]
First [firstname]
Last [lastname]
Server [SX server, stp.scour.net, psx can query the Scour servers to get this]
Port [SX server port, 8080]
DownloadDir [directory to download files to]
ShareDir [directory of files to share, you can have many of these]
ShareType [extensions to share, like wav.  can have many of these]
SearchType [default type to search for, like audio, video, image, wav, mpg...]
HotListFile [file to save hotlist in]
MD5CacheFile [file to save MD5 sums of shared files in]
Speed [speed type]
  1  14.4 kbps
  2  28.8 kbps
  3  33.6 kbps
  4  56.7 kbps
  5  64K ISDN
  6  128K ISDN
  7  Cable
  8  DSL
  9  T1
  10 T3 or greater
ControlPort [port a remote program can send commands to, see below]

Notes on FIONREAD: You'll need the FIONREAD ioctl call defined. This is done by default in RedHat Linux. If you have problems with 'sys/ioctl.ph', you may need to run h2ph in the /usr/include directory (if you have root), or grep through your header files to find the value of FIONREAD, and modify the value (there's pointers at the top of the file on this). Or, compile a simple C program to find the value:

% cat > fionread.c
#include 
main() {
  printf("%#08x\n", FIONREAD);
}
^D
% cc -o fionread fionread.c
% ./fionread
0x4004667f
In Solaris I also needed to include <sys/types.h> and <sys/filio.h>


ControlPort
If you set this to a non-zero value, psx will listen on the port and send commands on behalf of an external program. It currently accepts:

SEARCH [filetype] [filename]
ADD [filename] [full path to file on disk]

A SEARCH command will return back the set of search results. These commands would be useful for say, a separate GUI, which could use psx for STP requests.

vince@cs.ucla.edu