/usr/bin or /usr/local/bin 에 실행권한주고 넣어서 사용
# /bin/bash # ptrace if [ ! -d /tmp/ptrace ]; then mkdir /tmp/ptrace fi PTDIR=/tmp/ptrace DATETIME=$(date +%Y%m%d%H%M%S) COMMAND=$1 if [ -z $COMMAND ]; then echo 'ERROR : Please input your command' echo '[ trace / show / stop / help ]' else if [ "$COMMAND" = "help" ]; then echo 'ptrace option [param]' echo 'option : [ trace / show / stop ]' elif [ "$COMMAND" = "trace" ]; then if [ -z "$2" ]; then echo 'ERROR : Please input correct ethernet.' else sudo -b tcpdump -i $2 -n > $PTDIR/trace_$DATETIME.log fi elif [ "$COMMAND" = "show" ]; then tail -f $PTDIR/`ls -ltr $PTDIR | tail -1 |awk '{print $9}'` elif [ "$COMMAND" = "stop" ]; then sudo kill -9 `ps -ef | grep ptrace | grep -v grep | awk '{print $2}'` fi fi |
'OS > macOS' 카테고리의 다른 글
[OS/macOS] FATA[0000] networks.yaml: "/opt/socket_vmnet/bin/socket_vmnet" (`paths.socketVMNet`) has to be installed (0) | 2024.06.08 |
---|---|
[OS/macOS] 맥북 덮어도 화면 안꺼지게하는 명령어 (0) | 2022.07.07 |
[OS/macOS] macOS M1 Processor 환경에서 LIMA 를 이용한 oracle 설치 (0) | 2022.04.01 |
[OS/macOS] remote 서버 접근 ip 저장 script (vmgmt) (0) | 2021.06.18 |
[OS/macOS] numbers 숫자를 문자로 변경 (number to text) (0) | 2021.06.18 |