找回密码
 加入
搜索
查看: 1665|回复: 4

求网克收尾工具源码

[复制链接]
发表于 2009-3-26 18:28:12 | 显示全部楼层 |阅读模式
网克收尾工具,  
功能:  按MAC 修改 机器名,IP 及IPX 及分辨率及CS 码

Thinking 大侠的

Thinking_Ghost_ending_v2.0  有这功能,但试过还是会部分修改不过来

网上找了好多工具都有点不稳定,有时总修改不过来,想自己编下,好知道问题在哪
发表于 2009-3-26 18:32:27 | 显示全部楼层
config.ini如下
自已修改下


[MacSm]
mac=机名|IP
00-1D-0F-24-66-1E=NetGame|192.168.0.254
00-E0-61-15-C5-43=A001|192.168.0.11
00-E0-61-16-12-01=A002|192.168.0.12
00-E0-61-15-C8-DC=A003|192.168.0.13
#Region AutoIt3Wrapper 预编译参数(完整参数)
;** 这个列表中中的编译器定义是为 AutoIt3Wrapper.exe 使用的,同时也兼容ACN论坛的ACNWrapper.exe.
;** 注释行不需要您删除,这是一些描述信息,不会到最终的EXE中.
;===============================================================================================================
;** AUTOIT3 设置
#AutoIt3Wrapper_UseAnsi=N                       ;(Y/N) 使用 Ansi 版本的 AutoIt3a/AUT2EXEa. 默认=N(3.2.13.1开始此函数失效)
#AutoIt3Wrapper_UseX64=                         ;(Y/N) 使用 X64 版本的 AutoIt3_x64/AUT2EXE_x64. 默认=N
#AutoIt3Wrapper_Run_Debug_Mode=                 ;(Y/N) 运行脚本于控制图调试. 默认=N
;===============================================================================================================
;** AUT2EXE 设置
#AutoIt3Wrapper_Icon=ico.ico                           ;需要使用的图标(路径)名称
#AutoIt3Wrapper_OutFile=Ghost自动设置工具.exe                        ;目标 exe/a3x 文件名.
#AutoIt3Wrapper_OutFile_Type=exe                ;a3x=小型 AutoIt3 文件; exe=标准可执行文件(默认)
#AutoIt3Wrapper_Compression=4                    ;压缩参数 0-4 ?=低 2=中 4=高 默认=2
#AutoIt3Wrapper_UseUpx=                         ;(Y/N) 压缩输出的程序.  默认=Y
#AutoIt3Wrapper_Change2CUI=                     ;(Y/N) 修改输出的程序为CUI(控制台程序). 默认=N
;===============================================================================================================
;** 目标程序资源信息
#AutoIt3Wrapper_Res_Comment=根据MAC地址全自动修改[计算机名]-[IP]-[IPX]-[网关]-[DNS]-[CS-CDKey]-[IE]等                    ;注释
#AutoIt3Wrapper_Res_Description=GHOST后自动设置网吧版-飛翔浪子制作               ;详细信息
#AutoIt3Wrapper_Res_Fileversion=9.1.16.11
#AutoIt3Wrapper_Res_FileVersion_AutoIncrement=p  ;(Y/N/P)自动更新版本  . 默认=N P=提示
;                                              
#AutoIt3Wrapper_Res_Language=2052                   ;资源语言代码. 官方默认 2057=英语 (英国),ACN版本默认 2052=简体中文(中国)
#AutoIt3Wrapper_Res_LegalCopyright=By-Jycel QQ:472891322             ;版权
#AutoIt3Wrapper_res_requestedExecutionLevel=    ;None, asInvoker, highestAvailable or requireAdministrator   (默认=None)
                                                                                                ;无  , 请求     ,最高权限        或者  需求管理员权限
#AutoIt3Wrapper_Res_SaveSource=                 ;(Y/N) 保持源代码备份到EXE资源中. 默认=N
#cs ____________________________________

 AU3 版本:V3 
 脚本作者:飞翔浪子 
        Email:jycel@163.com
        QQ/TM: 472891322
 脚本版本: 9.1.16.9
 脚本功能: 根据MAC地址全自动修改[计算机名]-[IP]-[IPX]-[网关]-[DNS]-[CS-CDKey]-[IE]等 

#ce _______________脚本开始_________________
#NoTrayIcon;不显示托盘图标
$g_szVersion = "MacSm 2.3"
If WinExists($g_szVersion) Then Exit
AutoItWinSetTitle($g_szVersion)
HotKeySet("{ESC}", "_Terminate")

