目前分類:未分類文章 (10)

瀏覽方式: 標題列表 簡短摘要

4-Way Handshake

 

I was thinking to write about the 4-way handshake and started to think that from where I should start writing. Shall I just describe 4-way handshake which can be found everywhere on the web or shall I do a deep dive?  Reason for me to write is to make it easier to understand for non WiFi people who can just read and understand because sometimes different terminologies used in this process can be confusing. So, let’s start with…

What is 4-way Handshake:

The 4-way handshake is the process of exchanging 4 messages between an access point (authenticator) and the client device (supplicant) to generate some encryption keys which can be used to encrypt actual data sent over Wireless medium. These keys which are generated through 4-way handshake are generated by some source key material which will be discussed later.

If you do not want to get confused about the terminologies used in 4-way handshake then let’s have a quick look. Let’s see what terminologies we might come across to understand 4-way handshake. I would say don’t be scared of these terminologies. It’s like much ado about nothing.

These are the few keys we will be discussing…

  • MSK (Master Session Key)
  • PMK (Pairwise Master Key)
  • GMK (Group Master Key)
  • PTK (Pairwise Transit Key)
  • GTK (Group Temporal Key)
  • ANonce
  • SNonce
  • MIC

I will start by talking about the keys which are generated during the 4-way handshake and towards the keys and other variables needed in order to generate these keys.

PTK (Pairwise Transit Key):

Pairwise transit key is used to encrypt all unicast traffic between a client station and the access point. PTK is unique between a client station and access point. To generate PTK, client device and access point need the following information.

PTK = PRF (PMK + Anonce + SNonce + Mac (AA)+ Mac (SA))

Anonce is a random number generated by an access point (authenticator), Snonce a random number generated by the client device (supplicant). MAC addresses of supplicant (client device) and MAC address of authenticator (access point). PRF is a pseudo-random function which is applied to all the input.

PTK is dependent on another high-level key PMK (pairwise master key) which is discussed below.

GTK (Group Temporal Key):

Group temporal key is used to encrypt all broadcast and multicast traffic between an access point and multiple client devices. GTK is the key which is shared between all client devices associated with 1 access point. For every access point, there will be a different GTK which will be shared between its associated devices.

GTK is dependent on another high-level key GMK (group master key) discussed below.

PMK (Pairwise Master Key):

horace papa 發表在 痞客邦 留言(0) 人氣()

https://www.shellcheck.net/

 


horace papa 發表在 痞客邦 留言(0) 人氣()

https://www.booleanworld.com/depth-guide-iptables-linux-firewall/

a very good doc for understanding iptables.

 

he Linux kernel comes with a packet filtering framework named netfilter. It allows you to allow, drop and modify traffic leaving in and out of a system. A tool, iptables builds upon this functionality to provide a powerful firewall, which you can configure by adding rules. In addition, other programs such as fail2ban also use iptables to block attackers.

In this article, we’re going to take a look at how iptables works. We’re also going to look at a few examples, which will help you write your own rules.

How does iptables work?

iptables is just a command-line interface to the packet filtering functionality in netfilter. However, to keep this article simple, we won’t make a distinction between iptables and netfilter in this article, and simply refer to the entire thing as “iptables”.

 

The packet filtering mechanism provided by iptables is organized into three different kinds of structures: tables, chains and targets. Simply put, a table is something that allows you to process packets in specific ways. The default table is the filter table, although there are other tables too.

Again, these tables have chains attached to them. These chains allow you to inspect traffic at various points, such as when they just arrive on the network interface or just before they’re handed over to a process. You can add rules to them match specific packets — such as TCP packets going to port 80 — and associate it with a target. A target decides the fate of a packet, such as allowing or rejecting it.

When a packet arrives (or leaves, depending on the chain), iptables matches it against rules in these chains one-by-one. When it finds a match, it jumps onto the target and performs the action associated with it. If it doesn’t find a match with any of the rules, it simply does what the default policy of the chain tells it to. The default policy is also a target. By default, all chains have a default policy of allowing packets.

