不過,現在已經有GitHub和GitLab了!就不用這麼麻煩,把程式碼Copy-Paste下來再放上去就行了;網誌當然也沒有存在的必要,就把它刪除吧!
Picasso's Fantasy Notepad
Here is my fantasy world, recorded that I want to do....
4.05.2024
刪除Socket Programming的一些相關網誌。。。。。
大約在六年前 (2018)的時候,當時在學習一些Socket Programming的東西,寫了一些簡單的範例,把它們放在Blogger和Google Drive。
不過,現在已經有GitHub和GitLab了!就不用這麼麻煩,把程式碼Copy-Paste下來再放上去就行了;網誌當然也沒有存在的必要,就把它刪除吧!
Linux C, getnameinfo()
Linux C, getaddrinfo(), gai_strerror(), freeaddrinfo()
Linux C, getprotobyname(), getprotobynumber, getprotoent(), endprotoent()
Linux C, gethostbyaddr(), gethostbyname()
Linux C, getservbyname(), getservbyport, getservent(), endservent()
Linux C, gethostname(), getpeername()
Linux C, htonl(), htons(), ntohl(), ntohs()
Linux C, inet_addr(), inet_aton(), inet_ntoa(), inet_pton(), inet_ntop()
Linux C, getifaddrs(), freeifaddrs()
Linux Socket Programming 初學筆記
不過,現在已經有GitHub和GitLab了!就不用這麼麻煩,把程式碼Copy-Paste下來再放上去就行了;網誌當然也沒有存在的必要,就把它刪除吧!
1.10.2024
WPA2-Passphrase - CCMP Mode
這裡記錄一下當使用者設定成WPA2-Passphrase - CCMP的時候,它的封包流程和內容長什麼樣子。
AP MAC Address: E8:C7:CF:AF:5C:C0
STA MAC Address: C4:04:15:22:64:9A
Security: WPA2 Personal
Cipher Suite: CCMP
Passphrase: 0987654321 #2946: The STA send Probe Request to AP.
(沒抓到): The AP feedback Probe Response to STA.
#2969: The STA send Authentication (request) to AP.
#2982: The AP feedback Authentication (response) to STA.
#2992: The STA send Association Request to AP.
#3004: The AP feedback Association Response to STA.
#3018, #3020, #3023, #3025: Unicast 4-Way handshaking.
#3028: Data packet; decrypted is a DHCP Request.
因為這一個案例是在Open Environment下抓的,並非在Sheilding Room / Box,所以有一些封包漏掉了,沒抓到!所以,我們就隨便找一個由AP所發出的Beacon封包:
#2941: The AP broadcast Beacon to ALL. 由上圖資訊可以得知:
#3028: Data packet; decrypted is a DHCP Request. 這一個Data封包,一樣也有一個CCMP Parameters的欄位資訊,表示是由CCMP來加密。
AP MAC Address: E8:C7:CF:AF:5C:C0
STA MAC Address: C4:04:15:22:64:9A
Security: WPA2 Personal
Cipher Suite: CCMP
Passphrase: 0987654321 #2946: The STA send Probe Request to AP.
(沒抓到): The AP feedback Probe Response to STA.
#2969: The STA send Authentication (request) to AP.
#2982: The AP feedback Authentication (response) to STA.
#2992: The STA send Association Request to AP.
#3004: The AP feedback Association Response to STA.
#3018, #3020, #3023, #3025: Unicast 4-Way handshaking.
#3028: Data packet; decrypted is a DHCP Request.
因為這一個案例是在Open Environment下抓的,並非在Sheilding Room / Box,所以有一些封包漏掉了,沒抓到!所以,我們就隨便找一個由AP所發出的Beacon封包:
#2941: The AP broadcast Beacon to ALL. 由上圖資訊可以得知:
- OUI: 00:0F:AC (IEEE 802.11 ;這是IEEE 802.11的OUI)
- RSN Version: 1
- Group Cipher Suite Type: AES (CCM) (4)
- Pairwise Cipher Suite Count: 1
- Pairwise Cipher Suite Type: AES (CCM) (4)
- Auth Key Management (AKM) Suite Count: 1
- Auth Key Management (AKM) Type: PSK (2)
- RSN Capabilities:
- Management Frame Protection Required: False
- Management Frame Protection Capable: True
#3028: Data packet; decrypted is a DHCP Request. 這一個Data封包,一樣也有一個CCMP Parameters的欄位資訊,表示是由CCMP來加密。
1.01.2024
WPA-PSK - CCMP Mode
這裡記錄一下當使用者設定成WPA-PSK - CCMP的時候,它的封包流程和內容長什麼樣子。
AP MAC Address: 00:12:0E:C1:D7:09
STA MAC Address: C0:FF:D4:D4:E9:BA
Security: WPA1 Personal
Cipher Suite: CCMP
Pre-Shared Key: 0987654321
#119: The STA send Probe Request to AP.
#122: The AP feedback Probe Response to STA.
#123: The STA send Authentication (request) to AP.
#125: The AP feedback Authentication (response) to STA.
#127: The STA send Association Request to AP.
#129: The AP feedback Association Response to STA.
#141, #143, #145, #151: Unicast 4-Way handshaking.
#155, #159: Multicast / Broadcast 2-Way handshaking.
#165: Data packet; decrypted is a DHCP Offer.
基於TKIP的經驗,這回直接看Probe Response封包:
#122: The AP feedback Probe Response to STA. 由上圖資訊可以得知:
#165: Data packet; decrypted is a DHCP Offer. 這一個Data封包,多了一個CCMP Parameters的欄位資訊,表示是由CCMP來加密。
由此可見,WPA TKIP和CCMP的差異就在於Multicast / Unicast的Ciphrt Suite。
Refer: CWSP – CCMP Encryption Method
Releated: WPA-PSK - TKIP Mode
AP MAC Address: 00:12:0E:C1:D7:09
STA MAC Address: C0:FF:D4:D4:E9:BA
Security: WPA1 Personal
Cipher Suite: CCMP
Pre-Shared Key: 0987654321
#119: The STA send Probe Request to AP.
#122: The AP feedback Probe Response to STA.
#123: The STA send Authentication (request) to AP.
#125: The AP feedback Authentication (response) to STA.
#127: The STA send Association Request to AP.
#129: The AP feedback Association Response to STA.
#141, #143, #145, #151: Unicast 4-Way handshaking.
#155, #159: Multicast / Broadcast 2-Way handshaking.
#165: Data packet; decrypted is a DHCP Offer.
基於TKIP的經驗,這回直接看Probe Response封包:
#122: The AP feedback Probe Response to STA. 由上圖資訊可以得知:
- OUI: 00:50:F2 (Microsoft Corp. ;這是微軟的OUI)
- WPA Version: 1
- Multicast Cipher Suite Type: AES (CCM) (4)
- Unicast Cipher Suite: AES (CCM) (4)
- Authentication Key Management Type: PSK (2)
#165: Data packet; decrypted is a DHCP Offer. 這一個Data封包,多了一個CCMP Parameters的欄位資訊,表示是由CCMP來加密。
由此可見,WPA TKIP和CCMP的差異就在於Multicast / Unicast的Ciphrt Suite。
Refer: CWSP – CCMP Encryption Method
Releated: WPA-PSK - TKIP Mode
12.31.2023
WPA-PSK - TKIP Mode
這裡記錄一下當使用者設定成WPA-PSK - TKIP的時候,它的封包流程和內容長什麼樣子。
AP MAC Address: 00:12:0E:C1:D7:08
STA MAC Address: C0:FF:D4:D4:E9:BA
Security: WPA1 Personal
Cipher Suite: TKIP
Pre-Shared Key: 0987654321 #292: The STA send Probe Request to AP.
#300: The AP feedback Probe Response to STA.
#294: The STA send Authentication (request) to AP.
#302: The AP feedback Authentication (response) to STA.
#304: The STA send Association Request to AP.
#306: The AP feedback Association Response to STA.
#332, #334, #336, #338: Unicast 4-Way handsharking.
#340, #342: Multicast / Broadcast 2-Way hsndsharking.
#294: The STA send Authentication (request) to AP. #302: The AP feedback Authentication (response) to STA. 由Authentication SEQ分別為0x0001和0x0002可以得知AP和STA之間認證成功;但是會帶RSN-IE的4種封包當中,與AP有關的是Beacon和Probe Response。所以,我們回過頭來檢查一下Probe Response:
#300: The AP feedback Probe Response to STA. 由上圖資訊可以得知:
會發現多了一個TKIP Parameters欄位,代表這一個封包的Cipher Suite是用TKIP;因為TKIP有向下相容於WEP,所以依樣會有Initialization Vector (初始化向量)和Key Index (金鑰索引)的欄位資訊。因為這個封包已經經過WireShark來解密,所以可以得知這是一個DHCP Ack封包。
Refer: CWSP – TKIP Encryption Method
AP MAC Address: 00:12:0E:C1:D7:08
STA MAC Address: C0:FF:D4:D4:E9:BA
Security: WPA1 Personal
Cipher Suite: TKIP
Pre-Shared Key: 0987654321 #292: The STA send Probe Request to AP.
#300: The AP feedback Probe Response to STA.
#294: The STA send Authentication (request) to AP.
#302: The AP feedback Authentication (response) to STA.
#304: The STA send Association Request to AP.
#306: The AP feedback Association Response to STA.
#332, #334, #336, #338: Unicast 4-Way handsharking.
#340, #342: Multicast / Broadcast 2-Way hsndsharking.
#294: The STA send Authentication (request) to AP. #302: The AP feedback Authentication (response) to STA. 由Authentication SEQ分別為0x0001和0x0002可以得知AP和STA之間認證成功;但是會帶RSN-IE的4種封包當中,與AP有關的是Beacon和Probe Response。所以,我們回過頭來檢查一下Probe Response:
#300: The AP feedback Probe Response to STA. 由上圖資訊可以得知:
- OUI: 00:50:F2 (Microsoft Corp. ;這是微軟的OUI)
- WPA Version: 1
- Multicast Cipher Suite Type: TKIP (2)
- Unicast Cipher Suite: TKIP (2)
- Authentication Key Management Type: PSK (2)
會發現多了一個TKIP Parameters欄位,代表這一個封包的Cipher Suite是用TKIP;因為TKIP有向下相容於WEP,所以依樣會有Initialization Vector (初始化向量)和Key Index (金鑰索引)的欄位資訊。因為這個封包已經經過WireShark來解密,所以可以得知這是一個DHCP Ack封包。
Refer: CWSP – TKIP Encryption Method
12.30.2023
Static WEP - Shared Key Mode
這裡記錄一下當使用者設定成Static WEP – Shared Key的時候,它的封包流程和內容長什麼樣子。
從上頭的流程圖可以得知:NONE Security和Open System只有2道認證;而Shared Key則是需要4道。
AP MAC Address: E8:C7:CF:AF:59:40
STA MAC Address: 80:86:F2:83:07:0C
Security: Static WEP
Authentication: Open System / Shared Key
Key Length: 64-bit / 128-bit
Key Type: ASCII / Hex
Key Index: 1
Key1 / 2 / 3 / 4: ABCDE / N / A / N / A / N / A #619: The STA send Authentication (request) to AP.
#627: The AP feedback Authentication (response) with cleartext challenge (口令盤查) to STA.
#625: The STA send Authentication (request) with encrypted cleartext challenge (WEP加密過的口令盤查) to AP.
#629: The AP feedback Authentication (response) to STA.
#631: The STA send Association Request to AP.
#634: The AP feedback Association Response to STA.
這一次偷懶,並沒有抓AP和STA的Probe Request / Response封包,因為這本來就會有的;直接從Authentication開始抓。其中#627和#625的順序剛好對調,這是因為接收封包的軟體順序的問題,並不代表AP和STA的行為錯誤。
#619: The STA send Authentication (request) to AP. Authentication Algorithm現在是設定成 Shared Key (1)。
#627: The AP feedback Authentication (response) with cleartext challenge (口令盤查) to STA. AP回覆128 Bytes的Challenge Text。
#625: The STA send Authentication (request) with encrypted cleartext challenge (WEP加密過的口令盤查) to AP. 這一個封包已經先行經過WEP解密,所以才看的到封包內容。STA也回覆128 Bytes的Challenge Text,但是有經過WEP加密過。
#629: The AP feedback Authentication (response) to STA. 最後一個封包,AP回覆Status Code: Successful (0x0000),表示認證成功。留意這四組封包:#619、#627、#625、#629,它們的Authentication SEQ依序為:0x0001、0x0002、0x0003、0x0004,也表示這一個完整的認證過程。再補充IEEE 802.11對Authentication Algorithm的規範: Refer: CWSP-Legacy 802.11 Security
Related:
AP MAC Address: E8:C7:CF:AF:59:40
STA MAC Address: 80:86:F2:83:07:0C
Security: Static WEP
Authentication: Open System / Shared Key
Key Length: 64-bit / 128-bit
Key Type: ASCII / Hex
Key Index: 1
Key1 / 2 / 3 / 4: ABCDE / N / A / N / A / N / A #619: The STA send Authentication (request) to AP.
#627: The AP feedback Authentication (response) with cleartext challenge (口令盤查) to STA.
#625: The STA send Authentication (request) with encrypted cleartext challenge (WEP加密過的口令盤查) to AP.
#629: The AP feedback Authentication (response) to STA.
#631: The STA send Association Request to AP.
#634: The AP feedback Association Response to STA.
這一次偷懶,並沒有抓AP和STA的Probe Request / Response封包,因為這本來就會有的;直接從Authentication開始抓。其中#627和#625的順序剛好對調,這是因為接收封包的軟體順序的問題,並不代表AP和STA的行為錯誤。
#619: The STA send Authentication (request) to AP. Authentication Algorithm現在是設定成 Shared Key (1)。
#627: The AP feedback Authentication (response) with cleartext challenge (口令盤查) to STA. AP回覆128 Bytes的Challenge Text。
#625: The STA send Authentication (request) with encrypted cleartext challenge (WEP加密過的口令盤查) to AP. 這一個封包已經先行經過WEP解密,所以才看的到封包內容。STA也回覆128 Bytes的Challenge Text,但是有經過WEP加密過。
#629: The AP feedback Authentication (response) to STA. 最後一個封包,AP回覆Status Code: Successful (0x0000),表示認證成功。留意這四組封包:#619、#627、#625、#629,它們的Authentication SEQ依序為:0x0001、0x0002、0x0003、0x0004,也表示這一個完整的認證過程。再補充IEEE 802.11對Authentication Algorithm的規範: Refer: CWSP-Legacy 802.11 Security
Related:
12.29.2023
Static WEP - Open System Mode
這裡記錄一下當使用者設定成Static WEP – Open System的時候,它的封包流程和內容長什麼樣子。
AP MAC Address: E8:C7:CF:AF:5C:C0
STA MAC Address: C0:FF:D4:D4:E9:BA
Security: Static WEP
Authentication: Open System / Shared Key
Key Length: 64-bit / 128-bit
Key Type: ASCII / Hex
Key Index: 1
Key1 / 2 / 3 / 4: ABCDE / N / A / N / A / N / A
#4449: The STA send Probe Request.
#4486: The AP feedback Probe Response.
#4471: The STA send Authentication (request) to AP.
#4521: The AP feedback Authentication (response) to STA.
#4523: The STA send Association Request to AP.
#4527: The AP feedback Association Response to STA.
#4471: The STA send Authentication (request) to AP. #4521: The AP feedback Authentication (response) to STA. 找一個Data封包 #4558 看一下內容: 它會告訴你Protected Flag: Data is protected;且下面還多了WEP Parameters的相關參數,告訴你這個資料封包是用WEP方式加密。而加密內容是一堆亂碼。然後我們用WireShark來解密WEP: 原來這是一個ICMPv6的封包!所以,Static WEP – Open System和NONE Security的流程和封包非常相似,差別在於Data封包是否有加密。
Related:
STA MAC Address: C0:FF:D4:D4:E9:BA
Security: Static WEP
Authentication: Open System / Shared Key
Key Length: 64-bit / 128-bit
Key Type: ASCII / Hex
Key Index: 1
Key1 / 2 / 3 / 4: ABCDE / N / A / N / A / N / A
#4449: The STA send Probe Request.
#4486: The AP feedback Probe Response.
#4471: The STA send Authentication (request) to AP.
#4521: The AP feedback Authentication (response) to STA.
#4523: The STA send Association Request to AP.
#4527: The AP feedback Association Response to STA.
#4471: The STA send Authentication (request) to AP. #4521: The AP feedback Authentication (response) to STA. 找一個Data封包 #4558 看一下內容: 它會告訴你Protected Flag: Data is protected;且下面還多了WEP Parameters的相關參數,告訴你這個資料封包是用WEP方式加密。而加密內容是一堆亂碼。然後我們用WireShark來解密WEP: 原來這是一個ICMPv6的封包!所以,Static WEP – Open System和NONE Security的流程和封包非常相似,差別在於Data封包是否有加密。
Related:
12.26.2023
超級瑪利歐 酷跑 (Super Mario RUN)
遊戲整個區分成三組玩法:
1. Remix 10
【解鎖所有可用的角色】
01. 馬利歐 (Mario):遊戲原創角色。
02. 路易吉 (Luigi):
03. 碧姬公主 (Princess Peach):玩家依序通關至世界巡迴6-4打敗魔王庫巴拯救公主之後即可使用。
04. 奇諾比奧 (Toad):玩家連結任天堂帳戶 (Nintendo Account)後即可啟用。
05. 奇諾比珂 (Toadette):
06. (綠) 耀西 (Yoshi):
07. 紅耀西 (Red Yoshi):
08. 藍耀西 (Blue Yoshi):遊戲內建的角色,毋須購買,直接在「建造王國」的商店交換即可!
09. 黃耀西 (Yellow Yoshi):
10. 紫耀西 (Purple Yoshi):
11. 黛西公主 (Princess Daisy):玩家依序通關至Remix 10「區域30」打敗魔王庫巴拯救公主之後即可使用。
【解鎖★世界】
在世界巡迴模式中,玩家依序通關1st至6th世界直到6-4拯救碧姬公主成功,即可解鎖★世界;但★世界有9個關卡,每一個關卡都需條件來解鎖。
【解鎖水管世界】
【實用的小道具】
1. Remix 10
- 每乙張拉力賽卷可以一次玩10個小關卡;
- 中途失誤直接跳下一關;
- 第5關會變更角色;
- 第10關有機會出現魔王關卡;
- 每一小關有3枚彩虹獎章 (金幣)可以蒐集;
- 有時候會出現「!」或「?」的特殊關卡,一次可以蒐集5枚彩虹獎章 (金幣)。
- 沒有失誤,通關會再追加2枚彩虹獎章 (金幣);
- 拿到全部的彩虹獎章 (金幣),會再多追加3枚;
- 追上好友,再多送1枚彩虹獎章 (金幣)。
- 黛西公主 (Princess Daisy)在「區域30」。
- 每一場區域結束後,可以在獎勵遊戲中 (黃色?磚塊)抽獎,獲得裝飾或是建築物。
- 每一場區域結束後,可以在右下角的超級獎勵遊戲中 (彩虹?磚塊)獲得3~6星級的物件。
- 總共有6個世界,每個世界都有4個小關卡;
- 每個小關卡均可以分別蒐集粉色、紫色和黑色的金幣。
- 可在拉力賽當中與其他玩家競賽,獲得五種顏色的奇諾比奧:紅色、黃色、綠色、藍色和紫色。
【解鎖所有可用的角色】
01. 馬利歐 (Mario):遊戲原創角色。
02. 路易吉 (Luigi):
- 在首頁「建造王國」的商店購買「路易吉之家」即可讓路易吉成為玩家可操縱的腳色。
- 「路易吉之家」需要150個綠色奇諾比奧和150個紫色奇諾比奧方能解鎖購買。
- 或者,玩家課金300 NT. 之後即可直接使用。
03. 碧姬公主 (Princess Peach):玩家依序通關至世界巡迴6-4打敗魔王庫巴拯救公主之後即可使用。
04. 奇諾比奧 (Toad):玩家連結任天堂帳戶 (Nintendo Account)後即可啟用。
05. 奇諾比珂 (Toadette):
- 在首頁「建造王國」的商店購買「奇諾比珂之家」即可讓奇諾比珂成為玩家可操縱的腳色。
- 「奇諾比珂之家」需要5種顏色的奇諾比奧各200個。
06. (綠) 耀西 (Yoshi):
- 在首頁「建造王國」的商店購買「(綠) 耀西之家」即可讓恐龍(綠) 耀西成為玩家可操縱的腳色。
- 「(綠) 耀西之家」需要30個紅色奇諾比奧和30個黃色奇諾比奧才能解鎖購買。
07. 紅耀西 (Red Yoshi):
- 在首頁「建造王國」的商店購買「紅耀西之家」即可讓恐龍紅耀西成為玩家可操縱的腳色。
- 「紅耀西之家」需要1000個黃色奇諾比奧和9999個紅色奇諾比奧才能解鎖購買。
08. 藍耀西 (Blue Yoshi):遊戲內建的角色,毋須購買,直接在「建造王國」的商店交換即可!
09. 黃耀西 (Yellow Yoshi):
- 在首頁「建造王國」的商店購買「黃耀西之家」即可讓恐龍黃耀西成為玩家可操縱的腳色。
- 「黃耀西之家」需要300個藍色奇諾比奧、300個綠色奇諾比奧,和200個紫色奇諾比奧才能解鎖購買。
10. 紫耀西 (Purple Yoshi):
- 在首頁「建造王國」的商店購買「紫耀西之家」即可讓恐龍紫耀西成為玩家可操縱的腳色。
- 「紫耀西之家」需要150個藍色奇諾比奧、150個綠色奇諾比奧,和100個紫色奇諾比奧才能解鎖購買。
11. 黛西公主 (Princess Daisy):玩家依序通關至Remix 10「區域30」打敗魔王庫巴拯救公主之後即可使用。
【解鎖★世界】
在世界巡迴模式中,玩家依序通關1st至6th世界直到6-4拯救碧姬公主成功,即可解鎖★世界;但★世界有9個關卡,每一個關卡都需條件來解鎖。
- ★-1:World 6-4 用碧姬公主打倒庫巴吧!
- ★-2:World 1-1 拿到5枚以下的金幣過關吧!
- ★-3:奇諾比奧拉力賽 (Toad Rally)贏得3連勝吧!
- ★-4:Remix 10 一次蒐集30枚以上的獎章吧!
- ★-5:World 4-1 以剩餘時間+60以上破關吧!
- ★-6:World 1-2 拿到400枚以上的金幣過關吧!
- ★-7:World 4-2 一隻栗寶寶也不擊倒的過關吧!
- ★-8:World 5-1 拿到300枚以上的金幣過關吧!
- ★-9:World 2-4 一次打倒20隻以上的哈庫吧!
【解鎖水管世界】
- 粉色金幣水管:在世界巡迴中蒐集第1~6世界的粉色金幣 (5 * 4 * 6 = 120)。
- 紫色金幣水管:在世界巡迴中蒐集第1~6世界的紫色金幣 (5 * 4 * 6 = 120)。
- 黑色金幣水管:在世界巡迴中蒐集第1~6世界的黑色金幣 (5 * 4 * 6 = 120)。
- 黃金星星水管 (★-S):在世界巡迴中蒐集★世界的黑色金幣 (5 * 9 = 45)。
【實用的小道具】
- ?磚塊、長?磚塊、巨大?磚塊:可以隨機獲得物品。
- 紅色獎勵小遊戲之家:遊戲基本擁有的小遊戲之家,不需要購買,每4小時可玩1次。遊戲進行時,會出現多條不同路徑讓玩家選擇,玩家選擇不同的路徑會影響獲得不同數量的金幣,走到最後玩家可以獲得寶箱,寶箱內可獲得不定數量的奇諾比奧拉力卷。
- 藍色獎勵小遊戲之家:30個紫色奇諾比奧和30個黃色奇諾比奧即可購買。每6小時可玩1次。在一定時間內,將規定的方框連在一起就算獲勝。
- 黃色獎勵小遊戲之家:50個黃色奇諾比奧即可購買。每8小時可玩1次。遊戲進行時,會從綠色水管噴出東西,如金幣、奇諾比奧拉力卷、火球,玩家一旦碰到火球,遊戲就會結束。
訂閱:
文章 (Atom)