1

My goal is to have two telnet clients that pipe data to eachother, via python. I have manually connected one telnet client to my TeamSpeak server. The other telnet client is connected to an IRC server. How can I bridge / pipe them, using python?

My code is in this github project: https://github.com/Khailz/Teamspeak-IRC

mdurant
  • 27,272
  • 5
  • 45
  • 74
Khailz
  • 89
  • 1
  • 12
  • "The other telnet is a IRC server" - No – ErlVolton Oct 28 '14 at 14:39
  • And why is this? I don't literraly mean that, I'm saying the other telnet client is connecitng to the IRC server – Khailz Oct 28 '14 at 14:41
  • OK I edited your question so it doesn't break SO guidelines. You will have to ask the part about teamspeak keepalives as its own question. – ErlVolton Oct 28 '14 at 14:44
  • I already asked that part in a different [question](http://stackoverflow.com/questions/26599762/python-telnet-closes-before-waiting-for-a-print-read-function), I think, if were talking about the same thing, I don't need the part about teamspeak, I just want to know if they can connect together without having to exit another session to begin a new one – Khailz Oct 28 '14 at 14:49

1 Answers1

0

Doing this with python will be very challenging. If for whatever reason you must use python, everything you need is in this question, which is about piping stdout of one subprocess to stdin of another. My recommendation for how to solve your problem would be to use linux pipes and fifo files. This would be as simple as:

$ mknod backpipe p
$ telnet team.speak.server 8080 < backpipe | telnet irc.server 8080 > backpipe

Which is a slightly modified version of the command given in this blog post.

Community
  • 1
  • 1
ErlVolton
  • 6,714
  • 2
  • 15
  • 26
  • I'm not sure if this what I'm looking for teamspeak can only be connected throuh telnet – Khailz Oct 28 '14 at 15:07
  • I updated my answer, you can do exactly the same thing with the telnet command – ErlVolton Oct 28 '14 at 15:09
  • Even though I'm not directly typing commands? I'm actually making it so commands are sent from teamspeak and the telnet reads the command and it goes on to irc or the other way around. Really they are hard codded commands so, I'm guessing with this just that line really should work? – Khailz Oct 28 '14 at 15:19
  • Yes, it should work. If you don't actually need some implementation of the telnet protocol and are literally just connecting the TCP sockets, you should use netcat instead of telnet, but telnet will still work. – ErlVolton Oct 28 '14 at 15:21