bash: using /dev/tcp to connect to an smtp server: issues
I'm currently working on a script that can only use bash built-ins; these are the restrictions of the target machince. I can't use netcat, mail,sendmail or any other program; I'm stuck using bash's internals.
The following works just fine.
exec 5<>/dev/tcp/google.ca/80
echo −e "GET / HTTP/1.0\n" >&5
cat <&5
However if I type this in:
exec 5<>/dev/tcp/smtp1.sympatico.ca/25
It hangs; I have to CTRL-C out of it.
I've tried doing this:
exec 5<>/dev/tcp/smtp1.sympatico.ca/25 &
And then trying to echo "EHLO" and other commands but I get nothing when I cat the file descriptor. Bash eventually returns
-bash: connect: Connection timed out
-bash: /dev/tcp/smtp1.sympatico.ca/25: Connection timed out
I've tried to dissect some example programs I found in different threads but I can't seem to find the root of my problem.
I'm currently using slackware-current, however the target box uses something very similar to slackware 8.0-8.1.
Ideas?
|