Dim $ie,$ie1,$ie2,$bt,$dns[2]
$bt="飛翔網絡-将快乐网起来! Tel:2624067 地址:西南科技大学飛翔網絡城";ie标题
 
Dim $Msg = '本机修改信息如下' & @CRLF & @CRLF
If Not @OSType = "WIN32_NT" OR Not @OSLang = "0804" then;判断是否支持此系统
 MsgBox(16, "错误", "本程序不支持此系统",10)
 Exit
EndIf

;设置配置文件路径
$MacSm = "config.ini"
If Not FileExists($MacSm) Then
 $MacSm = @ScriptDir & "\config.ini"
  If Not FileExists($MacSm) Then
   $MacSm = @WorkingDir & "\config.ini"
  EndIf
EndIf


If Not FileExists($MacSm) Then
MsgBox(48,"温馨提醒您:", "未找到程序配置文件,程序将自动创建."& @CRLF &"请使用服务端工具扫描配置信息.")
        IniWrite("config.ini", "版权信息", "飛翔浪子","QQ:472891322")
    IniWrite("config.ini", "版权信息", "E-mail","jycel@qq.com")
        IniWrite("config.ini", "版权信息", "作者空间","http://472891322.qzone.qq.com/"&@CRLF)
        IniWrite("config.ini", "Setting", "Mask","192.168.0.1")
        IniWrite("config.ini", "Setting", "GateWay","255.255.255.0")
        IniWrite("config.ini", "Setting", "主DNS","202.98.96.68")
        IniWrite("config.ini", "Setting", "副DNS","61.139.2.69")
        IniWrite("config.ini", "Setting", "ie","http://192.168.0.136"&@CRLF)
        IniWrite("config.ini", "MacSm", "mac","机名|IP"&@CRLF)
        IniWrite("config.ini", "Cs15Key", "1","6801563651288")
        IniWrite("config.ini", "Cs15Key", "2","3294345689725")
        IniWrite("config.ini", "Cs15Key", "3","2292823454228")
        IniWrite("config.ini", "Cs15Key", "4","7842715618877")
        IniWrite("config.ini", "Cs15Key", "5","3865568763903")
        IniWrite("config.ini", "Cs15Key", "6","5013955315983")
        IniWrite("config.ini", "Cs15Key", "7","3094945136861")
        IniWrite("config.ini", "Cs15Key", "8","2726631268402")
        IniWrite("config.ini", "Cs15Key", "9","1421339652155")
        IniWrite("config.ini", "Cs15Key", "10","2293026703085")
        IniWrite("config.ini", "Cs15Key", "11","1977560827768")
        IniWrite("config.ini", "Cs15Key", "12","2996620270749")
        IniWrite("config.ini", "Cs15Key", "13","0072430366426")
        IniWrite("config.ini", "Cs15Key", "14","7893392675840")
        IniWrite("config.ini", "Cs15Key", "15","2623436581467")
        IniWrite("config.ini", "Cs15Key", "16","2367234335487")
        IniWrite("config.ini", "Cs15Key", "17","5899430794142")
        IniWrite("config.ini", "Cs15Key", "18","6373906794557")
        IniWrite("config.ini", "Cs15Key", "19","0186166087129")
        IniWrite("config.ini", "Cs15Key", "20","9309282185282")
        IniWrite("config.ini", "Cs15Key", "21","9942810937876")
        IniWrite("config.ini", "Cs15Key", "22","2702926069367")
        IniWrite("config.ini", "Cs15Key", "23","2873922711009")
        IniWrite("config.ini", "Cs15Key", "24","3182452724788")
        IniWrite("config.ini", "Cs15Key", "25","2881320716061")
        IniWrite("config.ini", "Cs15Key", "26","3882348620722")
        IniWrite("config.ini", "Cs15Key", "27","2498521763020")
        IniWrite("config.ini", "Cs15Key", "28","9745406730972")
        IniWrite("config.ini", "Cs15Key", "29","3995846325049")
        IniWrite("config.ini", "Cs15Key", "30","3990645369061")
        IniWrite("config.ini", "Cs15Key", "31","3881442673780")
        IniWrite("config.ini", "Cs15Key", "32","4722953384569")
        IniWrite("config.ini", "Cs15Key", "33","5991335738183")
        IniWrite("config.ini", "Cs15Key", "34","0943245009979")
        IniWrite("config.ini", "Cs15Key", "35","0057329934856")
        IniWrite("config.ini", "Cs15Key", "36","7597026797903")
        IniWrite("config.ini", "Cs15Key", "37","1509899106786")
        IniWrite("config.ini", "Cs15Key", "38","9080368774300")
        IniWrite("config.ini", "Cs15Key", "39","2306437281560")
        IniWrite("config.ini", "Cs15Key", "40","8047751630688")
        IniWrite("config.ini", "Cs15Key", "41","2572265422347")
        IniWrite("config.ini", "Cs15Key", "42","2897524202721")
        IniWrite("config.ini", "Cs15Key", "43","9525803960507")
        IniWrite("config.ini", "Cs15Key", "44","3896321644454")
        IniWrite("config.ini", "Cs15Key", "45","2575508916775")
        IniWrite("config.ini", "Cs15Key", "46","3832845609762")
        IniWrite("config.ini", "Cs15Key", "47","5109677149369")
        IniWrite("config.ini", "Cs15Key", "48","2007224885708")
        IniWrite("config.ini", "Cs15Key", "49","2304525119809")
        IniWrite("config.ini", "Cs15Key", "50","0700233570541")
        IniWrite("config.ini", "Cs15Key", "51","3892248363021")
        IniWrite("config.ini", "Cs15Key", "52","3049152178425")
        IniWrite("config.ini", "Cs15Key", "53","0143005967914")
        IniWrite("config.ini", "Cs15Key", "54","5895638781104")
        IniWrite("config.ini", "Cs15Key", "55","5512355833199")
        IniWrite("config.ini", "Cs15Key", "56","2348134376448")
        IniWrite("config.ini", "Cs15Key", "57","3005789616110")
        IniWrite("config.ini", "Cs15Key", "58","2492629725023")
        IniWrite("config.ini", "Cs15Key", "59","7169336493198")
        IniWrite("config.ini", "Cs15Key", "60","5498338402186")
        IniWrite("config.ini", "Cs15Key", "61","2810029507117")
        IniWrite("config.ini", "Cs15Key", "62","8295771797102")
        IniWrite("config.ini", "Cs15Key", "63","1320904578028")
        IniWrite("config.ini", "Cs15Key", "64","5531764511342")
        IniWrite("config.ini", "Cs15Key", "65","5898238712127")
        IniWrite("config.ini", "Cs15Key", "66","5998632785122")
        IniWrite("config.ini", "Cs15Key", "67","0514846371932")
        IniWrite("config.ini", "Cs15Key", "68","0416231170064")
        IniWrite("config.ini", "Cs15Key", "69","3015038603991")
        IniWrite("config.ini", "Cs15Key", "70","2120338265425")
        IniWrite("config.ini", "Cs15Key", "71","9589846712664")
        IniWrite("config.ini", "Cs15Key", "72","3667588858575")
        IniWrite("config.ini", "Cs15Key", "73","5464829472848")
        IniWrite("config.ini", "Cs15Key", "74","2833689982865")
        IniWrite("config.ini", "Cs15Key", "75","3997145348020")
        IniWrite("config.ini", "Cs15Key", "76","2494731044643")
        IniWrite("config.ini", "Cs15Key", "77","1150596958039")
        IniWrite("config.ini", "Cs15Key", "78","3398042694766")
        IniWrite("config.ini", "Cs15Key", "79","3799042684746")
        IniWrite("config.ini", "Cs15Key", "80","2701338554560")
        IniWrite("config.ini", "Cs15Key", "81","4879687250041")
        IniWrite("config.ini", "Cs15Key", "82","2128042478263")
        IniWrite("config.ini", "Cs15Key", "83","3578243538587")
        IniWrite("config.ini", "Cs15Key", "84","3096244508581")
        IniWrite("config.ini", "Cs15Key", "85","4336435699588")
        IniWrite("config.ini", "Cs15Key", "86","2317233759548")
        IniWrite("config.ini", "Cs15Key", "87","2727132555486")
        IniWrite("config.ini", "Cs15Key", "88","6996551041203")
        IniWrite("config.ini", "Cs15Key", "89","0463262884916")
        IniWrite("config.ini", "Cs15Key", "90","2792231045626")
        IniWrite("config.ini", "Cs15Key", "91","1154247940716")
        IniWrite("config.ini", "Cs15Key", "92","2344284682451")
        IniWrite("config.ini", "Cs15Key", "93","2146333363483")
        IniWrite("config.ini", "Cs15Key", "94","7040402632368")
        IniWrite("config.ini", "Cs15Key", "95","5555142687861")
        IniWrite("config.ini", "Cs15Key", "96","3922648525588")
        IniWrite("config.ini", "Cs15Key", "97","2498020435749")
        IniWrite("config.ini", "Cs15Key", "98","8039436549949")
        IniWrite("config.ini", "Cs15Key", "99","2696734026608")
        IniWrite("config.ini", "Cs15Key", "100","2396032072643")
        IniWrite("config.ini", "Cs15Key", "101","5634030696618")
        IniWrite("config.ini", "Cs15Key", "102","8362321875446")
        IniWrite("config.ini", "Cs15Key", "103","9748585333927")
        IniWrite("config.ini", "Cs15Key", "104","9539130852949")
        IniWrite("config.ini", "Cs15Key", "105","9724143611498")
        IniWrite("config.ini", "Cs15Key", "106","9035730237150")
        IniWrite("config.ini", "Cs15Key", "107","1765628747642")
        IniWrite("config.ini", "Cs15Key", "108","8267335625064")
        IniWrite("config.ini", "Cs15Key", "109","9872308440938")
        IniWrite("config.ini", "Cs15Key", "110","0040945670291")
        IniWrite("config.ini", "Cs15Key", "111","7437120445097")
        IniWrite("config.ini", "Cs15Key", "112","2914557016520")
        IniWrite("config.ini", "Cs15Key", "113","5201939075592")
        IniWrite("config.ini", "Cs15Key", "114","7023459460265")
        IniWrite("config.ini", "Cs15Key", "115","0004084032358")
        IniWrite("config.ini", "Cs15Key", "116","2579488650504")
        IniWrite("config.ini", "Cs15Key", "117","1435403495605")
        IniWrite("config.ini", "Cs15Key", "118","5722891164576")
        IniWrite("config.ini", "Cs15Key", "119","5812923357220")
        IniWrite("config.ini", "Cs15Key", "120","0684570142794")
        IniWrite("config.ini", "Cs15Key", "121","9051295359780")
        IniWrite("config.ini", "Cs15Key", "122","0766160464649")
        IniWrite("config.ini", "Cs15Key", "123","6023089585711")
        IniWrite("config.ini", "Cs15Key", "124","7282726715071")
        IniWrite("config.ini", "Cs15Key", "125","6965198320844")
        IniWrite("config.ini", "Cs15Key", "126","0590638349985")
        IniWrite("config.ini", "Cs15Key", "127","4887920308855")
        IniWrite("config.ini", "Cs15Key", "128","6224273676938")
        IniWrite("config.ini", "Cs15Key", "129","0234070701672")
        IniWrite("config.ini", "Cs15Key", "130","6829133462999")
        IniWrite("config.ini", "Cs15Key", "131","1514397024359")
        IniWrite("config.ini", "Cs15Key", "132","0338114504295")
        IniWrite("config.ini", "Cs15Key", "133","9180097837863")
        IniWrite("config.ini", "Cs15Key", "134","5695926015450")
        IniWrite("config.ini", "Cs15Key", "135","3160620118964")
        IniWrite("config.ini", "Cs15Key", "136","1190096475687")
        IniWrite("config.ini", "Cs15Key", "137","8359933291311")
        IniWrite("config.ini", "Cs15Key", "138","2696985056117")
        IniWrite("config.ini", "Cs15Key", "139","7853809758364")
        IniWrite("config.ini", "Cs15Key", "140","2111724559521")
        IniWrite("config.ini", "Cs15Key", "141","0578332166402")
        IniWrite("config.ini", "Cs15Key", "142","5735257958665")
        IniWrite("config.ini", "Cs15Key", "143","7914860615387")
        IniWrite("config.ini", "Cs15Key", "144","4063606421917")
        IniWrite("config.ini", "Cs15Key", "145","3419830076512")
        IniWrite("config.ini", "Cs15Key", "146","7381489152175")
        IniWrite("config.ini", "Cs15Key", "147","1628431817077")
        IniWrite("config.ini", "Cs15Key", "148","2876552803407")
        IniWrite("config.ini", "Cs15Key", "149","8856983770314")
        IniWrite("config.ini", "Cs15Key", "150","7530358675181")
        IniWrite("config.ini", "Cs15Key", "151","5174560117316")
        IniWrite("config.ini", "Cs15Key", "152","7322581102730")
        IniWrite("config.ini", "Cs15Key", "153","0719965552707")
        IniWrite("config.ini", "Cs15Key", "154","5620798081913")
        IniWrite("config.ini", "Cs15Key", "155","3185381184427")
        IniWrite("config.ini", "Cs15Key", "156","8680457335754")
        IniWrite("config.ini", "Cs15Key", "157","9869960983369")
        IniWrite("config.ini", "Cs15Key", "158","6915151587317")
        IniWrite("config.ini", "Cs15Key", "159","1272066388570")
        IniWrite("config.ini", "Cs15Key", "160","9301433546382")
        IniWrite("config.ini", "Cs15Key", "161","5817471724979")
        IniWrite("config.ini", "Cs15Key", "162","7946642797514")
        IniWrite("config.ini", "Cs15Key", "163","3926072554435")
        IniWrite("config.ini", "Cs15Key", "164","9956746016428")
        IniWrite("config.ini", "Cs15Key", "165","0590651353471")
        IniWrite("config.ini", "Cs15Key", "166","1714170985947")
        IniWrite("config.ini", "Cs15Key", "167","5499802054656")
        IniWrite("config.ini", "Cs15Key", "168","1163480853697")
        IniWrite("config.ini", "Cs15Key", "169","3739923265822")
        IniWrite("config.ini", "Cs15Key", "170","3354655249230")
        IniWrite("config.ini", "Cs15Key", "171","1204514178341")
        IniWrite("config.ini", "Cs15Key", "172","8144711732971")
        IniWrite("config.ini", "Cs15Key", "173","8451579776433")
        IniWrite("config.ini", "Cs15Key", "174","8206536922064")
        IniWrite("config.ini", "Cs15Key", "175","7267404852062")
        IniWrite("config.ini", "Cs15Key", "176","6365487067597")
        IniWrite("config.ini", "Cs15Key", "177","4919689608720")
        IniWrite("config.ini", "Cs15Key", "178","2960547428824")
        IniWrite("config.ini", "Cs15Key", "179","0504759069059")
        IniWrite("config.ini", "Cs15Key", "180","3050776320471")
        IniWrite("config.ini", "Cs15Key", "181","0694888961606")
        IniWrite("config.ini", "Cs15Key", "182","9655746791606")
        IniWrite("config.ini", "Cs15Key", "183","9610972107773")
        IniWrite("config.ini", "Cs15Key", "184","7937556243769")
        IniWrite("config.ini", "Cs15Key", "185","5898414073778")
        IniWrite("config.ini", "Cs15Key", "186","8334441434100")
        IniWrite("config.ini", "Cs15Key", "187","5988643975322")
        IniWrite("config.ini", "Cs15Key", "188","3522855506549")
        IniWrite("config.ini", "Cs15Key", "189","2721837712087")
        IniWrite("config.ini", "Cs15Key", "190","0375939353208")
        IniWrite("config.ini", "Cs15Key", "191","8326908182312")
        IniWrite("config.ini", "Cs15Key", "192","0058411868073")
        IniWrite("config.ini", "Cs15Key", "193","7386866002317")
        IniWrite("config.ini", "Cs15Key", "194","9415036075966")
        IniWrite("config.ini", "Cs15Key", "195","9415034784963")
        IniWrite("config.ini", "Cs15Key", "196","9268017928447")
        IniWrite("config.ini", "Cs15Key", "197","2554301377411")
        IniWrite("config.ini", "Cs15Key", "198","6199709193805")
        IniWrite("config.ini", "Cs15Key", "199","6595690064434")
        IniWrite("config.ini", "Cs15Key", "200","8764101331054")
        IniWrite("config.ini", "Cs15Key", "201","8695699602249")
        IniWrite("config.ini", "Cs15Key", "202","3953514404409")
        IniWrite("config.ini", "Cs15Key", "203","6308441865835")
        IniWrite("config.ini", "Cs15Key", "204","5438918032640")
        IniWrite("config.ini", "Cs15Key", "205","3567485290466")
        IniWrite("config.ini", "Cs15Key", "206","8052441431786")
