tshark – Wireshark command line tool

Wireshark gui 很吃資源,打開程式就死當

使用 command line tool “tshark” 就沒問題了

windows 系統為例

底下指令

1. 列出現在的網路介面

PS C:\Program Files\Wireshark> ^C
PS C:\Program Files\Wireshark> ^C
PS C:\Program Files\Wireshark> .\tshark.exe -D
1. \Device\NPF_{38D018FF-8738-45CD-AA7F-27945699DEB0} (VirtualBox Host-Only Network #4)
2. \Device\NPF_{712B91F4-2935-43F1-8EF0-CF96EEAA9436} (銋云蝬脰楝 3)
3. \Device\NPF_{0320428E-FD78-4053-AF72-A73F6620083B} (銋云蝬脰楝)
4. \Device\NPF_{362554FF-1063-4EA1-9D92-AE72742290DB} (銋云蝬脰楝 2)
5. \\.\USBPcap1 (USBPcap1)

2. 抓取封包

只監聽網路介面 nterface 3 的流量
只抓取跟 host 118.220.173.20 有關的封包
結果寫入 ps20180802.pcapng 檔案

PS C:\Program Files\Wireshark> .\tshark.exe -i 3 -w ps20180802.pcapng -f “host 118.220.173.20”

3. 限定存檔大小
後面加上 -a filesize:數字
5 代表 5kb
5000 代表 5MB
10000 代表 10MB

PS C:\Program Files\Wireshark> .\tshark.exe -i 3 -w psynet20180802_2.pcapng -f “host 118.220.173.20” -a filesize:10000

Mysqldump 導出結構或數據

1. 導出數據庫 dbname 的表結構(只有表結構,不含資料)

mysqldump -uroot -pdbpasswd -d dbname > db.sql;

2. 導出數據庫 dbname 中 某張表 dbtable 的表結構(只有表結構,不含資料)

mysqldump -uroot -pdbpasswd -d dbname dbtable > db.sql;

3. 導出數據庫 dbname 的所有表結構和數據

mysqldump -uroot -pdbpasswd  dbname > db.sql;

4. 導出數據庫 dbname 的 某張表的表結構和數據

mysqldump -uroot -pdbpasswd dbname dbtable > db.sql;

Linux 修改 hostname

  1. 修改 /etc/hosts
    將 /etc/hosts 內出現的 hostname2 都改成 hostname3
  2. 修改 /etc/sysconfig/network 內的 HOSTNAME
  3. 使用 hostname 命令指定
  4. 用 hostname 命令確認

Laragon

剛安裝完 Laragon

使用 Laragon 快速建立 Laravel 專案

發生錯誤

ERROR 1045 (28000): Access denied for user ‘root’@’172.18.0.1’ (using password: NO)

 

解決辦法

Menu -> Mysql -> my.ini

找到下面這一行,打開,密碼改為自己設定的 root 密碼

password=xxxx

 

docker toolbox window10 啟動錯誤,重啟

今天電腦重啟後

啟動環境出現以下錯誤

$ docker-compose up -d
ERRORERROR: Windows named pipe error: 穡t??禮瓣瞻?穡?竄羹穢w????簧??C (code: 2)
Traceback (most recent call last):
File “logging\__init__.py”, line 884, in emit
File “site-packages\colorama\ansitowin32.py”, line 40, in write
File “site-packages\colorama\ansitowin32.py”, line 141, in write
File “site-packages\colorama\ansitowin32.py”, line 169, in write_and_convert
File “site-packages\colorama\ansitowin32.py”, line 174, in write_plain_text
IOError: [Errno 0] Error
Logged from file errors.py, line 79

docker ps 查看一下

$ docker ps
error during connect: Get http://%2F%2F.%2Fpipe%2Fdocker_engine/v1.36/containers/json: open //./pipe/docker_engine: The system cannot find the file specified. In the default daemon configuration on Windows, the docker client must be run elevated to connect. This error may also indicate that the docker daemon is not running.

 

看來是docker沒起來,重啟一下

開啟 Docker Quickstart Terminal

$ docker-machine restart
Restarting “default”…
(default) Check network to re-create if needed…
(default) Windows might ask for the permission to configure a dhcp server. Sometimes, such confirmation window is minimized in the taskbar.
(default) Waiting for an IP…
Waiting for SSH to be available…
Detecting the provisioner…
Restarted machines may have new IP addresses. You may need to re-run the docker-machine env command.

 

$ docker-machine env
export DOCKER_TLS_VERIFY=”1″
export DOCKER_HOST=”tcp://192.168.99.100:2376″
export DOCKER_CERT_PATH=”C:\Users\neo\.docker\machine\machines\default”
export DOCKER_MACHINE_NAME=”default”
export COMPOSE_CONVERT_WINDOWS_PATHS=”true”
# Run this command to configure your shell:
# eval $(“C:\Program Files\Docker Toolbox\docker-machine.exe” env)

neo@DESKTOP-QVUSV16 MINGW64 /e/docker (master)
$ eval $(“C:\Program Files\Docker Toolbox\docker-machine.exe” env)

$ docker-share mount -t
Testing /e/docker.. OK

 

$ docker-compose up -d
memcached is up-to-date
Starting nginx …
Starting elasticsearch …
Starting php7 …
Starting elasticsearch … done