TiVo Community
TiVo Community
TiVo Community
Go Back   TiVo Community > Main TiVo Forums > TiVo Help Center
TiVo Community
Forum Jump
Thread Tools
Old 08-15-2007, 01:09 AM   #1
Registered User
Join Date: Nov 2004
Posts: 2,010
Help with man in the middle setup using netcat on the tivo to redirect ports

I need the advice of a unix guru. I've been trying to create a man in the middle situation using NC and piped output. I tried
nc -l -p 81 | nc x.x.x.1 80 | nc -l -p 81
but that isnt able to bind to the same port as the first one. I can't seem to get the connection to go both ways. Here is an example of what I have tried against my routers administration page to test

bash-2.02# tail -f /var/hack/io | nc -l -p 82 &
[11] 574
bash-2.02# nc x.x.x.1 80 > /var/hack/io

GET / HTTP/1.1
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.
070725 Firefox/
Accept: text/xml,application/xml,application/xhtml+xml,text/html;
Accept-Language: en-us,en;q=0.5
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Connection: keep-alive
At which point I get an error page in the browser
I break out of the command and the error page is exactly what is in my IO file

bash-2.02# cat /var/hack/io
HTTP/1.0 400 Bad Request
Server: httpd
Date: Tue, 14 Aug 2007 23:42:22 GMT
Content-Type: text/html
Connection: close

<HTML><HEAD><TITLE>400 Bad Request</TITLE></HEAD>
<BODY BGCOLOR="#cc9999"><H4>400 Bad Request</H4>
No request found.
Does this mean my "tunnel" is working but tail is saying "file truncated" when the connection is established which is confusing everything?

Last edited by ciper; 08-15-2007 at 01:49 AM.
ciper is offline   Reply With Quote
Old 11-27-2012, 09:17 AM   #2
Registered User
Join Date: Nov 2012
Posts: 1

you have to use a pipe:

mknod tmp_pipe p
nc -l 1231 < tmp_pipe |nc hostname 80 > tmp_pipe

you can also search and replace for strings and copy the intermediate traffic to your file system:

nc -l 9080 < tmp_pipe |nc 9080 |tee original.txt |sed 's/HTTP\/1.1 771 Undefined/HTTP\/1.1 200 OK/' |tee modified.txt > tmp_pipe

best Regards,


Romeo Kienzler
r o m e o . k i e n z l e r ( a - t ) g m a i l . c o m

ormium is offline   Reply With Quote
Old 11-27-2012, 05:28 PM   #3
Registered User
Join Date: Aug 2003
Location: San Antonio, Texas, USA
Posts: 6,922
After more than 5 years, I seriously doubt the OP is still seeking a solution.

lrhorer is offline   Reply With Quote
Old 02-28-2014, 02:18 AM   #4
Registered User
Join Date: Feb 2014
Posts: 1

@lrhorer: I was VERY HAPPY about the reply of ormium. More than a year ago, he wrote exactly what I was looking for!

A question is a question. We google them.
A solution is a solution. We find them.

I thank cypher for asking my question years ago.
And i thank ormium for serving the answer long time before I was asking!

That's why we love forums
What is your contribute?

wintifrosch is offline   Reply With Quote
Forum Jump

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


TiVo Community
Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2016, Jelsoft Enterprises Ltd.
vBulletin Skins by: Relivo Media

(C) 2016 DBNet - All Rights Reserved. No information may be posted elsewhere without written permission.
TiVoŽ is a registered trademark of TiVo Inc. This site is not owned or operated by TiVo Inc.
All times are GMT -5. The time now is 09:19 AM.
Page generated in 0.12932992 seconds (42.40% PHP - 57.60% MySQL) with 18 queries