AutoIt3 隐藏显示系统文件+扩展名的脚本实例

来源:互联网 发布:苹果邮箱阿里云邮箱 编辑:程序博客网 时间:2024/06/05 14:31
 #NoTrayIcon
#Region ;**** 参数创建于 AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_icon=ico2.ico
#AutoIt3Wrapper_Compression=4
#AutoIt3Wrapper_UseAnsi=y
#AutoIt3Wrapper_Res_Comment=[显示/隐藏系统文件]版本:绿色版   出自:IsBase
#AutoIt3Wrapper_Res_Description=右键添加[显示/隐藏系统文件]快捷方式
#AutoIt3Wrapper_Res_Fileversion=2.0.0.9
#AutoIt3Wrapper_Res_LegalCopyright=版权所有(C) 1996-2009   、IsBase技术交流
#AutoIt3Wrapper_Res_SaveSource=y
[email=#AutoIt3Wrapper_Res_Field=Email|168@IsBase.net]#AutoIt3Wrapper_Res_Field=Email| 168@IsBase.net[/email]
#AutoIt3Wrapper_Res_Field=QQ/TM| 2611262
#AutoIt3Wrapper_Res_Field=QQ群| 47328822
#AutoIt3Wrapper_Res_Field=技术网站|http://www.IsBase.net
#AutoIt3Wrapper_Res_Field=作者:IsBase
#AutoIt3Wrapper_Res_Field=产品版本| V2009.05.01
#AutoIt3Wrapper_Res_Field=产品名称|[显示/隐藏系统文件] V2009.05.01
#AutoIt3Wrapper_Res_Field=内部说明|[显示/隐藏系统文件] V2009.05.01 IsBase技术交流!不得用于任何商业及非法目的!
#AutoIt3Wrapper_Res_Field=公司|  
#AutoIt3Wrapper_Res_Field=合法商标|  
#AutoIt3Wrapper_Res_Field=内部名称|显示/隐藏系统文件.exe
#AutoIt3Wrapper_Res_Field=源文件名|IsBase.exe
#AutoIt3Wrapper_AU3Check_Stop_OnWarning=y
#AutoIt3Wrapper_Run_Tidy=y
#Tidy_Parameters=/rel
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
#include <GUIConstants.au3>
$Form1 = GUICreate("安装 - 显示/隐藏系统文件", 487, 264, 251, 170)
GUISetIcon("D:\autoit3\ico2.ico")
$GroupBox1 = GUICtrlCreateGroup("", 8, 1, 473, 225)
$Label1 = GUICtrlCreateLabel("【安装】将[显示/隐藏系统文件]加入到右键菜单", 76, 16, 360, 24)
GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif")
GUICtrlSetColor(-1, 0x0000FF)
$Label2 = GUICtrlCreateLabel("【删除】将[显示/隐藏系统文件]从右键菜单删除", 74, 56, 360, 24)
GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif")
GUICtrlSetColor(-1, 0x0000FF)
$Label3 = GUICtrlCreateLabel("注意:请不要对其他窗口操作,以免误操作!", 93, 88, 324, 24)
GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif")
GUICtrlSetColor(-1, 0xFF0000)
$Label4 = GUICtrlCreateLabel("", 63, 120, 385, 24)
GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif")
GUICtrlSetColor(-1, 0x000080)
$Label5 = GUICtrlCreateLabel("超级QQ群:47328822   Email:
168@isbase.net", 60, 160, 390, 24)
GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif")
GUICtrlSetColor(-1, 0x000080)
$Label6 = GUICtrlCreateLabel("版权所有(C) 1996-2009   、IsBase技术交流", 90, 200, 331, 24)
GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif")
GUICtrlSetColor(-1, 0xFF0000)
$Pic1 = GUICtrlCreatePic("D:\autoit3\(自定义图片1).jpg", 23, 16, 44, 44)
$Pic2 = GUICtrlCreatePic("D:\autoit3\(自定义图片2).jpg", 15, 64, 44, 156)
GUICtrlSetTip(-1, "66")
GUICtrlCreateGroup("", -99, -99, 1, 1)
$tab5button1 = GUICtrlCreateButton("安装(&I)", 64, 232, 75, 25, 0)
$tab5button2 = GUICtrlCreateButton("卸载(&U)", 192, 232, 75, 25, 0)
$tab5button3 = GUICtrlCreateButton("退出(&Q)", 320, 232, 75, 25, 0)
GUISetState(@SW_SHOW)
While 1
$msg = GUIGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE
ExitLoop
Case $msg = $tab5button1
RegWrite('HKCR\Directory\Background\shellex\ContextMenuHandlers\SuperHidden', '', 'Reg_sz', '')
RegWrite('HKCR\CLSID\\InProcServer32', '', 'Reg_Expand_sz', '%SystemRoot%\system32\shdocvw.dll')
RegWrite('HKCR\CLSID\\InProcServer32', 'ThreadingModel', 'Reg_sz', 'Apartment')
RegWrite('HKCR\CLSID\\Instance', 'CLSID', 'Reg_sz', '')
RegWrite('HKCR\CLSID\\Instance\InitPropertyBag', 'method', 'Reg_sz', 'ShellExecute')
RegWrite('HKCR\CLSID\\Instance\InitPropertyBag', 'Param1', 'Reg_sz', 'SuperHidden.exe')
RegWrite('HKCR\CLSID\\Instance\InitPropertyBag', 'command', 'Reg_sz', '[显示/隐藏系统文件]')
RegWrite('HKCR\CLSID\\Instance\InitPropertyBag', 'CLSID', 'Reg_sz', '')
RegWrite('HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced', 'ShowSuperHidden', 'Reg_Dword', '0x00000000')
RegWrite('HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced', 'Hidden', 'Reg_Dword', '0x00000002')
FileInstall("SuperHidden.exe", @SystemDir & "\")
If Not IsDeclared("sToolTipAnswer") Then Local $sToolTipAnswer
$sToolTipAnswer = ToolTip("显示/隐藏系统文件 V2.2.09 已经安装卸载" & @CRLF & " 本程序由IsBase制作完成" & @CRLF & "   仅供安全技术研究及绿兵内部交流使用" & @CRLF & " 不得散播到其他网站" & @CRLF & " 谢谢您的使用!5秒后自动退出" & @CRLF & " 版权所有(C) 1996-2009   、IsBase技术交流", 400, 500, "右键添加[显示/隐藏系统文件]软件安装成功", 1, 1)
Sleep(5000)
_quit()
Case $msg = $tab5button2
RegDelete("HKCR\CLSID\")
RegDelete("HKCR\Directory\Background\shellex\ContextMenuHandlers\SuperHidden")
FileDelete(@SystemDir & "\SuperHidden.exe")
If Not IsDeclared("sToolTipAnswer") Then Local $sToolTipAnswer
$sToolTipAnswer = ToolTip("[显示/隐藏系统文件] V2009.05.01 已经成功卸载" & @CRLF & " 本程序由IsBase制作完成" & @CRLF & "   仅供安全技术研究及绿兵内部交流使用" & @CRLF & " 不得散播到其他网站" & @CRLF & " 谢谢您的使用!5秒后自动退出" & @CRLF & " 版权所有(C) 1996-2009   、IsBase技术交流", 400, 500, "右键添加[显示/隐藏系统文件]软件卸载成功", 1, 1)
Sleep(5000)
_quit()
Case $msg = $tab5button3
GUICtrlSetState($tab5button3, $GUI_DISABLE)
ToolTip("正在退出右键添加[显示/隐藏系统文件]软件,请稍候....", @DesktopWidth - 600, @DesktopHeight - 300, "", 0, 1)
Sleep(1500)
_quit()
EndSelect

WEnd
Func _quit()
Exit
EndFunc ;==>_quit

if RegWrite('HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced', 'ShowSuperHidden', 'Reg_Dword', '0x00000000') = RegWrite('HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced', 'ShowSuperHidden', 'Reg_Dword', '0x00000000') then

RegWrite('HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced', 'HideFileExt', 'Reg_Dword', '0x00000001')
RegWrite('HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced', 'Hidden', 'Reg_Dword', '0x00000002')
RegWrite('HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced', 'ShowSuperHidden', 'Reg_Dword', '0x00000000')
RegWrite('HKCR\CLSID\\Instance\InitPropertyBag', 'command', 'Reg_sz', '显示/隐藏[系统文件,扩展名]')
Send ("""""")
;MsgBox(0, "显示/隐藏[系统文件,扩展名]","OK! 您已经可以查看系统隐藏文件和它们的扩展名啦!", 2)
EndIf
if RegWrite('HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced', 'ShowSuperHidden', 'Reg_Dword', '0x00000001') = RegWrite('HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced', 'ShowSuperHidden', 'Reg_Dword', '0x00000001') then

RegWrite('HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced', 'HideFileExt', 'Reg_Dword', '0x00000000')
RegWrite('HKCU\Software\Microsoft"e\Windows\CurrentVersion\Explorer\Advanced', 'Hidden', 'Reg_Dword', '0x00000001')
RegWrite('HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced', 'ShowSuperHidden', 'Reg_Dword', '0x00000001')
RegWrite('HKCR\CLSID\\Instance\InitPropertyBag', 'command', 'Reg_sz', '显示/隐藏[系统文件,扩展名]')
Send ("""""")
;'WSHShell.Popup "OK! 现在已经隐藏了系统隐藏文件和它们的扩展名啦!", 1, sTitle2, vbInformation
EndIf

注意部分文件路径及注释请以实际路径为准!以上仅供参考!



                  AutoIt3 提升权限进行局域网时间校对的脚本实例

#NoTrayIcon
#include <GuiConstants.au3>
#include <Constants.au3>
Global $ourProcess,$txt,$cl,$i,$date,$kcd=0,$time
Global $retime[3]                      ;时间数组
Global $CF[5]                               ;年月日时间数组
Global $r[6]                               ;最终分析比对数组,以便确定是否要改写时间
If $cmdline[0] = 0 Then                 ;无参数提示
      MsgBox(48,'请填写正确参数
[email=!@ToMan]!@ToMan','[/email]如要改时间请在程序后面加参数如: DFTime 192.168.0.10 只需填服务器IP就可以了')
      Exit
EndIf
$ourProcess = Run(@ComSpec & ' /k net time \' & $cmdline[1],'', @SW_HIDE, $STDOUT_CHILD + $STDIN_CHILD)       ;获取局域网服务器的时间数据
$txt = StdoutRead($ourProcess)
$cl = StringTrimLeft($txt,StringInStr($txt,'是')+1)       ;去除无效字符
$CF = StringSplit($cl,' ')                                                       ;分离获取年月日时间
$date = $CF[2]
If StringIsDigit(StringStripWS($CF[3],8)) = 0 Then       ;识别时间所在数组,并识别上午、下午或24小时制
      if $CF[3]="下午" Then $kcd=12                                              ;如果是下午,则加上12小时时差
      $time = $CF[4]
      $retime=StringSplit(StringStripWS($time,8),":")
      $time=$retime[1]+$kcd&":"&$retime[2]
Else
      $time = $CF[3]
EndIf
$r=StringSplit($date&"/"&$retime[1]+$kcd&"/"&$retime[2],"/")       ;取年月日时分进行比对,以明确是否执行写入操作
if StringLen ($r[1])=1 Then $r[1]=000&$r[1]                      ;补齐年位数
if StringLen ($r[1])=2 Then $r[1]=00&$r[1]
if StringLen ($r[1])=3 Then $r[1]=0&$r[1]
if StringLen ($r[2])=1 Then $r[2]=0&$r[2]                      ;补齐月位数
if StringLen ($r[3])=1 Then $r[3]=0&$r[3]                      ;补齐日位数
if StringLen ($r[4])=1 Then $r[4]=0&$r[4]                      ;补齐时位数
if StringLen ($r[5])=1 Then $r[5]=0&$r[5]                      ;补齐分位数
;MsgBox(0,"test",$r[1]&$r[2]&$r[3]&$r[4]&$r[5]&@CRLF&@YEAR&@MON&@MDAY&@HOUR&@MIN)
if @YEAR=$r[1] and @MON=$r[2] and @MDAY=$r[3] and @HOUR=$r[4] and @MIN=$r[5] Then
      Exit
Else
      FileInstall('..\..\cmd\wsu.exe',@TempDir&'\')
      RunWait(@ComSpec & " /C "
[email=&@TempDir]&@TempDir[/email]& '\wsu ' & '"' & 'cmd /c echo ' & $date & '|date' & '"','', @SW_HIDE)
      RunWait(@ComSpec & " /C "
[email=&@TempDir]&@TempDir[/email]& '\wsu ' & '"' & 'cmd /c echo ' & StringStripWS($time,8) & '|time' & '"','', @SW_HIDE)
      FileDelete(@TempDir&"\wsu.exe")
      Exit
EndIf



            AutoIt3 FTP文件上传下载器的脚本实例

#NoTrayIcon
#include <GUIConstants.au3>
#include "
ftp.au3"
#include <file.au3>
$z_ver = "V2.1.505"
$title = "FTP文件上传下载器 " & $z_ver
Global $ftpserverinfo = "
ftp.ini"
If( Not FileExists($ftpserverinfo) ) Then
MsgBox(48,"ERROR","配置文件 "&$ftpserverinfo&" 丢失!")
Exit
EndIf
Dim $ftp_ip = IniRead($ftpserverinfo, "serverinfo", "ip", "")
Dim $ftp_name = IniRead($ftpserverinfo, "serverinfo", "name", "")
Dim $ftp_pass = IniRead($ftpserverinfo, "serverinfo", "pass", "")
Dim $ftp_ctrlport = IniRead($ftpserverinfo, "serverinfo", "ctrlport", "")
Dim $ftp_dataport = IniRead($ftpserverinfo, "serverinfo", "dataport", "")

$gui_main = GUICreate($title, 320,130, @DesktopWidth/2-160, @DesktopHeight/2-45, -1, 0x00000018); WS_EX_ACCEPTFILES
;~ $Dummy1 = GUICtrlCreateDummy()
$Label_txt = GUICtrlCreateLabel("请将要上传的文件拖动到下面的文本框中", 11, 13, 220, 17)
$input_file = GUICtrlCreateInput ( "", 10, 35, 300, 20)
GUICtrlSetState(-1,$GUI_DROPACCEPTED)
GUICtrlCreateLabel("FTP服务器:" & $ftp_ip, 11, 78, 220, 17)
GUICtrlSetState(-1, $GUI_DISABLE)
GUICtrlCreateLabel("Powered by zeebit", 210, 116, 180, 17)
GUICtrlSetState(-1, $GUI_DISABLE)
$btn_upload = GUICtrlCreateButton ("上传", 160, 75, 49, 20)
$btn_download = GUICtrlCreateButton ("下载", 210, 75, 49, 20)
$btn_help = GUICtrlCreateButton ("帮助", 260, 75, 49, 20)
$Graphic1 = GUICtrlCreateGraphic(0, 98, 320, 18)
GUICtrlSetBkColor(-1, 0xD4D0C8)
$Label_stat = GUICtrlCreateLabel("欢迎使用 "&$title, 11, 101, 320, 14)
GUICtrlSetBkColor(-1, 0xD4D0C8)
GUISetState ()

$gui_help = GUICreate($title, 320,130, @DesktopWidth/2-160, @DesktopHeight/2-45, -1, 0x00000018); WS_EX_ACCEPTFILES
;~ $Icon = GUICtrlCreateIcon("d:\My Documents\icon\favicon.ico", 0, 288, 0, 32, 32, BitOR($SS_NOTIFY,$WS_GROUP))
;~ $Label_h0 = GUICtrlCreateLabel("注意:", 11, 13, 320, 17)
$Label_h1 = GUICtrlCreateLabel("1、正被打开着的文件,上传时可能会失败。", 12, 13, 270, 17)
$Label_h2 = GUICtrlCreateLabel("2、在文本框中输入完整准确的文件名,再点“下载”,可以从FTP服务器下载指定文件到桌面。", 12, 33, 300, 34)
$Label_h3 = GUICtrlCreateLabel("3、如果提示连接FTP服务器出错,请确定网络畅通且服务器运行正常。", 12, 66, 310, 27)
$btn_back = GUICtrlCreateButton ("返回", 250, 95, 60, 20)
GUICtrlCreateLabel("Powered by zeebit", 210, 116, 180, 17)
GUICtrlSetState(-1, $GUI_DISABLE)
GUISetState(@SW_HIDE, $gui_help)

Local $nMsg
While 1
$nMsg = GUIGetMsg()
Select
Case $nMsg = $GUI_EVENT_CLOSE
Exit
Case $nMsg = $btn_help
GUISetState(@SW_HIDE, $gui_main)
GUISetState(@SW_SHOW, $gui_help)
Case $nMsg = $btn_back
GUISetState(@SW_HIDE, $gui_help)
GUISetState(@SW_SHOW, $gui_main)
Case $nMsg = $btn_download
$full_path = GUICtrlRead($input_file)
If($full_path=="") Then
    GUICtrlSetData($Label_stat,"请输入要下载的文件名!")
    GUICtrlSetBkColor(-1, 0xD4D0C8)
    ContinueLoop
EndIf
GUICtrlSetState($btn_download, $GUI_DISABLE)
$array_filename = StringSplit($full_path,"\")
$file_name = $array_filename[$array_filename[0]]
$error_i = 0
$dllhandle = DllOpen( 'wininet.dll' )
    if @error then
   GUICtrlSetData($Label_stat,"DllOpen wininet.dll Failed")
    EndIf
$z_ftpOpen = _FTPOpen('MyFTP_Control')
    if @error then
   GUICtrlSetData($Label_stat,"打开FTP会话出错!")
   GUICtrlSetBkColor(-1, 0xD4D0C8)
    EndIf
$z_ftpConn = _FTPConnect($z_ftpOpen, $ftp_ip, $ftp_name, $ftp_pass, $ftp_ctrlport)
    if @error then
   GUICtrlSetData($Label_stat,"连接FTP服务器出错!")
   GUICtrlSetBkColor(-1, 0xD4D0C8)
   $error_i = $error_i+1
;~    ContinueLoop
    EndIf
If($error_i==0) Then
    $z_ftpPut = _FtpGetFile($z_ftpConn, '/'&$file_name, @DesktopDir & '\' & $file_name,1,0)
    if @error then
   GUICtrlSetData($Label_stat,"从FTP服务器下载文件时出错!")
   GUICtrlSetBkColor(-1, 0xD4D0C8)
   $error_i = $error_i+1
    EndIf
EndIf
$z_ftpColse = _FTPClose($z_ftpOpen)
    if @error then
   GUICtrlSetData($Label_stat,"结束FTP会话出错!")
   GUICtrlSetBkColor(-1, 0xD4D0C8)
    EndIf
DllClose($dllhandle)
    if @error then
   GUICtrlSetData($Label_stat,"DllClose wininet.dll Failed")
    EndIf
GUICtrlSetData($input_file,"")
If($error_i ==0) then
    GUICtrlSetData($Label_stat,"“"&$file_name&"”成功下载到桌面!")
    GUICtrlSetBkColor(-1, 0xD4D0C8)
EndIf
$error_i = 0
GUICtrlSetState($btn_download, $GUI_ENABLE)
Case $nMsg = $btn_upload
$full_path = GUICtrlRead($input_file)
If($full_path=="") Then
    GUICtrlSetData($Label_stat,"请选择要上传的文件!")
    GUICtrlSetBkColor(-1, 0xD4D0C8)
    ContinueLoop
EndIf
GUICtrlSetState($btn_upload, $GUI_DISABLE)
$array_filename = StringSplit($full_path,"\")
$file_name = $array_filename[$array_filename[0]]
$error_i = 0
$dllhandle = DllOpen( 'wininet.dll' )
    if @error then
   GUICtrlSetData($Label_stat,"DllOpen wininet.dll Failed")
    EndIf
$z_ftpOpen = _FTPOpen('MyFTP_Control')
    if @error then
   GUICtrlSetData($Label_stat,"打开FTP会话出错!")
   GUICtrlSetBkColor(-1, 0xD4D0C8)
    EndIf
$z_ftpConn = _FTPConnect($z_ftpOpen, $ftp_ip, $ftp_name, $ftp_pass, $ftp_ctrlport)
    if @error then
   GUICtrlSetData($Label_stat,"连接FTP服务器出错!")
   GUICtrlSetBkColor(-1, 0xD4D0C8)
   $error_i = $error_i+1
;~    ContinueLoop
    EndIf
If($error_i==0) Then
    $z_ftpPut = _FtpPutFile($z_ftpConn, $full_path, '/'&$file_name)
    if @error then
   GUICtrlSetData($Label_stat,"上传文件到FTP服务器时出错!")
   GUICtrlSetBkColor(-1, 0xD4D0C8)
   $error_i = $error_i+1
    EndIf
EndIf
$z_ftpColse = _FTPClose($z_ftpOpen)
    if @error then
   GUICtrlSetData($Label_stat,"结束FTP会话出错!")
   GUICtrlSetBkColor(-1, 0xD4D0C8)
    EndIf
DllClose($dllhandle)
    if @error then
   GUICtrlSetData($Label_stat,"DllClose wininet.dll Failed")
    EndIf
GUICtrlSetData($input_file,"")
If($error_i ==0) then
    GUICtrlSetData($Label_stat,"“"&$file_name&"”上传成功!")
    GUICtrlSetBkColor(-1, 0xD4D0C8)
EndIf
$error_i = 0
GUICtrlSetState($btn_upload, $GUI_ENABLE)
EndSelect
WEnd

ftp.ini配置文件内容
[serverinfo] ip="127.0.0.1"----------------这个根据实际情况修改 name="ftp" pass="ftp" ctrlport="21"---------------这个暂时没用到 dataport="22"------------------这个暂时没用到
原创粉丝点击