Now, we’re going to take a deeper look into each of these structures.

Tables

As we’ve mentioned previously, tables allow you to do very specific things with packets. On a modern Linux distributions, there are four tables:

  • The filter table: This is the default and perhaps the most widely used table. It is used to make decisions about whether a packet should be allowed to reach its destination.
  • The mangle table: This table allows you to alter packet headers in various ways, such as changing TTL values.
  • The nat table: This table allows you to route packets to different hosts on NAT (Network Address Translation) networks by changing the source and destination addresses of packets. It is often used to allow access to services that can’t be accessed directly, because they’re on a NAT network.
  • The raw table: iptables is a stateful firewall, which means that packets are inspected with respect to their “state”. (For example, a packet could be part of a new connection, or it could be part of an existing connection.) The raw table allows you to work with packets before the kernel starts tracking its state. In addition, you can also exempt certain packets from the state-tracking machinery.

In addition, some kernels also have a security table. It is used by SELinux to implement policies based on SELinux security contexts.

horace papa 發表在 痞客邦 留言(0) 人氣()

[音響論壇] 調整LP唱盤的八大基本功

音響論壇第87期 217-221頁 作者/劉漢盛。 

在LP時代,許多人終其一生聽LP唱片,然而,他們可能連唱頭要調整三個角度都不知道。只知道唱頭鎖上唱頭蓋,加上適當針壓就能唱出聲音了。從「知」的角度來看,他們可說是糊里糊塗的聽著唱片。從「不知」的角度來看,他們才是真正幸福的LP迷,因為他們從來未曾感受到調整唱頭唱臂的痛苦。 
 

 

調整唱頭唱臂有什麽痛苦呢?第一:聲音不穩定。往往今天聽了好聲,明天聲音就跑掉了。至於為什麽聲音會跑掉?從來這就是無頭公案。也因為聲音不穩定,LP時代邀請人來家裏聆樂時,往往就因為聲音跑掉而尷尬極了。第二:越調越迷糊:每一個人在調整唱頭唱臂時都想要越調越好,但往往反覆調過幾次之後,聽覺越來越遲鈍,越來越迷糊,也越來越不敢確定到底哪一次聲音最好。調到後來,經常就是心神耗盡,疲勞崩潰收場。第三:變數大多。就以唱片本身來說好了,唱片彎曲不說,每個廠牌的唱片厚度還不一樣。唱片彎曲其他的調整就都白費了,因為所有的角度都會不正確。而厚薄不同也讓費心調好的垂直循軌角V.T.A心血泡湯,因為我們爭的也就是那零點零幾公分的差異。第四:要非常小心。為什麽非常小心是痛苦之一?當然羅,因為祇要您一不小心,昂貴的唱針就會被您弄斷。唱針一弄斷至少就要花個幾千幾萬,您不會心疼痛苦嗎? 

基於這四大痛苦,所以今日CD盛行真是救苦救難菩薩,讓大多數人從苦海中解脫。奇怪?既然聽LP唱片那麽的痛苦,為什麽還有人甘之如飴呢?其實答案也很簡單。第一:聽LP唱片有成就感。調整功夫的高低直接就影響到聲音的好聽與否,功夫不夠,聲音就不好聽;功夫好,大家都稱讚。因此,聽LP唱片比聽CD要來得有成就感。第二:LP是類比的聲音。類比聲音裏有數位聲音所無法企及的許多細節,而且音質也更自然。這也是許多人仍不放棄聽LP唱片的主要原因。 

對於從LP時代跨到CD時代的LP迷而言,調整唱頭唱臂的一些基本功夫他們皆已具備。而對于那些要從CD時代跨入LP領域的新LP迷而言,他們恐怕就沒有這些基本功夫。因此,我在這裡想以最簡單的方式來為這些新鮮人講述調整唱盤系統的八大基本功。有了這八大基本功之後,您再往更細微的地方去發展,很快的就會有所成就。 

第一功:調唱盤、轉盤的水平 

