Skip to content

Instantly share code, notes, and snippets.

@pilcrowonpaper
pilcrowonpaper / crypto-random.ts
Last active January 3, 2024 18:55
Cryptographically strong Math.random(). Generate cryptographically strong random float between 0-1. Uses 52 bits instead of 32.
function random(): number {
const buffer = new ArrayBuffer(8);
const bytes = crypto.getRandomValues(new Uint8Array(buffer));
// sets the exponent value (11 bits) to 01111111111 (1023)
// since the bias is 1023 (2 * (11 - 1) - 1), 1023 - 1023 = 0
// 2^0 * (1 + [52 bit number between 0-1]) = number between 1-2
bytes[0] = 63;
bytes[1] = bytes[1] | 240;
@william8th
william8th / .tmux.conf
Last active November 9, 2024 17:31
Tmux open new pane in same directory
# Set the control character to Ctrl+Spacebar (instead of Ctrl+B)
set -g prefix C-space
unbind-key C-b
bind-key C-space send-prefix
# Set new panes to open in current directory
bind c new-window -c "#{pane_current_path}"
bind '"' split-window -c "#{pane_current_path}"
bind % split-window -h -c "#{pane_current_path}"
@rohan-molloy
rohan-molloy / Instance Metadata.md
Last active March 3, 2018 12:37
Instance Metadata

Cloud metadata

Many cloud providers such as Amazon AWS, Digitalocean and Vultr provide an instance metadata service.

Guest instances can discover their own parameters by accessing an API. By convention, this API is accessible from the address 169.254.169.254

To get the value of key 'k', we send an HTTP request to the relative location /$k If the key corresponds to a tuple, the request is rewritten to key/ which is an index. If no value or tuple exists, it simply returns not found

@asukakenji
asukakenji / 0-go-os-arch.md
Last active November 6, 2024 03:19
Go (Golang) GOOS and GOARCH

Go (Golang) GOOS and GOARCH

All of the following information is based on go version go1.17.1 darwin/amd64.

GOOS Values

GOOS Out of the Box
aix
android
@EdOverflow
EdOverflow / github_bugbountyhunting.md
Last active November 8, 2024 20:13
My tips for finding security issues in GitHub projects.

GitHub for Bug Bounty Hunters

GitHub repositories can disclose all sorts of potentially valuable information for bug bounty hunters. The targets do not always have to be open source for there to be issues. Organization members and their open source projects can sometimes accidentally expose information that could be used against the target company. in this article I will give you a brief overview that should help you get started targeting GitHub repositories for vulnerabilities and for general recon.

Mass Cloning

You can just do your research on github.com, but I would suggest cloning all the target's repositories so that you can run your tests locally. I would highly recommend @mazen160's GitHubCloner. Just run the script and you should be good to go.

$ python githubcloner.py --org organization -o /tmp/output
@jhaddix
jhaddix / all.txt
Last active November 7, 2024 08:01
all wordlists from every dns enumeration tool... ever. Please excuse the lewd entries =/
This file has been truncated, but you can view the full file.
.
..
........
@
*
*.*
*.*.*
🐎
@averagesecurityguy
averagesecurityguy / pdf_flatedecode.py
Last active October 2, 2024 19:10
Decompress FlateDecode Objects in PDF
#!/usr/bin/env python3
# This script is designed to do one thing and one thing only. It will find each
# of the FlateDecode streams in a PDF document using a regular expression,
# unzip them, and print out the unzipped data. You can do the same in any
# programming language you choose.
#
# This is NOT a generic PDF decoder, if you need a generic PDF decoder, please
# take a look at pdf-parser by Didier Stevens, which is included in Kali linux.
# https://tools.kali.org/forensics/pdf-parser.
#
@Abukamel
Abukamel / installNginxWithHttp2.sh
Last active January 8, 2017 06:07
Install nginx with libressl and http2 support on Centos 7. Credit goes to Matthias Adler https://matthiasadler.info/blog/nginx-http2-static-libressl-on-centos-7/
#!/usr/bin/env bash
# Names of latest versions of each package
export VERSION_PCRE=pcre-8.39
export VERSION_ZLIB=zlib-1.2.10
export VERSION_LIBRESSL=libressl-2.4.4
export VERSION_NGINX=nginx-1.11.8
# Download nginx cache purge module to add it in compilation time
# git clone https://github.com/FRiCKLE/ngx_cache_purge
@Lewiscowles1986
Lewiscowles1986 / rPi3-ap-setup.sh
Last active July 16, 2023 15:33
Raspberry Pi 3 access-point-setup
#!/bin/bash
#
# This version uses September 2017 august stretch image, please use this image
#
if [ "$EUID" -ne 0 ]
then echo "Must be root"
exit
fi
@lnoering
lnoering / apcu.ini
Last active February 24, 2019 11:48
[install] Install Server CentOS 7 for Magento
; Enable APCu extension module
extension = apcu.so
; This can be set to 0 to disable APCu
apc.enabled=1
; Setting this enables APCu for the CLI version of PHP
; (Mostly for testing and debugging).
;apc.enable_cli=0