Exit
EndIf

;定义变量
$RUN1 = @ScriptDir & "\config.ini"
$Copyright01 = IniRead($RUN1, "版权信息", "飛翔浪子", "")
$Copyright02 = IniRead($RUN1, "版权信息", "作者空间", "")
$POST = "请勿随便修改版权,有需要请联系QQ:472891322 "& @CRLF &"欢迎光临作者QQ空间:http://472891322.qzone.qq.com"
If $Copyright01 <> "QQ:472891322" Or $Copyright02 <> "http://472891322.qzone.qq.com/" Then
        MsgBox(64, "温馨提醒您:", $POST)
        Exit
EndIf

$ie = IniRead($MacSm, "Setting", "ie", "http://192.168.0.136");配置IE
$LocMAC = _GetLocalMAC()
If $LocMAC[0] = 0 Then
 MsgBox(64, "错误", '找不到本机MAC地址,' & @CRLF & '请检查本机配置!', 15)
 Exit
Else
 For $m = 1 to $LocMAC[0]
  $info = IniRead($MacSm, "MacSm", $LocMAC[$m], "")
  If $info <> "" Then ExitLoop
 Next
EndIf

$info = StringSplit($info, "|")
If $info[0] < 2 Then Dim $info[3]

$PcName = _StringIsComputerName($info[1])
While @error
 $info[1] = InputBox("输入的新计算机名", '请重新设置计算机名!' & @CRLF & @CRLF & '标准名称可以含有字母(a-z, A-Z)、数字(0-9)和连字符(-),但不能含有空格或句号(.)。名称可能不完全是数字。', "", " M63")
 If @error Then _Terminate()
 $PcName = _StringIsComputerName($info[1])
 If Not @error Then ExitLoop