這裡所說的唱盤包括整座唱盤本身以及轉盤。尤其是轉盤,如果轉盤本身沒有水平,那就沒什麽戲好唱了。為什麽?由于它不水平,抗滑會有問題,唱片溝槽二側受力也不同。這樣一來,許多問題就會產生。 

調整方法:使用水平儀。水平儀有二種,一種是圓形中間有孔的,可以套在轉軸中央。另一種是長型的,可以測較大面積的表面水平與否。最好的方法就是二種都準備,先用長型水平儀側唱盤水平與否。然後再用圓形的測轉盤水平與否。至於要如何調轉盤的水平,由于各種唱盤的懸浮系統都不一樣,因此無法在此詳述。 

檢驗成果:以目視檢驗,看氣泡是否在中間就對了。 
文章標籤

horace papa 發表在 痞客邦 留言(0) 人氣()

[音響論壇] 調整LP唱盤的八大基本功

音響論壇第87期 217-221頁 作者/劉漢盛。 

在LP時代,許多人終其一生聽LP唱片,然而,他們可能連唱頭要調整三個角度都不知道。只知道唱頭鎖上唱頭蓋,加上適當針壓就能唱出聲音了。從「知」的角度來看,他們可說是糊里糊塗的聽著唱片。從「不知」的角度來看,他們才是真正幸福的LP迷,因為他們從來未曾感受到調整唱頭唱臂的痛苦。 
 

 

調整唱頭唱臂有什麽痛苦呢?第一:聲音不穩定。往往今天聽了好聲,明天聲音就跑掉了。至於為什麽聲音會跑掉?從來這就是無頭公案。也因為聲音不穩定,LP時代邀請人來家裏聆樂時,往往就因為聲音跑掉而尷尬極了。第二:越調越迷糊:每一個人在調整唱頭唱臂時都想要越調越好,但往往反覆調過幾次之後,聽覺越來越遲鈍,越來越迷糊,也越來越不敢確定到底哪一次聲音最好。調到後來,經常就是心神耗盡,疲勞崩潰收場。第三:變數大多。就以唱片本身來說好了,唱片彎曲不說,每個廠牌的唱片厚度還不一樣。唱片彎曲其他的調整就都白費了,因為所有的角度都會不正確。而厚薄不同也讓費心調好的垂直循軌角V.T.A心血泡湯,因為我們爭的也就是那零點零幾公分的差異。第四:要非常小心。為什麽非常小心是痛苦之一?當然羅,因為祇要您一不小心,昂貴的唱針就會被您弄斷。唱針一弄斷至少就要花個幾千幾萬,您不會心疼痛苦嗎? 

基於這四大痛苦,所以今日CD盛行真是救苦救難菩薩,讓大多數人從苦海中解脫。奇怪?既然聽LP唱片那麽的痛苦,為什麽還有人甘之如飴呢?其實答案也很簡單。第一:聽LP唱片有成就感。調整功夫的高低直接就影響到聲音的好聽與否,功夫不夠,聲音就不好聽;功夫好,大家都稱讚。因此,聽LP唱片比聽CD要來得有成就感。第二:LP是類比的聲音。類比聲音裏有數位聲音所無法企及的許多細節,而且音質也更自然。這也是許多人仍不放棄聽LP唱片的主要原因。 

對於從LP時代跨到CD時代的LP迷而言,調整唱頭唱臂的一些基本功夫他們皆已具備。而對于那些要從CD時代跨入LP領域的新LP迷而言,他們恐怕就沒有這些基本功夫。因此,我在這裡想以最簡單的方式來為這些新鮮人講述調整唱盤系統的八大基本功。有了這八大基本功之後,您再往更細微的地方去發展,很快的就會有所成就。 

第一功:調唱盤、轉盤的水平 

這裡所說的唱盤包括整座唱盤本身以及轉盤。尤其是轉盤,如果轉盤本身沒有水平,那就沒什麽戲好唱了。為什麽?由于它不水平,抗滑會有問題,唱片溝槽二側受力也不同。這樣一來,許多問題就會產生。 

