電腦魔域
電腦世界內的迷失空間, 是天堂? 是地獄? 那就要看您是否我的同道中人了...KISS...
星期二, 12月 28, 2004
又一逃出房間遊戲
我終於給 iq game 難倒了, 真係好難, 因為內有孔明棋及拼圖, 孔明棋是我的強項, 絕對不成問題, 可惜拼圖是我最差的一環, 接了好久都接不好....
http://ctime.cool.ne.jp/MyDiamondBaby/
星期日, 12月 26, 2004
Google不為人知的特殊用法
Google的搜尋引擎是美國一所著名大學研製出的最新一代網路查詢技術,它根據網際網路本身的連接結構對相關網站自動進行分類,為你的每一個查詢迅速提供準確的結果。同時Google依據網路自身結構,清理混沌信息,縝密組織資源,使您需要查詢的網站一擊即中,而這就是為什麼Google不像其他搜尋門戶網站界面複雜,有各種分類項目的原因。
本文裡收集了一些Google不為人知的特殊用法,或者說叫「復活節彩蛋」,好,讓我們看看都有些什麼吧!
http://www.google.com/microsoft
微軟風格的入口
http://www.google.com/mac
MAC風格的入口
http://www.google.com/linux
Linux風格的入口
http://www.google.com/bsd
FreeBSD風格的入口
Google有各種語言的版本,下面這些語言可能實在是稀罕了點兒
http://www.google.com/intl/xx-klingon/
克林岡語入口(沒看過星際旅行嗎?)
http://www.google.com/intl/xx-bork/
政治入口?
http://www.google.com/intl/xx-elmer/
宗教入口
http://www.google.com/intl/xx-piglatin/
小豬入口
http://www.google.com/intl/xx-hacker/
黑客專用入口
Google裡還有一個小小的彩蛋遊戲,大家自己去看吧! http://www.google.com/Easter/feature_easter.html
下面是一些更有用的彩蛋
http://froogle.google.com/
作用: 通過特殊的搜尋引擎,你可以在網上找到你想購物的網站位置。以及你可以很方便的搜尋出同類產品的價格。 看看世界各地的商品價格,自己再買的時候心底有數多了把
http://labs.google.com/cgi-bin/webquotes
作用:可以搜尋出你要查詢的內容在internet上被多少其他的網站引用過,可以讓你知道internet上其他人對你要查詢內容的觀點, 適合寫論文和評論以及特殊用途人使用。
http://labs1.google.com/gvs.html
作用:給google打一個電話,說出你要搜尋的內容,然後google會把你要查詢的結果顯示出來。 給不識字的人用的?
星期四, 12月 23, 2004
藍芽裝置的外部控制,出現了漏洞。
我把行動電話擺在桌上,電話忽然閃了幾閃,顯示「連接中」的字樣,然後就回到正常狀態。勞里(Adam Laurie)抬起原本看著筆記型電腦的視線,說:「你的電話簿裡是不是有marca03的資料?」
「對,有。」
勞里是一名安全專家,也是一年一度的駭客大會Defcon的創辦人之一,還是英國倫敦資料安全公司AL Digital的負責人。他剛剛「藍芽侵吞」(bluesnarf)了我的電話,也就是說,他侵入我電話的藍芽連線,證明他能夠在我不知情或未同意的狀況下,取得我的資料。這項漏洞存在於許多廠商的藍芽裝置內,因此當行動電話變成萬用的通訊工具,甚至可用來付帳及銀行轉帳時,危險性也會隨之提高。
藍芽是一種個人網路標準,可以用在器材間的短距離通訊。它能取代纜線與紅外線連線,讓電腦、行動電話、個人數位助理、鍵盤、印表機與其他裝置彼此溝通。(但別把藍芽與802.11搞混了。802.11也稱為Wi-Fi,用於無線上網與區域網路。)
藍芽的創始人相當重視安全問題,傳輸的數據都經過加密。根據內建的特性,使用者可經常設定藍芽連線,讓裝置只能與特定的器材通訊,除此之外,其他器材並無法搜尋到使用者的藍芽裝置。但問題是,這項設定不一定存在,也不一定好用。許多藍芽連線和住宅區的Wi-Fi網路一樣,都是開放的,而且相當脆弱。
勞里在攻擊行動中,讓我的電話誤以為可與勞里的筆記型電腦連線,然而他的電腦並不在我許可連線的名單上。他利用了藍芽裝置的共用標準。藍芽可用來連結各種為人熟知的服務,比如聲音、檔案傳輸、列印與傳真等,並且依靠一套自訂的協定運作,也就是所謂的「個人設定」檔(profile)。勞里並未透露他到底如何利用這些個人設定,但清楚解釋自己是透過藍芽,才能侵入廠商所提供的服務的漏洞。他並且表示,自己用以竊取資料的大部份必要軟體,要不是可從網際網路上取得,就是早已經可合法持有,比如資料備份與短訊服務用的工具軟體。
對大部份人來說,這種資料危機乍聽之下並不嚴重。勞里說:「大家都覺得沒關係,但最後卻會發現,自己並不願意讓別人看到電話裡的某些名單。」隨著行動電話發展出愈來愈強大的功能與儲存空間,涵蓋了電子郵件、錄音、照片與其他形式的資料,這個問題也會變得日益嚴重。
奧地利薩爾斯堡研究院(Salzburg Research)的研究員赫弗特(Martin Herfurt)試圖重複勞里的研究時,甚至發現了更糟的狀況:「藍芽竊聽」(bluebugging)。這種攻擊與藍芽侵吞一樣,可以偽裝成藍芽裝置騙取連線,但是之後會進一步與裝置上的藍芽個人設定檔連結,盜用序列埠,也就是用以連接數據機的傳統插槽。然後,你就可以傳送撥接時代常用的AT指令,來控制該裝置。利用標準的工具軟體,你就可以命令該電話撥打付費諮詢電話,或者是傳送簡訊(收費標準也可能是諮詢費率),並可連結上網。你甚至可以命令被挾持的電話,在主人不知情的狀況下打電話給你,以就近竊聽交談內容。
有些受害廠商已經修正其軟體。勞里也與藍芽技術的創始人合作,協助改善下一代標準的安全性。但這個事件提醒我們一個基本問題:從纜線過渡到無線,確實會帶來前所未見的隱形危機。
本文出自科學人2004年12月號
AMR (ATI Multi-Rendering technology 多重渲染技術)
面對 NVIDIA 來勢洶洶的 SLI 多顯示卡並行技術, ATi 也準備推出自家的多顯示卡並行技術, 並將此技術命名為 AMR (ATI Multi-Rendering technology 多重渲染技術). AMR 技術不需要用戶具備兩張完全一樣的顯示卡, 比如 R520 加 R5xx 顯示卡, 也可以構建 AMR 系統. 另外 AMR 技術無需使用專門的 SLI 連接器, 在 AMR 架構當中, 兩張顯示卡通過主機板內建的 PCI Express 匯流排進行資料交換.
目前 ATi 已經發佈的 Radeon Xpress 200 晶片組(RS480)和即將發佈的RS400 晶片組都已經內建對 AMR 的支持. 另外 RS480G 和 RS400G 內建的 X300 圖形內核, 也可以通過 AMR 和外接的PCIE顯示卡運行 AMR.
星期六, 12月 18, 2004
SLI (Scalable Link Interface) 的前世今生...
NVIDIA 的 SLI (Scalable Link Interface) 技術, 是源於 1998 年 3dfx Voodoo2 的 SLI (Scan Line Interleave) 技術, 但當然他們的名不同了, 技術也當然進步了, 前世 3dfx Voodoo2 的 SLI 技術原理是透過專用介面把兩張 PCI 介面的 Voodoo 2 連接在一起, 以 Scanline 交錯方式, 一張負責運算單數的行段, 一張負責運算雙數的行段, 再合併輸出, 以達到提升速度的目標, 而今生就利害了, 都係透過專用介面把兩張 PCI-Express 介面的 Geforce 6 系 GPU (Graphic Processing Unit) 連接在一起, 不過不用 Scanline 交錯方式了, 而是用以下兩種模式運作 SFR (Split Frame Rendering) 及 AFR (Alternate Frame Rendering)...
Split Frame Rendering 模式把畫面分為上下半部由兩顆不同的 GPU 分開工作, 然後得出來的畫面重新結合成一個畫面, 情況就如同硬碟的 RAID 0 (Redundant Array of Inexpensive Disks) 那樣把資料分開交給兩個不同的硬碟存取. 但由於上下兩個畫面的工作份量不同, GPU 是會對工作出預測, 分工是上下兩個的畫面並非 50% 分配,而是按估計的工作量盡量平分, 當然也有估計錯誤, 出現其中一方太早完成而要等待另一方完成, 也能繼續下一個工作的情況.
Alternate Frame Rendering 模式則是把 Frame 以單雙數分給不同的 GPU 處理, 例如 GPU 1 負責 (1,2,5,7,9), 而 GPU 2 負責 (2,4,6,8,10), 這個方法比 SFR 更有效率, 而效能亦是 AFR 更佳, 當然也要視乎遊戲的類型, 其實兩者各有千秋.
至於 SLI 會用那一個模式並不是用家自行決定, 而是由 GPU 的驅動程式偵查該遊戲的執行檔, 來設定採用那一個模式, 而沒有被定義的就會進入Compatibility Mode, 即不運行 SLI. 因此用家應定時更新 GPU 的驅動程式以已增加 SLI 的遊戲兼容度.
再來就是要談談這編文章的高潮所在啦, 就是現今各大電腦主機板上的晶片組生產商對 SLI 的支援問題啦, 為什麼要談這個問題, 不是在主機板上加多條 PCI-Express x16 的插座就行了, 對...其實是可以就這麼簡單的去支援 SLI, 不過問題在於當插上兩張 PCI-Express x16 的 GPU 時, 它們會以什麼速度運行, 廢話...PCI-Express x16 的插座插上 PCI-Express x16 的 GPU 時, 三歲小朋友都知它是行 x16 的啦, 不然點可能稱它為 x16, 對...又對...事實上當你插上一張的時候它是行 x16 的, 不過好不幸, 現今市面上不論支不支援 SLI 的 PCI-Express 晶片組都只得 20 至 24 個 Lane, 換句話說現在一套晶片組最多只可支援到一張 PCI-Express x16 及 一張 PCI-Express x8, 就算是 NVIDIA 自家出的 nForce4 SLI 晶片組都只可以支援兩張 PCI-Express x16 的 GPU 以 PCI-Express x8 速度運行 SLI, 真不知 NVIDIA 在想什麼. 而 nForce4 Ultra 晶片組雖然原生不支援 SLI 但有些電腦主機板生產商, 例如: MSI 就使用 nForce4 Ultra 晶片組實現 SLI.
Intel 的 915/925 系列的晶片組因為不是專門針對 SLI 而開發的, 所以只能以北橋晶片支援一張行 PCI-Express x16, 一張要交由南橋 ICH6 晶片以 PCI-Express x4 運行, 你會說不是比 NVIDIA 的晶片組快, 可惜 NVIDIA 的驅動程式是以最低的平行速度來運行, 所以只能以 PCI-Express x4 來行 SLI, 而且南北橋晶片之間數據傳輸的延遲又是一個好大的問題, 而 E7520/ E7525 系列都可以支援兩張 PCI-Express x16 的 GPU 以 PCI-Express x8 速度運行 SLI, 不過他們都是以高階市場為主, 相信會好貴及沒什麼電腦主機板生產商, 會用它們製造普通市場的 SLI 主機板...
VIA 及 SIS 都打算推出支援 SLI 的晶片組, VIA 的 K8T890 Pro 晶片組同 Intel 的差不多, 都是一條 PCI-Express x16 及一條 PCI-Express x4 運行, 不過不同的是它們會整合在同一個北橋內, 還打算使用自家驅動程式令它們真正可以行 x16 一張行 x4, 這樣不單能令 NVIDIA 的 PCI-Express GPU 行 SLI, 還可以令 其他公司出的 PCI-Express GPU 做到類似 SLI 的效果, 而且南橋 Vt8251 晶片內還可以支援多二條 PCI-Express x1.
ATI RS480/RX480 晶片組同其它晶片組一樣可以用一條 PCI-Express x16 及一條 PCI-Express x4 運行 SLI, 不過要支援 SLI 是需要 NVIDIA 我認證, 以 ATI 及 NVIDIA 的死敵關係...大家估0下吧, 而且 ATI 也在發展自家類似 SLI 的多顯示卡並行技術, AMR (ATI Multi-Rendering technology 多重渲染技術), 其實現在是可以插兩張 ATI 的 GPU 在有兩條 PCI-Express x16 的主機板上, 支援 2 至 4 個顯示器運行...
最後現在真的沒有辦法可以全速使用兩條 PCI-Express 16x GPU 行 SLI 嗎?
答案出奇地是可以的, Tyan 推出了 nForce 4 Dual Opteron 真正做到兩條PCI-Express 接口都是 x16 的速度, 因為它內置了一顆 nForce4 Ultra 及一顆 nForce4 晶片, 來獨立控制各自的 PCI-Express 16x 插座...
NVIDIA nForce4 SLI Technical Specifications
http://www.nvidia.com/page/pg_20041015917263.html
NVIDIA nForce4 Ultra Technical Specifications
http://www.nvidia.com/page/pg_20041015990644.html
NVIDIA nForce4 Technical Specifications
http://www.nvidia.com/page/pg_20041014863476.html
Intel 915P Express chipset
http://www.intel.com/design/chipsets/915p/index.htm
Intel 925XE Express chipset
http://www.intel.com/design/chipsets/925xe/index.htm
Intel E7520 chipsets
http://www.intel.com/design/chipsets/E7520_E7320/index.htm
Intel E7525 Memory Controller Hub (MCH) chipset
http://www.intel.com/design/chipsets/E7525/index.htm
RAID (Redundant Array of Inexpensive Disks) 是什麼???
RAID (Redundant Array of Inexpensive Disks) 暫時有 RAID Level 0,1,2,3,4,5,6,10,50 及 0+1 這幾個不同的格式.
RAID Level 0 Striped Disk Array Without Fault Tolerance:
RAID Level 0 requires a minimum of 2 drives to implement
Characteristics & Advantages
RAID 0 implements a striped disk array, the data is broken down into blocks and each block is written to a separate disk drive, I/O performance is greatly improved by spreading the I/O load across many channels and drives, Best performance is achieved when data is striped across multiple controllers with only one drive per controller, No parity calculation overhead is involved, Very simple design, Easy to implement.
Disadvantages
Not a "True" RAID because it is NOT fault-tolerant, The failure of just one drive will result in all data in an array being lost, Should never be used in mission critical environments.
Recommended Applications
Video Production and Editing, Image Editing, Pre-Press Applications,Any application requiring high bandwidth.
RAID Level 1 Mirroring & Duplexing:
RAID Level 1 requires a minimum of 2 drives to implement, For Highest performance, the controller must be able to perform two concurrent separate Reads per mirrored pair or two duplicate Writes per mirrored pair.
Characteristics & Advantages
One Write or two Reads possible per mirrored pair, Twice the Read transaction rate of single disks, same Write transaction rate as single disks, 100% redundancy of data means no rebuild is necessary in case of a disk failure, just a copy to the replacement disk, Transfer rate per block is equal to that of a single disk. Under certain circumstances, RAID 1 can sustain multiple simultaneous drive failures, Simplest RAID storage subsystem design.
Disadvantages
Highest disk overhead of all RAID types (100%) - inefficient, Typically the RAID function is done by system software, loading the CPU/Server and possibly degrading throughput at high activity levels. Hardware implementation is strongly recommended, May not support hot swap of failed disk when implemented in "software".
Recommended Applications
Accounting, Payroll, Financial, Any application requiring very high availability.
RAID Level 2 Hamming Code ECC:
Each bit of data word is written to a data disk drive (4 in this example: 0 to 3). Each data word has its Hamming Code ECC word recorded on the ECC disks. On Read, the ECC code verifies correct data or corrects single disk errors.
Characteristics & Advantages
"On the fly" data error correction, Extremely high data transfer rates possible, The higher the data transfer rate required, the better the ratio of data disks to ECC disks, Relatively simple controller design compared to RAID levels 3,4 & 5.
Disadvantages
Very high ratio of ECC disks to data disks with smaller word sizes - inefficient, Entry level cost very high - requires very high transfer rate requirement to justify, Transaction rate is equal to that of a single disk at best (with spindle synchronization), No commercial implementations exist / not commercially viable
RAID Level 3 Parallel Transfer with Parity:
The data block is subdivided ("striped") and written on the data disks. Stripe parity is generated on Writes, recorded on the parity disk and checked on Reads.
RAID Level 3 requires a minimum of 3 drives to implement
Characteristics & Advantages
Very high Read data transfer rate, Very high Write data transfer rate,
Disk failure has an insignificant impact on throughput, Low ratio of ECC (Parity) disks to data disks means high efficiency.
Disadvantages
Transaction rate equal to that of a single disk drive at best (if spindles are synchronized), Controller design is fairly complex, Very difficult and resource intensive to do as a "software" RAID.
Recommended Applications
Video Production and live streaming, Image Editing, Video Editing, Prepress Applications, Any application requiring high throughput.
RAID Level 4 Independent Data Disks with Shared Parity Disk:
Each entire block is written onto a data disk. Parity for same rank blocks is generated on Writes, recorded on the parity disk and checked on Reads.
RAID Level 4 requires a minimum of 3 drives to implement
Characteristics & Advantages
Very high Read data transaction rate, Low ratio of ECC (Parity) disks to data disks means high efficiency, High aggregate Read transfer rate.
Disadvantages
Quite complex controller design, Worst Write transaction rate and Write aggregate transfer rate, Difficult and inefficient data rebuild in the event of disk failure, Block Read transfer rate equal to that of a single disk.
RAID Level 5 Independent Data Disks with Distributed Parity Disk:
Each entire data block is written on a data disk; parity for blocks in the same rank is generated on Writes, recorded in a distributed location and checked on Reads.
RAID Level 5 requires a minimum of 3 drives to implement
Characteristics & Advantages
Highest Read data transaction rate, Medium Write data transaction rate,
Low ratio of ECC (Parity) disks to data disks means high efficiency, Good aggregate transfer rate.
Disadvantages
Disk failure has a medium impact on throughput, Most complex controller design, Difficult to rebuild in the event of a disk failure (as compared to RAID level 1), Individual block data transfer rate same as single disk
Recommended Applications
File and Application servers, Database servers, Web, E-mail, and News servers, Intranet servers, Most versatile RAID level.
RAID Level 6 Independent Data Disks with Two Independent Distributed Parity Schemes:
Characteristics & Advantages
RAID 6 is essentially an extension of RAID level 5 which allows for additional fault tolerance by using a second independent distributed parity scheme (two-dimensional parity), Data is striped on a block level across a set of drives, just like in RAID 5, and a second set of parity is calculated and written across all the drives; RAID 6 provides for an extremely high data fault tolerance and can sustain multiple simultaneous drive failures,
Perfect solution for mission critical applications.
Disadvantages
More complex controller design, Controller overhead to compute parity addresses is extremely high, Write performance can be brought on par with RAID Level 5 by using a custom ASIC for computing Reed-Solomon parity, Requires N+2 drives to implement because of two-dimensional parity scheme.
RAID Level 10 Very High Reliability Combined with High Performance:
RAID Level 10 requires a minimum of 4 drives to implement
Characteristics & Advantages
RAID 10 is implemented as a striped array whose segments are RAID 1 arrays, RAID 10 has the same fault tolerance as RAID level 1, RAID 10 has the same overhead for fault-tolerance as mirroring alone, High I/O rates are achieved by striping RAID 1 segments, Under certain circumstances, RAID 10 array can sustain multiple simultaneous drive failures, Excellent solution for sites that would have otherwise gone with RAID 1 but need some additional performance boost.
Disadvantages
Very expensive / High overhead, All drives must move in parallel to proper track lowering sustained performance, Very limited scalability at a very high inherent cost.
Recommended Applications
Database server requiring high performance and fault tolerance
RAID Level 50 High I/O Rates & Data Transfer Performance:
RAID Level 50 requires a minimum of 5 drives to implement
Characteristics & Advantages
RAID 50 should really be called "RAID 03" because it is implemented as a striped (RAID level 0) array whose segments are RAID 3 arrays, RAID 50 has the same fault tolerance as RAID 3 as well as the same fault tolerance overhead, High data transfer rates are achieved thanks to its RAID 3 array segments, High I/O rates for small requests are achieved thanks to its RAID 0 striping, Maybe a good solution for sites who would have otherwise gone with RAID 3 but need some additional performance boost.
Disadvantages
Very expensive to implement, All disk spindles must be synchronized, which limits the choice of drives, Byte striping results in poor utilization of formatted capacity.
RAID Level 0+1 High Data Transfer Performance:
RAID Level 0+1 requires a minimum of 4 drives to implement
Characteristics & Advantages
RAID 0+1 is implemented as a mirrored array whose segments are RAID 0 arrays, RAID 0+1 has the same fault tolerance as RAID level 5, RAID 0+1 has the same overhead for fault-tolerance as mirroring alone, High I/O rates are achieved thanks to multiple stripe segments, Excellent solution for sites that need high performance but are not concerned with achieving maximum reliability.
Disadvantages
RAID 0+1 is NOT to be confused with RAID 10. A single drive failure will cause the whole array to become, in essence, a RAID Level 0 array, Very expensive / High overhead, All drives must move in parallel to proper track lowering sustained performance, Very limited scalability at a very high inherent cost.
Recommended Applications
Imaging applications, General fileserver.
星期五, 12月 17, 2004
超迷你 P2P 程式, 最短只有 8 行代碼...
TinyP2P是一個實用的點對點檔共用應用程式,由Ed Felten博士用Python語言編寫而成。而它令人稱奇之處,是它僅僅包含了15行代碼!作者稱,他寫TinyP2P只是為了說明編寫點對點應用程式的難度罷了。P2P程式可以非常簡單,一個熟練的程式師隨便都可以寫出來,所以,任何阻止他們創作的行為都將是徒勞無功的。
(每一行最多只有80個字母。第一行不算--它只起注釋之用,電腦在讀入的時候會忽略它)
當然,作者編寫這一程式並非為了方便別人侵犯版權,他自己也不能寬恕侵犯他人版權的舉動。這一程式的設計初衷並沒有協助檔共用之意,它存在價值主要在於它是一個概念的實現。一個更為實用的程式速度必須更快,更安全,對連接失敗的處理機制更為完善,但那一目標的實現需要更多行代碼。
工作原理:程式創建了一個小型的網路,可以用於一群朋友或者商業夥伴之間共用檔。它不適用於非常大的網路;相反,許多小型網路可以共存。每一個網路由一個密碼保護;只有知道網路密碼的人才可以訪問它。(但是網路對於竊聽資訊的攻擊者而言是毫無安全性可言的。)
程式使用標準的通訊協定:HTTP和XML-RPC。HTTP就是在網頁流覽器中普遍使用的協議,XML-RPC則在提供網頁服務方面被廣泛應用。
程式可作為服務端,也可作為用戶端。當作為服務端運行時,程式與一個網路中的其他服務端聯接,共用當前目錄中的所有檔,以供網路用戶下載。
儘管如此,TinyP2P畢竟還使用了一個現成的XML-RPC服務端類庫。另一個檔共用程式--MoleSter更令人吃驚:它僅僅由8行Perl代碼構成,而且只應用了TCP協議。
TinyP2P 網址
http://www.freedom-to-tinker.com/tinyp2p.html
MoleSter 網址
http://ansuz.sooke.bc.ca/software/molester/index.php
MoleSter 的源代碼附註解網址:
http://ansuz.sooke.bc.ca/software/molester/molester
MoleSter 的源代碼網址:
http://ansuz.sooke.bc.ca/software/molester/molester-min
TinyP2P的源代碼:
# tinyp2p.py 1.0 (documentation at http://freedom-to-tinker.com/tinyp2p.html)
import sys, os, SimpleXMLRPCServer, xmlrpclib, re, hmac # (C) 2004, E.W. Felten
ar,pw,res = (sys.argv,lambda u:hmac.new(sys.argv[1],u).hexdigest(),re.search)
pxy,xs = (xmlrpclib.ServerProxy,SimpleXMLRPCServer.SimpleXMLRPCServer)
def ls(p=""):return filter(lambda n:(p=="")or res(p,n),os.listdir(os.getcwd()))
if ar[2]!="client": # license: http://creativecommons.org/licenses/by-nc-sa/2.0
myU,prs,srv = ("http://"+ar[3]+":"+ar[4], ar[5:],lambda x:x.serve_forever())
def pr(x=[]): return ([(y in prs) or prs.append(y) for y in x] or 1) and prs
def c(n): return ((lambda f: (f.read(), f.close()))(file(n)))[0]
f=lambda p,n,a:(p==pw(myU))and(((n==0)and pr(a))or((n==1)and [ls(a)])or c(a))
def aug(u): return ((u==myU) and pr()) or pr(pxy(u).f(pw(u),0,pr([myU])))
pr() and [aug(s) for s in aug(pr()[0])]
(lambda sv:sv.register_function(f,"f") or srv(sv))(xs((ar[3],int(ar[4]))))
for url in pxy(ar[3]).f(pw(ar[3]),0,[]):
for fn in filter(lambda n:not n in ls(), (pxy(url).f(pw(url),1,ar[4]))[0]):
(lambda fi:fi.write(pxy(url).f(pw(url),2,fn)) or fi.close())(file(fn,"wc"))
MoleSter 的源代碼:
$/=$_;$,=shift;$w=$a=shift;sub g{open(F,'<',$4)&&t($2,$a,"e$4",
F}shift=~/()(.*)/;&i;socket S,2,1,6;bind S,&a;sub e{open F,'>',$4;print F
$';close F}sub h{t($2,$_,id)for keys%k}sub i{$k{$2}=1}sub f{t($_,$2,$4)for
keys%k}sub a{$w=~/:/;pack'CxnC4x8',2,$',split'\.',$`}for(listen
S,5;$SIG{ALRM}=sub{};m!^(.*?) (.*?) ([e-i])([^/]*)/!s&&$,eq$1&&&$3){alarm
9;(accept(C,S),alarm 0)?read C,$_,1e6:($_="$, $a f".shift);close
C}sub t{socket X,2,1,6;$w=shift;$k{$w}=(connect X,&a)?print
X"$, $_[0] $_[1]/".pop:$/;close X}
MoleSter 的源代碼附註解:
#!/usr/bin/perl
# MoleSter tiny P2P file sharing program
# Version 0.0.3
# This file is released to the public domain by its author, Matthew Skala.
# Contact mskala@ansuz.sooke.bc.ca
# Home page for this project is http://ansuz.sooke.bc.ca/software/molester/
# MoleSter should rhyme with "pollster"
# Thanks to Rob Kinyon and John Bokma for bug fixes/golfing tips
# A "minimal" version of this file also exists, which attempts to be the
# same code with some debugging messages removed and shaved down to as few
# bytes as possible; see the home page.
# To set up a MoleSter peer:
# perl molester password 192.168.1.1:2222 10.2.2.2:3333
# replace password with the password for your network, 192.168.1.1:2222 with
# the local address and port to run on, 10.2.2.2:3333 with the remote
# address and port of another MoleSter peer; if the other peer doesn't
# exist, your peer will still go up, but you'll have to wait for others to
# connect to you.
# The port-number protection has been removed, so be cautious! Nobody can
# make your peer connect out to random addresses without knowing your
# password, but even so, I don't really recommend running this on the
# public Internet. Note that I considered it worthwhile to fix the
# huge-input security problem while trading off this one, because the
# huge-input attack could be mounted by an attacker who didn't have the
# password.
# New in this version is huge-input protection. Connect to a peer and send
# more than 1e6 bytes and it'll just disconnect. Files are limited to
# just under a megabyte as a result. If you want to change that, you could
# replace the string '1e6' with '1e7' (just under 10 megabytes), '1e8' (just
# under 100 megabytes) or whatever, to taste.
# New in this version: stacking commands on the command line actually works.
# Sorry it didn't before.
# Addresses must be specified as dotted quad decimal, as shown above.
# You can add commands to get files or advertise your presence by adding
# additional command line arguments of the form
# Example, to connect to a net, discover nearby peers, and request a file:
# perl molester password 192.168.1.1:2222 10.2.2.2:3333 # h/ h/ h/ fgkernel-sources.tar.bz2/
# The files will magically appear in your directory as they're downloaded.
# Command-line parameters are processed in a 9-second cycle, so in the
# above example, you need to wait for 36 seconds (during which, hopefully,
# the peer discovery will have done its magic) before the file request is
# sent.
# if you want to share files too, include i/ on the command line
# Note that you probably should not really use this to distribute the kernel
# sources, unless you have a LOT of memory and bandwidth to spare.
# command reference:
# i/ advertises your presence to the peer, which is a nice thing to do if
# you plan to be up for a while
# g
# h/ gets all your peers' peer lists and merges those into yours
# f
# a wider net if the peer doesn't have the file you want, e.g.:
# fgfilename/
# f may be used multiple times, but it's friendlier to the network to just
# use h/ a bunch of times so that you'll peer with more of the network
# Note that if you want to run a share-only peer that can send but not
# receive files, (might be useful to prevent disk-space DoS attack, or
# illegal-material "hot potato" attacks), you can do it by deleting the
# subroutine named "e" below, and changing [e-i] in the regular expression
# inside the while loop, to [f-i].
# read entire files; $_ is undef at this point, so it's cheaper than undef$/
$/=$_;
# parse command line arguments
# $, = password, using $, so we can say $,eq without needing a space
# $a = my address, as 127.0.0.1:31416
$,=shift;
$w=$a=shift; # $w gets address too because &a looks in $w
# load the first peer - &i looks in $2 so must load that
shift=~/()(.*)/;&i;
# open a listening socket
# S = filehandle of listening socket
# 2 = PF_INET
# 1 = SOCK_STREAM
# 6 = tcp
# I'm pretty sure those numbers are universal, but if not, this may be
# Linux-specific :-(
# The die $! isn't in the minimal version, but is useful for debugging
socket(S,2,1,6) die $!;
bind(S,&a) die $!;
# loop for commands; some stuff is moved into the header to save
# semicolons.
for(listen(S,5) die $!;$SIG{ALRM}=sub{};
# now imagine these lines actually AFTER the syntactic body of the loop...
# now command is in $_, parse it
m!^(.*?) (.*?) ([e-i])([^/]*)/!s
# check for correct password
&& $, eq $1
# delete next line to remove debugging output - not included in minimal
&& (print("$a: $1 $2 $3$4/ (".join(',',keys %k).")\n") 1)
# call handler subroutine - it takes its arguments from $2, $4, and $'
&& &$3
){
# we will wait up to nine seconds for a remote input
alarm 9;
# and then if accept() returns a socket instead of timing out...
(accept(C,S),alarm 0)?
# ...then read up to 1000000 bytes from the socket
read C,$_,1e6
# otherwise get from the command line
:($_="$, $a f".shift);
# close socket - harmlessly fails if there was none
close C
}
# subroutines to actually do stuff
# the parameters for these are passed in the following special vars:
# $2 - peer's address
# $4 - filename
# $' - file data
# E: Expect an incoming file
sub e {
# using three-arg open costs a byte, but good for security
open F,'>',$4;
print F $';
close F
}
# F: Forward this request to your peers
sub f {
# note we don't pass "data" ($') so can't do recursive e/ anymore
t($_,$2,$4)for keys%k
}
# G: Give me a file
sub g {
# see above about 3-arg open
open(F,'<',$4) &&t($2,$a,"e$4",
close F
}
# H: Help me find peers
sub h {
# bare word id is cheaper than 'i' and the d is ignored by recipients
t($2,$_,id)for keys%k
}
# I: I am a peer
sub i {
$k{$2}=1
}
# helper function, A for Address
# does what sock_addr($port,inet_aton($addr)) does. may be Linux-specific,
# but at least should not be Intel-specific.
# takes its parameter in $w
sub a {
$w=~/:/;
pack'CxnC4x8',2,$',split'\.',$`
}
# helper function, T for send a Telegram
# y'see, S for Send would clash with s() for substitution - thanks
# Rob Kinyon for the clue on this
# usage destaddr, sourceaddr, req.filename, data
sub t {
socket X,2,1,6;
$w=shift;
# ?: is cheaper than if..else, and $k only needs to be defined or not
# note that $/=undef but is cheaper
$k{$w}=(connect X,&a)?print X"$, $_[0] $_[1]/".pop:$/;
close X
}
星期二, 12月 14, 2004
原來 NVIDIA SLI 有兩種模式...
Split Frame Rendering模式把畫面分為上下半部由兩顆不同的GPU分開工作,然後得出來的畫面重新結合成一個畫面,情況就如同硬碟的Raid那資料分開交給兩個不同的硬碟存取。但由於上下兩個顯面的工作份量不同,GPU是會對工作出預測,分工是上下兩個的顯面並非50%分配,而是按估設的工作量盡量平分,當然也有估計錯誤,出現其中一方太早完成而要等待另一方完成,也能繼續下一個工作的情況。
Alternate Frame Rendering模式則是把Frame以單雙數分給不同的GPU處理,例如VGA 1負責(1,2,5,7,9),而VGA 2負責(2,4,6,8,10),這個方法比SFR更有效率,而效能亦是AFR更佳,當然也要視乎遊戲的類型,兩者各有千秋。至於SLi會用那一個模式並不是用家自行決定,而是由驅動偵查其Game的exe檔,來設定採用那一個模式,而沒有被定義的就會進入Compatibility Mode,即不運行SLi。因此用家應定時更新Driver已增加SLi的遊戲兼容度。
網上小常識
NFO檔案名常識:
Incl.Keygen--->包含有註冊器
keygen only--->只含註冊器
WinALL--->適用於所有版本Windows作業系統(一般是指95 98 ME 2000 XP 2003)
Trainer--->密技
Cracked--->破解版本(對原文件進行了修改)
MAC OSX--->Macintosh平臺上的軟體
NUKED--->發佈的內容違犯規則或存在問題因而被取消,別的小組可重新發佈。
Ebook--->電子書
Repack /Proper--->重新打包/正確的(對上一個不成功的破解的修正)
Plug in--->插件
regged--->已經註冊了的軟件
retail--->零售版
READ.NFO--->一般表示有某種特別說明
DIRFIX nfo--->說明文件修正,一般只有一個nfo檔
BiLiNGUAL--->雙語版本
MutilLiNGUAL--->多語言版本
PHP.NULL--->PHP完整腳本程式
ASP.NULL--->ASP完整腳本程式
Incl.Patch--->帶有破解補丁
WORKING--->先前已有組織釋放,但是不能完整工作,當前的釋放是完整工作的。
Licensed--->帶有許可文件
FiXED--->重新修正版
Unlocker--->解鎖補丁
Cheats--->作弊修改器
ALL.ACCESS.CHEAT--->通關秘笈
電影檔案名常識:
PROPER---> 完美版
DUPE--->與別的組織Release有重複
UNRATE--->未刪節(好)
R-RATE--->有刪節(不好)
WS --->寬銀幕版本的影片
FS--->4:3 全螢幕版本的影片(有些影片DVD中同時有WS和FS兩種版本,Rip出來就要有兩種Release)
Bad IVTC --->畫面有不可去處的拉絲(不好的版本)
Bad Aspt --->畫面比例不正常(不好的版本)
LIMITED --->指在美國有限上映的片子,很多外國片都這樣
WITH EXTRAS--->帶花絮
INTERLACED--->隔行(可看見橫的掃瞄線)
NUKED---> 畫質太差,被FTP的管理員廢掉
SUBED --->內嵌硬字幕(畫面內不能消去)
CAM---> 攝影機拍影院銀幕,帶有影院音響(夾帶觀眾笑聲,不好)
Telesync, TS--->攝像機拍影院銀幕,從影院放映機直接接線輸出
Telecine, TC---> 膠版,直接轉電影拷貝,轉電影拷貝
DVD SCREENER --->用於觀摩或展示的DVD
SCREENER, SCR --->用於觀摩或展示錄影帶
WORKPRINT,WP--->工作錄影帶(導演剪接版,與發行版不同 )
Director Cut --->導演剪接版
TDX---> 傳統DivX製作規則,不符合規則就不會被接受或被NUKE
INTERNAL--->不太符合TDX標準的作品,一些是自己做著玩,還有一些是那組織認為依照TDX無法做到滿意的品質,但不依照TDX做又會被NUKE,所以只好INTERNAL,有些比較值得收藏。
STV--->指沒有也不會有美國影院公映這部片,或者是在影院放映前已經在電視上放過
OST---> 原聲大碟
PDA檔案名常識
其特定含義篇
PPC2002 - --> 該軟體所適用的作業系統,Pocket PC2002
WM2003 ---> 該軟體所適用的作業系統,Windows Mobile 2003等同於Pocket PC2003
ALL.PPC---> 適用於所有的Pocket PC系統,包括Pocket PC2000/Pocket PC2002/Pocket PC2003(Windows Mobile 2003)
ARM、MIPS、SH3分別代表該軟體只適用於基於ARM、MIPS、SH3處理器的Pocket PC
PalmOS---> 該軟體是為PalmOS系統開發的,
其中PalmOS5 是代表該軟體只適用於PalmOS 5.0系統及以上
CLIE為Sony Clie設備專用版
Treo 180/270/600分別為Handspring Treo機型專用版
HIRES為專為擁有高解析度螢幕(320*320)的機型設計
SymbianOS 6/6.1/7 是代表該軟體只適用於SymbianOS 6.0/6.1/7.0系統
UIQ 是代表該軟體適用於symbian7.0系統UIQ介面的機型,如Sony Ericsson的P800/P900和Motorola A920等
JAVA 該軟體為Java軟體,需要支援Java的機型才能正常使用
S60.Java 專為Nokia S60系列機型設計的Java軟體(Nokia7650, Nokia3650, Nokia3310等)
S40.Java 專為Nokia S40列機型設計的Java軟體(Nokia6100,Nokia6610,Nokia6108,Nokia7210,Nokia7250等)
其中如特指明N3650、N6600等則又為該機型所優化
Smartphone 代表該軟體適用於Windows Mobile Smartphone系統
星期五, 12月 03, 2004
Java Plugin 出現了重大的安全性漏洞
Java Plugin 是允許瀏覽器透過此項技術來執行 Java 程式的一項工具,前各大作
業系統上 (e.g. Windows, Linux...etc.) 著名的瀏覽器 (e.g. IE, Mozilla,
Opera...etc.) 都有支援這項技術。不過這項工具最近被發現會造成安全性上的漏
洞[1-3]。
■ 前言:
==============================
我們都知道 Java 在執行 Applet 程式的安全性考量上下了相當大的工夫,也就是
眾所皆知的「sandbox」設計。sandbox 技術可以用在限制對系統資源的存取,如
對檔案的讀取、寫入、或執行,或限制對網路連線的使用,以避免惡意程式盜取資
料或建立後門。當瀏覽器瀏覽到一個內含 Applet 程式網頁的時候,Applet 程式會
從伺服器端下載到本機電腦後開始執行。倘若我們對於 Applet 完全沒有規範限制
的話,那麼若是這個 Applet 程式對於記憶體空間做出無限的要求,這樣肯定會對
作業系統造成傷害。因此,sandbox 建造一個虛擬的環境出來,讓 Applet 程式在
經過位元碼的驗證《byte code verifier》、類別載入器《applet class loader》
和安全性管理《security manager》這幾個步驟的確認之後,可以在有限的系統資
源當中執行程式。如此一來,對於網路上那些 Applet 程式,就多了一份保護。
■ 問題描述:
==============================
這個漏洞最早是在今年六月被 Jouko Pynnonen 所發現的[4],Sun 也提出了修正,
不過似乎大家都不大知道就是了(我想應該是沒有大力宣傳的關係)。這個漏洞所
造成的影響是我們可以透過 JavaScript 程式碼來跳開 sandbox 當中 security manager
的限制,獲得一個原本不應該允許被取得的物件。舉個例子來說好了,很多的
Java 套件,其實都只允許 Java Virtual Machine (VM) 本身自己內部來使用,並
沒有允許廣為被大家拿來用在自己撰寫的程式碼當中。最明顯的例子就是那些
sun.* 的套件。因此當我們試圖想要使用這些套件的時候,往往就會丟出
AccessControlException 的例外(如下所示)。
java.security.AccessControlException: access denied (java.lang.RuntimePermission accessClassInPackage.sun.text)
at java.security.AccessControlContext.checkPermission(Unknown Source)
at java.security.AccessController.checkPermission(Unknown Source)
at java.lang.SecurityManager.checkPermission(Unknown Source)
at java.lang.SecurityManager.checkPackageAccess(Unknown Source)
at sun.applet.AppletSecurity.checkPackageAccess(Unknown Source)
at sun.plugin.javascript.JSClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClassInternal(Unknown Source)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at sun.plugin.javascript.invoke.JSInvoke.invoke(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at sun.plugin.javascript.JSClassLoader.invoke(Unknown Source)
at sun.plugin.com.MethodDispatcher.invoke(Unknown Source)
at sun.plugin.com.DispatchImpl.invokeImpl(Unknown Source)
at sun.plugin.com.DispatchImpl$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at sun.plugin.com.DispatchImpl.invoke(Unknown Source)
java.lang.Exception: java.security.AccessControlException: access denied (java.lang.RuntimePermission accessClassInPackage.sun.text)
at sun.plugin.com.DispatchImpl.invokeImpl(Unknown Source)
at sun.plugin.com.DispatchImpl$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at sun.plugin.com.DispatchImpl.invoke(Unknown Source)
不過當我們在 J2SE SDK/JRE 1.4.2_05 之前的版本上,搭配一些 JavaScript
程式碼來使用的話,居然可以讓我們獲得這些套件的物件實體出來。舉個簡單
例子,若是大家的版本是在 1.4.2_05 之前的話,可以拿 $JAVA_HOME$/demo/applets
裡面隨便一個例子來試試看(在這邊我是採用 Blink 這個目錄下的例子)。
我們用文字編輯器開啟範例網頁,在 [/applet] 之後加入下面這段程式碼
(請大家自行把 [] 替換成 html tag):
[script language=javascript]
var c=document.applets[0].getClass().forName('sun.text.Utility');
alert('got Class object: '+c)
[/script]
這時候開啟這個網頁的話,你會發現看到類似下列這張圖片的畫面:
圖一:Java Plugin 安全性漏洞
理論上不應該被允許使用的物件,現在居然被我們拿到了,如此一來,再透過
JavaScript 與 Java 溝通的技術[5],就可以把這個物件傳到其他 Applet
當中,自由來運用了。由於 Java 跨平台的特性,因此這個安全性漏洞的話,
會影響很多作業系統與瀏覽器。
■ 影響範圍:
==============================
此項安全性漏洞影響的範圍包括 Solaris, Windows 與 Linux 上 J2SE SDK/JRE 1.4.2_05
之前的所有系列版本,J2SE 1.3.1_13, 1.4.2_06 之後和目前最新的 J2SE 5.0
版本則不受影響。至於蘋果電腦上的 J2SE 版本的話,目前還不確定是否會對以
BSD 為核心的 Mac OSX 作業系統造成影響,這需要靜待蘋果公司出面表態說明
一下。
■ 解決方法:
==============================
下載更新到 J2SE 1.3.1_13, 1.4.2_06 之後和目前最新的 J2SE 5.0 版本。
■ 相關網站:
==============================
1.Windows and Linux exposed by Java flaw,
http://software.silicon.com/security/0,39024655,39126099,00.htm
2.Sun Fixes Security Vulnerability with Java Plug-in in JRE/SDK,
http://www.sys-con.com/story/?storyid=47188&rss=1
3.Sun Java Plug-in Sandbox Security Bypass Vulnerability,
http://secunia.com/advisories/13271/
4.Sun Java Plugin arbitrary package access vulnerability,
http://jouko.iki.fi/adv/javaplugin.html
5.JavaScript to Java Communication (Scripting),
http://java.sun.com/j2se/1.5.0/docs/guide/plugin/developer_guide/js_java.html
http://neural.ee.ncku.edu.tw/~ccy0927/plog/index.php?op=ViewArticle&articleId=35&blogId=1
