I've built a proxy using nc and some pipes. What I need to do is process the data coming through that proxy and perform certain actions if conditions are met. For example if a HTTP response code is 200 then run a script perhaps, the data must not be halted in transit. I'm very limited in what I can use, hence using nc for a proxy. Currently I'm piping out the data in transit and reading it from a background process, I'm struggling to capture the data correctly in the background process to be able to process it though.
nc -l -p 9090 <pipe.back | tee pipe.process | nc 127.0.0.2 9999 >pipe.back
Ideally I would like foo.sh to be able to process the data and perform actions. Currently it looks like this, I've tried a number of things to store the data in a variable etc but nothing is working.
Any help is much appreciated