Using shell scripts for CGI in lighttpd

点击打开链接

Using shell scripts for CGI in lighttpd

I needed to do some fuzzing experiments on a web browser, and decided that a shell script and a webserver was all I needed to do that. This is how to use shell scripts for cgi, this isnot about the fuzzing proccess.

First, I installed lighttpd and enabled the cgi module:

sudo apt-get install lighttpd
sudo lighty-enable-mod cgi

Then, a handler should be configured in /etc/lighttpd/conf-enabled/10-cgi.conf, like this:

$HTTP["remoteip"] =~ "127.0.0.1" {     
  alias.url += ( "/cgi-bin/" => "/usr/lib/cgi-bin/" )
  $HTTP["url"] =~ "^/cgi-bin/" {
    cgi.assign = ( ".sh" => "/bin/sh" )
  }
}

Now, make the server reload the config file using

sudo /etc/init.d/lighttpd reload

And here is a simple shell script. Place the shellscript in /usr/lib/cgi-bin/example.sh and remember to set the right permissions for the file.

#!/bin/sh
cat << EOF
Content-Type: text/html

<html>  
<head>  
<title>cgi shell scripting example\</title>  
</head>  
<body>  
<h1>Stats for this computer</h1>  
EOF  
echo Date: $(date) "<br />"  
echo Uptime: $(uptime) "<br />"  
cat << EOF  
</body>  
</html>  
EOF

Notice the extra newline between Content-Type: text/html and the actual webpage.

Navigate to http://127.0.0.1/cgi-bin/example.sh to see the script in action.


http://blog.163.com/lgh_2002/blog/static/44017526201192011647957/

(98)Address already in use: make_sock: could not bind to address 80 [resolved]  

http://bredsaal.dk/using-shell-scripts-for-cgi-in-lighttpd

Using shell scripts for CGI in lighttpd


http://bredsaal.dk/using-shell-scripts-for-cgi-in-lighttpd



http://www.cnblogs.com/mfryf/archive/2012/05/23/2514495.html


http://www.fpx.de/fp/Software/ProcCGIsh.html




  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值