Skip to content

Instantly share code, notes, and snippets.

@sffej
sffej / xz-backdoor.md
Created April 4, 2024 19:35 — forked from thesamesam/xz-backdoor.md
xz-utils backdoor situation (CVE-2024-3094)

FAQ on the xz-utils backdoor (CVE-2024-3094)

This is still a new situation. There is a lot we don't know. We don't know if there are more possible exploit paths. We only know about this one path. Please update your systems regardless.

This is a living document. Everything in this document is made in good faith of being accurate, but like I just said; we don't yet know everything about what's going on.

@sffej
sffej / bf.c
Created February 2, 2024 02:31 — forked from lifthrasiir/bf.c
/* The world's smallest Brainfuck interpreter in C, by Kang Seonghoon
* http://j.mearie.org/post/1181041789/brainfuck-interpreter-in-2-lines-of-c */
s[99],*r=s,*d,c;main(a,b){char*v=1[d=b];for(;c=*v++%93;)for(b=c&2,b=c%7?a&&(c&17
?c&1?(*r+=b-1):(r+=b-1):syscall(4-!b,b,r,1),0):v;b&&c|a**r;v=d)main(!c,&a);d=v;}
@sffej
sffej / gist:cc99915411ded5a319f9e182a5b31c05
Created January 26, 2024 01:13 — forked from relax-more/gist:487c5f2c0b80b64aa8de
memo: What is different ${...} and #{...} on spring
@sffej
sffej / stash-pop-recover
Created December 14, 2023 23:08 — forked from davidwalter0/stash-pop-recover
Undoing accidental git stash pop
# https://stackoverflow.com/questions/6543519/undoing-accidental-git-stash-pop
# https://stackoverflow.com/questions/89332/how-to-recover-a-dropped-stash-in-git
accepted
If you have only just popped it and the terminal is still open, you will still have the hash value printed by git stash pop on screen (thanks, Dolda).
Otherwise, you can find it using this for Linux and Unix:
git fsck --no-reflog | awk '/dangling commit/ {print $3}'
and for Windows:
@sffej
sffej / cryptography-file-formats.md
Created September 14, 2023 22:27 — forked from tuansoibk/cryptography-file-formats.md
Cryptography material conversion and verification commands
  1. Introduction
  2. Standards
  3. Common combinations
  4. Conversion
  5. Verification/Inspection
  6. Tips for recognising

Introduction

It happens that there are many standards for storing cryptography materials (key, certificate, ...) and it isn't always obvious to know which standard is used by just looking at file name extension or file content. There are bunch of questions on stackoverflow asking about how to convert from PEM to PKCS#8 or PKCS#12, while many tried to answer the questions, those answers may not help because the correct answer depends on the content inside the PEM file. That is, a PEM file can contain many different things, such as an X509 certificate, a PKCS#1 or PKCS#8 private key. The worst-case scenario is that someone just store a non-PEM content in "something.pem" file.

@sffej
sffej / README.md
Created May 17, 2023 03:14 — forked from dhondta/README.md
Tinyscript tool to bruteforce the password of a PDF

PDF password bruteforcer

This is a small tool using Tinyscript and pypdf or pikepdf to bruteforce the password of a PDF given an alphabet (defaults to printables) and a length (default is 8).

$ pip install pypdf tinyscript
$ wget https://gist.githubusercontent.com/dhondta/efe84a92e4dfae3b6c14932c73ab2577/raw/pdf-password-bruteforcer.py && chmod +x pdf-password-bruteforcer.py && sudo mv pdf-password-bruteforcer.py /usr/bin/pdf-password-bruteforcer

@sffej
sffej / __fastgit_ps1.sh
Created January 18, 2023 22:39 — forked from Ragnoroct/__fastgit_ps1.sh
Blazing fast simple git branch name for ps1
# Copyright (c) 2019 Will Bender. All rights reserved.
# This work is licensed under the terms of the MIT license.
# For a copy, see <https://opensource.org/licenses/MIT>.
# Very fast __git_ps1 implementation
# Inspired by https://gist.github.com/wolever/6525437
# Mainly this is useful for Windows users stuck on msys, cygwin, or slower wsl 1.0 because git/fs operations are just slower
# Caching can be added by using export but PROMPT_COMMAND is necessary since $() is a subshell and cannot modify parent state.
# Linux: time __ps1_ps1 (~7ms)
@sffej
sffej / init.el
Created October 23, 2022 19:30 — forked from Gavinok/init.el
A minimal emacs configuration using evil mode and use-package
;;; Startup
;;; PACKAGE LIST
(setq package-archives
'(("melpa" . "https://melpa.org/packages/")
("elpa" . "https://elpa.gnu.org/packages/")))
;;; BOOTSTRAP USE-PACKAGE
(package-initialize)
(setq use-package-always-ensure t)
(unless (package-installed-p 'use-package)
@sffej
sffej / Debuggable.java
Created December 30, 2021 01:35 — forked from shelajev/Debuggable.java
Java 8 cheat sheet code
public interface Debuggable {
default String debug() {
StringBuilder sb = new StringBuilder(this.getClass().getName());
sb.append(" [ ");
Field[] fields = this.getClass().getDeclaredFields();
for(Field f: fields) {
f.setAccessible(true);
try {
sb.append(f.getName() + " = " + f.get(this));
sb.append(", ");
@sffej
sffej / 20211210-TLP-WHITE_LOG4J.md
Created December 13, 2021 17:18 — forked from SwitHak/20211210-TLP-WHITE_LOG4J.md
BlueTeam CheatSheet * Log4Shell* | Last updated: 2021-12-12 2204 UTC

Security Advisories / Bulletins linked to Log4Shell (CVE-2021-44228)

Errors, typos, something to say ?

  • If you want to add a link, comment or send it to me
  • Feel free to report any mistake directly below in the comment or in DM on Twitter @SwitHak

Other great ressources