調整方法:使用水平儀。水平儀有二種,一種是圓形中間有孔的,可以套在轉軸中央。另一種是長型的,可以測較大面積的表面水平與否。最好的方法就是二種都準備,先用長型水平儀側唱盤水平與否。然後再用圓形的測轉盤水平與否。至於要如何調轉盤的水平,由于各種唱盤的懸浮系統都不一樣,因此無法在此詳述。 

檢驗成果:以目視檢驗,看氣泡是否在中間就對了。 

horace papa 發表在 痞客邦 留言(0) 人氣()

 原文載於: 背包客棧自助旅行論壇 http://www.backpackers.com.tw/forum/showthread.php?p=2598034

 

對汽車空調
分享一下淺見
如有誤,請大家指正

在修車廠維修空調時,技師回達車主
狀況排行榜第一名永遠都是
壓縮機壞了….
管路有漏,沒有冷媒了….


但實際狀況是否真的是如此
有待車主需簡易的對自己車車輕微的小認知一下

在如此昂貴且重要的壓縮機,其實都有些保護元件,避免壓縮機太過於容易壞
原文載於: 背包客棧自助旅行論壇 http://www.backpackers.com.tw/forum/showthread.php?p=2598034
(但若車體有碰撞或事故,不在此文所涉及範圍內,畢竟我不是達人)

horace papa 發表在 痞客邦 留言(0) 人氣()

http://infocenter.arm.com/help/topic/com.arm.doc.dai0201a/index.html


horace papa 發表在 痞客邦 留言(0) 人氣()

柚木(TEAK),马鞭草科,是世界公认的著名珍贵木材,其中以泰国、缅甸为最佳,因泰国已禁止砍伐,所以以缅甸进口的为上品。柚木从生长到成材最少经50年,生长期缓慢,其密度及硬度较高,不易磨损;柚木富含铁质和油质,这种铁质和油质使之保持不变形,防虫、防蚁、防酸碱,特别防潮、耐腐,且带有一种自然的醇香。优美的墨线、斑斓的油影,构成柚木独特的天然纹理;更为神奇的是,它的刨光面颜色能通过光合作用氧化而成金黄色,且颜色随时间的延长而更加美丽。

正因柚木有此优良特性,古今中外许多保存完好的古建筑,几乎都是采用柚木做装饰。在中国最繁华的上海滩上那些久远漂亮的建筑物(如汇丰银行、海关大楼、和平饭店等)都采用柚木装饰,虽历经百年沧桑,却依然完好如初,亮丽如新。在欧美,柚木不仅是一种装饰材料,也是一种保值商品,更成为富贵的象征。

随着人们对更高生活品质的追求,柚木地板走入寻常百姓家,成为了高档物业地板市场的主角。但却时常有消费者抱怨“如何买到正宗的缅甸柚木地板”是件很头疼的事情。

由于利益的驱使,市场上假冒的柚木地板可谓是前赴后继,因此要在市场上买到正宗的柚木地板确实不是件容易的事。花了大价钱买了假柚木地板,或贪一时小便宜买了假柚木地板屡见报端。森林之旅经营了二十多年的柚木,专做柚木地板也有九年时间,在这里给柚木地板消费者一些建议和教大家一些识别方法。

森林之旅建议消费者在购买柚木地板时一定要在销售凭证上注明“柚木实木地板”,最好是写上“缅甸柚木实木地板”字样。这能保证在发生纠纷时有证据来维护自己的权益,但还是不能从根本上解决问题。森林之旅认为最重要的是把工作做在前面,选择对的远比事后维权来的舒心。纵观整个柚木地板市场,森林之旅发现冒充缅甸柚木地板主要有三法:
柚木地板
一、自提身价法:以同一树种冒充缅甸柚木。市场上主要采用标有“印尼柚木”、“非洲柚木”、“南美柚木”、“巴西柚木”、“马来西亚柚木”、“尼日利亚柚木”、“圭亚那柚木”等名称的做法。实际上即使属于同一树种,因产地不同,其质地、价格也相差甚远、更有甚者,根本不是柚木树种,价格相差更远。这些非洲及美洲的柚木,因为种植地区气候不同,树木的生长周期短,树龄10年就能成材,油质相对下降很多,已失去柚木油质丰富的特性,材质干燥易裂。因此用"非洲柚木"或者"南美柚木"等加工的木地板实际上已经算不上真正的柚木地板了。

