This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env python | |
| # encoding: utf-8 | |
| # Sample binary target based on golang 1.11+ using modules and vendoring. | |
| # | |
| # To use: | |
| # - Update the go binary path if not in /usr/local/go/bin | |
| # - Remove '-mod=vendor' if not using vendoring | |
| bld.program( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // mirroring std.file.exists but with stat() instead of lstat() to dereference symbolic links | |
| bool existsWithDereference(string name) @trusted nothrow @nogc { | |
| import core.sys.posix.sys.stat: stat, stat_t; | |
| import std.internal.cstring: tempCString; | |
| auto namez = name.tempCString!char(); | |
| stat_t statbuf = void; | |
| return stat(namez, &statbuf) == 0; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Relies on https://github.com/alexwebr/salsa20 | |
| // To compile and run: place it in a directory with salsa20.c and salsa20.h and run: | |
| // % cc salsa20_obfuscator.c salsa20.c && ./a.out | |
| // Then write strings in stdin. For example: | |
| // % $ echo "Cancel" | ./a.out | |
| // 'Cancel' -> [0x89, 0x88, 0x6a, 0xd1, 0x12, 0xc1] | |
| #include <stdio.h> | |
| #include <stdlib.h> | |
| #include <string.h> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| diff --git a/Python/random.c b/Python/random.c | |
| index 93d300d..396041d 100644 | |
| --- a/Python/random.c | |
| +++ b/Python/random.c | |
| @@ -3,6 +3,9 @@ | |
| #include <windows.h> | |
| #else | |
| #include <fcntl.h> | |
| +#if defined(HAVE_GETRANDOM) || defined(HAVE_GETENTROPY) | |
| +#include <sys/random.h> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| diff --git a/Python/random.c b/Python/random.c | |
| index 93d300d..396041d 100644 | |
| --- a/Python/random.c | |
| +++ b/Python/random.c | |
| @@ -3,6 +3,9 @@ | |
| #include <windows.h> | |
| #else | |
| #include <fcntl.h> | |
| +#if defined(HAVE_GETRANDOM) || defined(HAVE_GETENTROPY) | |
| +#include <sys/random.h> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Iterated HMAC-SHA-256 password hashing homebrew | |
| # Important: avoid this. Use argon2 or scrypt instead (CPU+mem stretching) or PBKDF2 or bcrypt (just CPU) | |
| def iterated_hmacsha256(password, salt, extra_rounds): | |
| import hmac, hashlib | |
| current = salt | |
| for i in range(1 + extra_rounds): # extra rounds beyond the first | |
| current = hmac.new(key=password, msg=current, digestmod=hashlib.sha256).digest() | |
| return current | |
| # These vectors have been verified with multiple implementations |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env python3 | |
| # Inspired by https://stackoverflow.com/a/19706670/37020 by @mfukar | |
| import http.server, ssl | |
| # Concatenated private key and certificate. | |
| # Sample openssl comand to generate a self-signed server.pem file: | |
| # openssl req -x509 -sha256 -newkey rsa:2048 -nodes -keyout server.pem -out server.pem -days 365 -subj '/CN=localhost' | |
| CERTFILE="server.pem" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package main | |
| import ( | |
| "crypto/rand" | |
| "flag" | |
| "fmt" | |
| "math/big" | |
| ) | |
| func GenerateSecurePassword(n int, alphabet string) (string, error) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| wt() { | |
| if [ "$#" -eq 0 ]; then | |
| local -a extra_fzf_args | |
| elif [ "$#" -eq 1 ]; then | |
| extra_fzf_args=( | |
| --query | |
| "'$1" | |
| ) | |
| else | |
| echo "Unknown arguments $@" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| usage_exit() { | |
| echo "$0 <target-url> <jrpc-method> [jrpc-params] [extra-curl-args]" | |
| exit 1 | |
| } | |
| target="$1" | |
| shift | |
| method="$1" | |
| shift | |
| if [[ -z $target ]] || [[ -z $method ]]; then |