日前隨身碟病毒最泛濫的時候

就是利用了 windows 有 Autorun 這個功能

同時也藉由 autorun.inf 這個檔案的撰寫進行病毒的散播

但事實上 autorun 是個非常好用且方便的一個功能

當你的隨身碟或是光碟片放進去的時候

你可以編寫你想要的顯示、動作方式

為了能更快的了解 autorun.inf 可以做些什麼事

我直接寫一個簡單的 sample

現在 就來介紹簡單的 autorun.inf

以下的內容,請先於記事本 notepad.exe 編寫

// =====================================================

[autorun]

Label = EdisonShih
Icon = MyIcon.ico
Open = MediaPlayer.exe

Shell\打開記事本\command = notepad.exe
Shell\開啟IE瀏覽器\command = iexplore.exe
Shell\連上google\command = iexplore.exe http:\\www.google.com.tw
Shell\連上yahoo\command = iexplore.exe http:\\tw.yahoo.com
Shell\setup\command=softsetup.exe

// =====================================================

當你編寫完後,記得存檔成 autorun.inf,現在就為各位解釋裡面的語法

1.  Label = EdisonShih
     假設我插入的隨身碟在電腦裡面讀到的是 F:
     加入這個語法後,電腦裡顯示的將會是  EdisonShih(F:)

2.  Icon = MyIcon.ico
     使用這個指令時,必須要先準備一個 .ico 的圖檔
     到時候顯示的時候,將會顯示你的 icon 圖片

Autorun (1).jpg  

 

3. Open = MediaPlayer.exe
    如上圖所示,當 Autorun 在跑的時候,
    寫了這行會多了一個選項: "執行程式",
    當使用者按下確定的時候,就會跑到隨身碟底下去找 MediaPlayer.exe
    進而執行 

4.
Shell\打開記事本\command = notepad.exe
Shell\開啟IE瀏覽器\command = iexplore.exe
Shell\連上google\command = iexplore.exe http:\\www.google.com.tw
Shell\連上yahoo\command = iexplore.exe http:\\tw.yahoo.com
Shell\setup\command=softsetup.exe

這一串命令其實都是一樣的

Shell\[右鍵想要出現的名稱]\command = [使用者點選之後所執行的動作]

以 Shell\打開記事本\command = notepad.exe 為例
當使用者在隨身碟按下右鍵時,將多了一個選項:
" 打開記事本"
當使用者點選時,將會執行 notepad.exe (也就是執行記事本程序)

同理,
Shell\連上google\command = iexplore.exe http:\\www.google.com.tw
這行指令是當使用者在随身碟按下右鍵時,多了
"連上google" 選項
當使用者點選此選項時,將會使用 IE 瀏覽器連上 google 網站

<圖片如下>

Autorun (2).JPG  

 

5. 當然,要提醒各位,inf 裡面所用到的檔案都要複製到隨身碟裡面
    (如 MyIcon.ico, MediaPlay.exe)
    或是在編寫時可以使用相對\絕對路經的方式指定檔案位置
    最後 再附上一張 這份 INF 我複製到隨身碟裡所用到的檔案 
 
(Share.reg 我於這份 inf 沒用到,其它的都有用到)

Autorun (3).JPG  

6.
如果有一份 ppt 想要直接開啟的話可以試著在 Open 那裡下手...


Open = "c:\program files\microsoft office\office12\powerpnt.exe" example.ppt


當然,也可以放在Shell-command 裡面呼叫

最後,如果各位覺得這些功能不喜歡
為了避免中毒的困擾想要關閉的話
提供下面資訊給各位

開啟/關閉 Autorun 功能:

1. 開始->執行->gpedit.msc->

2. 出現「群組原則物件編輯器」

3. 左邊 -> 電腦設定 -> 系統管理範本 -> 系統

4. 右邊 -> 「關閉自動播放」項目,進行開啟/關閉

arrow
arrow
    全站熱搜

    Edison 發表在 痞客邦 留言(4) 人氣()