Команды SFK


    1        2        3        4        5        6        7        8        9        10    

Раздел 6. Networking - Сеть
fromnet | ftp | ftpserv | httpserv | ip | netlog | ping | pingdiff | tcpdump | udpdump | udpsend | web | wget |


Help:   Рус   |   Eng        Refer:   Рус   |   Eng  

Команда: httpserv

instantly run a simple no-installation web server

on the command line, to allow easy file transfer between any Windows, Mac OS X, Linux and Raspberry Pi machine, with the free sfk httpserv command. Are you working on a machine without internet access, no shared network folders, unavailable USB ports, missing admin rights, and a thousand other reasons why it seems impossible to transfer a single file? then try the following on a second machine (the one from which you want to copy files).
sfk httpserv [-h[elp]] [-port=nport] [-rw]

The SFK Instant HTTP Server for easy file transfer.

default behaviour since sfk 1.9.8:
* the current folder AND SUB FOLDERS are made accessible.
  use option -nosub to disable.
* just ONE CLIENT (browser etc.) can connect at a time.

only for trusted environments!
  sfk httpserv is intended only for personal file transfer
  between two machines that the user has control of, within
  a trusted LAN environment. it should not be used to offer
  files in the internet. if security is important then do not
  use sfk httpserv but a full scale web server like Apache.

options
  -nosub       do not list folder names, allow no access
               to files in sub folders.
  -rw          allow write access with upload of files.
  -nolist      do not provide a content listing, but change
               any access to "/" into "index.html".
               includes -nosub to disable sub folder access.
  -deep        only after -nolist: allow access to files
               in sub folders, for html references.
  -port=n      use other port than default, e.g. -port=81.
  -port2=n     alternative port, used if first port fails.
               use -port2=0 to disable alternative port.
  -raw         send no http reply header, just raw content.
  -headers     show incoming request headers.
  -startdir x  set default subdir to redirect to if a client
               connects for the first time, requesting '/'.

about filename character encodings
  only filenames with characters of the system codepage
  are supported. for details type: sfk listcodes sys
  names with chars beyond that cannot be accessed.

see also
  sfk ftpserv -h    the SFK Instant FTP server.
  sfk wget          a web file download command.

web reference
   http://stahlworks.com/sfk-httpserv

examples: display a simple web page
  sfk webserv -nolist
     no file listings, load index.html if present.
     access to files in sub folders is blocked.
  sfk webserv -nolist -deep
     same as above, but allow access to sub folder files.

examples: easy file down- and upload
  sfk webserv
     make current folder, and all sub folders, accessible
     for reading and downloading.
  sfk webserv -rw
     same as above, but also allow upload of files.
  sfk webserv -nosub
     do not show sub folders, do not allow access to files
     in sub folders. (sfk 1.9.7 default behaviour)


How to copy any file between Windows and Linux machines:

   If the target machine has ANY connection to a local network:

      -  on the source machine, where you have SFK already, type

         sfk httpserv -port=9090

         within the directory from which you want to transfer files.

      -  then, on the target machine, try to open a web browser
         and to access

            http://othermachine:9090/

         OR type

            wget http://othermachine:9090/yourfile

   If that fails (no browser, no gui, no wget command),
   check if there exists an "ftp" command on the target machine.
   If so, try:

   SFK Instant FTP Server for easy file exchange

      -  on another machine where you have SFK already, type

         sfk ftpserv

      -  then, on the target machine, type

            ftp othermachine

         and if the login succeeds, try

            dir
            bin
            get yourfile

      -  if ftp connections fail to work, check if the "ftp"
         client on the target accepts the command

            passive

         then try to "get" again (ftp creates a new connection
         per file download, which is often blocked by firewalls.
         the passive command changes the way in which those
         connections are created.)


How to get SFK up and running anywhere:

   Download the executables for Windows, Linux/lib6 or Linux/lib5

   By browser:

   -  http://stahlworks.com/dev/swiss-file-knife.html

      then click on one of the top links to either download
      binaries instantly, or look further on sourceforge:

   -  http://sourceforge.net/projects/swissfileknife/

   OR

   On a Linux text console, use one of these:

      Instant binaries:

      -  wget http://stahlworks.com/dev/sfk/sfk       (Linux lib6)
      -  wget http://stahlworks.com/dev/sfk/sfk-lib5  (Linux lib5)

      Whole distribution package in a .zip (insert version for nnn):

      -  wget http://stahlworks.com/dev/sfk/sfknnn.zip

      Make sure your system has the real Info-ZIP unzip command,
      in version 5.50 or higher (just type "unzip" to find out).
      If nothing is available, get one of these:

      -  wget http://stahlworks.com/dev/unzip-linux-lib6.exe
      -  wget http://stahlworks.com/dev/unzip-linux-lib5.exe

   OR

   Apple Macintosh and 64-bit Linux in general:

   -  there are no binary distributions so far, but you may compile
      the source code easily, even if you're no software developer.

      first, type "g++" to find out if a compiler exists on your system.
      if so, download the source code, contained in the sfknnn.zip, from

      http://sourceforge.net/projects/swissfileknife/

      then extract that by "unzip sfknnn.zip",
      and take a look into do-compile-unix.bat or type:

         Mac compile:

            g++ -DMAC_OS_X sfk.cpp patch.cpp inst.cpp -o sfk

         Linux 64-bit compile:

            g++ sfk.cpp patch.cpp inst.cpp -o sfk


How to prepare the SFK binary under Linux:

   -  after download, you have to type

         chmod +x sfk-linux.exe

      to enable execution (the 'x' flag) of sfk.
      Then simply type

         ./sfk-linux.exe

      to get it running (the "./" is often needed as
      the PATH may not contain the current directory ".").               

Where to place the SFK executable:

   Recommendation for Windows:

      -  create a directory structure

            c:\app\bin

         then rename sfknnn.exe to sfk.exe, and copy that to c:\app\bin .

         If you use the "sfk alias" command later, the created alias
         batch files will also be placed into "c:\app\bin".

      -  extend the Windows Shell Path

            set PATH=%PATH%;c:\app\bin

      -  make sure your Windows Shell supports command autocompletion
         and Copy/Paste of text (the QuickEdit and Insert setting),
         otherwise it is very hard to use! read more by typing

            sfk help shell

      -  further tools can be installed parallel to "bin" into c:\app

      This way you avoid the long, blank-character-contaminated,
      inefficient default paths like "C:\Program Files".

   Recommendation for Linux:

      -  type "cd" then "pwd" to find out what your account's
         home directory is.

      -  within your home directory (e.g. /home/users/youruserid/)
         create a directory "tools"

            mkdir tools

         then rename sfk-linux.exe to sfk, and copy that
         into the tools dir.

      -  extend the PATH like

            export PATH=$PATH:/home/users/youruserid/tools

      -  then you should be able to run sfk by typing "sfk".

      By default, there are no colors, as it is not possible
      to autodetect the background color under Linux.

      If you like colorful output, type "sfk help color"
      and read on how to set the "SFK_COLORS" variable
      (read it careful! if you set a wrong "def:" value,
       you may end up with white text on white background)