This is mainly about the echo of a basic use of grammar, echo in the penetration test is also often used, we can use echo in a simple shell to write a word trojan, or through ECHO to the Linux public key written to the remote server as the authentication key, This allows for a password-free login, plus the ability to execute system commands via Echo!
Echo most basic is as output, basic use syntax is as follows:
What echo is going to output
[Email protected]:~/eth10/eth10# echo Hello Eth10hello eth10[email protected]:~/eth10/eth10# echo "Hello eth10" Hello Eth10
But if there are some special characters in the content you want to output, you are likely to be eaten!
[Email protected]:~/eth10/eth10# echo "Hello eth10" Welcome "" Hello Eth10 Welcome
At this point, we can use the-e parameter to turn on escape!
[Email protected]:~/eth10/eth10# echo-e "Hello eth10 \" welcome\ "" Hello eth10 "Welcome" [Email protected]:~/eth10/eth10#
So we can print out special characters! And you can use the escape character \ n to implement line wrapping! But you'd better leave a space before!
[Email protected]:~/eth10/eth10# echo-e "Hello eth10 \n\" welcome\ "" Hello eth10 "Welcome"
In addition, for single quotes, we do not need to add escape characters!
[Email protected]:~/eth10/eth10# echo-e "Hello eth10\n\" welcome\ "' eth10 '" Hello eth10 "Welcome" ' eth10 ' [email protected ]:~/eth10/eth10# echo-e "Hello eth10\n\" welcome\ "\ ' eth10\ '" Hello eth10 "welcome" \ ' eth10\ ' [email protected]:~/eth10/ eth10#
With the simple use of ECHO, only the content can be output, then you can use the redirect > or append >> to write our output to the file!
In addition, we can use the "this symbol to execute system commands via echo, even if there is no word wrap!"
[Email protected]:~/eth10/eth10# echo ' whoami ' Root[email protected]:~/eth10/eth10#[email protected]:~/eth10/eth10# Echo ' cat/etc/passwd ' Root:x:0:0:root:/root:/bin/bash daemon:x:1:1:daemon:/usr/sbin:/usr/sbin/nologin bin:x:2:2: Bin:/bin:/usr/sbin/nologin
Is it possible for us to download any file to the server using wget? or use NC directly to get a reverse connection?
This article is from the "eth10" blog, make sure to keep this source http://eth10.blog.51cto.com/13143704/1958208
Linux command--echo