WEnd
$PcName = $info[1]
$Msg = $Msg & "●计算机名: " & $PcName & @CRLF

$strComputer = "."
$IPX=Random(1,9999,1)
$IPX= StringFormat("%08d", $IPX)
$objWMIService = ObjGet("winmgmts:\\" & $strComputer & "\root\cimv2")
$objNetworkSettings = $objWMIService.Get("Win32_NetworkAdapterConfiguration")
$objNetworkSettings.SetIPXVirtualNetworkNumber(int($IPX))
$Msg = $Msg & "●IPX 地址: " & $ipx & @CRLF

$ipAdd = _StringIsIP($info[2])
While @error
 $info[2] = InputBox("IP地址", "请重新输入IP地址!", "", " M15", 1, 1, @DesktopWidth/2-95, @DesktopHeight/2-72)
 If @error Then _Terminate()
 $ipAdd = _StringIsIP($info[2])
 If Not @error Then ExitLoop
WEnd
$Msg = $Msg & "●I P 地址: " & $ipAdd & @CRLF

$Mask = _StringIsIP(IniRead($MacSm, "Setting", "Mask", "255.255.255.0"))

While @error
 $Mask = InputBox("子网掩码格式错误", "请重新输入子网掩码!", "", " M15", 1, 1, @DesktopWidth/2-95, @DesktopHeight/2-72)
 If @error Then _Terminate()
 $Mask = _StringIsIP($Mask)
 If Not @error Then ExitLoop
