cgi

Allowing Apache on EC2 to run sudo commands via CGI script

冷暖自知 提交于 2019-12-11 08:04:59
问题 I have an Amazon (AMI) Linux EC2 instance running on AWS. I'm create a perl script that will create directories when it is called through a web url (CGI script). However, because the browser is executing the script, the user apache is running the perl script. Because apache is not allowed to do mkdir command without using sudo none of the directories are being created. I've modified the scripts permissions to execute (755) via the browser, however none of the mkdir commands work. I even tried

How can I run Python CGI scripts on my web server?

可紊 提交于 2019-12-11 07:39:57
问题 I want to run a Python CGI script on my web server (Apache 2.2). When I try to run the test.py file I get the following error: <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> <html><head> <title>403 Forbidden</title> </head><body> <h1>Forbidden</h1> <p>You don't have permission to access /test.py on this server.</p> </body></html> In the error log: [client 127.0.0.1] Options ExecCGI is off in this directory: C:/Program Files (x86)/Apache Software Foundation/Apache2.2/htdocs/test.py So what

How can I validate input to my Perl CGI script so I can safely pass it to the shell?

元气小坏坏 提交于 2019-12-11 07:13:26
问题 I am new to both Perl and complicated regular expressions. I mean I've used the * from regular expressions before but nothing more complicated than that. In the script below I know that there is a very big security hole in which perl code can be injected and ran so that any command can be executed even a shell. In trying to stop this injection, I've come to realize that regular expressions are much harder than I thought. The book I am using says to use the combination of die "The specified

How to redirect a page to another page in python 3 cgi

怎甘沉沦 提交于 2019-12-11 06:44:37
问题 Hello I am studying python recently and a newbie ,I am unable set a logic to as, if the post data does not qualify,post page will be redirected to origin page. After a long time search I found this how to redirect one page to another ,But still having confusion regarding redirecting page. here is my html code : <form action="generate_timing_data.py" method="POST"> <p>Select an athlete from the list to work with: </p><input type="radio" name="which_athlete" value="Mikey McManus"> Mikey McManus

mod_perl script going in to a tight loop during 'use' processing

て烟熏妆下的殇ゞ 提交于 2019-12-11 05:53:35
问题 I have a rather complex problem to describe. I'm looking for any suggestions for further debugging. I'm trying to convert to mod_perl from regular cgi. I send an http request to a script that loads up a page, and on that page there are links to load images that are retrieved via further scripts (in other words, the images are loaded via a cgi script, not just a plain link). So when the page loads in the browser, the browser kicks off half a dozen more requests that run scripts to load the

Global symbol “%formsequence” requires explicit package name at line 37

喜欢而已 提交于 2019-12-11 05:52:40
问题 I am trying to execute a Perl CGI script, but I am getting an error: Global symbol "%formsequence" requires explicit package name at line 37. I did some research and found that use strict forces me to declare the variables before I use them or store any data, but in my program I have declared them and that is why I don't understand the error. Here is my script: #!/usr/bin/perl -w use strict; my %errors; my %form; my @formsequence; my %fields = ( "lname" => "Last Name", "phone" => "Phone",

Running an extension less file as php

懵懂的女人 提交于 2019-12-11 05:37:23
问题 I was using .htaccess to run an extensionless file as PHP using <Files thumbs> SetHandler application/x-httpd-php </Files> but i changed my server to a CGI/FastCGI since then this is not working. I tried online and also here but couldn't find a solution . Also i tried <Files "thumbs"> ForceType application/x-httpd-php </Files> Then the file is getting downloaded instead of executing. 回答1: Got it fixed by making application/x-httpd-php it as application/x-httpd-php5 <Files thumbs> SetHandler

How do I set Perl's @INC for a CGI script?

被刻印的时光 ゝ 提交于 2019-12-11 05:29:43
问题 I have the following, simplest Perl CGI script: use strict; use warnings; use CGI(); use CGI::Carp qw(fatalsToBrowser); use Template; print CGI::header(); foreach(@INC) { print "$_\n"; } When called (http://[..]/cgi-bin/p.cgi) I am given the following error: Can't locate Template.pm in @INC (@INC contains: /usr/lib/perl5/site_perl/5.8.8/i386-linux-thread-multi /usr/lib/perl5/site_perl/5.8.8 /usr/lib/perl5/site_perl /usr/lib/perl5/vendor_perl/5.8.8/i386-linux-thread-multi /usr/lib/perl5/vendor

Running C++ CGI Script As Background Process?

我怕爱的太早我们不能终老 提交于 2019-12-11 05:28:41
问题 I'm working on an audio encoder cgi script that utilises libmp3lame. I'm writing in a mixture of C/C++. I plan to have an entry-point cgi that can spawn multiple encoding processes that run in the background. I need the encoding processes to be asynchronous as encoding can take several hours but I need the entry-point cgi to return instantly so the browser can continue about its business. I have found several solutions for this (some complete/ some not) but there are still a few things I'd

How to redirect to another page in Python in CGIAr

有些话、适合烂在心里 提交于 2019-12-11 05:27:59
问题 If I want to redirect the user from a cgi script to a HTML page using core libraries from the following: import cgi Please could someone point me in the right direction. Nothing more. Simply redirect from cgi script to html page. How ever you would do this Python. If you have to physically write out the HTTP Response Headers to achieve this, then I would appreciate any info on how to do this. TIA Andrew 回答1: You need to output one more header ("Status") in addition to the Location one, e.g.: