Skip to content

Instantly share code, notes, and snippets.

View ChristianTremblay's full-sized avatar

Christian Tremblay ChristianTremblay

View GitHub Profile
@ChristianTremblay
ChristianTremblay / ts.sh
Last active September 8, 2020 19:17
Termshark shortcut to capture BACnet packets on Linux boxes
#!/bin/bash
interface=$1
echo "Starting Termshark on ${interface}"
sudo /var/lib/snapd/snap/bin/termshark -i ${interface} -f "udp port 47808"
@ChristianTremblay
ChristianTremblay / .tmux.conf
Created September 8, 2020 13:58
My Tmux config
# remap prefix from 'C-b' to 'C-a'
unbind C-b
set-option -g prefix C-a
bind-key C-a send-prefix
set -g default-terminal "screen-256color"
set -g history-limit 10000
# split panes using h and v
bind v split-window -h
bind h split-window -v
@ChristianTremblay
ChristianTremblay / main.py
Last active January 26, 2021 21:37
Weather BACnet device using OpenWeatherMap API
import atoma, requests
import BAC0
import re
from weatherlink import data, xref
from bacpypes.basetypes import EngineeringUnits, DateTime
from bacpypes.primitivedata import CharacterString, Date, Time
from BAC0.core.devices.local.models import (
analog_input,
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
#!/usr/bin/env python
"""
Rebuilt Commandable
"""
from bacpypes.debugging import bacpypes_debugging, ModuleLogger
from bacpypes.consolelogging import ConfigArgumentParser
from bacpypes.core import run
@ChristianTremblay
ChristianTremblay / Meteo.py Example
Created October 19, 2019 19:41
Example of using BAC0 to create a BACnet device. (Meteo parser not included)
import atoma, requests
import BAC0
import re
from meteo_parser import MeteoGC
from bacpypes.basetypes import EngineeringUnits, DateTime
from bacpypes.primitivedata import CharacterString, Date, Time
from BAC0.core.devices.create_objects import (
create_AV,
@ChristianTremblay
ChristianTremblay / bacpypes_karen
Created September 26, 2018 02:34
Code example for MockServer using bacpypes
from bacpypes.debugging import bacpypes_debugging, ModuleLogger
from bacpypes.consolelogging import ConfigArgumentParser
from bacpypes.core import run, stop, deferred, enable_sleeping
from bacpypes.iocb import IOCB
from bacpypes.pdu import Address
from bacpypes.primitivedata import Real
from bacpypes.object import get_datatype, AnalogValueObject, Property, register_object_type
from bacpypes.apdu import ReadPropertyRequest
@ChristianTremblay
ChristianTremblay / Niagara4 Scram exchange
Created April 25, 2017 01:54
Extract from wireshark TCP flow
GET /prelogin?clear=true HTTP/1.1
Host: 192.168.210.10:88
User-Agent: python-requests/2.7.0 CPython/3.4.3 Linux/4.4.50-v7+
Connection: keep-alive
Accept: */*
Accept-Encoding: gzip, deflate
HTTP/1.1 302 Found
Set-Cookie: JSESSIONID=29d3613a82dc65dc7eab15c94d40d9e487ffe25aa868d7d84d;Path=/;HttpOnly
Expires: Thu, 01 Jan 1970 00:00:00 GMT
# -*- coding: utf-8 -*-
"""
Created on Fri Sep 16 18:13:39 2016
@author: CTremblay
"""
import fysom
from ..crc import calc_incr_header_crc, data_crc