• 欢迎访问奇跡の海网站,本站不上传任何资源,所有资源均来自于网络,欢迎加入奇跡の海~!奇跡の海-WordPress QQ群
  • 本站下载资源为网络上收集整理而来,并且以计算机技术研究交流为目的,版权归原作者所有,仅供大家参考,学习,不存在任何商业目的与商业用途.
  • 本站系统镜像均来自于官方原版,ed2k可视为P2P下载链接。所有操作系统默认均为试用版,如有正版密钥可以有效激活,本站不提供任何激活和相关服务。

AutoIt3(au3)源码-Windows开启/关闭系统共享

AutoIT3 奇跡の海 2年前 (2017-11-09) 483次浏览 已收录 0个评论 扫描二维码

代码简介

调用批处理修改注册表键值实现,Windows开启/关闭系统共享
AutoIt3(au3)源码-Windows开启/关闭系统共享

AU3源码

#NoTrayIcon
#Region ;**** 参数创建于 ACNWrapper_GUI ****
#AutoIt3Wrapper_icon=共享.ico
#AutoIt3Wrapper_outfile=C:\Users\Administrator\共享设置工具.exe
#AutoIt3Wrapper_UseUpx=n
#AutoIt3Wrapper_UseX64=n
#AutoIt3Wrapper_Res_Description=共享设置工具
#AutoIt3Wrapper_Res_Fileversion=13.6.20.7
#AutoIt3Wrapper_Res_Fileversion_AutoIncrement=y
#AutoIt3Wrapper_Res_LegalCopyright=QQ:411933069
#EndRegion ;**** 参数创建于 ACNWrapper_GUI ****
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <Process.au3>

#Region ### START Koda GUI section ### Form=



$Form1 = GUICreate("系统共享设置工具 - QQ:411933069", 374, 129, 192, 124)

$Button1 = GUICtrlCreateButton("开启共享(&K)", 24, 68, 137, 41)
If @OSVersion = "WIN_7" Then GUICtrlSetFont($Button1, 12, 400, 1, "微软雅黑")
$Button2 = GUICtrlCreateButton("关闭共享(&G)", 221, 68, 137, 41)
If @OSVersion = "WIN_7" Then GUICtrlSetFont($Button2, 12, 400, 1, "微软雅黑")

