Posting screen caps to Slack

Any major updates coming, Upcoming Software, General Security advice for others and topics alike Post them here so other users can chat with you.
Post Reply
lbutlr
Posts: 17
Joined: Mon Feb 06, 2017 5:47 pm

Posting screen caps to Slack

Post by lbutlr »

Since the only alert notifications in my SmartClient (and I assume yours) are email and I've gotten into the habit of looking at email every few days and not every 15 minutes, I decided to create a slack channel on my family slack that would get all the screenshots. This has the additional benefit of sending me an alert on my computer, laptop, iPad, and iPhone.

I used procmail to do this, but anything that lets you process mail will work.

Code: Select all


:0c
* ^TO_.*myNVRalertEmail@mydomain.tld
* 9876543210^0 ^Content-Type:.*multipart
* 9876543210^0 ^Content-Type:.*inline
* 9876543210^0 ^Content-Type:.*image/jpeg
# If the message has any sort of attachment that could be an image...
{
# Write the mime message parts to a web accessible directory
:0fw
| ripmime -i - -d /www/photodrop/

# Get one file that was created in the last minute. This will *usually* be the most recent
# File, but with 8 cameras, maybe not.
FOTO=`find /www/photodrop/ -cmin -1 -size +10k -type f -exec basename {} \; | tail -1`
# WHOST is the http://server/path of the web host
URL="<${WHOST}/${FOTO}>"
URL=`echo $URL | sed 's/ /%20/g'`
# $HOOK is the web hook from api.slack.com
PAYLOAD="payload={\"icon_emoji\":\":warning:\",\"username\":\"QCAM-NVR\",\"text\":\"${URL}\"} $HOOK"
:0c
# If these match, there was no FOTO LINK, so abort
* ! URL ?? ^^${WHOST}^^
| curl -s --data-urlencode $PAYLOAD

# Or, use Oysttyer and dm yourself, but this results in twitter getting annoyed with you.
# | oysttyer -runcommand="/dm ${TWIT} $URL"
}
Hope someone finds this useful
QCAM HD with 8 IP3M952E cameras
Post Reply