简体   繁体   中英

Run command in interactive ncat shell via bash script

I have the below bash script and I'm trying to get the subsequent python command to run within the Ncat shell once a connection is established. Is there a way to do this?

#!/bin/bash ncat -vnl 443 --ssl python -c 'import pty;pty.spawn("/bin/bash")'

The solution I've come up with is to have Ncat run a bash script containing the python command on the penetration test box when a connection is established rather than /bin/bash. This way only the listener is required on the server and we get our fully interactive shell.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM