mv命令是move的缩写形式,通过这个命令可以移动文件以及重命名文件!在渗透测试中常用于重命名文件,在命令执行漏洞中,我们需要上传webshell或者nc这类的工具,如果直接wget的话,很有可能被防或者被杀,因此我们需要先wget一个文本文件或者图像文件到远程服务器上,然后再通过mv来重命名来还原文件!
基本使用语法(移动):
1
|
mv
源文件 目标目录
|
1
2
3
4
5
6
7
8
|
root@kali:~
/eth10/eth10
# ls
test1
test
.txt
root@kali:~
/eth10/eth10
# ls test1
root@kali:~
/eth10/eth10
# mv test.txt test1/
root@kali:~
/eth10/eth10
# ls
test1
root@kali:~
/eth10/eth10
# ls test1/
test
.txt
|
基本使用语法(重命名):
1
|
mv
源文件 重命名后的文件
|
1
2
3
4
5
|
root@kali:~
/eth10/eth10
# ls
test1 test1.txt
root@kali:~
/eth10/eth10
# mv test1.txt test.txt
root@kali:~
/eth10/eth10
# ls
test1
test
.txt
|
另外如果有同名文件的,需要添加-i参数来提醒是否需要覆盖,不然默认就把同名文件替换了,回复y是替换,回复n是跳过该文件!
1
2
3
4
|
root@kali:~
/eth10/eth10
# ls
test1.txt
test
.txt
root@kali:~
/eth10/eth10
# mv -i test1.txt test.txt
mv
:是否覆盖
'test.txt'
? n
|
其次我们可以使用-b来对存在同名文件的文件进行添加~进行重命名
1
2
3
4
5
|
root@kali:~
/eth10/eth10
# ls
test1.txt
test
.txt
root@kali:~
/eth10/eth10
# mv -b test1.txt test.txt
root@kali:~
/eth10/eth10
# ls
test
.txt
test
.txt~
|
本文转自 eth10 51CTO博客,原文链接:http://blog.51cto.com/eth10/1957042