Somewhere I Belong

All about geek's life


  • 首頁

  • 歸檔

  • 關於

  • 標籤

  • 開源專案

Wireshark x ssh x tcpdump 遠端偵錯

發表於 12月 15 2015 | 0 Comments

最近工作常常需要用到 Wireshark 來看看一些怪怪的問題…

如果是要除錯一般 ethernet 就還好,可以借一台具備 Port Mirror 功能的 Switch 來除錯,但是如果遇到像是 WiFi 或 Cellular 這種無線介面,就只能用 TCPDUMP 擋著…

但是,光是從 console 觀察 TCPDUMP 資訊實在很費工夫,好在 Wireshark 有提供從 stdin pipe 進來的機制 (當然,你也可以用 tcpdump 存成檔案在用 Wireshark 來讀取)

於是乎,只要下…

Linux / Mac

ssh -l root 192.168.3.127 tcpdump -U -s0 -w - -i eth1 | wireshark -k -i -

eth1 換成你要的介面

Windows (without cygwin)

plink.exe -ssh -pw abc123 root@192.168.2.1 "tcpdump -ni eth0 -s 0 -w - not port 22" | "C:\Program Files\Wireshark\Wireshark.exe" -k -i -

其中 plink 可前往 putty 下載頁面 Download

Reference:

  • Remote capture via ssh and pipe

依照檔名中版本號碼排序

發表於 11月 6 2015 | 0 Comments

ls -v 可以依照檔名中的版本來排序,根本太強大啊!

Before -v

root@zack:/unstable# ls i-feel-so-good*.deb -alh

-rw-rw-r-- 1 zack zack 2.2M Sep 14 11:41 i-feel-so-good0.9.0_all.deb
-rw-rw-r-- 1 zack zack 1.7M Oct 13 17:40 i-feel-so-good0.9.10_all.deb
-rw-rw-r-- 1 zack zack 1.9M Oct 29 10:48 i-feel-so-good0.9.11_all.deb
-rw-rw-r-- 1 zack zack 1.8M Sep 22 17:25 i-feel-so-good0.9.1_all.deb
-rw-rw-r-- 1 zack zack 1.8M Sep 22 17:55 i-feel-so-good0.9.2_all.deb
-rw-rw-r-- 1 zack zack 1.8M Sep 24 15:28 i-feel-so-good0.9.3_all.deb
-rw-rw-r-- 1 zack zack 1.8M Sep 30 18:04 i-feel-so-good0.9.5_all.deb
-rw-rw-r-- 1 zack zack 1.8M Sep 30 18:41 i-feel-so-good0.9.6_all.deb
-rw-rw-r-- 1 zack zack 1.8M Oct 2 18:01 i-feel-so-good0.9.7_all.deb
-rw-rw-r-- 1 zack zack 1.7M Oct 13 10:17 i-feel-so-good0.9.8_all.deb
-rw-rw-r-- 1 zack zack 1.7M Oct 13 10:42 i-feel-so-good0.9.9_all.deb

After -v

root@zack:/unstable# ls i-feel-so-good*.deb -avlh
-rw-rw-r-- 1 apt-server apt-server 2.2M Sep 14 11:41 i-feel-so-good0.9.0_all.deb
-rw-rw-r-- 1 apt-server apt-server 1.8M Sep 22 17:25 i-feel-so-good0.9.1_all.deb
-rw-rw-r-- 1 apt-server apt-server 1.8M Sep 22 17:55 i-feel-so-good0.9.2_all.deb
-rw-rw-r-- 1 apt-server apt-server 1.8M Sep 24 15:28 i-feel-so-good0.9.3_all.deb
-rw-rw-r-- 1 apt-server apt-server 1.8M Sep 30 18:04 i-feel-so-good0.9.5_all.deb
-rw-rw-r-- 1 apt-server apt-server 1.8M Sep 30 18:41 i-feel-so-good0.9.6_all.deb
-rw-rw-r-- 1 apt-server apt-server 1.8M Oct 2 18:01 i-feel-so-good0.9.7_all.deb
-rw-rw-r-- 1 apt-server apt-server 1.7M Oct 13 10:17 i-feel-so-good0.9.8_all.deb
-rw-rw-r-- 1 apt-server apt-server 1.7M Oct 13 10:42 i-feel-so-good0.9.9_all.deb
-rw-rw-r-- 1 apt-server apt-server 1.7M Oct 13 17:40 i-feel-so-good0.9.10_all.deb
-rw-rw-r-- 1 apt-server apt-server 1.9M Oct 29 10:48 i-feel-so-good0.9.11_all.deb

又學到一招了!

秒建 WordPress 在你閒置的 Raspberry Pi 上

發表於 11月 1 2015 | 0 Comments

最近把吃喝玩樂 Blog 從 Blogspot 搬到 WordPress 了!於是乎就想要玩玩各種功能…

Production 環境目前是 host 在 DigitalOcean ,看了旁邊的 Raspberry Pi 一眼好像閒著也是閒著,於是上網看看有沒有現成的 Docker Image 可以用,結果找不到喜歡的。就自己 Build 一個吧!

英文說明與 Dockerfile, Scripts 都在 Github 連結:imZack/wordpress-armhf

這邊主要會用到兩個 Image 分別是 zack/wordpress-armhf:4.3.1-apache 與 armbuilds/mariadb,詳細的 Dockerfile 可以在上面 Github 連結裡面找到。由於 Docker Hub 無法自動 Build armhf 的 Image 所以我必須先在 Raspberry Pi 上 build 好然後再推上去。(另有用 QEMU 方式,這邊先不多提…)