WEnd
$Msg = $Msg & "●子网掩码: " & $Mask & @CRLF

$Gateway = _StringIsIP(IniRead($MacSm, "Setting", "GateWay", "192.168.0.1"))
While @error
 $Gateway = InputBox("默认网关格式错误", "请重新输入网关!", "", " M15", 1, 1, @DesktopWidth/2-95, @DesktopHeight/2-72)
 If @error Then _Terminate()
 $Gateway = _StringIsIP($Gateway)
 If Not @error Then ExitLoop
WEnd
$Msg = $Msg & "●默认网关: " & $Gateway & @CRLF
$dns[0] = _StringIsIP(IniRead($MacSm, "Setting", "主DNS", $Gateway))
While @error
$dns[0] = InputBox("主DNS格式错误", "请重新输入主DNS.", "", " M15", 1, 1, @DesktopWidth/2-95, @DesktopHeight/2-72)
If @error Then _Terminate()
$dns[0] = _StringIsIP($dns[0])
If Not @error Then ExitLoop

WEnd
$Msg = $Msg & "●首选 DNS: " & $dns[0] & @CRLF

$dns[1] = _StringIsIP(IniRead($MacSm, "Setting", "副DNS", $Gateway))
While @error
$dns[1] = InputBox("DNS格式错误", "请重新输入副DNS.", "", " M15", 1, 1, @DesktopWidth/2-95, @DesktopHeight/2-72)
If @error Then _Terminate()
$dns[1] = _StringIsIP($dns[1])
If Not @error Then ExitLoop

