Skip to content

Instantly share code, notes, and snippets.

@plugnburn
plugnburn / README.md
Last active April 24, 2024 16:35
NokiaTool - simple interface Bash script for MediaTek-based Nokia simple phones

NokiaTool: control MediaTek-based Nokia phones from your PC

Overview

NokiaTool is a simple Bash script (nokiatool.sh) that allows you to use an undocumented serial connection in USB-enabled MediaTek-based Nokia feature phones manufactured by Microsoft (even the most basic ones, like the new 105) in order to control them from your PC.

This project is an ongoing work and uses only some bits and pieces of information about the phone internals available to the public, so under any circumstances don't consider it stable or a replacement for official tools if any are present.

@plugnburn
plugnburn / README.md
Last active March 27, 2024 00:01
Statix - the simplest static website generator in bash

Statix - the simplest static website generator in Bash

Statix is a stand-alone Bash script aimed at generating full-featured, routable static websites from reusable HTML snippets. It features the most basic templating engine ever possible but allows to organize your content in a SEO-friendly way. All Statix-based websites contain these parts:

  • Templates: a directory where all HTML templates are stored
  • Route configuration: a file that maps each publicly accessible template to a SEO-friendly URL
  • Assets: a directory with optional files copied to the output website directory with no processing.

This script is also lightweight. Aside from some standard file management commands such as cp, mkdir and rm, the only serious dependency for Statix is GNU Grep compiled with PCRE support (i.e. the version that supports -P flag, included in most Linux distributions).

@plugnburn
plugnburn / mtk-bootseq.py
Created June 15, 2020 20:55
MTK Bootseq: enter alternative boot modes in MediaTek-based smartphones
#!/usr/bin/env python3
# Simple script to enter the necessary boot mode in the MT6572-based (etc) phones
# Depends on pyserial, otherwise fully cross-platform
# Usage: python3 mtk-bootseq.py [MODECMD] [port]
# e.g. python3 mtk-bootseq.py FASTBOOT /dev/tty.usbmodem14200
# and then connect the cable and repeatedly short-press the power on key
# Supported commands depend on the device and its preloader. Here's the list for Sigma S3500 sKai:
@plugnburn
plugnburn / README.md
Last active January 10, 2024 06:38
JJY.js: Web Audio API based JJY transmitter

JJY.js: JJY time signal emulation/transmission library

Usage

  1. Make sure that the watch/clock is configured to receive JJY 40 KHz signal (for most Casio Waveceptor/G-Shock watches, the easiest way is to enter the engineer menu by pressing Mode+Light+Receive and select J 40 reception mode, for all other watches you need to set the home city to Tokyo)
  2. Make sure your device clock is in sync before running the emulator.
  3. From the page, run:
@plugnburn
plugnburn / diffie.sh
Last active November 17, 2023 21:10
Sample Diffie-Hellman key exchange helper implementation in Bash (depends on dc for bigint and od for secret generation)
#!/bin/bash
# RFC 3526 prime and base (id 14, 2048-bit)
PRIME='FFFFFFFFFFFFFFFFC90FDAA22168C234C4C6628B80DC1CD129024E088A67CC74020BBEA63B139B22514A08798E3404DDEF9519B3CD3A431B302B0A6DF25F14374FE1356D6D51C245E485B576625E7EC6F4
4C42E9A637ED6B0BFF5CB6F406B7EDEE386BFB5A899FA5AE9F24117C4B1FE649286651ECE45B3DC2007CB8A163BF0598DA48361C55D39A69163FA8FD24CF5F83655D23DCA3AD961C62F356208552BB9ED52907709
6966D670C354E4ABC9804F1746C08CA18217C32905E462E36CE3BE39E772C180E86039B2783A2EC07A28FB5C55DF06F4C52C9DE2BCBF6955817183995497CEA956AE515D2261898FA051015728E5A8AACAA68FFFF
FFFFFFFFFFFF'
BASE=2
@plugnburn
plugnburn / olc.js
Last active November 8, 2023 03:39
TinyOLC - smallest Open Location Code implementation in JS
/**
* TinyOLC - Open Location Code for smallest applications
* Differences from Google's open-source JS implementation:
* - less than 600 bytes minified (as opposed to over 4.5 KB from Google)
* - only 2 methods exposed - encode (lat, lng => str) and decode (str => [lat, lng])
* - only floating point degrees accepted as encoding input (positive as N and E, negative as S and W)
* - no short code resolution
* - no area encoding, only points with 11-digit resolution
* - assuming the block lower left corner only when decoding a low-res code
* - no validation checks
@plugnburn
plugnburn / libwallace.js
Last active October 11, 2023 12:49
LibWallace: toolbox library for Qualcomm-based phones running KaiOS
/**
* LibWallace: toolbox library for Qualcomm-based and MTK-based phones running KaiOS
*
* Full support: KaiOS 2.5+ Nokias (Nokia 8110 4G, Nokia 2720 Flip, Nokia 800 Tough)
* Partial support: CAT B35, KaiOS 1.0 devices (Alcatel OT-4044O), MTK devices (Sigma S3500 sKai)
*
* Needs "certified" level in the app manifest.
* Requires additional manifest permissions:
*
* "power" - enable power management and privileged factory reset;
@plugnburn
plugnburn / unlockgen.py
Created March 28, 2019 09:39
Huawei modem unlock/flash code generator for algos v1/v2/v201 (Python 2 version)
#!/usr/bin/python
# -*- coding: utf-8 -*-
import os
import hashlib
import argparse
import binascii
import struct
def encrypt_v1(imei, key):
@plugnburn
plugnburn / README.md
Last active August 19, 2023 14:01
Samples.js: a tiny and simple Web Audio API based sample playback library

Samples.js: a tiny and simple Web Audio API based sample playback library

Web Audio API spec is a great way of professional audio playing and mixing in the modern browser. However, it's too complex and versatile for some simple one-off tasks such as "load an audio sample into memory and just play it when necessary". That's why Samples.js has come true. It's a really simple and tiny (less than 1K minified) library that exposes just 5 methods to manipulate your samples from JS code in a really easy and fun way.

API reference

The library exposes the following calls:

@plugnburn
plugnburn / mtphreak-6572.lua
Created June 16, 2020 22:16
MTPhreak-6572: sKai-specific MP0B_001 file modifier
-- MTPhreak IMEI changer and randomizer for MediaTek NVRAM
-- This version is adapted specifically for the Sigma sKai and other MT6572 based phones
-- Usage: lua mtphreak-6572.lua NVRAMfile [imei1 [imei2]]
-- If no IMEIs are passed, they are randomized (with respect to Luhn checksum)
function parseImei(imeistr) -- imei string to 12-byte table
local imeiTbl = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
for i = 1, 15 do
local digit = tonumber(imeistr:sub(i,i))