GREP表達式資料整理

GREP是一個命令行,最初用於Unix作業系統的工具。在給出文件列表或標準輸入後,GREP會對匹配一個或多個正則表達式的文本進行搜索,並只輸出匹配的文本。(wiki)



下面舉些GREP應用例子:
1. 在GREP中"."代表萬用字元,所以當我們下條件"john.smith"時下列三種情況都可以搜尋到的
‧ john smith
‧ john,smith
‧ johnQsmith

2."#"在GREP中代表任意數字,所以當我們下指令"###-###-###"下面字串均可搜尋到
‧123-366-3410
‧453-235-4942



介紹幾個在鑑識中常用的GREP表達式:


IP Address: (?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)


MAC Address: ([a-fA-F0-9]{2}\:){5}[a-fA-F0-9]{2}


URL: (http|https|ftp|mail)\:[\/\w.]+


Email: [A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,4}


Visa Credit Card Numbers:(^4[0-9]{12}(?:[0-9]{3})?$)


Valid Social Security Numbers:(^(?!000)([0-6]d{2}|7([0-6]d|7[012]))([ -]?)(?!00)dd3(?!0000)d{4}$)




另外如果需要常常使用GREP表達式,則可利用下面三套功能強大的工具協助我們產生自訂的GREP


Regulazy ( http://weblogs.asp.net/rosherove/archive/2006/07/09/IntroducingRegulazy10.aspx ) Download Here
RegulazyDemo.gif


Regex Creator ( http://sourceforge.net/projects/regexcreator/ ) Download Here
2010-02-17_092238.jpg


Rad Software Regular Expression Designer ( http://www.radsoftware.com.au/regexdesigner/ ) Download Here
RegexDesignerMainScreen.gif


三套工具各有各的好用之處,在這就不做介紹了。



參考資料:
http://weblogs.asp.net/rosherove/archive/2006/07/09/IntroducingRegulazy10.aspx
http://sourceforge.net/projects/regexcreator
http://www.radsoftware.com.au/regexdesigner
http://zh.wikipedia.org/zh-tw/Grep
http://gleeda.blogspot.com/2010/02/forensic-regexes.html

0 意見: