没有壳 [英] without shell

查看:49
本文介绍了没有壳的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,


可以在不使用shell(bash)的情况下调用/执行任何linux命令吗?

安全问题是什么?


问候,

KM

hi all,

can any linux command be invoked/ executed without using shell (bash) ?
what abt security concerns ?

regards,
KM

推荐答案

2005年6月12日,星期日23:16:35 + 0530,km写道:
On Sun, 12 Jun 2005 23:16:35 +0530, km wrote:
大家好,

可以在不使用shell(bash)的情况下调用/执行任何linux命令吗?


py> import os

py> status = os.system(" ls")

打印ls的输出并将退出代码存储到状态。


py> file_list = os.popen(" ls")。read()


将ls的输出存储到file_list中。


或者看看模块命令。

安全问题是什么?
hi all,

can any linux command be invoked/ executed without using shell (bash) ?
py> import os
py> status = os.system("ls")

Prints the output of ls and stores the exit code into status.

py> file_list = os.popen("ls").read()

Stores the output of ls into file_list.

Or see the module "commands".
what abt security concerns ?




是的,存在严重的安全问题。关于执行用户生成的字符串,你应该*非常小心

。你可能不希望你的

程序执行像os.system(rm -rf /)这样的东西。


-

史蒂文。



Yes, there are serious security concerns. You should be *very* careful
about executing strings generated by users. You probably don''t want your
program executing something like os.system("rm -rf /").

--
Steven.


2005-06-12,km< km@mrna.tn.nic.in>写道:
On 2005-06-12, km <km@mrna.tn.nic.in> wrote:
可以在不使用shell(bash)的情况下调用/执行任何linux命令吗?


是 - 对于linux命令的某些值。您可以使用bash执行

任何不是bash内部或bash脚本而没有

的内容。

安全问题是什么?
can any linux command be invoked/executed without using shell (bash)?
Yes -- for some values of "linux command". You can execute
anything that''s not a bash internal or a bash script without
using bash.
what abt security concerns?




他们怎么样?


-

Grant Edwards grante哇!我很年轻......我是健康的... b $ b我可以HIKE

visi.com THRU CAPT GROGAN''LUMBAR

REGIONS!



What about them?

--
Grant Edwards grante Yow! I''m young... I''m
at HEALTHY... I can HIKE
visi.com THRU CAPT GROGAN''S LUMBAR
REGIONS!


2005-06-10,Steven D''Aprano< st *** @ REMOVETHIScyber.com.au>写道:
On 2005-06-10, Steven D''Aprano <st***@REMOVETHIScyber.com.au> wrote:
On Sun,2005年6月12日23:16:35 +0530,km写道:
On Sun, 12 Jun 2005 23:16:35 +0530, km wrote:
大家好,

可以在不使用shell(bash)的情况下调用/执行任何linux命令吗?
py> import os
py> status = os.system(" ls")

打印ls的输出并将退出代码存储到状态。
hi all,

can any linux command be invoked/ executed without using shell (bash) ?
py> import os
py> status = os.system("ls")

Prints the output of ls and stores the exit code into status.




它'通过调用用户的SHELL并传递字符串来完成

" ls"它。在一般情况下,调用一个未知的shell和

传递一个字符串是充满危险的。

py> file_list = os.popen(" ls")。read()

将ls的输出存储到file_list中。


这也执行一个shell(与os.system()相同),因此它与

一样,与os.system一样不可靠和不安全( )。 [见
笔记> http://docs.python.org/lib/os-newstr...#os-newstreams


描述popen。]

或者看看模块命令。



It''s done by invoking the user''s SHELL and passing the string
"ls" to it. In the general case, invoking an unknown shell and
passing it a string is fraught with peril.
py> file_list = os.popen("ls").read()

Stores the output of ls into file_list.
That also executes a shell (same as os.system()), so it''s
equally as unreliable and insecure as os.system(). [See the
notes at http://docs.python.org/lib/os-newstr...#os-newstreams
that describe popen.]
Or see the module "commands".

安全问题是什么?



是的,存在严重的安全问题。关于执行用户生成的字符串,你应该非常小心。你可能不希望你的程序执行像os.system(rm -rf /)这样的东西。



Yes, there are serious security concerns. You should be *very* careful
about executing strings generated by users. You probably don''t want your
program executing something like os.system("rm -rf /").




你有如果你不调用shell,你也可以获得更好的机会获得你想要的东西,但是使用os.spawn *

函数。


-

格兰特爱德华兹格兰特哇!我觉得部分加氢了!
visi.com



You''ve got also got a much better chance of getting what you
expect if you don''t invoke a shell, but use os.spawn*
functions instead.

--
Grant Edwards grante Yow! I feel partially
at hydrogenated!
visi.com


这篇关于没有壳的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