summaryrefslogtreecommitdiff
path: root/doc/note/tcpdump/tcpdump.txt
blob: 9c9feb6465838e15273fc6ad94eefbdf95e3e26d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63

Tcpdump
================


## Realtime Download:

  scriptlee -W OcChunkDownload.lua -n OC_PROJ --scan-delay 10 --workdir ../../../../../tmp --pod-pattern 'houston.%d' --file-pattern 'houston.STAGE.tcp.*gz' --skip 1

  RNG="{001,002,003}"; TS="20230907-100235"; ocprod exec -i "$(ocprod get pods|grep houston-[1-9]|cut -f1 -d' ')" -- sh -c 'true && cd /tmp && tar c houston-prod-tcp-'"${TS:?}"'.pcap'"${RNG:?}"'.gz && rm houston-prod-tcp-'"${TS:?}
"'.pcap'"${RNG:?}"'.gz' | tar x



## Base (inclusive blacklist brox, fluentd, ...):

redis=6379, brox=7022, fluentd=7099

  cd /tmp && timeout --foreground -s INT 180 tcpdump -ni any -C 50M -W 999 -w houston-STAGE-tcp-`date -u +%Y%m%d-%H%M%S`.pcap "not port 443 and not port 6379 and not port 7022 and not port 7099" -z gzip



## pcap cli PreProcessing

Tips: "https://chrissanders.org/2018/06/large-captures4-filter-whittling/"

  mergecap.exe -a -w OUTFILE INFILES_GLOB

  -Y 'http.request.uri.query contains "expand"'
  -Y 'http.time < 2.0 or http.request'



## Accept HTTP POST requests:

  "tcp[((tcp[12:1] & 0xf0) >> 2):4] = 0x504F5354"



## Copy result to local machine (the boring way)

  oc rsync <pod-name>:/remote/dir/filename .



## Special filters

  "tcp[tcpflags] & (tcp-syn|tcp-ack|tcp-fin|tcp-rst) != 0"

  "ip 1.2.3.4"

  "net 172.18.0.0/16"



## Extract hosts file from DNS traffic

Not perfect because needs manual fine-tuning. But can be helpful anyway.

  -Y 'dns.a and dns.resp.name' -Tfields -edns.a -edns.resp.name

Vielleicht auch mal option "-zhosts" ausprobieren. Sollte auch sowas tun.