Skip to content

Instantly share code, notes, and snippets.

View gabonator's full-sized avatar
👨‍🏭
at work

Gabriel Valky gabonator

👨‍🏭
at work
View GitHub Profile
@gabonator
gabonator / tunnelclient.js
Created November 18, 2017 15:43
simple IP tunneling using public server in nodejs
var net = require('net');
var tunnel = null;
var target = null;
// tunnel server
var serverInfo = {port:8811, host:"public.server.com"};
// target device we want to access on network where this script is running
var targetInfo = {port:1001, host:"ip.local.network"};
function listen()
@gabonator
gabonator / cc1101oregon.ino
Created May 12, 2016 21:06
Oregon scientific WMR sniffing with CC1101 transceiver using arduino
#include "cc1101.h"
class C1101Receiver : public CC1101
{
enum
{
SS = 10,
MOSI = 11,
MISO = 12,
SCK = 13,
@gabonator
gabonator / info.txt
Created December 25, 2022 09:59
cool led - flexible led matrix panel
Cool led flexible led panel
Product: 16x64 16x96 LED Matrix Panel Car Sign Scrolling Display BLE APP Control 5V 2A
Main MCU: artery at32f421
1x mw245b - https://cdn.datasheetspdf.com/pdf-down/M/W/2/MW245-Sunmoon.pdf - octal buffer (74HCT245D)
9x sm16206s - https://datasheet.lcsc.com/lcsc/2003131816_Shenzhen-Sunmoon-Micro-SM16206S_C121618.pdf - column controller 3x3x16
2x sm5166pf - https://www.waveshare.com/w/upload/8/8b/Sm5166p.pdf - row controller 2x8
Reverse powering:
@gabonator
gabonator / test.sh
Created November 15, 2023 12:08
systemd & rsyslog in container
if [[ -z "${DOCKER}" ]]; then
cat > Dockerfile <<- EOM
FROM debian:trixie
WORKDIR /app
RUN apt update -y --fix-missing && apt upgrade -y
RUN apt install -y rsyslog build-essential libsystemd-dev systemd
COPY test.sh .
ENV DOCKER 1
ENTRYPOINT ["bash", "test.sh"]
EOM
@gabonator
gabonator / index.html
Created November 7, 2023 09:35
Websockets with nodejs express server using single port
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/xterm@5.3.0/css/xterm.css"/>
<script src="https://cdn.jsdelivr.net/npm/xterm@5.3.0/lib/xterm.js"></script>
<div id="terminal">
<script>
var terminal = new window.Terminal({cursorBlink: true});
terminal.open(document.querySelector('#terminal'));
terminal.onData(e => socket.send(e));
var socket = new WebSocket(document.location.href.split("http").join("ws") + "terminal");
socket.onmessage = msg => terminal.write(msg.data);
@gabonator
gabonator / filter.py
Created November 3, 2023 09:15
Simple string filtering algorithm
# During data processing you will face a situation when you will
# need to filter out some data based on string comparison (e.g. process
# only file names which pass some condition). Things get more complicated
# if the condition is meant to be provided by user or as a CLI argument.
#
# Some of the popular methods are following:
# - wildcard matching (e.g. "*.jpg" which will return only jpeg files)
# - regex (e.g. ".*\.jpg")
# - code (e.g. filename.substr(-4) == ".jpg")
#
@gabonator
gabonator / WebSocketServer.cpp
Created March 31, 2018 19:31
ESP8266 based Wifi CNC controller: http server, websocket server, embedded html resources
//#define DEBUGGING
#include "WebSocketServer.h"
#include "crypto.h"
bool WebSocketServer::handshake(Client &client) {
socket_client = &client;
// If there is a connected client->
if (socket_client->connected()) {
// Check request and look for websocket handshake
#ifdef DEBUGGING
@gabonator
gabonator / abcom_protocol.js
Created November 26, 2017 20:05
ABcom satellite settop box protocol reverse engineering
/*
reverse engineering of ABcom Cryptobox 600HD mini dvbs box protocol
Firstly I examined android package (since it was easier to get it) "g-mscreen-2-3-11.apk". It
uses C++ library for implementing control protocol. Then I was trying to capture UPnP communication
from iphone connected to OSX running wireshark. But without luck. GMScreen allowed to connection
to box using ip address and port. This traffic was easier to caputre and analyse. Requests by
client application are human readable json/xml code. Some response packets are compressed using
zlib.
@gabonator
gabonator / hikvision.js
Created May 16, 2021 19:34
Nodejs downloads still image from hikvision nvr
// nodejs script for downloading still images from hikvision nvr
// uses request-digest for basic http authenticatication
//
// Still images are available at this url:
// http://192.168.1.130/ISAPI/Streaming/channels/200/picture?videoResolutionWidth=1920&videoResolutionHeight=1080
var digestRequest = require('request-digest')('user', 'password');
var fs = require('fs');
var cam = 3;
@gabonator
gabonator / serialws.js
Created November 7, 2015 17:57
Serial port to websocket connector using NodeJs
// http://ejohn.org/blog/ecmascript-5-strict-mode-json-and-more/
"use strict";
process.title = 'node-serial-ws';
// Websocket
var webSocketsServerPort = 1337;
var webSocketServer = require('websocket').server;
var http = require('http');
var server = http.createServer(function(request, response) {
// Not important for us. We're writing WebSocket server, not HTTP server