Your Digital Media Has Never Looked So Good

 
prajwalshetty
Topic Author
Posts: 40
Joined: Mon May 18, 2015 8:02 pm

Roku device charles set up

Thu May 28, 2015 10:50 am

Hi All,

Does anyone had any luck setting up charlesproxy for roku device. Was wondering so that i can track and debug the http calls going away from the roku device.

Thanks in advance.

Regards,
Prajwal
 
User avatar
TheEndless
** Valued Community Member **
Posts: 9232
Joined: Mon Oct 04, 2004 10:15 am
Location: US
Contact:

Re: Roku device charles set up

Thu May 28, 2015 11:06 am

If you have a network card that supports promiscuous mode, you may have some luck with WireShark, but Roku doesn't support proxies. If you're trying to trace the calls from your channel, then you could just output them all to the debug console as you make them.
My Channels: http://roku.permanence.com - Twitter: @TheEndlessDev
Instant Watch Browser (NetflixIWB), Aquarium Screensaver (AQUARIUM), Clever Clocks Screensaver (CLEVERCLOCKS), iTunes Podcasts (ITPC), My Channels (MYCHANNELS)
 
sjb64
Posts: 108
Joined: Thu Apr 16, 2015 1:13 pm
Location: Memphis, TN

Re: Roku device charles set up

Thu May 28, 2015 12:49 pm

IIRC, you can put your Roku into a packet tracing mode, which creates a cycle of (3 in think) output files than can be read into wireshark as a history file which will parse and display them in complete detail.
FlixRaider channel
 
belltown
Posts: 1445
Joined: Thu Dec 09, 2010 1:43 pm
Contact:

Re: Roku device charles set up

Thu May 28, 2015 1:14 pm

sjb64 wrote:
IIRC, you can put your Roku into a packet tracing mode, which creates a cycle of (3 in think) output files than can be read into wireshark as a history file which will parse and display them in complete detail.

The tcpdump captures are extremely limited though. Only the first 200 bytes or so of each packet are captured. That's often not even enough to capture the http headers.
https://github.com/belltown/
 
sjb64
Posts: 108
Joined: Thu Apr 16, 2015 1:13 pm
Location: Memphis, TN

Re: Roku device charles set up

Thu May 28, 2015 1:25 pm

OK, that was what I was thinking about, but you have a point that 200 or so bytes certainly isn't "complete detail". Still depending on need it might work, definitely helped me when I was dealing with debugging ECP launching and a M3U8 web server routine.
FlixRaider channel
 
belltown
Posts: 1445
Joined: Thu Dec 09, 2010 1:43 pm
Contact:

Re: Roku device charles set up

Thu May 28, 2015 1:31 pm

It has its uses, yes. I just wish they let you capture the whole packet. It's probably a hangover from the days when Rokus had fewer gigabytes in their memories.

Sometimes I'll run my server on my computer connected to the same local network as my Roku, and use Wireshark to capture the traffic on my computer's wireless adapter.
https://github.com/belltown/
 
User avatar
RokuJoel
Posts: 1752
Joined: Mon Nov 14, 2011 5:22 pm

Re: Roku device charles set up

Thu May 28, 2015 5:27 pm

As I mentioned in an email to a developer today who was having problems with Charles Proxy, you might consider using something that acts as the default gateway for your network, like:

https://mitmproxy.org/
http://grinder.sourceforge.net/g3/tcpproxy.html

http://xmodulo.com/how-to-set-up-transparent-proxy-on-linux.html


- Joel
 
gabek
Posts: 44
Joined: Sat Jul 05, 2014 2:47 pm

Re: Roku device charles set up

Sat May 30, 2015 11:00 am

If you're just looking to debug APIs I highly recommend Runscope. It's a handy remote proxy https://www.runscope.com/docs/debugging.
 
prajwalshetty
Topic Author
Posts: 40
Joined: Mon May 18, 2015 8:02 pm

Re: Roku device charles set up

Tue Jun 16, 2015 9:08 am

Hi,