冠以泰柚叫卖的,殊不知因泰国禁止砍伐,天然原始林的泰柚在市场上几乎不存在。现在陆陆续续有部分从泰国进口的柚木,也基本就是泰国的人工林柚木。

二、冒充替代法:用相似或相近纹理、密度的树种冒充缅甸柚木。市场上最多的是黑心木莲冒充缅甸柚木,令外行人很难辨认。
 
三、臆造名法:主要有:金丝柚、金柚木、柚木王、柚木皇、紫金柚、柚檀、铁柚、美柚等,事实上这些树种世界上根本不存在,充其量不过是一些杂木而已。

费者了解了柚木地板假冒三法就能做到心中有数,但在购买的时候一样要注意分辨。以下是森林之旅教给大家一些鉴别真假柚木地板的方法,大部分分辨方法是建立在素板或背面不封漆的基础上的,如果全部封漆再加上在工艺上做一些手脚的话,就很难予以分辨。

horace papa 發表在 痞客邦 留言(0) 人氣()


一.   arm-linux-objcopy被用来复制一个目标文件的内容到另一个文件中,可用于不同源文件的之间的格式转换
二.   示例:
Arm-linux-objcopy –o binary –S elf_file bin_file

三.   常用的选项:
input-file , outflie
输入和输出文件,如果没有outfile,则输出文件名为输入文件名

2.-l bfdname或—input-target=bfdname
用来指明源文件的格式,bfdname是BFD库中描述的标准格式名,如果没指明,则arm-linux-objcopy自己分析
3.-O bfdname 输出的格式
4.-F bfdname 同时指明源文件,目的文件的格式
5.-R sectionname 从输出文件中删除掉所有名为sectionname的段
6.-S 不从源文件中复制重定位信息和符号信息到目标文件中
7.-g 不从源文件中复制调试符号到目标文件中


horace papa 發表在 痞客邦 留言(0) 人氣()

iptables 封包過瀘規則

需求

Kernel 2.4.x

參考文件

  • pinfo iptables
  • netfilter
  • Linux 伺服器安全防護 (O'REILLY, ISBN: 986-7794-18-4)
  • Linux iptables Pocket reference (O'REILLY, ISBN: 986-7794-39-7)
  • Linux Firewalls (New Riders, ISBN: 0735710996)

Linux 在做封包過瀘時,是由 kernel 的 netfilter 在實際做封包的過瀘,並非由 iptables 來做,而 iptables 最主要的功能,是用來設定 netfilter 的規則,iptables 可以用來設計防火牆或封包傳送的規則,也可以顯示目前核心 (kernel) 的 netfilter 過瀘狀態。

netfilter 攔截網路封包,分別有五個地方,這五個地方分別為 PREROUTING、POSTROUTING、INPUT、OUTPUT及 FORWRD。這五個 chains 分別為網路封包旅程時會依其狀態而經過。

以下為這五個 chains 的攔截點圖:

上圖可以很清楚看到這五個 chains 的位置,而封包在經過網路介面時,會判別該封包是會往那裡去,然而也是我們在做 iptables 設置時要搞清楚的地方。

  • PREROUTING
    封包進入網路卡介面的時候
  • POSTROUTING
    封包即將離開網路介面的時候
  • FORWARD
    封包在轉送的時候,如(從 A 到 B 網段)
  • INPUT
    到達本機的封包
  • OUTPUT
    離開本機的封包

iptables 三種過瀘規則

  • filter
    這是預設的規則,如果都不指定類別 (table),那麼就會使用 filter 來當做預設的規則,filter 用來過瀘封包的來源 (埠)、目的 (埠) 和其它的類別,filter 可以使用處理 INPUT, OUTPUT, FORWARD 等 chains.
  • nat

horace papa 發表在 痞客邦 留言(0) 人氣()