Skip to content

Instantly share code, notes, and snippets.

View rain-1's full-sized avatar
☂️
Umbrella

rain1 rain-1

☂️
Umbrella
View GitHub Profile
@rain-1
rain-1 / minikanren.scm
Created January 6, 2019 17:49
minikanren.scm - based off orchid-hybrid mirukanren. works in Chez
;; utils
(define (assp p l)
(if (null? l)
#f
(if (p (caar l))
(car l)
(assp p (cdr l)))))
#!/bin/bash
# do this first
# ./configure
#
echo '#include <sys/types.h>' >> config.h
CFLAGS="-DHAVE_CONFIG_H -DSHELL -g -O2 -Wno-parentheses -Wno-format-security -DRCHECK -Dbotch=programming_error -DMALLOC_DEBUG"
##
@rain-1
rain-1 / wcry.md
Created May 12, 2017 20:23 — forked from anonymous/wcry.md
wcry.md

Ransomware attack hits UK NHS, Spain Telefonica, 74 countries affected.

  • Virus Name: WannaCrypt, WannaCry, WanaCrypt0r, WCrypt, WCRY
  • Vector: Windows 7 is vulnerable. It uses EternalBlue MS17-010 to propagate.

Malware samples

@rain-1
rain-1 / fishbowl.c
Created May 12, 2017 18:25
fishbowl.c
// This program runs another program in a "fishbowl" set to the
// current working directory. The idea is that the subprocess
// should only be able to edit files in that path or anything
// descended from it. It can read outside the fishbowl but if it
// attempts to create or edit files outside of it that syscall
// is blocked (by switching it to getpid which does nothing).
//
// A malicious program can bypass the fishbowl using threads to
// make a syscall and then swap the path after verification.
// This is not a security tool, it is just to protect against
@rain-1
rain-1 / makesfile
Created April 10, 2018 22:11
example makesfile to build jq
#!/bin/sh
set -e
set -x
function clean {
rm -f src/version.h
rm -f src/builtin.inc
rm -f src/*.o
rm -f jq
}
@rain-1
rain-1 / s_packed.c
Created January 8, 2021 14:26
S as a single file
#include <assert.h>
#include <errno.h>
#include <libgen.h>
#include <limits.h>
#include <linux/limits.h>
#include <signal.h>
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
@rain-1
rain-1 / gopher security.md
Created November 11, 2021 21:37
gopher security

HTTPS vs HTTP, security properties

HTTPS provides some very important security properties that HTTP does not.

It provides confidentiality, integrity and authentication.

  • Confidentiality: What you're loading cannot be snooped on by others. Eve is on the same networking as you, and can listen into your traffic - but if it's HTTPS they cannot read it. If it was plain HTTP they could see what you were looking at and copy your session cookies to potentially log in to sites as you.
  • Integrity, Authentication: You know that if a document you recieve is valid it is unmodified. Mallory cannot set up a man in the middle attack and edit the documents in transit, if it was HTTP they could do this with arp poisoning/cain and abel - and change all the images on the pages you are looking at to rick astley.

Implementing confidentiality requires a cipher and a system for keys, initialization vectors and such. It's rather involved.

@rain-1
rain-1 / docker node tip.txt
Last active December 24, 2021 07:04
Easily build NodeJS projects inside a docker container
Here's a quick dockerfile:
----------------8<-------------[ cut here ]------------------
FROM debian:latest
RUN apt-get update && apt-get install -y nodejs npm
----------------8<-------------[ cut here ]------------------
save that as Dockerfile and do: docker build -t node-builder .
@rain-1
rain-1 / checksum-colorizer.go
Created March 18, 2019 23:39
checksum colorizer
package main
import (
"bufio"
"fmt"
"os"
"log"
"regexp"
)

How to make a small tweak to free software

The target audience for this is people who are beginners at software engineering and using linux. A lot of the information here may be obvious or already known to you. The language involved is C but you do not need to know any C to read this tutorial. I used mg to write this blog post. I used vs code to edit the source code.

This post is also available on gopher://tilde.team:70/0/~river/tweak-free-software

If you use a piece of free software and it's 99% perfect but there's just this one thing it does that annoys the hell out of you.. you can in theory just fix it! Here's a look at what doing that is like. Hopefully it inspires you, or you pick up a could tricks on the way!

Step 0: Have a problem