Skip to content

Instantly share code, notes, and snippets.

@codeniko
codeniko / UNMS-Unifi-Pi-Buster.md
Last active June 22, 2023 02:23
Setup UNMS and Unifi network controller on Raspberry pi 4 Raspbian buster

Setup Raspbian Buster

I'm using debian 10 as my daily so these are *nix commands. Mac should work with these too but you're on your own if you're using Windows. Goal for me is to make a headless raspberry pi I can SSH into and connect to my network using Ethernet. You should be comfortable in command line if you choose to follow this guide.

  1. Go to https://www.raspberrypi.org/downloads/raspbian and download Raspbian lite archive
  2. unzip the image
  3. Plug in sdcard. Run lsblk to see drives and mount points. Likely, the sdcard will show up in /dev/sda or /dev/sdb and may have some partitions like /dev/sda1 and /dev/sda2.
  4. If partitions are mounted, unmount all of them. Ex: umount /dev/sda1 and umount /dev/sda2
  5. Copy the raspbian image to the sdcard with sudo dd if=RASPBIAN_IMAGE_FILE.img of=/dev/sda bs=4M
  6. Run sync to ensure the written contents are flushed
  7. OPTIONAL: To start ssh server on boot, Unplug sdcard and reinsert to remount new partitions. You'll have two with raspbian.
@codeniko
codeniko / namecheap_ddns.etc.ddclient.conf
Last active June 27, 2020 12:24
Namecheap ddns configuration
from https://ktmresearch.com/2014/10/dynamic-dns-ddclient-with-namecheap/
service ddclient restart
daemon=300
ssl=yes
use=web, web=checkip.dyndns.com/, web-skip='IP Address'
protocol=namecheap
server=dynamicdns.park-your-domain.com
login=nfeld.com
@codeniko
codeniko / Example systemd .system file
Created July 24, 2020 02:22
soft link it to /etc/systemd/system
[Unit]
Description=Universal Media Server
After=network.target
After=network-online.target
[Service]
User=pi
ExecStart=/opt/ums/UMS.sh headless
TimeoutSec=30
Restart=on-failure
@codeniko
codeniko / ssdp_discover.sh
Created August 3, 2020 03:28
Broadcast SSDP request or specify ip as arg1
#!/usr/bin/env python2
import socket
import sys
dst = "239.255.255.250"
if len(sys.argv) > 1:
dst = sys.argv[1]
st = "upnp:rootdevice"
if len(sys.argv) > 2:
st = sys.argv[2]
@codeniko
codeniko / sshd_config
Last active September 24, 2020 05:13
# $OpenBSD: sshd_config,v 1.103 2018/04/09 20:41:22 tj Exp $
# This is the sshd server system-wide configuration file. See
# sshd_config(5) for more information.
# This sshd was compiled with PATH=/usr/bin:/bin:/usr/sbin:/sbin
# The strategy used for options in the default sshd_config shipped with
# OpenSSH is to specify options with their default value where
# possible, but leave them commented. Uncommented options override the
@codeniko
codeniko / gen-fake-cert-and-key
Created October 24, 2020 08:24
generate fake cert and key for https testing in dev
openssl req -x509 -sha256 -nodes -days 9365 -newkey rsa:2048 -keyout fake-key.pem -out fake-cert.pem
@codeniko
codeniko / 0_reverse engineering.md
Last active April 16, 2024 08:01
Android Reverse Engineering

https://github.com/skylot/jadx for dex decompiling, no need to convert to jar with dex2jar https://github.com/pxb1988/dex2jar
https://www.evilsocket.net/2017/04/27/Android-Applications-Reversing-101/

Add android:debuggable="true" to decompiled AndroidManifest to allow debugging. Recompile, sign, and install after.

Tools

Apk Downloader
ApkTool for decompiling dex to smali
https://github.com/skylot/jadx for viewing apk file contents (java-fied)
Apk-Multi-tool various tools to do everything

@codeniko
codeniko / gist:a89e4476379e1c7ca69f83ca259863ee
Created March 8, 2023 19:38
Windows 10/11 iso burn to USB from mac
// Disk N is the id of the external usb drive from the diskutil commands
// This transfers most files over except for the >4GB file, which we need to use 3rd party tool to split
// Double tap the Windows 11/10 iso to mount it, plug in the USB
brew install wimlib
diskutil list
diskutil eraseDisk MS-DOS "WINDOWS11" MBR diskN
ls /Volumes
rsync -avh --progress --exclude=sources/install.wim /Volumes/CCCOMA_X64FRE_EN-US_DV9/ /Volumes/WINDOWS11
#!/usr/bin/bash
MAM_ID_FILE=~/mam_id.txt
TIMESTAMP=$(date +%s)000
# URL="https://www.myanonamouse.net/json/bonusBuy.php/?spendtype=upload&amount=1&_=${TIMESTAMP}"
URL="https://www.myanonamouse.net/json/bonusBuy.php/?spendtype=upload&amount=Max%20Affordable%20&_=${TIMESTAMP}"
mamId=`cat ${MAM_ID_FILE}`
echo "$URL"
curl -i "${URL}" \