프로그램 사용/nc

shell과 nc를 이용하여 주기적으로 데이터 보내기

구차니 2023. 6. 23. 15:22

원하는건 좀 달라서 수정이 필요한데.. 아이디어는 아래 글에서 발견

while echo "hello"; do
  sleep 20
done | nc -q 192.168.100.161 2612

[링크 : https://stackoverflow.com/questions/44078540]

 

echo는 while 문에서 주기적으로 생성하고

done 에서 파이프 라인으로 연결해주면 끝!

$ cat nc2.sh 
target=192.168.0.100

while [ 1 ]
do
  echo -n -e "\x01\x02\x03\x04\x05\x06"
  sleep 1
done | nc ${target} 6000 | hexdump -C