{"id":1557,"date":"2014-11-02T18:39:56","date_gmt":"2014-11-03T02:39:56","guid":{"rendered":"https:\/\/surfrock66.com\/?p=1557"},"modified":"2014-11-05T08:57:05","modified_gmt":"2014-11-05T16:57:05","slug":"improving-the-motorola-blink-baby-monitorcamera-part-4","status":"publish","type":"post","link":"https:\/\/surfrock66.com\/?p=1557","title":{"rendered":"Improving the Motorola Blink Baby Monitor\/Camera (Part 4)"},"content":{"rendered":"<p>\r\n<p>I screwed up.<\/p>\r\n<p>I finally did it, I figured out the commands to do a custom firmware, and I tried to flash it...now the camera is UNRESPONSIVE.  It boots, but no network, the LED is on, can't talk to it, nada.  I'm working on my backout plan now :)  Hey, that's the price of hacking.  Nevertheless, I've learned a TON which is worth sharing.<\/p>\r\n<p>Below is the set of commands I used to generate my custom firmware.  The original firmware is a tar.gz, which contains conprog.bin and rootfs.bin.gz, then rootfs.bin.gz unpacks into rootfs.bin which can be mounted with:<\/p><br \/>\n<code>sudo mount -t romfs -o loop rootfs.bin \/mnt\/rootfs<\/code><br \/><!--more--><\/p>\n<p>\r\n<p>I then copied all the contents of that to ~\/Projects\/Blink\/JoeFW.0.01\/rootfs where I made some modifications (I added &lt;p&gt;test&lt;\/p&gt; to blinkhome.html).  I then ran the following commands to repack the firmware to be uploaded:<\/p>\r\n<br \/>\n<code>genromfs -d ~\/Projects\/Blink\/JoeFW.0.01\/rootfs\/ -f ~\/Projects\/Blink\/JoeFW.0.01\/rootfs.bin<\/p>\n<p>tar -C ~\/Projects\/Blink\/JoeFW.0.01\/ -zcp ~\/Projects\/Blink\/JoeFW.0.01\/rootfs.bin.gz ~\/Projects\/Blink\/JoeFW.0.01\/rootfs.bin<\/p>\n<p>chmod 665 rootfs.bin.gz<\/p>\n<p>tar -C ~\/Projects\/Blink\/JoeFW.0.01\/ -zcpf ~\/Projects\/Blink\/JoeFW.0.01\/bmfwromfs_08_052.tar.gz rootfs.bin.gz conprog.bin<\/code><br \/>\n\r\n<p>So, I went to blinkhome.html, clicked firmware upgrade, then uploaded my new firmware...it uploaded successfully and said it flashed, but then it never came back on.<\/p>\r\n<p>Now, this is probably my fault...I actually screwed up my tar command in a rev 1.0 and added full path to my rootfs...so it was \/home\/surfrock66\/Projects\/Blink\/rootfs\/~ and I believe the flash just copied the whole thing as is, so I may have filled up the storage on there with a full 2nd copy of the firmware.  FAIL.<\/p>\r\n<p>That being said, there's still more work to do.  I began analyzing the rest of the firmware, and specifically the executables in there.<\/p>\r\n<p>I wanted to start analyzing the firmware update binaries.  Assume the root of the rootfs, in \/mlsrb_src\/ there is fwupgrade and otatest.  I wanted to see if I could figure out how the upgrade works to see if there's anything I missed, and see how the auto-online-upgrade works to see if I can't download the actual firmwares from motorola.  I started with this command, which produced the following output:<\/p>\r\n<br \/>\n<code>surfrock66@sr66-darter:~\/Projects\/Blink\/JoeFW.0.1\/blinkromFW\/mlsrb_src$ file fwupgrade<br \/>\n<br \/>fwupgrade: ELF 32-bit LSB executable, ARM, EABI4 version 1 (SYSV), dynamically linked (uses shared libs), stripped<br \/>\n<br \/>surfrock66@sr66-darter:~\/Projects\/Blink\/JoeFW.0.1\/blinkromFW\/mlsrb_src$ file otatest<br \/>\n<br \/>otatest: ELF 32-bit LSB executable, ARM, EABI4 version 1 (SYSV), dynamically linked (uses shared libs), stripped<br \/>\n<br \/>surfrock66@sr66-darter:~\/Projects\/Blink\/JoeFW.0.1\/blinkromFW\/mlsrb_src$ file mlswwwn\/cgi-bin\/online_upgrade<br \/>\n<br \/>mlswwwn\/cgi-bin\/online_upgrade: ELF 32-bit LSB executable, ARM, EABI4 version 1 (SYSV), dynamically linked (uses shared libs), stripped<\/code><br \/>\n\r\n<p>I'm planning on installing the <a href=\"http:\/\/www.denx.de\/wiki\/DULG\/ELDK\">ELDK<\/a> to figure out some of the stuff in there, but before that, I started dumping strings from the binaries to see what I could find.  I'm not outputting all of it here, but some of it will be curious to you:<\/p>\r\n<br \/>\n<code>strings fwupdate<br \/>\nstrings otatest<br \/>\nstrings mlswwwn\/cgi-bin\/online_upgrade<\/code><br \/>\n\r\n<p>Some Interesting Snippets, first from fwupdate:<\/p>\r\n<br \/>\n<code>md5sum %s >\/tmp\/xyz.md5<br \/>\n<br \/>\/tmp\/xyz.md5<br \/>\n<br \/>MD5 of the file is '%s'<br \/>\n<br \/>MD5 Not Matched. ERROR ERROR ERROR<br \/>\n<\/code><br \/>\n\r\n<p>HMM.  An MD5 check?  then my firmware shouldn't have flashed, right?  So how did I break it?<\/p>\r\n<p>Now, onto otatest, which is FASCINATING:<\/p>\r\n<br \/>\n<code><br \/>\nCurrent Version (%02d-%03d)<br \/>\n<br \/>http:\/\/%s\/version_dev.txt<br \/>\n<br \/>ota.monitoreverywhere.com\/ota\/cam_patch<br \/>\n<br \/>http:\/\/%s\/version.txt<br \/>\n<br \/>Going to download this file '%s'<br \/>\n<br \/>msc2000:patch2012<br \/>\n<br \/>libcurl-agent\/1.0<\/p>\n<p>going to calculate Checksum<br \/>\n<br \/>md5sum %s.tar.gz > xyz.md5<br \/>\n<br \/>xyz.md5<br \/>\n<br \/>MD5 of the file is '%s'<br \/>\n<br \/>MD5 of the MD5 File is '%s'<br \/>\n<br \/>MD5 not matched<br \/>\n<br \/>WRITING TO FLASH.<br \/>\n<br \/>http:\/\/%s\/cameraservice?action=command&command=success_update&mac=%s&version=%02d%03d&random=%08X<br \/>\n<br \/>bms.monitoreverywhere.com\/BMS<\/p>\n<p>http:\/\/98.130.72.88\/ms85478\/2a4w00<\/p>\n<p>75.101.137.50\/ota\/cam_patch<br \/>\n<\/code><br \/>\n\r\n<p>VERY interesting stuff.  That ota.monitoreverywhere.com\/ota\/cam_patch site has a password wall...but look below, on a hunch I tried msc2000 as the username and patch2012 as the password, and it WORKED..but there's no files hosted.  I assume you have to pass some sort of info over POST\/GET, I bet I'll find out more when I get to decompiling.  bms.monitoreverywhere.com\/BMS goes to the client portal, with an outdated SSL cert I might add, which is a little bit of a cooler interface.  I tried the other URL's in there, they go nowhere I can find, and I tried a few different ports.<\/p>\r\n<p>Lastly, I looked at online_upgrade...nothing particularly interesting there.  I also did see a file in \/mlsrb_src called \"mjpg_streamer_iball\" (IT'S GPL MOTOROLA YOU HAVE TO RELEASE THE SOURCE >:[ ) and I string'd that, which turned up some new commands and confirmed some others:<\/p>\r\n<ul>\r\n<li>GET \/?action=snapshot<\/li>\r\n<li>GET \/?action=log<\/li>\r\n<li>GET \/?action=device_status<\/li>\r\n<li>GET \/?action=mini_device_status<\/li>\r\n<li>GET \/?action=stream<\/li>\r\n<li>GET \/?action=appletvastream<\/li>\r\n<li>GET \/?action=appletvstream<\/li>\r\n<li>GET \/?action=appletastream<\/li>\r\n<li>GET \/?action=command<\/li>\r\n<\/ul><br \/>\r\n<p>I THINK I also found the full list of commands that can be received in the device.  It's a big list, but we need to dump it...since these are just strings, they could mean nothing, but I'm trying to capture an ordered list that encompasses commands I already found:<\/p>\r\n<ul>\r\n<li>leaving<\/li>\r\n<li>contrast_plus<\/li>\r\n<li>contrast_minus<\/li>\r\n<li>brightness_plus<\/li>\r\n<li>brightness_minus<\/li>\r\n<li>value_contract<\/li>\r\n<li>value_brightness<\/li>\r\n<li>set_contract<\/li>\r\n<li>set_brightness<\/li>\r\n<li>VGA640_480<\/li>\r\n<li>QVGA320_240<\/li>\r\n<li>QQVGA160_120<\/li>\r\n<li>setup_wireless_save<\/li>\r\n<li>value_resolution<\/li>\r\n<li>get_storage_folder<\/li>\r\n<li>set_storage_folder<\/li>\r\n<li>move_forward<\/li>\r\n<li>move_backward<\/li>\r\n<li>move_left<\/li>\r\n<li>move_right<\/li>\r\n<li>move_forward_cont<\/li>\r\n<li>move_backward_cont<\/li>\r\n<li>move_left_cont<\/li>\r\n<li>move_right_cont<\/li>\r\n<li>fb_stop<\/li>\r\n<li>lr_stop<\/li>\r\n<li>setup_led0<\/li>\r\n<li>setup_led1<\/li>\r\n<li>value_setupled<\/li>\r\n<li>audio_out1<\/li>\r\n<li>audio_out0<\/li>\r\n<li>value_wifi<\/li>\r\n<li>value_battery<\/li>\r\n<li>restart_system<\/li>\r\n<li>restart_app<\/li>\r\n<li>melody1<\/li>\r\n<li>melody2<\/li>\r\n<li>melody3<\/li>\r\n<li>melody4<\/li>\r\n<li>melody5<\/li>\r\n<li>melodystop<\/li>\r\n<li>value_melody<\/li>\r\n<li>value_temperature<\/li>\r\n<li>reset_factory<\/li>\r\n<li>switch_to_uap<\/li>\r\n<li>uapconfig_read<\/li>\r\n<li>uapconfig_save<\/li>\r\n<li>vox_get_threshold<\/li>\r\n<li>vox_set_threshold<\/li>\r\n<li>vox_enable<\/li>\r\n<li>vox_disable<\/li>\r\n<li>vox_get_status<\/li>\r\n<li>get_version<\/li>\r\n<li>get_default_version<\/li>\r\n<li>flipup<\/li>\r\n<li>save_camera_name<\/li>\r\n<li>get_spk_volume<\/li>\r\n<li>check_cam_ready<\/li>\r\n<li>set_master_key<\/li>\r\n<li>set_random_number<\/li>\r\n<li>set_random_number2<\/li>\r\n<li>get_session_key<\/li>\r\n<li>check_upnp<\/li>\r\n<li>reset_upnp<\/li>\r\n<li>set_upnp_port<\/li>\r\n<li>get_upnp_port<\/li>\r\n<li>set_register<\/li>\r\n<li>get_register<\/li>\r\n<li>get_log<\/li>\r\n<li>set_log_level<\/li>\r\n<li>pcmlog_enable<\/li>\r\n<li>pcmlog_disable<\/li>\r\n<li>set_audio_finetune<\/li>\r\n<li>get_audio_finetune<\/li>\r\n<li>save_http_usr_passwd<\/li>\r\n<li>set_sensor_register<\/li>\r\n<li>get_sensor_register<\/li>\r\n<li>get_sessionkey<\/li>\r\n<li>enable_telnet<\/li>\r\n<li>set_delay_output<\/li>\r\n<li>get_hw_version<\/li>\r\n<li>take_snapshot<\/li>\r\n<li>get_routers_list<\/li>\r\n<li>check_fw_upgrade<\/li>\r\n<li>request_fw_upgrade<\/li>\r\n<li>get_mac_address<\/li>\r\n<li>get_mac_in_flash<\/li>\r\n<li>set_mac_in_flash<\/li>\r\n<li>set_temp_alert<\/li>\r\n<li>set_int_internet_connected<\/li>\r\n<li>get_debug_val1<\/li>\r\n<li>set_debug_val1<\/li>\r\n<li>set_temp_offset<\/li>\r\n<li>get_temp_offset<\/li>\r\n<li>set_remote_ip<\/li>\r\n<li>get_codecs_support<\/li>\r\n<\/ul><br \/>\r\n<p>LASTLY, I got an email from a dude working on this as well...he said he has a BlinkHD, and his RTSP stream is asking for a username and password...I found this in the mjpg_streamer_iball strings:<\/p>\r\n<br \/>\n<code>username and password do not match to configuration<br \/>\n<br \/>access granted<br \/>\n<br \/>blink1.0:blink101013<br \/>\n<\/code><br \/>\n\r\n<p>Happy Hacking!<\/p>\r\n<p>Related Posts:<\/p>\r\n<ul>\r\n<li><a href=\"https:\/\/surfrock66.com\/improving-the-motorola-blink-baby-monitorcamera\/\">Improving the Motorola Blink Baby Monitor\/Camera<\/a><\/li>\r\n<li><a href=\"https:\/\/surfrock66.com\/improving-the-motorola-blink-baby-monitorcamera-part-2\/\">Improving the Motorola Blink Baby Monitor\/Camera (Part 2)<\/a><\/li>\r\n<li><a href=\"https:\/\/surfrock66.com\/improving-the-motorola-blink-baby-monitorcamera-part-3\/\">Improving the Motorola Blink Baby Monitor\/Camera (Part 3)<\/a><\/li>\r\n<li><a href=\"https:\/\/surfrock66.com\/improving-the-motorola-blink-baby-monitorcamera-part-5-2\/\">Improving the Motorola Blink Baby Monitor\/Camera (Part 5)<\/a><\/li>\r\n<\/ul><br \/>\r\n<\/p>\n","protected":false},"excerpt":{"rendered":"<p>sudo mount -t romfs -o loop rootfs.bin \/mnt\/rootfs<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8,3],"tags":[],"class_list":["post-1557","post","type-post","status-publish","format-standard","hentry","category-geek","category-projects"],"_links":{"self":[{"href":"https:\/\/surfrock66.com\/index.php?rest_route=\/wp\/v2\/posts\/1557","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/surfrock66.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/surfrock66.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/surfrock66.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/surfrock66.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1557"}],"version-history":[{"count":14,"href":"https:\/\/surfrock66.com\/index.php?rest_route=\/wp\/v2\/posts\/1557\/revisions"}],"predecessor-version":[{"id":1587,"href":"https:\/\/surfrock66.com\/index.php?rest_route=\/wp\/v2\/posts\/1557\/revisions\/1587"}],"wp:attachment":[{"href":"https:\/\/surfrock66.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1557"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/surfrock66.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1557"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/surfrock66.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1557"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}