[gull] truc et astuce: Download http avec nc

Félix Hauri felix at f-hauri.ch
Tue Jun 14 08:48:02 CEST 2005


Bonjour,

Dans la lignée de la petite discution a propos de telnet et http,
voici comment télécharger un fichier via un proxy http:

$ export PROXYHOST=nom_ou_ip_proxy
$ export PROXYPORT=port_proxy
$ export URL=http://f-hauri.ch/vrac/xterm/tux.sh.gz
$ echo GET $URL $'HTTP/1.0\n' |
      nc $PROXYHOST $PROXYPORT |
      (
          while read a &&
              [ ${#a} -gt 1 ] ;do
              :
              done
          cat
      ) |
      gunzip >/tmp/tux.sh

Le ``gunzip'' se passe sans erreur; le binaire passe correctement.
... et pour les gros fichiers:

$ URL=http://www.ch.kernel.org/pub/linux/kernel/v2.6/linux-2.6.11.12.tar.bz2 
$ echo GET $URL $'HTTP/1.0\n' |
      nc $PROXYHOST $PROXYPORT |   
      (
          while read a &&
              [ ${#a} -gt 1 ] ;do
              :
              done
          cat
      ) |
      buffer -S 10240 >/tmp/linux-2.6.11.12.tar.bz2

Et pour finir:
$ URL=http://www.ch.kernel.org/pub/linux/kernel/v2.6/linux-2.6.11.12.tar.bz2.sign
$ echo GET $URL $'HTTP/1.0\n' | nc $PROXYHOST $PROXYPORT | (
     while read a && [ ${#a} -gt 1 ] ;do :;done; cat ) |
      gpg -v   
...
Detached signature.
Please enter name of data file: /tmp/linux-2.6.11.12.tar.bz2 
gpg: Signature made dim 12 jun 2005 07:38:18 CEST using DSA key ID 517D0F0E
gpg: using classic trust model
gpg: Good signature from "Linux Kernel Archives Verification Key <ftpadmin at kernel.org>"

A quoi peuvent bien nous servir des truc comme firefox, mozilla, lynx, w3m ou 
encore wget?

-- 
 Félix Hauri  -  <felix at f-hauri.ch>  -  http://www.f-hauri.ch



More information about the gull mailing list