XCTF command_execution

一.使用命令拼接的方式来执行其它命令

  1.了解   |  ,  &    , &&   ,  和  ||

  windows或linux下:command1 && command2 先执行command1,如果为真,再执行command2。

  command1 | command2 只执行command2。

  command1 & command2 先执行command2后执行command1。

  command1 || command2 先执行command1,如果为假,再执行command2 

二.实验步骤

  1.输入    127.0.0.1

  

 

 

   发现确实返回了ping的结果,我们试着命令拼接看能不能成功,输入   127.0.0.1 | ls ../    ,发现html这个文件夹

  

 

 

   继续输入   127.0.0.1 |  ls ../../    ,  出现了更多的文件,但似乎没有flag相关的

  

 

 

   再输入  127.0.0.1  |  ls ../../../

  

 

 

   发现  home  ,试着进入home里看看能不能收获点什么 

  

 

 

   果然发现flag文件,通过 输入 127.0.0.1 | cat ../../../home/flag.txt    ,  得到flag

  

 

 


  当然这里我们可以直接采用  127.0.0.1 | find / -name "flag*"     ,得到flag.txt。

   

 

 

 

  

posted @ 2020-04-02 15:43  l2sec  阅读(389)  评论(0编辑  收藏  举报