發表文章

目前顯示的是 10月, 2014的文章

正規表示式 Regexper 及測試使用的小工具

圖片
講到 RE 首先推薦這個網站,由 osteele 作者開發的小工具,可以方便的針對程式中使用的正規表示式先行測試,最後還附上使用語法的頁面。 以檢測是否為網卡卡號的表示式為範例: [0-9a-f]{2}:[0-9a-f]{2}:[0-9a-f]{2}:[0-9a-f]{2}:[0-9a-f]{2}:[0-9a-f]{2} http://osteele.com/tools/rework/ 另外一各式把正規表示式畫成一個圖,看起來比較容易理解。 http://www.regexper.com/ 底下為使用 REGERPER 網站顯示的圖形說明 在 Linux 下可以使用 grep -E 來使用進階的正規表示試驗正,如果使用 grep -e 的話只是用一般型態的正規表示式。地下為 ifconfig 指令找到該指令中 MAC address 位置的正規表示式。 常見的正規表示式 1. 驗證是否為一個合法的日期字串 ex: 2014-10-31 /^(\d{2}(([02468][048])|([13579][26]))\-((((0[13578])|(1[02]))\-((0[1-9])|([1-2][0-9])|(3[01])))|(((0[469])|(11))\-((0[1-9])|([1-2][0-9])|(30)))|(02\-((0[1-9])|([1-2][0-9])))))|(\d{2}(([02468][1235679])|([13579][01345789]))\-((((0[13578])|(1[02]))\-((0[1-9])|([1-2][0-9])|(3[01])))|(((0[469])|(11))\-((0[1-9])|([1-2][0-9])|(30)))|(02\-((0[1-9])|(1[0-9])|(2[0-8])))))$/ 2. Email 簡單的正規表示式 /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/ 3. ftp http https 網址 /(ftp|http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+...

webmaster 小工具

這個網站,提供一些網頁的小工具 http://www.phpjunkyard.com/ 查詢某個 ip 的 whois 資訊 http://www.phpjunkyard.com/tools/ip-whois.php 將文字轉換成為 html ,避免掉奇怪的程式碼 http://www.phpjunkyard.com/tools/text-to-html.php  將 html 去除成為純文字 http://www.phpjunkyard.com/tools/html-to-text.php 觀看 html 的 head 資訊 http://www.phpjunkyard.com/tools/view-http-header.php 亂碼產生器可以產生自己也會往記的密碼 http://www.phpjunkyard.com/tools/random-string.php

phpmailer 發信程式範例(smtp 不用認證)

PHPmailer 是個很好用的發信工具,  https://github.com/PHPMailer/PHPMailer (原始碼) 目前在 linux 的套件也都有收錄這套。 如果要安裝直接安裝   libphp-phpmailer  就可以(ubuntu , linux mint 都有收錄) mtchang@mt ~ $ sudo apt-cache search phpMailer libphp-phpmailer - full featured email transfer class for PHP mtchang@mt ~ $ sudo apt-get install libphp-phpmailer 安裝好後他會放在 /usr/share/php/libphp-phpmailer 目錄內 如果程式中需要引用的話,可以透過 require_once "/usr/share/php/libphp-phpmailer/class.phpmailer.php"; 的方式引用 底下為 phpmailer 引用的程式碼範例,並針對中文部份有使用 mb_internal_encoding('UTF-8'); 及 mb_encode_mimeheader("$name","UTF-8")); 避免中文的亂碼產生。 // 程式開始  ------------------------------------------------------------------------------------------------------ <?php // phpmailer 發信函式庫 require_once "/usr/share/php/libphp-phpmailer/class.phpmailer.php"; // ------------------------------------------------------------------------------------ // 接收上一個網頁傳來的變數 // -----------------------------------------------...

類似 bootstrap 前端 UI Frameworks