wordpress:
image: zack/wordpress-armhf:4.3.1-apache
restart: always
links:
- mysql
environment:
- WORDPRESS_DB_PASSWORD=wordpressmeetsdocker
ports:
- "8080:80"
volumes:
- ./www-data:/var/www/html

mysql:
image: armbuilds/mariadb
restart: always
volumes:
- ./mysql-data:/var/lib/mysql
environment:
- MYSQL_ROOT_PASSWORD=wordpressmeetsdocker
- MYSQL_DATABASE=wordpress

用上面的 docker-compose.yml 就能在幾秒內建立一個全新的 WordPress 環境囉!

只需要下 docker-compose up 等他跑完初始化,就能開啟 http://localhost:8080 Port 囉 !

淺讀 Netfilter Framework

發表於 10月 29 2015 | 0 Comments

Background

  • Linux 2.3.x 時期 Paul Rusty Russel 寫的
  • 基本上就是插入一些 Hooks 到 Kernel module
  • Iptables 常常跟 Netfilter Framework 搞混,Iptables 屬於 Netfilter Framework 的一員

Hooks and The Callback Functions

有五種 Hooks 會插入在 Linux networking stack 中的不同階段

--> PREROUTING ---> [ROUTE] ---> FORWARD -------------------> POSTROUTING -->
| ^
| |
| [ROUTE]
V |
LOCAL IN ---> LOCAL PROCESS --> LOCAL OUT
閱讀全文 »

移除/停用 Ionic Splash Screen

發表於 9月 9 2015 | 0 Comments

這幾天再開發 TNUA BUS APP iOS 版的時候,發現預設有惱人的 Splash Screen…

什麼是 Splash Screen ?就是一開啟 APP 他會跳出來顯示 LOGO 之類的那個玩意,然後過幾秒(或是等待背景程式預備狀態)後自動消失。

因為我把 TNUA BUS APP 定調為一個簡單速查的工具,這個過十分沒有必要。Google 了一下發現答案還滿多種的 = =+

於是找到了一個官方有提到的設定參數

Customizing the Splash Screen

直接在 Ionic 專案根目錄中的 config.xml 加入下方程式碼:

<preference name="AutoHideSplashScreen" value="true" />

打完收工。

UPDATE 2015/09/13: 原來上面的方式無法關閉(上次不知道為什麼鬼打牆ㄡ…)
要進 Xcode Project Setting 裡面修改把 Launch Screen File 清空,如下圖:

xcode remove splash screen

啟用 zram 在 Raspberry Pi 上

發表於 9月 8 2015 | 0 Comments

有鑑於 Raspberry Pi 2 記憶體只有 1G,一個不小心可能程式就被 Kernel 發出 OOM 事件幹掉…

這邊就想到 2013 WWDC OS X 狂推猛推的神奇黑科技 (事實上卻是早在 Linux 好一陣子的 zram 技術來用,嘖嘖!)

zram 有利於嵌入式裝置、小筆電和其它相似的低端硬體裝置。這些裝置通常使用固態儲存,它們由於其原生性質而壽命有限,因而避免以其提供交換空間可防止其迅速磨損。此外,使用zRAM還可顯著降低Linux系統用於交換的I/O

  • zRAM,先前稱為compcache
  • Debian ZRam
  • zram: Compressed RAM based block devices
閱讀全文 »

Security of Things: 駭客年會 NANO Wargame 心得

發表於 9月 6 2015 | 0 Comments

以往一直沒機會參加的駭客年會 (Hitcon),今年終於參與了!
本篇主要講一下這次有趣的 Wargame - Arduino Nano…

閱讀全文 »

AD-ZaiJian: 廣告再見

發表於 9月 5 2015 | 1 Comment

起因

幾天前看到幾篇瀏覽器 AdBlock 以及其他外掛效能大戰,無意間看到一個有趣的專案:Pi-Hole (RASPBERRY PI AD-BLOCKER)。

原來是透過 dnsmasq 來提供 dns service (tcp/udp 53),並藉由網路上定期維護的幾份黑名單來阻擋域名解析…

Dnsmasq is a Domain Name System (DNS) forwarder and Dynamic Host Configuration Protocol (DHCP) (more information)

這樣就可以把廣告 擋在你的電腦之前;而不是先讀取完廣告,才將其隱藏或刪除網頁上的元素!

閱讀全文 »

自造:PTT 新文章、關鍵字 手機通知服務

發表於 8月 31 2015 | 21 Comments

故事是這樣的…

常常在 PTT 上看到一些特價訊息或是好康活動文章,由於不是整天沒事幹守在板上所以每次看到訊息的時候可能都已經超過活動時間…Q_Q

於是誕生了…

閱讀全文 »

編譯小米 WIFI (mt7601) 給樹莓派使用

發表於 4月 28 2015 | 2 Comments

安裝 Driver

繼上一篇自編 Kernel 後,其實我最主要的目的是希望把小米 WiFi 的 Driver 裝上…

下載我先前修改過(加入MIFI 的 usb device id)

λ ~/git clone https://github.com/imZack/mt7601.git

閱讀全文 »
123…7

YuLun Shih

70 文章
6 分類
127 標籤
RSS
GitHub E-Mail Twitter
© 2017 YuLun Shih