標籤:協助文檔 cheat
實驗環境:
vmware workstation 11
centos6.7的系統下
ip:192.168.244.129 防火牆關閉 setenforce 0
putty(ssh遠端連線軟體)
軟體介紹:
什麼是cheat?
cheat是在GNU通用公用許可證下,為Linux命令列使用者發行的互動式備忘單應用程式。它提供顯示Linux命令使用案例,包括該命令所有的選項和簡短但尚可理解的功能。
實驗過程:
‘Cheat’有兩個主要的依賴——‘python’ 和 ‘pip’,在安裝‘cheat’之前,確保你的系統安裝了python和pip。
一、安裝pip
[[email protected] ~]# yum install python-pip -y
二、安裝cheat
[[email protected] ~]# pip install cheatCollecting cheat/usr/lib/python2.6/site-packages/pip/_vendor/requests/packages/urllib3/util/ssl_.py:90: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning. InsecurePlatformWarning Downloading cheat-2.1.25.tar.gz (43kB) 100% |████████████████████████████████| 45kB 111kB/sCollecting docopt>=0.6.1 (from cheat) Downloading docopt-0.6.2.tar.gzCollecting pygments>=1.6.0 (from cheat) Downloading Pygments-2.1.3-py2.py3-none-any.whl (755kB) 100% |████████████████████████████████| 757kB 172kB/sInstalling collected packages: docopt, pygments, cheat Running setup.py install for docopt Running setup.py install for cheatSuccessfully installed cheat-2.1.25 docopt-0.6.2 pygments-2.1.3
三、軟體的使用方法
[[email protected] ~]# cheat tcpdump# TCPDump is a packet analyzer. It allows the user to intercept and display TCP/IP# and other packets being transmitted or received over a network. (cf Wikipedia).# Note: 173.194.40.120 => google.com# Intercepts all packets on eth0tcpdump -i eth0# Intercepts all packets from/to 173.194.40.120tcpdump host 173.194.40.120# Intercepts all packets on all interfaces from / to 173.194.40.120 port 80# -nn => Disables name resolution for IP addresses and port numbers.tcpdump -nn -i any host 173.194.40.120 and port 80# Make a grep on tcpdump (ASCII)# -A => Show only ASCII in packets.# -s0 => By default, tcpdump only captures 68 bytes.tcpdump -i -A any host 173.194.40.120 and port 80 | grep ‘User-Agent‘# With ngrep# -d eth0 => To force eth0 (else ngrep work on all interfaces)# -s0 => force ngrep to look at the entire packet. (Default snaplen: 65536 bytes)ngrep ‘User-Agent‘ host 173.194.40.120 and port 80# Intercepts all packets on all interfaces from / to 8.8.8.8 or 173.194.40.127 on port 80tcpdump ‘host ( 8.8.8.8 or 173.194.40.127 ) and port 80‘ -i any# Intercepts all packets SYN and FIN of each TCP session.tcpdump ‘tcp[tcpflags] & (tcp-syn|tcp-fin) != 0‘# To display SYN and FIN packets of each TCP session to a host that is not on our networktcpdump ‘tcp[tcpflags] & (tcp-syn|tcp-fin) != 0 and not src and dst net local_addr‘# To display all IPv4 HTTP packets that come or arrive on port 80 and that contain only data (no SYN, FIN no, no packet containing an ACK)tcpdump ‘tcp port 80 and (((ip[2:2] - ((ip[0]&0xf)<<2)) - ((tcp[12]&0xf0)>>2)) != 0)‘# Saving captured datatcpdump -w file.cap# Reading from capture filetcpdump -r file.cap# Show content in hexa# Change -x to -xx => show extra header (ethernet).tcpdump -x# Show content in hexa and ASCII# Change -X to -XX => show extra header (ethernet).tcpdump -X# Note on packet maching:# Port matching:# - portrange 22-23# - not port 22# - port ssh# - dst port 22# - src port 22## Host matching:# - dst host 8.8.8.8# - not dst host 8.8.8.8# - src net 67.207.148.0 mask 255.255.255.0# - src net 67.207.148.0/24
可以看到輸出簡單易懂,用法清晰明了。
參考文章連結:http://os.51cto.com/art/201409/450709.htm
本文出自 “積少成多” 部落格,謝絕轉載!
一個比man、help更好的命令協助軟體。