Scripting an HTTP header request with netcat

后端 未结 5 1675
渐次进展
渐次进展 2020-12-08 11:04

I\'m trying to play around with netcat to learn more about how HTTP works. I\'d like to script some of it in bash or Perl, but I\'ve hit upon a stumbling block early on in m

5条回答
  •  盖世英雄少女心
    2020-12-08 11:59

    You can use below netcat command to make your instance webserver:

    MYIP=$(ifconfig eth0|grep 'inet addr'|awk -F: '{print $2}'| awk '{print $1}')
    while true; do echo -e "HTTP/1.0 200 OK\r\n\r\nWelcome to $MYIP" | sudo nc -l -p 80 ; done&
    

提交回复
热议问题