zhuce 发表于 2018-5-17 09:46:51

linux命令——wget

  wget是大多数linux自带的一个文件下载工具,使用wget可以下载网络上的文件到本地服务器上,在渗透测试中,wget使用频率还是较高的,通常使用wget从自己的外网主机(不一定就是外网主机,主要是要让渗透的目标主机能访问的都行)下载相关工具到我们渗透的服务器上面,从而实施渗透,多数情况下就是下载webshell、端口转发工具、提权工具等!

  基本使用语法:

wget url    //这个主要是从网络上下载单个文件并保存到当前目录中  使用这个下载命令后自动以最后一个/后面的内容进行命令,如果有重名的会自动在后面添加.1,.2这类的名字
root@VM-12-155-debian:~/eth10# ls
root@VM-12-155-debian:~/eth10# wget http://www.baidu.com/index.html
--2017-08-23 09:14:46--http://www.baidu.com/index.html
Resolving www.baidu.com (www.baidu.com)... 220.181.112.244, 220.181.111.188
Connecting to www.baidu.com (www.baidu.com)|220.181.112.244|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 2381 (2.3K)
Saving to: ‘index.html’
index.html          100%[===================>]   2.33K--.-KB/s    in 0s
2017-08-23 09:14:46 (324 MB/s) - ‘index.html’ saved
root@VM-12-155-debian:~/eth10# ls
index.html
root@VM-12-155-debian:~/eth10#  如果我们需要对下载的文件进行重命名,需要使用-O(不是零,大写的欧)参数!

root@VM-12-155-debian:~/eth10# wget -O baidu.html http://www.baidu.com/index.html
……
root@VM-12-155-debian:~/eth10# ls
baidu.htmlindex.html
root@VM-12-155-debian:~/eth10#  有时我们的网络不稳定,会导致下载中断,这是我们需要使用-c参数进行断点续传!

root@VM-12-155-debian:~/eth10# wget -c http://www.baidu.com/index.html
……
root@VM-12-155-debian:~/eth10#  但是有些时候我们下载的文件很大,然后总是下载中断,这时如果每次都使用-c参数进行断点续传,这是很忧桑的事情,所以我们需要使用-b参数进行后台下载!在渗透中,由于某些工具的限制,总是会显示网络超时,然后就下载失败了,此时我们就可以使用-b参数进行下载,然后使用cat wget-log来查看下载进度!
root@VM-12-155-debian:~/eth10# wget -b http://www.baidu.com/index.html
Continuing in background, pid 7709.
Output will be written to ‘wget-log’.
root@VM-12-155-debian:~/eth10# cat wget-log
Resolving www.baidu.com (www.baidu.com)... 220.181.112.244, 220.181.111.188
Connecting to www.baidu.com (www.baidu.com)|220.181.112.244|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 2381 (2.3K)
Saving to: ‘index.html.1’
   0K ..                                                    100%380M=0s
2017-08-23 09:23:43 (380 MB/s) - ‘index.html.1’ saved   另外我们在渗透测试中,可能获取的命令执行的当前路径不一定就是网站的可访问路径,此时通过其他手段获取到了网站可访问的绝对路径,然后我们就可以使用-P来下载网络文件到指定的目录中了!

root@VM-12-155-debian:~/eth10# wget -P /root/eth10/eth10/http://www.baidu.com/index.html
--2017-08-23 09:40:42--http://www.baidu.com/index.html
Resolving www.baidu.com (www.baidu.com)... 14.215.177.37, 14.215.177.38
Connecting to www.baidu.com (www.baidu.com)|14.215.177.37|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 2381 (2.3K)
Saving to: ‘/root/eth10/eth10/index.html’
index.html          100%[===================>]   2.33K--.-KB/s    in 0s
2017-08-23 09:40:42 (472 MB/s) - ‘/root/eth10/eth10/index.html’ saved
root@VM-12-155-debian:~/eth10# ls eth10/
index.html
root@VM-12-155-debian:~/eth10#  不知道为什么,-P和-O同时使用就不成功了,难道是不支持?
页: [1]
查看完整版本: linux命令——wget