- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我知道这是不正确的。我只想知道perl是如何解析的呢。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。
所以,我在玩perl,我想要的是perl -ne
我键入的是perl -ie
,该行为有点有趣,我想知道发生了什么。
$ echo 1 | perl -ie'next unless /g/i'
Aborted (core dumped)
。阅读
perl --help
我看到
-i
扩展了备份。
-i[extension] edit <> files in place (makes backup if extension supplied)
-e
只是评估。所以我在想,三件事之一可能是发生的,要么被解析为
perl -i -e'next unless /g/i'
我无法定义,其余的作为e perl -ie 'next unless /g/i'
我得到参数e,其余的像文件名perl -i"-e'next unless /g/i'"
整个东西作为i $ echo 1 | perl -i -e'next unless /g/i'
'next unless /g/i'
不会被解析为
-e
的文字参数。毫无疑问,以上内容将以这种方式进行解析,并且结果会有所不同。
$ echo 1 | perl -ie'foo bar'
Unrecognized switch: -bar (-h will show valid options).
$ echo 1 | perl -ie'foo w w w'
... works fine guess it reads it as `perl -ie'foo' -w -w -w`
$ echo 1 | perl -ie'foo e eval q[warn "bar"]'
bar at (eval 1) line 1.
-i
内获得Perl eval命令。这对安全性有影响吗?
$ perl -i'foo e eval "warn q[bar]" '
最佳答案
快速回答
Shell报价处理正在折叠和连接它认为是所有论点的内容。您的调用相当于
$ perl '-ienext unless /g/i'
它会立即终止,因为perl将此参数解析为包含
-u
,这触发了将开始执行代码的核心转储。这是一个曾经用于创建伪可执行文件的旧功能,但如今已成为残余。
eval
的调用是对
-e 'ss /g/i'
的误判。
dump
可以成为您的 friend 。
$ echo 1 | perl -MO=Deparse,-p -ie'next unless /g/i'
dump is not supported.
BEGIN { $^I = "enext"; }
BEGIN { $/ = "\n"; $\ = "\n"; }
LINE: while (defined(($_ = <ARGV>))) {
chomp($_);
(('ss' / 'g') / 'i');
}
那么,为什么
unle
消失了?如果您使用的是Linux,那么您可能还没有达到我的水平。上面的输出来自Cygwin上的Perl,有关
dump
不支持的错误是一个提示。
-u
This switch causes Perl to dump core after compiling your program. You can then in theory take this core dump and turn it into an executable file by using the undump program (not supplied). This speeds startup at the expense of some disk space (which you can minimize by stripping the executable). (Still, a "hello world" executable comes out to about 200K on my machine.) If you want to execute a portion of your program before dumping, use the
dump
operator instead. Note: availability of undump is platform specific and may not be available for a specific port of Perl.
-i
processing中看到的那样,
enext
选项使用下一个单词(
-i
)。
case 'i':
Safefree(PL_inplace);
[Cygwin-specific code elided -geb]
{
const char * const start = ++s;
while (*s && !isSPACE(*s))
++s;
PL_inplace = savepvn(start, s - start);
}
if (*s) {
++s;
if (*s == '-') /* Additional switches on #! line. */
s++;
}
return s;
对于备份文件的扩展名,perl.c中的上述代码最多消耗第一个空格字符或字符串结尾(以先到者为准)。如果保留字符,则第一个必须为空格,然后跳过它;如果下一个为破折号,则也要跳过它。在Perl中,您可以将此逻辑编写为
if ($$s =~ s/i(\S+)(?:\s-)//) {
my $extension = $1;
return $extension;
}
然后,所有
-u
,
-n
,
-l
和
-e
都是有效的Perl选项,因此参数处理会吞噬它们,而变得毫无意义
ss /g/i
作为
-e
的参数,它将perl解析为一系列的除法。但是在执行开始之前,古老的
-u
导致perl转储核心。
next
和
unless
之间放置两个空格
$ perl -ie'next unless /g/i'
该程序尝试运行。
Back in the main option-processing loop我们看到了
case '*':
case ' ':
while( *s == ' ' )
++s;
if (s[0] == '-') /* Additional switches on #! line. */
return s+1;
break;
多余的空间将终止该参数的选项解析。见证人:
#!
) line constraints,而pert会尽力而为。
Interpreter scripts
An interpreter script is a text file that has execute permission enabled and whose first line is of the form:
#! interpreter [optional-arg]
The interpreter must be a valid pathname for an executable which is not itself a script. If the filename argument of
execve
specifies an interpreter script, then interpreter will be invoked with the following arguments:interpreter [optional-arg] filename arg...
where arg... is the series of words pointed to by the
argv
argument ofexecve
.For portable use, optional-arg should either be absent, or be specified as a single word (i.e., it should not contain white space) …
关于perl - Perl模棱两可的命令行选项,以及-i对eval的安全性影响?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10709127/
我正在尝试构建一个托管在服务器上的 Blazor 应用程序,起点位于一个 razor 页面内。 类似的东西: 我的问题是: 如果 Razor 页面具有授权属性,所有 blazor 代码都不是通过身份
对tomcat中管道和阀门机制不懂的小伙伴,参考本篇文章 领域 目前可知结构,如图所示,下面继续分析 GenericPrincipal类 LoginConfig类 Authenticator接口 在T
我刚刚开始学习 React 中的授权和身份验证,我在使用 JWT 完成我的第一个简单登录系统后编写了这篇文章,因为大多数人都知道您在浏览器中存储了一个 token ,然后将其与保存的进行比较现在,当验
我正在为grails项目寻找安全插件。 Spring安全核心1.2.7.3看起来很棒,但是似乎已经有将近一年没有开发了。有谁知道是这样吗? 还有其他好的插件吗? 我也正在使用mongodb,想知道sp
我有一个 WCF 服务,它使用具有消息安全性和用户名身份验证的 NetTcpBinding。在此之前,我使用 WsHttpBinding 但我切换到 NetTcp,因为我可以使用回调。 我的服务配置如
我正在考虑使用 cakePHP 构建一个 Web 应用程序。我的问题是我必须自己编写多少安全内容来防止(SQL 注入(inject)等)? cakePHP 自己处理什么安全问题,我必须编写什么代码?
任何人都有关于为安全环境强化/配置 TFS 的信息? 最佳答案 TFS 使用 Windows 身份验证,因此它与您的网络一样安全。我建议您还查看有关加强网络安全的资源。 Team Foundation
就目前而言,这个问题不适合我们的问答形式。我们希望答案得到事实、引用资料或专业知识的支持,但这个问题可能会引发辩论、争论、投票或扩展讨论。如果您觉得这个问题可以改进并可能重新打开,visit the
我一直想知道 codeigniter 设置有多安全。因为数据库密码等信息存储在主应用程序文件夹的配置文件中,黑客可以检索到这些信息吗?我知道您可以将应用程序文件夹移动到远离 Web 根目录的位置,但如
在客户端使用 PouchDB 访问远程服务器时要遵循的最佳安全实践是什么? https://pouchdb.com/getting-started.html上的例子使用代码与远程服务器同步: var
已结束。此问题正在寻求书籍、工具、软件库等的推荐。它不满足Stack Overflow guidelines 。目前不接受答案。 我们不允许提出寻求书籍、工具、软件库等推荐的问题。您可以编辑问题,以便
我正在开发一个网络应用程序,用户可以在其中上传文件并执行它们。我的意思是,他们可以上传 html 文件,然后通过单击,他们可以在我的 Web 应用程序内的 iframe 中执行该文件并查看渲染的 ht
试图澄清 -AsPlainText ConvertTo-SecureString 中的参数小命令: -AsPlainText Specifies a plain text string to conv
我正在玩 coreos 和 digitalocean,我想开始允许我的容器之间进行内部通信。 我已经为所有主机设置了私有(private)网络,现在我想确保某些容器只打开到 localhost 和内部
我们有两台机器: 服务器 客户 服务器正在运行 Clojure + Ring + ...标准 ClojureScript webstack。 客户端 = 某些运行 Chorme/Firefox/Saf
让我们有一个函数 foo 和一个类 Bar: fun foo(key: String): String? { // returns string or null } class Bar(x: St
已关闭。此问题不符合Stack Overflow guidelines 。目前不接受答案。 这个问题似乎不是关于 a specific programming problem, a software
确保只有正确的用户才能在 Sharepoint 2007 中看到 Web 部件的最佳做法是什么? 有人向我建议了安全组和受众。 最佳答案 这取决于您是在谈论 Web 部件的呈现还是从 Web 部件库添
我试图说服一个团队,使用 jQuery JSONP 调用与不受信任的第三方可能是不安全的。我正在使用标准 jQuery 代码: $.ajax({ url:unsecureserver+"?js
我有以下ajax调用,它检查用户是否是付费成员(member),如果是,则相应地运行某些功能。这可行,但我担心安全性。如果有人在控制台中更改此 ajax 代码,强制 #button 成功运行功能而无需
我是一名优秀的程序员,十分优秀!