Simple Socket Server in Bash?

后端 未结 4 1681
挽巷
挽巷 2020-12-04 08:27

Is there a way to quickly bind to a TCP port/ip address and simply print out all information to STDOUT? I have a simple debugging solution which writes things to 127.0.0.1:4

4条回答
  •  春和景丽
    2020-12-04 09:00

    That is working as you expecting:

     nc -k -l 4444 |bash
    

    and then you

    echo "ls" >/dev/tcp/127.0.0.1/4444
    

    then you see the listing performed by bash.

    [A Brief Security Warning]
    Of course if you leave a thing like this running on your computer, you have a wide open gateway for all kinds of attacks because commands can be sent from any user account on any host in your network. This implements no security (authentication, identification) whatsoever and sends all transmitted commands unencrypted over the network, so it can very easily be abused.

提交回复
热议问题