WEnd
$Msg = $Msg & "●备用 DNS: " & $dns[1] & @CRLF

$CsKey = IniReadSection($MacSm, "Cs15Key")
If @error Then
 $CsKey = 0
Else
 $n = Random(1, $CsKey[0][0], 1)
 $CsKey = IniRead($MacSm, "Cs15Key", $n, "1234567890123")
EndIf
If $CsKey <> 0 Then $Msg = $Msg & "●CS-CDKEY: " & $CsKey & @CRLF
$Msg = $Msg & "●I E 主页: " & $ie & @CRLF
$OK = MsgBox(0,"GHOST后自动设置工具-飛翔专用版", $Msg,5);加,时间=超时
;If $OK = 2 Then  _Terminate()
$SetName = _SetComputerName($PcName)
$SetIpAdd = _SetIPAddress($ipAdd, $Mask, $Gateway)
If $CsKey <> 0 Then RegWrite("HKCU\Software\Valve\CounterStrike\Settings", "key", "REG_SZ", $CsKey)

Func _SetIPAddress($ipAdd, $Mask = "255.255.255.0", $Gateway = "")
 $Return = 0
 $ipAdd = _StringIsIP($ipAdd)
 If $ipAdd = "" Then $Return = $Return + 1
 $Mask = _StringIsIP($Mask)
 If $Mask = "" Then $Return = $Return + 2
 $Gateway = _StringIsIP($Gateway)
 If $Gateway = "" Then $Return = $Return + 4

 Dim $LocalIPAddress[1] = [$ipAdd]
 Dim $strSubnetMask[1] = [$Mask]
 Dim $strGateway[1] = [$Gateway]
 Dim $strGatewayMetric[1] = [1]
 
 $strComputer = "localhost"
 $objWMIService = ObjGet("winmgmts:\\" & $strComputer & "\root\cimv2")
 $colNetAdapters = $objWMIService.ExecQuery ("Select * from Win32_NetworkAdapterConfiguration where IPEnabled=TRUE")
 If IsObj($colNetAdapters) Then
  For $objNetAdapter in $colNetAdapters
   If BitAND($Return, 1) = 0 AND BitAND($Return, 2) = 0 Then $objNetAdapter.EnableStatic($LocalIPAddress, $strSubnetMask)
   If BitAND($Return, 4) = 0 Then $objNetAdapter.SetGateways($strGateway, $strGatewayMetric)
  Next
 EndIf
 Return $Return
