Command to upload a file other than Wget

My host allows you to restrict access to SSH and Linux commands. However, I cannot use Wget , believe it or not.

I was hoping to download something (.flv) from another server. Is there any other team I can try?

If this did not happen, I could probably use Python, Perl or PHP (my favorite) to upload the file. Is it possible?

+4
source share
11 answers

You can use the following command:

curl -O http://www.domain.com/file.flv

+4
source
 echo -ne "GET /path/to/file HTTP/1.0\r\nHost: www.somesite.com\r\n\r\n" | nc www.somesite.com 80 | perl -pe 'BEGIN { while (<>) { last if $_ eq "\r\n"; } }' 
+7
source

Bash compiled with --enable-net-redirections is pretty powerful. ( Zsh has similar features.) Hell, I'll even drop HTTP Basic Auth here.

Of course, this is not a very good HTTP / 1.1 client; for example, it does not support striping. But this is quite rare in practice.

 read_http() { local url host path login port url="${1#http://}" host="${url%%/*}" path="${url#${host}}" login="${host%${host#*@}}" host="${host#${login}@}" port="${host#${host%:*}}" host="${host%:${port}}" ( exec 3<>"/dev/tcp/${host}/${port:-80}" || exit $? >&3 echo -n "GET ${path:-/} HTTP/1.1"$'\r\n' >&3 echo -n "Host: ${host}"$'\r\n' [[ -n ${login} ]] && >&3 echo -n "Authorization: Basic $(uuencode <<<"${login}")"$'\r\n' >&3 echo -n $'\r\n' while read line <&3; do line="${line%$'\r'}" echo "${line}" >&2 [[ -z ${line} ]] && break done dd <&3 ) } 

OTOH, if you have Perl LWP installed, it should go with a sample binary name named GET & hellip;

+5
source

If you are trying to download a file from a host to which you have authenticated access, try using scp . It looks like a regular copy, but it is done through the ssh tunnel. I found that hosts that allow "limited ssh" often allow scp .

 scp user@myhost.com :folder/file.flv ./ 

You will need to provide user credentials. See scp documentation for more details.

+3
source
 curl -C - -O http://www.url.com 
+3
source

Python script:

 #!/usr/bin/env python import os,sys,urllib f = open (os.path.basename (sys.argv[1]), 'w') f.write (urllib.urlopen (sys.argv[1]).read ()) f.close () 

where sys.argv[1] is the URL you are interested in.

+3
source

lynx -source

+2
source

Another tool that makes similar material is snarf .

+2
source

Different ways

+1
source

Use scp.

Usage: scp [-1246BCpqrv] [-c cipher] [-F ssh_config] [-i identity_file]
[-l limit] [-o ssh_option] [-p port] [-S program]
[[user @] host1:] file1 ... [[user @] host2:] file2

+1
source

Another possible alternative is aria2 .

0
source

All Articles