Skip to content

Instantly share code, notes, and snippets.

View adRn-s's full-sized avatar

A.s. adRn-s

View GitHub Profile
@adamchainz
adamchainz / test_migrations.py
Last active June 29, 2023 14:25
Django test for pending migrations
from io import StringIO
from django.core.management import call_command
from django.test import TestCase
class PendingMigrationsTests(TestCase):
def test_no_pending_migrations(self):
out = StringIO()
try:
call_command(
@gmurdocca
gmurdocca / socat_caesar_dpi.md
Last active January 22, 2024 05:08
Circumventing Deep Packet Inspection with Socat and rot13

Circumventing Deep Packet Inspection with Socat and rot13

I have a Linux virtual machine inside a customer's private network. For security, this VM is reachable only via VPN + Citrix + Windows + a Windows SSH client (eg PuTTY). I am tasked to ensure this Citrix design is secure, and users can not access their Linux VM's or other resources on the internal private network in any way outside of using Citrix.

The VM can access the internet. This task should be easy. The VM's internet gateway allows it to connect anywhere on the internet to TCP ports 80, 443, and 8090 only. Connecting to an internet bastion box on one of these ports works and I can send and receive clear text data using netcat. I plan to use good old SSH, listening on tcp/8090 on the bastion, with a reverse port forward configured to expose sshd on the VM to the public, to show their Citrix gateway can be circumvented.

Rejected by Deep Packet Inspection

I hit an immediate snag. The moment I try to establish an SSH or SSL connection over o

@adamchainz
adamchainz / settings.py
Created February 10, 2022 22:19
Django logging setting with Rich
LOGGING = {
"version": 1,
"disable_existing_loggers": False,
"filters": {
"require_debug_true": {
"()": "django.utils.log.RequireDebugTrue",
},
},
"formatters": {
"rich": {"datefmt": "[%X]"},
@bitonic
bitonic / configuration.nix
Last active May 8, 2024 22:38
NixOS configuration for a remote ZFS server on Hetzner
# Full NixOS configuration for a ZFS server with full disk encryption hosted on Hetzner.
# See <https://mazzo.li/posts/hetzner-zfs.html> for more information.
{ config, pkgs, ... }:
let
# Deployment-specific parameters -- you need to fill these in where the ... are
hostName = "...";
publicKey = "...";
# From `ls -lh /dev/disk/by-id`

Installing NocoDB on FreeBSD/FreeNAS/TrueNAS jail

First of all, make sure to refer and understand the general instructions in the official NocoDB site:

https://docs.nocodb.com/getting-started/installation

What you'll find here are the specific instructions to setup NocoDB in a FreeBSD system, or in a FreeNAS/TrueNAS CORE jail.

This was originally done in a TrueNAS CORE 12.0-U5.1, which uses FreeBSD 12.4-RELEASE-p6 as base system.

@bluewalk
bluewalk / GetNordVPNWireGuardDetails.md
Last active May 15, 2024 02:56
Getting NordVPN WireGuard details

About

Instructions to obtain WireGuard details of your NordVPN account. These can be used to setup a WireGuard tunnel on your router to NordVPN.

Source: https://forum.gl-inet.com/t/configure-wireguard-client-to-connect-to-nordvpn-servers/10422/27

Prerequisites

If you have any linux machine, use that or install a vm if you don't have one.

Get their official linux app installed. Make sure you have wireguard installed too. And set the used technology to Nordlynx by running nordvpn set technology nordlynx

@FreddieOliveira
FreddieOliveira / docker.md
Last active May 19, 2024 07:24
This tutorial shows how to run docker natively on Android, without VMs and chroot.

Docker on Android 🐋📱

Edit 🎉

All packages, except for Tini have been added to termux-root. To install them, simply pkg install root-repo && pkg install docker. This will install the whole docker suite, left only Tini to be compiled manually.


Summary

@dannguyen
dannguyen / fetch_ghstars.md
Last active April 10, 2024 19:25
fetch_ghstars.py: quick CLI script to fetch from Github API all of a user's starred repos and save it as raw JSON and wrangled CSV

fetch_ghstars.py: quick CLI script to fetch and collate from Github API all of a user's starred repos

  • Requires Python 3.6+
  • Creates a subdir 'ghstars-USERNAME' at the current working directory
  • the raw JSON of each page request is saved as: 01.json, 02.json 0n.json
  • A flattened, filtered CSV is also created: wrangled.csv

Example usage:

@jetersen
jetersen / add-cert.py
Created March 8, 2020 09:00
Python: add custom root ca to certifi store
import requests
import certifi
import sys
try:
requests.get('https://any-website-protected-by-your-custom-root-ca')
print('Certificate already added to the certifi store')
sys.exit(0)
except requests.exceptions.SSLError as err:
print('SSL Error. Adding custom certs to Certifi store...')