I have a Vortex script that uses exec to echo data to /dev/tcp which sends data to another server by tcp/ip. It seems that using the command line for bash has a limitation of the number of characters. Is there any way around this in Vortex, or would I have to write a user function to do this?
exec echo /dev/tcp
exec echo /dev/tcp
Can you use <write> to write directly to /dev/tcp, instead of <exec>'ing echo or bash? Then there is no command-line involved.
exec echo /dev/tcp
Depending on the exact command you are using anything between the <exec> and </exec> will be the standard input to the program, so that may let you send as much as you want rather than putting it on the command line?
John Turnbull
Thunderstone Software
Thunderstone Software
exec echo /dev/tcp
Kai - I tried write, but I got this output:
<!-- 002 testwrite:24: Cannot open /dev/tcp/192.168.0.1/49159: No such file or directory in the function dowrite -->
<!-- 002 testwrite:24: Cannot open /dev/tcp/192.168.0.1/49159: No such file or directory in the function dowrite -->
exec echo /dev/tcp
Ok that's probably a consequence of some interaction between the fact that the path is a device and how <write> opens files. What version of Texis is this, and what is your <exec> echo command line?
exec echo /dev/tcp
It looks like /dev/tcp is a bash-ism, i.e. it does not exist in the real filesystem (as a device or not), but only for file paths that are evaluated directly by bash -- e.g. file redirection on a bash command line. That's why <write> didn't work -- it looks at the filesystem.
John's answer seems like it should still work though: use bash to open the /dev/tcp socket, but use <exec>'s stdin to send the data:
<exec "bash" "-c" "cat >/dev/tcp/192.168.0.1/49159">
<fmt "send all the data here\n">
</exec>
John's answer seems like it should still work though: use bash to open the /dev/tcp socket, but use <exec>'s stdin to send the data:
<exec "bash" "-c" "cat >/dev/tcp/192.168.0.1/49159">
<fmt "send all the data here\n">
</exec>
exec echo /dev/tcp
Thanks to both of you. That seems to work fine.
exec echo /dev/tcp
Actually, it still looks like there's still a limitation on the amount of data being sent. I can send under 130k bytes of data with success. Anything over that doesn't work. I don't get an error return from exec. Do you think it's a limitation when sending data to /dev/tcp or is exec still using the command line?
exec echo /dev/tcp
What happens when you send over 130k: error? data past that lost? something else?
Does >130k data work outside of Vortex, e.g. `cat hugeFile.txt >/dev/tcp/whatever' from a shell prompt ?
Does >130k data work outside of Vortex, e.g. `cat hugeFile.txt >/dev/tcp/whatever' from a shell prompt ?
exec echo /dev/tcp
To answer your question about the command line. Given:
<exec "bash" "-c" "cat >/dev/tcp/192.168.0.1/49159">
<fmt "send all the data here\n">
</exec>
"-c" "cat >/dev/tcp/192.168.0.1/49159" is the only thing on the command line.
<fmt "send all the data here\n"> is fed into cat's stdin.
<exec "bash" "-c" "cat >/dev/tcp/192.168.0.1/49159">
<fmt "send all the data here\n">
</exec>
"-c" "cat >/dev/tcp/192.168.0.1/49159" is the only thing on the command line.
<fmt "send all the data here\n"> is fed into cat's stdin.