Skip to content

Instantly share code, notes, and snippets.

@phieber
phieber / setup.sh
Created December 18, 2017 17:23
LDAP setup script which does TLS setup and basic hardening. Improved version of https://riecken.de/index.php/2016/05/openldap-automatisch-installieren-und-einrichten/
#!/bin/bash
# Author: Patrick Hieber
# modified version of:
#https://riecken.de/index.php/2016/05/openldap-automatisch-installieren-und-einrichten/
# Changelog
# v1.1: added TLS via Letsencrypt, heredoc instead of echos, consistent usage of variables
# v1 (original): #https://riecken.de/index.php/2016/05/openldap-automatisch-installieren-und-einrichten/
@phieber
phieber / takeOverMyVPS.sh
Last active May 21, 2022 02:26
VPS notes for using takeover.sh
#!/bin/bash
# https://github.com/marcan/takeover.sh
#
# Allows to install another Linux flavor like e.g. Gentoo even if the VPS hoster doesn't offer/allow you to do so.
#
# First argument: the deep link to the sysresccd iso image
set -o nounset
/etc/init.d/apache2 stop
@phieber
phieber / setupTorWithOnioncat.sh
Last active November 13, 2016 21:08
Onioncat and Tor on Ubuntu 1604
#/bin/bash
echo 'deb http://deb.torproject.org/torproject.org xenial main' > /etc/apt/sources.list.d/tor.list
echo 'deb-src http://deb.torproject.org/torproject.org xenial main' >> /etc/apt/sources.list.d/tor.list
gpg --keyserver keys.gnupg.net --recv A3C4F0F979CAA22CDBA8F512EE8CBC9E886DDD89
gpg --export A3C4F0F979CAA22CDBA8F512EE8CBC9E886DDD89 | sudo apt-key add -
apt-get update
apt-get install -y tor deb.torproject.org-keyring onioncat apparmor-utils dstat patch curl vim-nox
@phieber
phieber / esp8266-add-umqtt.robust.sh
Created August 29, 2016 10:45
esp8266 add umqtt.robust
# clone micropython
cd unix
make axtls
make
./micropython -m upip install micropython-umqtt.simple
./micropython -m upip install micropython-umqtt.robust
./micropython -m upip install micropython-time
make clean
make axtls
make
@phieber
phieber / boot.py
Last active October 8, 2016 19:35
esp8266-01 micropython
import network
import gc
import webrepl
import esp
esp.osdebug(None)
ap_if = network.WLAN(network.AP_IF)
sta_if = network.WLAN(network.STA_IF)
#!/bin/bash
cd /tmp
# SDK
git clone --recursive https://github.com/pfalcon/esp-open-sdk.git
cd esp-open-sdk && make
## add it to the PATH
export PATH=/tmp/esp-open-sdk/xtensa-lx106-elf/bin:$PATH
@phieber
phieber / gps2kml.cpp
Last active October 14, 2022 18:55
based on the GPS module from adafruit, TeensyLC and the SD adapter for the Teensy
#include <Adafruit_GPS.h>
#include <SD.h>
#include <SPI.h>
#include <XMLWriter.h>
Adafruit_GPS GPS(&Serial3);
// Set GPSECHO to 'false' to turn off echoing the GPS data to the Serial console
// Set to 'true' if you want to debug and listen to the raw GPS sentences.
#define GPSECHO true
@phieber
phieber / makeRpi.sh
Created February 13, 2016 10:15
Script which creates new builds for the RaspberryPi. Those builds are pushed to https://rpi.pa.trickhieber.de .
#!/bin/bash
#
# Author: Patrick Hieber - github.com/phieber
#
# This work is licensed under a GNU General Public License (GPLv3) Version 3.0 http://www.gnu.org/licenses/gpl-3.0.html
cleanup() {
rm -rf /tmp/Gentoo* /tmp/root.tar.xz /tmp/boot.tar.xz /tmp/*.json /tmp/partition_setup.sh /tmp/rpi*
find /var/www/de/trickhieber/pa/rpi/htdocs/geNtOOBS* -mtime +1 -exec rm {} \;
#!/bin/sh
# Place in /etc/motd.d and drop the .sh suffix.
echo -e "\n\033[1mWelcome to Gentoo Linux!\033[0m"
echo -e "\nThis server is maintained by \033[1m$(cat /etc/maintainer)\033[0m."
echo -e "Contact \033[1m$(cat /etc/maintainer-address)\033[0m for support."
echo -e "\n \033[1;32m*\033[0m $(cat /etc/gentoo-release)"
@phieber
phieber / wirelessFreedom.sh
Created July 15, 2013 19:24
CVE-30360 WLan enable
#!/bin/bash
HOST=192.168.0.1
USER=admin
PASS=password
curl --cookie-jar cookies.txt http://${HOST}/login.asp -s
curl --cookie cookies.txt --cookie-jar cookies.txt --data "user=${USER}&pws=${PASS}" http://${HOST}/goform/login -s
curl --cookie cookies.txt --cookie-jar cookies.txt --data "dir=admin/&WFReset=Wifi%%20Factory%%20Reset%%20&file=wireless" http://${HOST}/goform/Wls -s
curl --cookie cookies.txt http://${HOST}/goform/logout -s