Package: easyshare
EasyshareDESCRIPTIONeasyshareis a client-server command line application written in Python for transfer files between network hosts.It is highly inspired by FTP, but aim to be easier and faster to use.For example,easysharesupports automatic discovery of thesharingsof the network,
therefore, from the client you can download entire directories just by giving the name
you assigned to them from the server side.REQUIREMENTSRequires at least Python 3.6.INSTALLATIONOn Linux, you can install it with pip:sudo pip install easyshareThis will install bothes(client) andesd(server).WHAT IT LOOKS LIKEA picture is worth a thousand wordses (client)esd (server)esdUSAGEesd [OPTION]... [SHARING [SHARING_NAME] [SHARING_OPTION]...]For share stuff, you have to start an easyshare daemon (esd).There are basically two ways for createsharings.By providing the path of the file/directory to share in the command line as SHARINGBy creating a configuration file and specifying it with the option -c configThe option 1. should be preferred for an easy one-shot sharing of a file or directory, since
doesn't need the creation a configuration file, but has the limit that only a file or folder
can be shared.If given, SHARING must be a valid path to a local file or directory.
SHARING_NAME is an optional name to assign to the sharing, as it will be seen by clients. If
not given, the name of the file/directory is used instead.
Currently the only supported SHARING_OPTION is the read-only flag, which can be enabled with
-r, and denies any write operation on a directory sharing.OPTIONS-a, --address  address        server address (default is primary interface)
-c, --config  config_path     load settings from a esd configuration file
-d, --discover-port  port     port used to listen to discovery messages; 1 disables discovery (default is 12021)
-e, --rexec                   enable rexec (remote execution)
-h, --help                    show this help
-n, --name  name              server name (default is server hostname)
--no-color                    don't print ANSI escape characters
-P, --password  password      server password, plain or hashed with es-tools
-p, --port  port              server port (default is 12020)
--ssl-cert  cert_path         path to an SSL certificate
--ssl-privkey  privkey_path   path to an SSL private key
-t, --trace  0_or_1           enable/disable tracing
-v, --verbose  level          set verbosity level
-V, --version                 show the easyshare versionCONFIGURATIONThe server can be configured either with a configuration file (2.) or by givingesdthe options
you need. The command line arguments have precedence over the corresponding setting of the
configuration file (i.e. if you specify an option in both the configuration file and as an argument,
the argument will be taken into account).The configuration file is composed of two parts.Global sectionSharings sectionsEach line of a section has the form <key>=<value>.
The available <key> of the global section are:address
    discover_port
    name
    no_color
    password
    port
    rexec
    ssl
    ssl_cert
    ssl_privkey
    trace
    verboseThe available <key> of the sharings sections are:path
    readonlyThe first lines of the configuration file belongs to the global section by default.
Each sharing section begins with "[SHARING_NAME]".
If you omit the SHARING_NAME, the name of the shared file or directory will be used instead.See the example of the configuration file below for more details.EXAMPLESShare a fileesd /tmp/fileShare a directory, assigning it a nameesd  /tmp/shared_directory sharedShare multiples directories, using a configuration fileesd -c /home/user/.easyshare/esd.confCONFIGURATION FILE EXAMPLE# esd.conf

# ===== SERVER SETTINGS =====

name=stefano-arch
password=aSecurePassword

port=12020
discover_port=12019

ssl=true
ssl_cert="/tmp/cert.pem"
ssl_privkey="/tmp/privkey.pem"
ssl_privkey="/tmp/privkey.pem"

rexec=false

verbose=4
trace=1

# ===== SHARINGS =====

[download]
    path="/home/stefano/Downloads"

[shared]
    path="/tmp/shared"
    readonly=true

# Automatic sharing name
[]
    path="/tmp/afile"esUSAGEes [OPTION]... [COMMAND [COMMAND_OPTIONS]]For fetch stuff shared withesd, you have to start an easyshare client (es).If no COMMAND is given, the interactive console is started, from which you can use any command.If COMMAND is a valid command, it is executed and the process quits unless the command isopen.OPTIONS-d, --discover-port  port      port used for broadcast discovery messages