Thanks for all the help. Might be foolish question. The scenario i am trying to accomplish is capture all the traffic going out from my roku application from my machine. Both my PC and TV is connected to wireless.

Is there anything else i have to do apart from trying out the below apps.

Regards,
Prajwal
 
belltown
Posts: 1445
Joined: Thu Dec 09, 2010 1:43 pm
Contact:

Re: Roku device charles set up

Tue Jun 16, 2015 10:58 am

prajwalshetty wrote:
Hi,

Thanks for all the help. Might be foolish question. The scenario i am trying to accomplish is capture all the traffic going out from my roku application from my machine. Both my PC and TV is connected to wireless.

Is there anything else i have to do apart from trying out the below apps.

Regards,
Prajwal

Another way to do this if you're running a Windows PC is to set up an ad-hoc network (or "hostednetwork" as they call it now on Windows 8 ), along with ICS (Internet Connection Sharing). Configure your Roku to connect to this network. Now all your Roku traffic will be going through your PC's wireless card, and you can use Wireshark to examine it. As long as your network adapter supports hosted networks this may be the way to go, since you don't need any additional hardware or proxies or APIs. You can capture any traffic going to/from your Roku, not just your own development channel, but other channels as well.

I'm not sure how you'd do this on a Mac or Linux system, but if you have Windows (I've been using it under Windows 8.1), then here are the steps involved:

First, set up the ad-hoc network:

- Start a Windows command prompt (as Administrator!!)
- Type: netsh wlan show drivers
- Find the entry for your wireless interface and look for something that says "Hosted Network Supported: Yes". If it says "Yes" then this should work, otherwise your wireless adapter does not support hosted networks.
- Type: netsh wlan set hostednetwork mode=Allow ssid="my-ssid" key="my-password"
where my-ssid is the name of the new network's ssid and my-password is the password
- Type: netsh wlan start hostednetwork

[Note that each time you restart your computer, or resume from Sleep state, you'll have to reissue the above start hostednetwork command]

Next, set up Internet Connection Sharing:

- Right-click on the wi-fi network icon in the system tray, then select 'Open Network and Sharing Center'
- Click on 'Change Adapter Settings'
- Right-click on the entry for your Wi-Fi adapter (NOT the new ad-hoc network), then click on 'Properties'
- If you successfully started the ad-hoc network you will see a 'Sharing' tab. Click the 'Sharing' tab
- Check the box labelled 'Allow other network users to connect through this computer's Internet connection', then click 'OK'

Next, configure your Roku to connect to the new ad-hoc network:
- Settings>Network>Wireless (Wi-Fi)>Set up new Wi-Fi connection
- Select the ssid you specified above (my-ssid) for the new ad-hoc network, enter the password (my-password), then select Connect

Next, install Wireshark if you haven't already installed it:
- Download from https://www.wireshark.org/download.html. You can use the Windows Installer 64-bit version if you have a 64-bit PC
- Run the installer selecting all default options, making sure to install WInPcap when asked

Finally, capture and examine your Roku traffic:
- Run Wireshark
- In the 'Capture' pane, select your Wi-Fi interface
- Click the green 'Start' icon to start capturing
- You can use the 'Filter' box to filter the traffic you're interested in, e.g. to capture Http traffic to/from my Roku's ip address, I'd type:
http && ip.addr==192.168.0.8
then click 'Apply'
- When you find an entry you're interested in (e.g. an Http GET command), right-click on it and select 'Follow TCP Stream'. This will bring up a window containing the entire Http dialog with options to display it in various formats, save it, etc.
https://github.com/belltown/
 
tim_beynart
Posts: 149
Joined: Wed Jul 15, 2015 8:30 am

Re: Roku device charles set up

Tue Sep 08, 2015 2:30 pm

Prajwal! It's Tim! We got this working on OSX.

Note: This was tested with OS X 10.10 Yosemite
1) Connect a Cat 5 ethernet cable to your Roku and your Mac's ethernet port (I used the thunderbolt adapter)
2) Go to System Preferences -> Sharing -> Internet Sharing
3) Under "Share your connection from: ", select your WiFi. Then under "To computers using: ", select Thunderbolt Ethernet.
5) Start up Charles and take note of the HTTP Proxy port set under Proxy Settings, by default its 8888. Make sure "Enable transparent HTTP Proxying" is checked.
6) To route all traffic to the Charles proxy, we need to set the following Port Forwarding rule in the OS X terminal:
echo "
rdr pass inet proto tcp from any to any port http -> 127.0.0.1 port 8888
rdr pass inet proto tcp from any to any port https -> 127.0.0.1 port 8888
rdr pass inet proto udp from any to any port http -> 127.0.0.1 port 8888
rdr pass inet proto udp from any to any port https -> 127.0.0.1 port 8888
" | sudo pfctl -ef -
After hitting enter it will prompt you to enter your machine password
7) Connect the Roku to WIred (Ethernet) in the Network settings, and you should get a prompt to accept a connection in Charles once an internet request is made on the device
8) Note the Roku IP so you can debug using telnet
 
