Tracking channel change

Ideas and dreaming will go this forum

mad_ady
SamyGO Project Donor
Posts: 268
Joined: Sun May 03, 2015 10:42 am

Tracking channel change

Post by mad_ady »

Hello all!

I'd like to implement a monitoring solution to keep track on what my kids are watching on TV when I'm not home (and for how long). My plan is to use either log parsing or a hook when changing channels to record when the user switched to a particular channel. This information will be sent to a remote mysql server for proper logging via http POST or GET query.

The question is - is there a way of getting which channel the user changed to as an event? I know I could use polling and libChannelInfo.so to get the current channel, but I'm concerned that by injecting the lib every 10 seconds I could cause the TV to crash eventually (haven't tried). Is there a log I could parse or a library that allows me to execute something when the channel is changed?

Also, I'd need to get power ON/OFF events (I'm using SoftPowerOff).

Thanks!
H6400, firmware 2602.2 downgraded to 2130
User avatar
bugficks
Official SamyGO Developer
Posts: 1062
Joined: Tue Jun 25, 2013 3:56 pm

Re: Tracking channel change

Post by bugficks »

i hope one day your kids are hiding a spy cam in your bed room and post vids on youtube...
payback is a bitch:)
mad_ady
SamyGO Project Donor
Posts: 268
Joined: Sun May 03, 2015 10:42 am

Re: Tracking channel change

Post by mad_ady »

:) I agree that a better mouse trap only makes a better mouse, but this way I encourage them to be honest and also inventive.
How about if I change the use case? Say I want to collect rating information to determine which channels/shows are preferred by a set of users. Or if I want to know if the nanny keeps the TV on while babysitting?
Regarding the webcam in the bedroom - it's already there, but youtube keeps blocking my videos :D
H6400, firmware 2602.2 downgraded to 2130
User avatar
bugficks
Official SamyGO Developer
Posts: 1062
Joined: Tue Jun 25, 2013 3:56 pm

Re: Tracking channel change

Post by bugficks »

yeah right, so all the gov internet spying programs are nothing else than an education plan to make their citizens honest. id say the contrary is the case. all you end up with is that they will tell you nothing or anything but the truth. just put you in their position and remember your own childhood.
move your webcam from bed room to tv room, problem solved :)
mad_ady
SamyGO Project Donor
Posts: 268
Joined: Sun May 03, 2015 10:42 am

Re: Tracking channel change

Post by mad_ady »

Sigh... I have a webcam in the TV room as well, but it's not pointing at the TV... Maybe I should install a mirror :) Wait a minute... libScreenshot already allows me to do this.
However this does not solve the polling issue and adds image recognition to the problem

Sorry that my problem makes me look like North Korea. I'm just trying to solve a domestic issue :)
H6400, firmware 2602.2 downgraded to 2130
zoelechat
SamyGO Moderator
Posts: 8615
Joined: Fri Apr 12, 2013 7:32 pm
Location: France

Re: Tracking channel change

Post by zoelechat »

Well, about soft on/off, lib already owns a feature to execute scripts on events (CMD_ON, CMD_OFF, check usage) so it's almost ready.

And about retrieving watched channels, you'd just need a single hook to for example (exeAPP):

Code: Select all

TCWindowProxy::SetChannel(TCWindowProxy_t *this, const TCChannel *a2, int a3, int a4)
to catch info from TCChannel. You can check libLogChannel or libChanList sources for how to get channel name from channel, or simply its number, that would prevent struggling with UTF16->UTF8 text conversion.

For hook usage, any resident lib has much "samples" inside. It's maybe a good opportunity for you to have a look at code, what you want to achieve is very basic in difficulty. I let you the sql/query part :)
I do NOT receive any PM. Please use forum.
mad_ady
SamyGO Project Donor
Posts: 268
Joined: Sun May 03, 2015 10:42 am

Re: Tracking channel change

Post by mad_ady »

Thank you zoe, I will have a look when I get a bit of time.
Will I need to analyze exeAPP in IDA to be able to write this code (maybe to understand code flow path or function offsets), or just overriding the correct functions (the one you pointed and the ones in the examples) should be enough and the rest is taken care by the loader?
Also, If I want to see if the user changed input to HDMI, I'd have to hook a different function, right? Otherwise I'd think the user watched channel X while they switched to HDMI instead.
H6400, firmware 2602.2 downgraded to 2130
zoelechat
SamyGO Moderator
Posts: 8615
Joined: Fri Apr 12, 2013 7:32 pm
Location: France

Re: Tracking channel change

Post by zoelechat »

mad_ady wrote:Will I need to analyze exeAPP in IDA to be able to write this code (maybe to understand code flow path or function offsets), or just overriding the correct functions (the one you pointed and the ones in the examples) should be enough and the rest is taken care by the loader?
Always better to have IDA in a corner :) . Analyze is much quicker than it used to (from v6.5 IIRC), shouldn't take more than an hour for exeAPP. What you'll need are functions "symbols", for example the "real" name of the one I showed you above is:

Code: Select all

_ZN13TCWindowProxy10SetChannelEPK9TCChannelii
mad_ady wrote:Also, If I want to see if the user changed input to HDMI, I'd have to hook a different function, right? Otherwise I'd think the user watched channel X while they switched to HDMI instead.
Right, the same hooking way you should be able to get a "source number" from 2nd arg of:

Code: Select all

_ZN13TCWindowProxy9SetSourceEii
then retrieve its string from

Code: Select all

_ZN11SsPrintBase15GetSourceStringEi
Will surely seem you clearer once you'll have had a look at IDA. Beware that version with decompiler is mandatory (the magical key to switch from asm to pseudocode is TAB :) )
I do NOT receive any PM. Please use forum.
mad_ady
SamyGO Project Donor
Posts: 268
Joined: Sun May 03, 2015 10:42 am

Re: Tracking channel change

Post by mad_ady »

Thank you. One more thing, if I may. Please don't implement this! It will give me an opportunity to get my hands dirty :D
H6400, firmware 2602.2 downgraded to 2130
zoelechat
SamyGO Moderator
Posts: 8615
Joined: Fri Apr 12, 2013 7:32 pm
Location: France

Re: Tracking channel change

Post by zoelechat »

mad_ady wrote:Thank you. One more thing, if I may. Please don't implement this! It will give me an opportunity to get my hands dirty :D
Don't worry, now focusing on K ;)
I do NOT receive any PM. Please use forum.

Post Reply

Return to “[H] Brainstorm”