EndFunc  ;_SetIPAddress修改IP地址
Func _SetComputerName($strComputerName)
 $SetKey1 = "HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\"
 $CtrlKey = "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\"
  $ie1 = "HKEY_CURRENT_USER\Software\Microsoft\";改IE
  $ie2 = "HKEY_CLASSES_ROOT\CLSID\{871C5380-42A0-1069-A2EA-08002B30309D}\shell\";修改IE启动项
  

 $Return = RegWrite ($SetKey1 & "Control\ComputerName\ComputerName", "ComputerName", "REG_SZ", $strComputerName)
 RegWrite ($SetKey1 & "Services\Tcpip\Parameters", "NV Hostname", "REG_SZ", $strComputerName)
 RegWrite ($SetKey1 & "Services\Tcpip\Parameters", "Hostname", "REG_SZ", $strComputerName)

 RegWrite ($CtrlKey & "Control\ComputerName\ComputerName", "ComputerName", "REG_SZ", $strComputerName)
 RegWrite ($CtrlKey & "Services\Tcpip\Parameters", "NV Hostname", "REG_SZ", $strComputerName)
 RegWrite ($CtrlKey & "Services\Tcpip\Parameters", "Hostname", "REG_SZ", $strComputerName)
 RegWrite ($ie1 & "Internet Explorer\Main", "Start Page", "REG_SZ", $ie);改IE
 RegWrite ($ie1 & "Internet Explorer\Main", "Default_Page_UR", "REG_SZ", $ie);改IE
 RegWrite ($ie1 & "Internet Explorer\Main", "Window Title", "REG_SZ", $bt);改IE
 RegWrite ($ie2 & "OpenHomePage\Command", "", "REG_SZ", "C:\Program Files\Internet Explorer\iexplore.exe "  & $ie);设置IE启动参数

 Return $Return
EndFunc  ;_SetComputerName修改计算机名

Func _GetLocalMAC()
 Dim $aNULL[1] = [0]
 $MAC = Chr(13)
 $strComputer = "localhost"
 $objWMIService = ObjGet("winmgmts:\\" & $strComputer & "\root\cimv2")
 $colNicConfigs = $objWMIService.ExecQuery ("SELECT * FROM Win32_NetworkAdapterConfiguration WHERE IPEnabled = True")
 If IsObj($colNicConfigs) Then
  For $objItem In $colNicConfigs
   $objNic = $objWMIService.Get ("Win32_NetworkAdapter.DeviceID=" & $objItem.Index)
   $MAC = $MAC & Chr(10) & $objNic.MACAddress
  Next
  $MAC = StringReplace($MAC, Chr(13) & Chr(10), "")
  If StringInStr($MAC, ":") = 0  Then
   SetError(2)
   Return $aNULL
  Else
   $MAC = StringReplace($MAC, ":", "-")
   Return StringSplit($MAC, Chr(10))
  EndIf
 Else
  SetError(1)
  Return $aNULL
 EndIf