chucktalley89
Posts: 1
Joined: Mon Sep 21, 2015 4:40 pm

Re: Roku device charles set up

Thu Sep 24, 2015 3:54 pm

Has anyone figured out how to replicate this in Windows? Beating my head on the wall at this point...

Thanks
 
Pradeepa
Posts: 2
Joined: Wed Apr 05, 2017 7:07 am

Re: Roku device charles set up

Thu Apr 06, 2017 9:35 am

tim_beynart wrote:
Prajwal! It's Tim! We got this working on OSX.

Note: This was tested with OS X 10.10 Yosemite
1) Connect a Cat 5 ethernet cable to your Roku and your Mac's ethernet port (I used the thunderbolt adapter)
2) Go to System Preferences -> Sharing -> Internet Sharing
3) Under "Share your connection from: ", select your WiFi. Then under "To computers using: ", select Thunderbolt Ethernet.
5) Start up Charles and take note of the HTTP Proxy port set under Proxy Settings, by default its 8888. Make sure "Enable transparent HTTP Proxying" is checked.
6) To route all traffic to the Charles proxy, we need to set the following Port Forwarding rule in the OS X terminal:
echo "
rdr pass inet proto tcp from any to any port http -> 127.0.0.1 port 8888
rdr pass inet proto tcp from any to any port https -> 127.0.0.1 port 8888
rdr pass inet proto udp from any to any port http -> 127.0.0.1 port 8888
rdr pass inet proto udp from any to any port https -> 127.0.0.1 port 8888
" | sudo pfctl -ef -
After hitting enter it will prompt you to enter your machine password
7) Connect the Roku to WIred (Ethernet) in the Network settings, and you should get a prompt to accept a connection in Charles once an internet request is made on the device
8) Note the Roku IP so you can debug using telnet


This method worked for me and I see the http call without any error in charles but https calls does not work. Roku does not have option to install the charles certificate in Roku device. Do you have any input for https:// calls
 
tim_beynart
Posts: 149
Joined: Wed Jul 15, 2015 8:30 am

Re: Roku device charles set up

Wed Apr 12, 2017 11:41 am

This method worked for me and I see the http call without any error in charles but https calls does not work. Roku does not have option to install the charles certificate in Roku device. Do you have any input for https:// calls


we are trying to work out https, apparently you have to install the cert using Brightscript and forward all traffic to Charles. I'll post once we get it to work.
 
tim_beynart
Posts: 149
Joined: Wed Jul 15, 2015 8:30 am

Re: Roku device charles set up

Thu Apr 27, 2017 9:57 am

I had no luck getting https to work with Charles. I have the iptable rules set up in a DDWRT router and route all traffic to the ip hosting Charles.  I have the Charles cert in my app and point to it using "setCertificatesFile" for each instance of roUrlTransfer. But the secure traffic just shows up as blank lines with "invalid first character" errors.
I am out of my depth here, if anyone has figured out how to capture https then please let us know!

Who is online

Users browsing this forum: No registered users and 6 guests