首页
社区
课程
招聘
[原创]VB程序实现:密码运行受限程序
发表于: 2009-5-5 19:11 3592

[原创]VB程序实现:密码运行受限程序

2009-5-5 19:11
3592
【原创】VB程序实现:自动输入密码运行受限程序

前期工作:点须要受限的程序属性。有个安全选项!设置受限用户为禁止!系统用户:administrator不须设置!
          如没有安全选项:可到我的电脑-文件选项-去掉使用简单文件共享就有了。

功能:运行程序前须打时系统管理员密码才可运行!
      受限用户不能运行!就像程序只给本人使用其他人不能用;
如:

原理:就像系统的runas功能一样!只要有密码的程序才可运行!
如:


好咱们让程序实现自动为我们输入密码、并且运行我们的受限程序。

代码实现:安装VB6.0-新建标准EXE-粘贴代码

Option Explicit

Private Const LOGON_WITH_PROFILE = &H1&
Private Const CREATE_DEFAULT_ERROR_MODE = &H4000000
Private Const CREATE_NEW_CONSOLE = &H10&
Private Const CREATE_NEW_PROCESS_GROUP = &H200&

Private Type PROCESS_INFORMATION
hProcess As Long
hThread As Long
dwProcessId As Long
dwThreadId As Long
End Type

Private Type STARTUPINFO
cb As Long
lpReserved As Long
lpDesktop As Long
lpTitle As Long
dwX As Long
dwY As Long
dwXSize As Long
dwYSize As Long
dwXCountChars As Long
dwYCountChars As Long
dwFillAttribute As Long
dwFlags As Long
wShowWindow As Integer
cbReserved2 As Integer
lpReserved2 As Byte
hStdInput As Long
hStdOutput As Long
hStdError As Long
End Type
Private Declare Function CreateProcessWithLogon Lib "advapi32" Alias "CreateProcessWithLogonW" (ByVal lpUsername As Long, ByVal lpDomain As Long, ByVal lpPassword As Long, ByVal dwLogonFlags As Long, ByVal lpApplicationName As Long, ByVal lpCommandLine As Long, ByVal dwCreationFlags As Long, ByVal lpEnvironment As Long, ByVal lpCurrentDirectory As Long, lpStartupInfo As STARTUPINFO, lpProcessInfo As PROCESS_INFORMATION) As Long
Private Declare Function CloseHandle Lib "kernel32" (ByVal hObject As Long) As Long

函数实现:

'以下函数用制定名和密码调用了应用程序
Private Function AnShell(Username As String, Domain As String, Password As String, ApplicationName As String) As Long
Dim lpUsername As String, lpDomain As String, lpPassword As String, lpApplicationName As String, lpCommandLine As String, lpCurrentDirectory As String
Dim StartInfo As STARTUPINFO, ProcessInfo As PROCESS_INFORMATION
lpUsername = Username
lpDomain = Domain
lpPassword = Password
lpApplicationName = ApplicationName
lpCommandLine = vbNullString
lpCurrentDirectory = vbNullString
StartInfo.cb = LenB(StartInfo)
StartInfo.dwFlags = 0&
CreateProcessWithLogon StrPtr(lpUsername), StrPtr(lpDomain), StrPtr(lpPassword), LOGON_WITH_PROFILE, StrPtr(lpApplicationName), StrPtr(lpCommandLine), CREATE_DEFAULT_ERROR_MODE Or CREATE_NEW_CONSOLE Or CREATE_NEW_PROCESS_GROUP, ByVal 0&, StrPtr(lpCurrentDirectory), StartInfo, ProcessInfo
CloseHandle ProcessInfo.hThread
CloseHandle ProcessInfo.hProcess
AnShell = ProcessInfo.dwProcessId
End Function

调用函数:
Private Sub Form_load()
AnShell "administrator", "", "123", "c:\radmin.exe"     administrator:密码,程序路径。
Me.Visible = False
End
End Sub

这样好像能达到,自己的计算机程序不给某人便用的目的!

[课程]FART 脱壳王!加量不加价!FART作者讲授!

收藏
免费 0
支持
分享
最新回复 (0)
游客
登录 | 注册 方可回帖
返回
//