我可以用密码保护应用程序吗?

发布于 2024-11-01 18:35:03 字数 383 浏览 1 评论 0原文

我有一个应用程序,除非获得明确许可(通过密码),否则我不希望人们访问该应用程序。更具体地说,除非用户输入密码,否则该应用程序需要在一天中的某些时间“锁定”。

检查时间的能力很简单。我不知道如何锁定应用程序。需要这样做的原因是公司不信任用户注销并且不希望任何未经授权的访问应用程序。这是为了以防万一而采取的最后措施。

但我没有编写该应用程序,因此我无法将密码嵌入其中。该机器只有一个用户,我不想创建其他用户。我的用户也是管理员,因此大多数吸引使用操作系统来提供安全性的选项都不起作用。

关于如何实现这一目标有什么想法吗? 我正在处理 Mac OS X,但更喜欢独立于操作系统的解决方案。欢迎任何涉及 CC++ 的解决方案。

谢谢!

I have an application which I don't want people to access unless given explicit permission (via a password). More specifically, this application needs to be "locked" during certain hours of the day unless the user enters a password.

The ability to check the time is simple. The ability to lock the application is what I don't know how to do. The reason that this needs to be done is that the company doesn't trust the user to log out and doesn't want any unauthorized access to the application. This is meant as a sort of last measure just in case.

I didn't write the application though, so I cant embed a password into it. The machine has only one user and I don't want to create others. My user is an admin as well, therefore most options appealing to use of the os to provide security wont work.

Any ideas on how to accomplish this?
I'm dealing with Mac OS X but would prefer an OS independent solution. Any solution involving C or C++ is welcome.

Thanks!

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

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

发布评论

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

评论(3

才能让你更想念 2024-11-08 18:35:03

将应用程序嵌入到加密的磁盘映像包中怎么样?只要使用它的唯一用户永远不会从那里复制它并在之后正确卸载捆绑包,我认为它会实现您想要的:

  1. 使用磁盘工具创建一个新的加密磁盘映像(DMG)(这允许您输入密码),将其存储在用户主目录中的任何位置。
  2. 装载 DMG 并将您要保护的应用程序放入其中
  3. 在装载的 DMG 中创建应用程序的别名并将其放在桌面上
  4. 卸载 DMG

之后,当用户双击桌面上的别名时,系统会提示用户输入 DMG 的密码。如果正确,则会安装 DMG,并且应用程序会自动直接启动。

之后自动卸载,也许您可​​以编写使用 diskutil shell 命令的脚本,如下所示:> diskutil unmount /Volumes/DMG_NAME

然后您所要做的就是:

  • 从系统中删除该应用程序的任何未加密副本
  • 明确通知您的用户在使用完该应用程序后卸载 DMG(或编写脚本自动完成)
  • 向您的 StackOverflowers 同事解释您正在解决的实际问题是什么。 Msw说得有道理,希望你能详细说明一下。

How about you embed the app in an encrypted disk image bundle? As long as the only user that uses it never copies it from there and properly unmounts the bundle afterwards, i think it would accomplish what you want:

  1. Create a new encrypted disk image (DMG) using Disk Utility (this allows you to enter a password), store it anywhere within the user's home directory.
  2. Mount the DMG and place the app you're trying to protect inside it
  3. Create an alias to the app within the mounted DMG and place it on the desktop
  4. Unmount the DMG

After that, when the user double-clicks the alias on the desktop, the user is prompted for the DMG's password. If it's correct, the DMG is mounted and the app is started automatically and directly.

To auto-unmount afterwards perhaps you could script something that uses the diskutil shell command, like this: > diskutil unmount /Volumes/DMG_NAME

All you have to do then is:

  • remove any unencrypted copies of the app from the system
  • explicitly inform your user to unmount the DMG when he's done using the app (or script this to do it automatically)
  • explain to your fellow StackOverflowers what the actual issue is that you're solving. Msw has a point and I hope you can elaborate a bit.
浅浅 2024-11-08 18:35:03

显然,通过这种设置,没有什么是 100% 安全的,但对于临时用户,您可以使用密码加密应用程序,然后编写一个启动应用程序,在输入密码时解密并启动应用程序,并在输入密码时删除应用程序。退出。

Obviously with this set-up nothing's going to be 100% secure, but for casual users you can encrypt the application with the password, then write a launching application that decrypts and launches the application when the password is entered, and deletes the application when it quits.

︶ ̄淡然 2024-11-08 18:35:03
#include <stdio.h>
#include <string.h>

char buf[BUFSIZ]
puts('what is the secret password? ');
fgets(buf, BUFSIZ, stdin);
if (strcmp('secret', buf)) exit(1);

应该和您可能编写的任何其他代码一样工作,并且具有简单性和可移植性的优点。

#include <stdio.h>
#include <string.h>

char buf[BUFSIZ]
puts('what is the secret password? ');
fgets(buf, BUFSIZ, stdin);
if (strcmp('secret', buf)) exit(1);

Should work as well as anything else you might code, and has the advantage of simplicity and portability.

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