Articles of perl

用perl / awk / sed预加string?

我正在尝试将脚本更改到我的apacheconfiguration文件(httpd.conf)。 我试图匹配下面的string: # # DirectoryIndex: sets the file that Apache will serve if a directory 并预备以下文本: # # Allow server status reports generated by mod_status, # with the URL of http://servername/server-status # Change the ".example.com" to match your domain to enable. # <Location /server-status> SetHandler server-status Order deny,allow Deny from all Allow from localhost ip6-localhost […]

脚本自动化:login,input密码,运行命令,本地保存输出?

我有一段时间的问题是否可能为Perl或Bash脚本: login到另一台机器 input密码 运行一些命令 将输出保存在本地文件中 我该怎么做? 感谢伟大的网站!

保护silent1.pl Perl脚本

我经营一个小的共享主机区。 虽然我注意到人们无法/努力地利用PHP,但是我发现只有less数人使用Perl来获取服务器信息。 所以,简单地说,这里是我想问的问题 – 有没有办法阻止Perl脚本访问某些系统重要文件,如named.conf / etc / passwd&others? 自然suhosin / suphp或php.ini不能防止这种情况在perl场景。

硬编码密码vs使用`猫`从文件检索

我使用Zentyal(以前的EBox)作为我的家庭网关/服务器,评估它可能在本地组织中使用。 我想更改root密码,我做了,并错误地更改了Zentyal /var/lib/zentyal/conf文件夹中的密码以匹配它。 所以我把Zentyal的密码改回原来的样子,但问题是,当我使用nano编辑这个文件时,它必须添加一个换行符或者什么,因为现在是检索密码的Perl脚本(它使用cat来检索它从文件)导致一个MySQL访问被拒绝的错误。 然而,当我在Perl数据库连接函数中对密码进行硬编码时,它就像一个魅力。 我已经尝试nano -L编辑文件,以及echo >输出密码到文件,并没有运气。 什么是Perl脚本做cat来获取密码的问题?

何时使用Bash,何时使用Python / Perl / Ruby?

什么时候编写Bash脚本以及什么时候使用更强大的脚本语言(Python,Perl,Ruby,…)? 我发现很简单的脚本比Bash更好,但是随着时间的推移,很多脚本都会变得非常有趣,而且重写整个事情似乎不是一个好主意。 这就是为什么我倾向于总是使用Python的所有脚本。 但是因为Bash似乎是Linux脚本的通用语言,那么一个负责任的系统pipe理员会做些什么呢?

Apache 2.4用“403 Forbidden”回复CGI脚本,我的configuration看起来不错

我在Ubuntu服务器14.04上安装了Apache 2.4的全新安装CGI脚本。 Apache不断回答403 Forbidden,如果对我来说,configuration文件是好的。 CGI是Monitorix的前端,一个用Perl编写的系统监视工具。 configuration文件/etc/apache2/conf-enabled/monitorix.conf是: Alias /monitorix /var/lib/monitorix/www ScriptAlias /monitorix-cgi /var/lib/monitorix/www/cgi <Directory /var/lib/monitorix/www/cgi/> DirectoryIndex monitorix.cgi Options ExecCGI <IfModule mod_authz_core.c> # Apache 2.4 Require all granted </IfModule> <IfModule !mod_authz_core.c> # Apache 2.2 Order deny,allow Allow from all </IfModule> </Directory> /var/lib/monitorix/www和/var/lib/monitorix/www/cgi所有文件至less都具有读取权限。 每次我尝试从URL /monitorix访问,在我的Apache日志中,我看到行: [Mon Sep 01 06:57:52.995680 2014] [authz_core:error] [pid 17145] [client xxxx:58879] AH01630: client denied […]

在Apache2中检查Perl版本

我如何检查Apache2使用哪个版本的Perl? 我有几个版本的Perl安装,我想确保。

Linux – 获取一个命令行perl脚本调用什么程序的报告以及它生成和使用的文件

我有一个Perl脚本,调用其他Perl脚本,其中一些调用Python脚本。 其中每个产生其他程序读取的文件。 这很复杂。 我想要做的是运行它,并有Linux报告哪些程序调用哪些程序,哪些文件读入每个程序,并生成? 在Linux中是否有这样的痕迹?

这个剧本是邪恶的吗?

这是坐在我的网站的CGI斌。 我应该关心它吗? #!/usr/bin/perl print <<HTML; Content-type: text/html <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title></title> <meta http-equiv="Content-Type" content="text/html"> <link rel="stylesheet" type="text/css" href="../../css/style.css"> </head> <body> <table cellspacing="0" cellpadding="0" border="0"> <tr class="subhead" align="Left"><th>Name</th><th>Value</th></tr> HTML my $class; foreach (sort keys %ENV) { next unless /^HTTP_|^REQUEST_/; $class = ($class ne 'normal')? 'normal': 'alt'; print <<HTML; <tr class="$class"><td […]

在Apache 2.2中的mod perl不parsingperl脚本

我已经使用mod_perl(mod perl v2.0.4 / perl v5.10.1)在windows server 2008 R2上build立了一个新的Apache 2.2.15服务器。 Mod_perl和Perl 5.10已经安装并且没有问题地加载。 但是,尽pipe我的configuration,mod_perl模块无法识别和执行我的.pl文件,而是select打印出perl源代替。 我做错了什么,我怎么让perl处理我的pl脚本,而不是发送给客户端? 我的configuration: <VirtualHost *:80> ServerAdmin [email protected] DocumentRoot "C:\Program Files (x86)\AWStats\wwwroot" ServerName analysis.example.com ServerAlias analysis.example.com ErrorLog "logs/analysis.example.com-error.log" CustomLog "logs/analysis.example.com-access.log" common DirectoryIndex index.php index.htm index.html PerlSwitches -T <Directory "C:\Program Files (x86)\AWStats\wwwroot"> Options Indexes FollowSymLinks AllowOverride None Order allow,deny Allow from all </Directory> <Directory "C:\Program […]