-h, --help                     show this help
--no-color                     don't print ANSI escape characters
-t, --trace  0_or_1            enable/disable tracing
-v, --verbose  level           set verbosity level
-V, --version                  show the easyshare version
-w, --discover-wait  seconds   time to wait for discovery responsesCOMMANDSFrom within theesconsole, type "help <command>" for the full documentation of a command.The available commands (either from the command line or from the interactive console) are the following:General commandshelp             show this help
exit, quit, q    exit from the interactive shell
trace, t         enable/disable packet tracing
verbose, v       change verbosity levelThehelpcommand should really be used since its quite complete.Connection establishment commandsscan, s          scan the network for easyshare servers
connect, c       connect to a remote server
disconnect       disconnect from a remote server
open, o          open a remote sharing (eventually discovering it)
close            close the remote sharingThe most straightforward way to establish a connection isopensince only requires you
to know the name assigned to the sharing.scancan be used for discover the sharings of the network (for figure out the name to give toopen).Tipically you won't need to useconnectexplicitly since the server connection
is automatically established, if the sharing name given toopenis valid and can be found.
Although there might be cases in which an explicitconnectis needed, for example for
connect to a server for which the discovery cannot be performed
(i.e. a server not on the same network of the client) or if you want to connect a server without
sharings (e.g. for execute commands remotely viarexec).Transfer commandsget, g          get files and directories from the remote sharing
put, p          put files and directories in the remote sharinggetis used for:Download files or directories from a "directory sharing"Download a shared file ("file sharing")putis used for:Upload files or directories to a "directory sharing"Local commandspwd              show the name of current local working directory
ls               list local directory content
l                alias for ls -la
tree             list local directory contents in a tree-like format
cd               change local working directory
mkdir            create a local directory
cp               copy files and directories locally
mv               move files and directories locally
rm               remove files and directories locally
exec, :          execute an arbitrary command locally
shell, sh        start a local shellYou should really be familiar with these commands since behave quite similar
to the Linux counterpart.The commandexec(which can be shortened with:) can be useful for execute arbitrary commands
without the need of open a new terminal.Remote commandsrpwd             show the name of current remote working directory
rls              list remote directory content
rl               alias for rls -la
rtree            list remote directory contents in a tree-like format
rcd              change remote working directory
rmkdir           create a remote directory
rcp              copy files and directories remotely
rmv              move files and directories remotely
rrm              remove files and directories remotely
rexec, ::        execute an arbitrary command remotely (disabled by default)
rshell, rsh      start a remote shell (disabled by default)These are the counterparts of theLocal commandsthat work on the remote sharing
instead of the local machine (i.e. you have to establish a connection to a "directory sharing"
before use those).The commandrexec(which can be shortened with::) is a really powerful command
that basically gives you arbitrary command execution on the remote machine
(technically not a shell, but not so far).For this reason, it is obviously disabled by default, but you can enable it with the
option-eif you are really confident that nobody with bad intentions will use it
(use a strong server password, by the way).Server information commandsinfo, i          show information about the remote server
list             list the sharings of the remote server
ping             test the connection with the remote serverinfocan be used for fetch information of the remote server
(e.g. name, address, ports, SSL certificate, type of authentication, available sharings).EXAMPLESThese are only examples, see thehelpsection of each command for known exactly
what you can do.Start the interactive shell (from which you can use any command)esScan the network for easyshare sharingses scan

alice-arch (192.168.1.105:12020)
  DIRECTORIES
  - shared
  - tmpOpen a sharing by name (implicit discovery and server connection) and start the interactive shelles open shared

alice-arch.shared:/ - /tmp>
...Get the content of a sharing by namees get shared

GET shared/f1    [===================] 100%  745KB/745KB
GET outcome: OK
Files        1  (745KB)
Time         1s
Avg. speed   1MB/sOpen a sharing by name and put some files into ites

/tmp> open shared
alice-arch.shared:/ - /tmp> rls
f1      f2
alice-arch.shared:/ - /tmp> put /tmp/afile
PUT afile    [===================] 100%  745KB/745KB
PUT outcome: OK
Files        1  (745KB)
Time         1s
Avg. speed   1MB/s
alice-arch.shared:/ - /tmp> rls
f1      f2      afileConnect to a server by specific address and port, then list the available sharingses connect 192.168.1.105:12020

alice-arch:/ - /tmp> list
DIRECTORIES
- shared
- tmp
FILES
- zshrcSee content of the remote sharing, then move some fileses 
/tmp> open shared
alice-arch.shared:/ - /tmp> rtree
|-- dir
|   |-- f3
|   +-- f4
|-- f1
+-- f2
alice-arch.shared:/ - /tmp> rmv f1 f2 dir
alice-arch.shared:/ - /tmp> rtree
+-- dir
    |-- f1
    |-- f2
    |-- f3
    +-- f4
alice-arch.shared:/ - /tmp> rcd dir
alice-arch.shared:/dir - /tmp> rls
f1      f2      f3      f4Arbitrary local command executiones 
/tmp> cd d
/tmp/d> ls
f0  
/tmp> :touch f1
f0      f1Arbitrary remote command execution (DISABLED BY DEFAULT)es 
/tmp> connect alice-arch
alice-arch:/ - /tmp> ::whoami
alicees-toolses-toolsis a little script that can help administrators of easyshare servers.Currently in two ways:Creating a default configuration fileGenerating an hash of a password to use in theesdconfiguration file (preferred over a plain password)USAGEes-tools [OPTION]...If neither -c nor -p is given, an interactive script is started and you will be asked what to do.OPTIONS-c, --generate-config             generate default esd.conf file
-h, --help                        show this help
-p, --hash-password  <password>   generate an hash of the password
-V, --version                     show the easyshare versionTESTINGTests can be run with:toxFor run tests with logging enabledtox -- -sActually there are still many things to write tests for...TODOTesting on Windowsfindandrfindcommand that finds files by name and tag those with incremental IDs (1, 2)
which can be used in other command (something like $1, $2)shellandrshellwhich implement command execution through a pty (enhanced version of exec/rexec)Behind NAT section in README (open two external ports internally forwarded to 12020 and 12021)Add unit testsHandle addresses instead of numeric IPsDo not transfer hidden files by default (add a -a option for transfer those)
LICENSEEasyshare isMIT licensed.