2 Documentation Library to catch traffic/packets using linux tcpdump command
5 Variables ../variables/Variables.py
10 ${dumppcappath} /tmp/${dumppcap}
11 ${dumpcmd} sudo tcpdump -s 0 -w ${dumppcappath}
15 [Arguments] ${system}=${TOOLS_SYSTEM_IP} ${user}=${TOOLS_SYSTEM_USER} ${password}=${TOOLS_SYSTEM_PASSWORD} ${prompt}=${TOOLS_SYSTEM_PROMPT} ${timeout}=5s ${eth}=eth0
16 ... ${more_params}=${None}
17 [Documentation] Connects to the remote machine via ssh and starts tcpdump linux command
18 ${currentcon}= SSHLibrary.Get Connection index=True
19 SSHLibrary.Open Connection ${system} prompt=${prompt} timeout=${timeout} alias=${dumpalias}
20 Utils.Flexible SSH Login ${user} password=${password} delay=${timeout}
21 SSHLibrary.Write ${dumpcmd} -i ${eth} ${more_params}
22 Run Keyword If ${currentcon}==${None} Return From Keyword
23 SSHLibrary.Switch Connection ${currentcon}
25 Stop Tcpdumping And Download
26 [Arguments] ${filename}=${dumppcap}.xz
27 [Documentation] Stops catching packets with tcpdump and download the saved file
28 ${oldcon}= SSHLibrary.Switch Connection ${dumpalias}
29 Utils.Write_Bare_Ctrl_C
31 ${stdout}= SSHLibrary.Execute Command xz -9ekvv ${dumppcappath}
33 ${stdout}= SSHLibrary.Execute Command ls -la /tmp
35 SSHLibrary.Get File ${dumppcappath}.xz ${filename}
36 SSHLibrary.Close Connection
37 Run Keyword If ${oldcon}==${None} Return From Keyword
38 SSHLibrary.Switch Connection ${oldcon}