让我的流程始终保持活力

发布于 2024-10-21 01:27:38 字数 179 浏览 2 评论 0原文

是否可以阻止用户(甚至管理员)终止我的程序?
或者一旦被杀,它会很快恢复?

更新: 澄清一下:我正在编写一个监控程序,类似于家长控制,可以记录用户使用电脑的行为。你可以通过查看我最近的其他问题来猜到这一点。
这样一个程序的首要需求就是活着!

现在,有人帮忙吗?

Is it possible to stop users (even admin) from killing my program?
or in case of killing, it restores itself quickly?

UPDATE:
to clarify: I'm writing a monitoring program, something like parental control which keeps record of what a user do with PC. you can guess that by viewing my other questions recently.
The first need of such a program is being alive!

now, anyone help?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

ぺ禁宫浮华殁 2024-10-28 01:27:38

首先,不要这样做。第二,还是不要这样做。

第三,如果你的程序太棒了,它永远不会停止运行,你总是可以提供安装一个服务来运行你的程序并在程序死机时重新启动它的功能。但请认真思考这一点,因为用户通常会对不会死掉的程序感到非常恼火。相反,让你的程序足够有用,以至于没有人会希望它停止运行,并在它死掉时重新启动它。

编辑:好的,鉴于您对OP的更新,让我们在这里尝试一些想法。

有两种基本情况需要考虑: 如果最终用户拥有计算机的管理员权限,那么在一般情况下您几乎无能为力。无论您尝试什么,具有管理权限的人都可以绕过。

那么如果用户没有管理员权限怎么办?那么用户就无法杀死由 root/管理员启动的任意进程。在这种情况下,您可以尝试将软件安装为守护程序样式/始终运行。在 Windows 上,您可以将其安装为启动时自动启动的系统服务。对于 Solaris,您可以使用 SMF 并将其设置为在终止时自动重新启动。在 Linux 上,您可以执行类似 root 拥有的 shell 之类的操作,该 shell 会永远循环并在程序退出时重新启动程序。

First, don't do that. Second, still don't do that.

Third, if your program is sooooo awesome that it should never stop running you could always provide the capability to install a service that runs your program and restarts it if it dies. But think long and hard about that because users typically get pretty annoyed about programs that won't die. Instead make your program useful enough that no one will WANT it to stop running, and restart it if it dies.

EDIT: OK so given your update to the OP let's try a few thoughts here.

There are two basic cases to consider: If the end user has admin rights on the machine there's pretty much nothing you can do in the general case. Whatever you attempt can be bypassed by someone with administrative privileges.

So then what if the user doesn't have admin rights. Then users can't kill arbitrary processes started by root/administrator. In that case you can try to install your software as a daemon style/always running. On Windows you would install as a system service that autostarts on boot. For Solaris you would use SMF and set it to auto-restart on termination. On Linux you could do something like a root-owned shell that loops forever restarting the program if it exits.

深爱不及久伴 2024-10-28 01:27:38

不,这是不可能的。管理员总是知道如何切断电源。

好吧,既然澄清已经到了,我还要添加一些文字。

我实际上见过一个 Windows 家长控制工具,它使用同一进程的多个实例相互监视,并且会重新启动如果用户终止其中一个,他们就会立即陷入困境。工作得很好 - 除非有人会切换到控制台并足够快地杀死他们。然而,使用任务管理器的速度太慢了。

当然,该方法是有限的,特别是因为管理员可以轻松删除自动启动条目(这可以通过使用某种隐藏的服务来生成进程来避免)。不过,除非你的目标是极端黑客的孩子,否则它是相当有效的。

但毕竟,人们可以重新安装完整的操作系统,从而避免您可能采取的所有预防措施。 因此,最好的方法可能是隐藏您的工具并希望它不会被发现。

No, it is not possible. Admin always knows how to chop off power supply.

Ok, now that clarification is here, I'll add some words as well.

I've actually seen a parental control tool for Windows that used several instances of the same process monitoring each other and that would restart their complices immediately if the user terminated one of them. Worked quite well - unless somebody would switch to the console and kill them quick enough. However, using Task Manager was far to slow.

Of course the approach is limited, especially since the administrator could easily remove the autostart entries (which could be avoided i.e. by using a somewhat hidden service to spawn the processes). Still, unless you target extremely hacker-ish children, it is quite effective.

But after all, people could just reinstall their complete OS, thus avoiding all precautions you may take. So the best way is probably to hide your tool and hope that it won't be found.

深爱不及久伴 2024-10-28 01:27:38

你可能疯了。杀死或破坏“天真的”烦人程序总是有可能的。尝试一些好的东西。

you might be insane. It is ALWAYS possible to kill or destroy a "Naive" annoying program. try something good.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文