<?xml version='1.0' encoding='UTF-8'?>
<?xml-stylesheet href="/rss/stylesheet/" type="text/xsl"?>
<rss xmlns:content='http://purl.org/rss/1.0/modules/content/' xmlns:taxo='http://purl.org/rss/1.0/modules/taxonomy/' xmlns:rdf='http://www.w3.org/1999/02/22-rdf-syntax-ns#' xmlns:itunes='http://www.itunes.com/dtds/podcast-1.0.dtd' xmlns:googleplay="http://www.google.com/schemas/play-podcasts/1.0" xmlns:dc='http://purl.org/dc/elements/1.1/' xmlns:atom='http://www.w3.org/2005/Atom' xmlns:podbridge='http://www.podbridge.com/podbridge-ad.dtd' version='2.0'>
<channel>
  <title>Jaryl Chng&apos;s Knowledge Base</title>
  <language>en-us</language>
  <generator>microfeed.org</generator>
  <itunes:type>episodic</itunes:type>
  <itunes:explicit>false</itunes:explicit>
  <atom:link rel="self" href="https://kb-jarylchng-com.pages.dev/rss/" type="application/rss+xml"/>
  <link>https://kb.jarylchng.com</link>
  <description>
    <![CDATA[<p>Welcome to the index page of my knowledge base, if you haven't done so, do visit my website at <a href="https://jarylchng.com" rel="noopener noreferrer" target="_blank">https://jarylchng.com</a>.</p><p>I will mainly use this site to document stuff, most of which will likely be in the public domain.</p>]]>
  </description>
  <itunes:author>Jaryl Chng</itunes:author>
  <itunes:image href="https://kb-static.jarylchng.com/kb-jarylchng-com/production/images/channel-c68f1f55f856ab833b4365991609dbec.png"/>
  <image>
    <title>Jaryl Chng&apos;s Knowledge Base</title>
    <url>https://kb-static.jarylchng.com/kb-jarylchng-com/production/images/channel-c68f1f55f856ab833b4365991609dbec.png</url>
    <link>https://kb.jarylchng.com</link>
  </image>
  <copyright>©2024</copyright>
  <itunes:category text="Technology"/>
  <item>
    <title>Home Automation - Jovision CloudSEE Doorbell Trigger to Telegram Chat</title>
    <guid>rykxH8CCzDk</guid>
    <pubDate>Sat, 06 Apr 2024 16:21:20 GMT</pubDate>
    <itunes:explicit>false</itunes:explicit>
    <description>
      <![CDATA[<p>The doorbell, according to the MAC address, is by China Dragon Technology Limited</p><p>The reason for this is because this model is from China and requires me to install HUAWEI Push Kit to receive notifications. But I did not want that and needed an alternative.</p><p>Now this may seem like a very simple integration, trust me it is not. The doorbell itself has all ports closed and it only communicates with their own cloud servers.</p><h2>Intercepting Traffic with Zanti Man-in-the-Middle (MitM) Attack</h2><p>I tried many ways to intercept traffic and see the requests sent by the doorbell when the alarm button is triggered. I settled onto my trusty Android device with <a href="https://www.zimperium.com/zanti-mobile-penetration-testing" rel="noopener noreferrer" target="_blank">Zanti Penetration Testing Application</a>.</p><p>Here's a sample request sent according to Zanti where they upload an image to their cloud servers when the button is pressed.</p><pre class="ql-syntax" spellcheck="false">URL: http://oss-cn-hangzhou.aliyuncs.com/xw-cloudstorage/ecateye/7days/(CAMERA_ID)/20210613/A01142912.jpg
Date: Sun Jun 13 14:29:10 GMT+08:00 2021
Method: PUT
Auth: null
Cookie: null
User Agent: (CAMERA_ID)
Mime Type: null

Headers:
date : Sun, 13 Jun 2021 06:29:19 GMT
authorization : OSS (AUTH_KEY)
content-length : 20857
host : oss-cn-hangzhou.aliyuncs.com
content-type : application/octet-stream
user-agent : (CAMERA_ID)

Form params:
</pre><h2>DNS "Poisoning" with AdGuard Home DNS Server</h2><p>Since my entire household is under <a href="https://github.com/AdguardTeam/AdGuardHome" rel="noopener noreferrer" target="_blank">AdGuard Home DNS</a> (previously <a href="https://github.com/pi-hole/pi-hole" rel="noopener noreferrer" target="_blank">PiHole</a>) and the device doesn't seem to be using any custom DNS servers, I have decided to reroute traffic going to oss-cn-hangzhou.aliyuncs.com to my <a href="https://www.nginx.com/" rel="noopener noreferrer" target="_blank">NGINX</a> server.</p><p><img src="https://kb-static.jarylchng.com/kb-jarylchng-com/production/media/rich-editor/items/rykxH8CCzDk/image-f5b9b669278c565672cfb493541f8ed0.png"></p><h2>Proxying and Mirroring with NGINX</h2><p>Luckily for me, the device uses insecure HTTP connection and I don't have to worry about any certificate checks. I pinged the address to find out that the IP address is 118.31.219.251. It may be a CDN IP but it's a low priority for me to keep up with it. I used the mirror keyword to route traffic to a webhook trigger on my local <a href="https://n8n.io/" rel="noopener noreferrer" target="_blank">N8N.io</a> instance</p><pre class="ql-syntax" spellcheck="false">server {
  listen 80;
  listen [::]:80;

  server_name oss-cn-hangzhou.aliyuncs.com;

  location / {
    mirror /mirror;
    mirror_request_body on;
    proxy_pass http://118.31.219.251;
  }
  location /mirror {
    internal;
    proxy_method POST;
    proxy_pass http://(N8N_IO_HOSTNAME)/webhook/(WEBHOOK_ID)/;
  }
}
</pre><h2>Handling request with <a href="http://N8N.io" rel="noopener noreferrer" target="_blank">N8N.io</a></h2><p><img src="https://kb-static.jarylchng.com/kb-jarylchng-com/production/media/rich-editor/items/rykxH8CCzDk/image-4cb96c45acc8a28add5ea0779e9f1964.png"></p><ol><li>Grabs the request body from POST webhook (make sure to enable Binary Data option)</li><li>Sends the image data captured in data binary object to my personal <a href="https://min.io/" rel="noopener noreferrer" target="_blank">MinIO</a> server</li><li>Sends the photo and a message to my family's Telegram channel</li></ol><h2>Final output</h2><p>It's time to press the doorbell!</p><p><img src="https://kb-static.jarylchng.com/kb-jarylchng-com/production/media/rich-editor/items/rykxH8CCzDk/image-3c74d614c8c4b7f3beef59a3ce1248c3.png"></p>]]>
    </description>
    <link>https://kb.jarylchng.com/i/home-automation-jovision-cloudsee-doorbell-trigg-rykxH8CCzDk/</link>
    <itunes:episodeType>full</itunes:episodeType>
  </item>
</channel>
</rss>