lang/php

capture on nginx to php-fpm unix-socket

C/H 2022. 3. 31. 00:23

tcpdump

sudo tcpdump port 9000 -A | strings

socat

socket cat

sudo apt-get install socat
#sudo socat -t100 -x -v UNIX-LISTEN:{virtual-socket},mode=777,reuseaddr,fork UNIX-CONNECT:{real-socket}
sudo socat -t100 -v UNIX-LISTEN:{virtual-socket},mode=777,reuseaddr,fork UNIX-CONNECT:{real-socket}
sudo socat -t100 -v UNIX-LISTEN:/var/run/shm/php7.4-fpm.sock.socat,mode=777,reuseaddr,fork UNIX-CONNECT:/var/run/shm/php7.4-fpm.sock
  1. change fastcgi_pass unix:/var/run/shm/php7.4-fpm.sock.socat;
  2. open web page
  3. socat -v
  4. socat -x -v
# send pc
sudo socat -u GOPEN:./source.file TCP:192.168.0.1:9999
# receive pc
sudo socat -u TCP-LISTEN:9999 CREATE:target.file

# TCP to UDP
sudo socat TCP-LISTEN:2223,fork,reuseaddr,bind=10.164.0.17 UDP-CONNECT:127.0.0.1:2223,reuseaddr

# Redirect
sudo socat TCP-LISTEN:443,fork TCP:domain.com:80
sudo socat UDP-LISTEN:4443,fork UDP:domain.com:80
  1. 가상 시리얼포트 생성
  2. 가상 시리얼포트 읽기
  3. 내용을 시리얼포트로 보내기
  4. 결과
반응형