$Label1 = GUICtrlCreateLabel("系统版本:" & GetOSVersion(), 24, 30, 286, 27)
If @OSVersion = "WIN_7" Then GUICtrlSetFont($Label1, 12, 400, 1, "微软雅黑")
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
GUISetState(@SW_HIDE)
Exit
Case $Button1
If @OSVersion = "WIN_XP" Then
FileInstall("Ntrights.exe", @TempDir & "\Ntrights.exe", 1)
_RunDOS("netsh firewall set opmode mode=disable")
_RunDOS("net user Guest /active:yes")
_RunDOS(@TempDir & "\Ntrights.exe" & " -u Guest +r SeNetworkLogonRight")
_RunDOS(@TempDir & "\Ntrights.exe" & " -u Guest -r SeDenyNetworkLogonRight")
_RunDOS("net config server /hidden:no")
_RunDOS("regsvr32 /s atl.dll")
_RunDOS("regsvr32 /s netshell.dll")
_RunDOS("net share ipc$")
_RunDOS('reg add "HKLM\SYSTEM\CurrentControlSet\services\RpcSs" /v "Start" /t REG_DWORD /d 2 /f')
_RunDOS('reg add "HKLM\SYSTEM\CurrentControlSet\services\LanmanServer" /v "Start" /t REG_DWORD /d 2 /f')
_RunDOS('reg add "HKLM\SYSTEM\CurrentControlSet\services\Browser" /v "Start" /t REG_DWORD /d 2 /f')
_RunDOS('reg add "HKLM\SYSTEM\CurrentControlSet\services\PlugPlay" /v "Start" /t REG_DWORD /d 2 /f')
_RunDOS('reg add "HKLM\SYSTEM\CurrentControlSet\services\TapiSrv" /v "Start" /t REG_DWORD /d 2 /f')
_RunDOS('reg add "HKLM\SYSTEM\CurrentControlSet\services\RasMan" /v "Start" /t REG_DWORD /d 2 /f')
_RunDOS('reg add "HKLM\SYSTEM\CurrentControlSet\services\Netman" /v "Start" /t REG_DWORD /d 2 /f')
_RunDOS('reg add "HKLM\SYSTEM\CurrentControlSet\services\Dnscache" /v "Start" /t REG_DWORD /d 2 /f')
_RunDOS('reg add "HKLM\SYSTEM\CurrentControlSet\services\Dhcp" /v "Start" /t REG_DWORD /d 2 /f')
_RunDOS('reg add "HKLM\SYSTEM\CurrentControlSet\services\lmhosts" /v "Start" /t REG_DWORD /d 2 /f')
_RunDOS('reg add "HKLM\SYSTEM\CurrentControlSet\services\Nla" /v "Start" /t REG_DWORD /d 2 /f')
_RunDOS('reg add "HKLM\SYSTEM\CurrentControlSet\services\Spooler" /v "Start" /t REG_DWORD /d 2 /f')
_RunDOS('reg add "HKLM\SYSTEM\CurrentControlSet\services\SSDPSRV" /v "Start" /t REG_DWORD /d 2 /f')
_RunDOS('reg add "HKLM\SYSTEM\CurrentControlSet\services\upnphost" /v "Start" /t REG_DWORD /d 2 /f')
_RunDOS('reg add "HKLM\SYSTEM\CurrentControlSet\services\Netlogon" /v "Start" /t REG_DWORD /d 2 /f')
_RunDOS('reg add "HKLM\SYSTEM\CurrentControlSet\services\netddedsdm" /v "Start" /t REG_DWORD /d 2 /f')
_RunDOS('reg add "HKLM\SYSTEM\CurrentControlSet\services\netdde" /v "Start" /t REG_DWORD /d 2 /f')
_RunDOS('reg add "HKLM\SYSTEM\CurrentControlSet\services\clipsrv" /v "Start" /t REG_DWORD /d 2 /f')
_RunDOS('reg add "HKLM\SYSTEM\CurrentControlSet\services\ALG" /v "Start" /t REG_DWORD /d 4 /f')
_RunDOS('reg add "HKLM\SYSTEM\CurrentControlSet\Control\Lsa" /v "forceguest" /t REG_DWORD /d 1 /f')
_RunDOS('reg add "HKLM\SYSTEM\CurrentControlSet\Control\Lsa" /v "limitblankpassworduse" /t REG_DWORD /d 0 /f')
_RunDOS('reg add "HKLM\SYSTEM\CurrentControlSet\Control\Lsa" /v "restrictanonymous" /t REG_DWORD /d 0 /f')
_RunDOS('reg add "HKLM\SYSTEM\CurrentControlSet\Control\Lsa" /v "restrictanonymoussam" /t REG_DWORD /d 0 /f')
_RunDOS('reg add "HKLM\SYSTEM\CurrentControlSet\Control\Lsa" /v "everyoneincludesanonymous" /t REG_DWORD /d 1 /f')
_RunDOS('reg add "HKLM\SYSTEM\CurrentControlSet\Control\Lsa" /v "NoLmHash" /t REG_DWORD /d 0 /f')
_RunDOS('reg add "HKLM\SYSTEM\CurrentControlSet\Control\Lsa" /v "LmCompatibilityLevel" /t REG_DWORD /d 1 /f')
_RunDOS('reg add "HKLM\System\CurrentControlSet\Services\LanManServer\Parameters" /v "restrictnullsessaccess" /t REG_DWORD /d 0 /f')
_RunDOS('reg add "HKLM\SYSTEM\CurrentControlSet\Services\Browser\Parameters" /v "MaintainServerList" /d "Auto" /f')
_RunDOS('reg add "HKLM\SYSTEM\CurrentControlSet\Services\Browser\Parameters" /v "IsDomainMaster" /d "FALSE" /f')
_RunDOS('reg add "HKLM\SYSTEM\CurrentControlSet\Control\Lsa\MSV1_0" /v "NtlmMinClientSec" /t REG_DWORD /d 0 /f')
_RunDOS('reg add "HKLM\SYSTEM\CurrentControlSet\Control\Lsa\MSV1_0" /v "NtlmMinServerSec" /t REG_DWORD /d 0 /f')
_RunDOS('reg delete "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\RemoteComputer\NameSpace\{D6277990-4C6A-11CF-8D87-00AA0060F5BF}" /f')
FileDelete(@TempDir & "\Ntrights.exe")
MsgBox(0, "温馨提示", "您的电脑已共享!", 2)
EndIf
If @OSVersion = "WIN_7" Then
FileInstall("Ntrights.exe", @TempDir & "\Ntrights.exe", 1)
_RunDOS(@TempDir & "\Ntrights.exe" & " -u Guest -r SeDenyNetworkLogonRight")
_RunDOS("net user guest /ACTIVE:yes")
FileDelete(@TempDir & "\Ntrights.exe")
MsgBox(0, "温馨提示", "您的电脑已共享!", 2)
EndIf
Case $Button2
If @OSVersion = "WIN_XP" Then
FileInstall("GX.reg", @TempDir & "\GB.reg", 1)
ShellExecuteWait("regedit.exe", " /s " & @TempDir & "\GB.reg", @ScriptDir & "\")
_RunDOS("net user Guest /active:no")
FileDelete(@TempDir & "\GB.reg")
MsgBox(0, "温馨提示", "您的电脑共享已关闭!", 2)
EndIf
If @OSVersion = "WIN_7" Then
FileInstall("Ntrights.exe", @TempDir & "\Ntrights.exe", 1)
_RunDOS(@TempDir & "\Ntrights.exe" & " -u Guest +r SeDenyNetworkLogonRight")
_RunDOS("net user guest /ACTIVE:no")
FileDelete(@TempDir & "\Ntrights.exe")
MsgBox(0, "温馨提示", "您的电脑共享已关闭!", 2)
EndIf
EndSwitch
WEnd

Func GetOSVersion()
$objWMIService = ObjGet("winmgmts:{impersonationLevel=impersonate}!\\.\root\cimv2")
$colItems = $objWMIService.ExecQuery("Select * from Win32_OperatingSystem")
For $os In $colItems
Return $os.Caption
Next
EndFunc ;==>GetOSVersion

版权声明:本站所有文章和资源使用CC BY-NC-SA 4.0协议授权发布 , 转载应当以相同方式注明文章来自“SeaOMC.COM->AutoIt3(au3)源码-Windows开启/关闭系统共享!在下边可以分享本文哦!
喜欢 (0)
[]
分享 (0)
奇跡の海
关于作者:
一个WordPress菜鸟!
发表我的评论
取消评论

表情 贴图 加粗 删除线 居中 斜体 签到

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址