圖片
BootStrap 這個 UI Frameworks 很好用,可以很快速的做出品質不錯的使用者界面。 http://getbootstrap.com/   但用久了發現大家做的都一樣,看不出差異。 於是最近評估了幾個類似的 Fremework ,主要來自於底下兩篇的介紹 10 Best Responsive HTML5 Frameworks http://designinstruct.com/roundups/html5-frameworks/ 20 Exceptional CSS Boilerplates and Frameworks  http://mashable.com/2013/04/26/css-boilerplates-frameworks/ 當然 wiki 上面這篇( http://en.wikipedia.org/wiki/CSS_frameworks ) 比較了格點系統的細節比較可以參考看看 另外在這篇主要比較了 bootstrap 及 Foundation 及 Skeleton http://responsive.vermilion.com/compare.php  我這次選了 Foundation  這個 css frameworks 來使用,因為從他的文件說明( http://foundation.zurb.com/docs / )看得出 他的 UI 走扁平化的設計,符合 時尚的潮流  ios7 Mac OS X 10.10 Yosemite 都用 。  Foundation button 但是總是感覺怪怪的,這個 button 和 10 多年前 M$ frontpage 的內建 button 很像的感覺。所以應該說 M$ 十多年前就走在設計的前端 .....,只是他的名子不叫 APPLE 。 FrontPage Sample

Linux Mint – LAMP 的安裝 (3) – 讓使用者可以用 public_html 當個人網頁目錄

Linux Mint – LAMP 的安裝 (3) – 讓使用者可以用 public_html 當個人網頁目錄 * 設定讓使用者可以用 public_html 當個人網頁目錄 mtchang@mtchang-virtual-machine /etc/apache2/mods-available $ sudo a2enmod userdir Enabling module userdir. To activate the new configuration, you need to run:   service apache2 restart mtchang@mtchang-virtual-machine /etc/apache2/mods-available $ sudo service apache2 restart  * Restarting web server apache2  * 測試 public_html 驗證否正常工作? mtchang@mtchang-virtual-machine /etc/apache2/mods-available $ cd ~ mtchang@mtchang-virtual-machine ~ $ ls vmware-tools-distrib  下載  公共  圖片  影片  文件  桌面  模板  音樂 mtchang@mtchang-virtual-machine ~ $ mkdir public_html mtchang@mtchang-virtual-machine ~ $ echo 'hello my person home'  > /home/mtchang/public_html/index.html mtchang@mtchang-virtual-machine ~ $ echo '<?php phpinfo();  ?>'  > /home/mtchang/puublic_html/index.php  * 請直接使用 http://localhost/~mtchang/index.htm...

Linux Mint – LAMP 的安裝 (2) -MySQL and phpMyAdmin 的安裝與設定

圖片
Linux Mint – LAMP 的安裝 (2) -MySQL and phpMyAdmin 的安裝與設定 MySQL and phpMyAdmin 的安裝與設定 mtchang@mtchang-virtual-machine ~ $ sudo apt-get install mysql-server 正在讀取套件清單... 完成 正在重建相依關係         正在讀取狀態資料... 完成 下列的額外套件將被安裝:   libaio1 libdbd-mysql-perl libdbi-perl libmysqlclient18 libterm-readkey-perl   mysql-client-5.5 mysql-client-core-5.5 mysql-common mysql-server-5.5   mysql-server-core-5.5 建議套件:   libmldbm-perl libnet-daemon-perl libplrpc-perl libsql-statement-perl tinyca   mailx 推薦套件:   libhtml-template-perl 下列【新】套件將會被安裝:   libaio1 libdbd-mysql-perl libdbi-perl libmysqlclient18 libterm-readkey-perl   mysql-client-5.5 mysql-client-core-5.5 mysql-common mysql-server   mysql-server-5.5 mysql-server-core-5.5 升級 0 個,新安裝 11 個,移除 0 個,有 89 個未被升級。 需要下載 8,945 kB 的套件檔。 此操作完成之後,會多佔用 96.3 MB 的磁碟空間。 Do you want to continue? [Y/n] y ... ... (省略了約 1000 行....) ... 設定 libaio1:amd64 (0.3.109-4) ... 設定 libmysqlclient18:a...

Linux Mint – LAMP 的安裝 (1)