EndFunc  ;_GetLocalMAC获取本地MAC地址

Func _StringIsComputerName($strComputerName, $ShowMsgBox=1)
 If $strComputerName = "" OR StringLen($strComputerName) > 63 Then
  $err = '请输入的新计算机名。标准名称可以含有字母(a-z, A-Z)、数字(0-9)和连字符(-),但不能含有空格或句号(.)。名称可能不完全是数字。'
  SetError(1)
  Return 0
 ElseIf StringIsDigit($strComputerName) = 1 Then
  If @OSVersion = "WIN_2000" Then
   $Title = "网络标识"
  Else
   $Title = "计算机名更改"
  EndIf
  If $ShowMsgBox=1 Then MsgBox(48, $Title, '新计算机名 "' & $strComputerName & '" 是一个数字。名称不应是数字。')
  SetError(2)
  Return 0
 EndIf
 $NoText = '`~!@#$. ^&*()=+[]{}\|;:' & Chr(39) & '",<>/?'
 For $i = 1 To StringLen($strComputerName)
  If StringInStr($NoText, StringMid($strComputerName, $i, 1)) <> 0 Then
   If @OSVersion = "WIN_2000" Then
    $Title = "网络标识"
    $Text = '新计算机名 "' & $strComputerName & '" 包括非法的字符。'
   Else
    $Title = "计算机名更改"
    $Text = '新计算机名 "' & $strComputerName & '" 包括不允许的字符。不允许的字符包括 ` ~ ! @ # $  ^ & * ( ) = + [ ] { } \ | ; : ' & Chr(39) & ' " , < > / 和 ?'
   EndIf
   If $ShowMsgBox = 1 Then MsgBox(48, $Title, $Text)
   SetError(3)
   Return 0
  EndIf
 Next
 If $ShowMsgBox <> 1 Then Return 1
 $Text = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-"
 For $i = 1 To StringLen($strComputerName)
  If StringInStr($Text, StringMid($strComputerName, $i, 1)) = 0 Then
   If @OSVersion = "WIN_2000" Then
    $Title = "网络标识"
   Else
    $Title = "计算机名更改"
   EndIf
   $iMsgBoxAnswer = MsgBox(48+4, $Title, '计算机名 "' & $strComputerName & '" 含有一个或一个以上非标准字符。标准字符包括字母(A-Z,a-z)、数字(0-9)和连字符(-)。如使用非标准字符名称,除非您所属网络使用 Microsoft DNS 服务器,否则其他用户就会在网络上找不到您的计算机。要使用这个非标准名称吗?')
   If $iMsgBoxAnswer = 6 Then
    Return 1
   Else
    SetError(4)
    Return 0
   EndIf
  EndIf
 Next
EndFunc  ; _StringIsComputerName判断计算机名是否正确


Func _StringIsIP($strIP)
 $str = StringSplit($strIP, ".")
 If $str[0] <> 4 Then
  SetError(1)
  return ('')
 ElseIf StringIsDigit($str[1]) <> 1 OR StringIsDigit($str[2]) <> 1 OR StringIsDigit($str[3]) <> 1 OR StringIsDigit($str[4]) <> 1 Then
  SetError(2)
  return ('')
 ElseIf $str[1] > 255 OR $str[2] > 255 OR $str[3] > 255 OR $str[4] > 255 Then
  SetError(3)
  return ('')
 Else
  return (Int($str[1]) & "." & Int($str[2]) & "." & Int($str[3]) & "." & Int($str[4]))
 EndIf
EndFunc  ;_StringIsIP判断IP格式是否正确

Func _Terminate()
 ToolTip("正在退出……" & @CR & "谢谢使用" & @CR & @YEAR & "年" & @MON & "月" & @MDAY & "日", @DesktopWidth-90, @DesktopHeight-71)
 Sleep(3000)
 Exit 0
EndFunc


[ 本帖最后由 jycel 于 2009-3-26 18:34 编辑 ]
发表于 2009-3-27 18:14:48 | 显示全部楼层
想适用的。还是自己写的比较合适。
 楼主| 发表于 2009-3-28 00:19:30 | 显示全部楼层
感谢 jycel提供源码
发表于 2009-3-30 10:21:25 | 显示全部楼层
同意楼上的说法..谢谢!!
您需要登录后才可以回帖 登录 | 加入

本版积分规则

QQ|手机版|小黑屋|AUTOIT CN ( 鲁ICP备19019924号-1 )谷歌 百度

GMT+8, 2024-12-24 09:13 , Processed in 0.075803 second(s), 22 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表