Using shell scripts for CGI in lighttpd

转载 2013年12月03日 10:45:03

点击打开链接

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




Processing Form Data in Shell CGI Scripts

Processing Form Data in Shell CGI Scripts Important: Versions before 11/06/1997 have a security bug...
  • yi412
  • yi412
  • 2015年05月21日 16:26
  • 793

Using Bash shell scripts for function testing

功能测试是软件开发的一个关键部分 -- 而已经装入 Linux 的 Bash 可以帮您轻而易举地完成功能测试。在本文中,Angel Rivera 将说明如何运用 Bash shell 脚本通过行命令来...

Shell Scripts - 循环while,until,for

while...do...done until...do...done for...do...done

84.Which two files in the database can be configured for automatic backups by using the autobackup f

84.Which two files in the database can be configured for automatic backups by using the autobackup f...

Using INSTEAD OF triggers in SQL Server for DML operations

Problem I have created some views to provide limited data access for an application. Several of the...

(转)Methods for Using Java in ORACLE

(转载地址:http://blog.csdn.net/songyubin001/article/details/588815)   java与oracle的接口:      在数据库中运行J...

Alternative solution for using IF condition with Eval in C# Repeater

/*by Jiangong SUN*/ I have encountered the problem when i want to use IF condition for Eval in C# r...

INFO: HHH000402: Using Hibernate built-in connection pool (not for production use!)的解决

今天按照学习视频学习了Hibernate的入门课程: 前提:用的mysql数据库 前提:导入了hibernate的jar包和JUnit4.0的jar包,还有mysql的jdbc驱动jar包,就是这货:...

Using openCV for Mac OS in XCode

原文:http://objectivecbeginner.blogspot.com/2010/11/using-opencv-for-mac-os-in-xcode.html担心翻墙,转载于此So a...
  • eminia
  • eminia
  • 2011年07月26日 15:40
  • 1933

Using resource bundle for validation messages in Spring

What i am trying to do is 1. putting up the messages file in WEB-INF/i18/validationMessages_en.pr...
内容举报
返回顶部
收藏助手
不良信息举报
您举报文章:Using shell scripts for CGI in lighttpd
举报原因:
原因补充:

(最多只允许输入30个字)