* Apache的管理與設定更是成了初學 Linux 的使用者必須一定要學會的技術。本文說明的主要環境以 Linux Mint,配合 Apache2 Server 網頁服務、PHP 程式語言、MySQL資料庫(更改為 MariaDB) 及 PHPMyAdmin資料庫管理工具,架設出完整的LAMP服務的架設流程。 * 需求套件:再進行LAMP服務的安裝時,我們需要以下開放原始碼的程式。他的官方網站如下: Apache(http://httpd.apache.org/) PHP(http://www.php.net/) MySQL(http://www.mysql.com/) --> 轉 https://mariadb.org/ PHPMyAdmin(http://www.phpmyadmin.net) 這些程式是他的官方網站資料,在 Linux Mint OS 中已經有提供LAMP已經編譯好的套件程式,只需要透過 apt-get 的軟體安裝即可方便的安裝完成。 安裝之前 1. 設定好你的網路及網路名稱 sudo /etc/init.d/networking restart  可以重新啟動你的網卡 ifconfig  可以查詢你的網卡資訊 mtchang@machine ~ $ sudo nano /etc/hosts 127.0.0.1 localhost 127.0.0.1 mtchang-virtual-machine 127.0.0.1 mini.jangmt.com 192.168.189.129 mint.jangmt.com # The following lines are desirable for IPv6 capable hosts ::1     ip6-localhost ip6-loopback fe00::0 ip6-localnet ff00::0 ip6-mcastprefix ff02::1 ip6-allnodes ff02::2 ip6-allrouters * 查詢網卡資訊 ifconfig mtchang@machine ~ $ ifconfig eth0   ...

電腦端立院 IVOD GUI 下載器 (win portable)

圖片
電腦端立院 IVOD GUI 下載器 (win portable) 我依據這篇 https://g0v.hackpad.com/IVOD-KdTs5gZb3yw 的程式碼及概念 用 PHP 改寫了一個 protable 版本可以在 windows 7 64bit 運作的 圖形界面下載器,他是用 php web 服務做的本機端下載程式。 ---- 2014.10.4 更新 ---- 找到一個 phpdesktop 的工具,把php 打包起來,看起來更像是一個桌面程式了。http://code.google.com/p/phpdesktop/ 另外修正一些小 bug ,重新打包 釋出 ivod v0.3 版本 。請解開後執行 run.exe 就可以開始抓了。 另外推薦最近熱門影片:範例網址(2):http://ivod.ly.gov.tw/Play/VOD/76446/300K (韓國已發展8G,台灣現在才推動4G是否太落伍?04:21秒起) 看新聞不清楚拉,直接看最了解為何 IT 人員會崩潰的原因,且可以作為資訊教育的案例宣導。 -------- 使用方式: (1) 下載這個檔案,完成後在你的電腦解開這個程式。 * 0.3版下載(2014.10.5 update) --> 解開後執行 run.exe 就可以了。 * 0.2 版下載 (2014.9.27 update) 這一版加入了中文檔名命名、改善啟動流程、跑起來更順了..... (2) 找到目錄中的 run.bat 檔案執行它,它會啟動 php web 服務。並且帶出瀏覽器引導你進入 http://localhost:8000/ 。 (3) 去立法院的 IVOD 選各想要下載的網址 (4) 丟到你本機的下載器內,它會先檢查一下內容,並引導你下載它。 我的環境是 win7 64bit eng. 目前測試用 chrome 和 firefox 最新版下載沒有問題。如有問題,請留言告訴我巴。 謝謝。

Vulnerability Scanning Tools(漏洞掃描工具)

https://www.owasp.org/index.php/Category:Vulnerability_Scanning_Tools 寫得很清楚 但 OpenSource 就只有幾個 http://rgaucher.info/beta/grabber/ http://sourceforge.net/p/grendel/code/ci/c59780bfd41bdf34cc13b27bc3ce694fd3cb7456/tree/ http://www.cirt.net/nikto2 https://subgraph.com/vega/ http://wapiti.sourceforge.net/ http://www.sensepost.com/research/wikto/ https://www.owasp.org/index.php/OWASP_Xenotix_XSS_Exploit_Framework https://www.owasp.org/index.php/OWASP_Zed_Attack_Proxy_Project 先推薦兩個: 1. vega https://subgraph.com/vega/ 跨平台,用 java 寫的,圖形化界面。 補充一個,無線網路偵測的 https://www.fern-pro.com/download.php