Skip to content

Instantly share code, notes, and snippets.

@remi
remi / shc.js
Last active Sep 19, 2021
Extract JSON object from https://smarthealth.cards QR code
View shc.js
// Extract JSON payload from SHC QR code (without any kind of private/public key verification)
// Credits + inspiration
// https://github.com/dvci/health-cards-walkthrough/blob/main/SMART%20Health%20Cards.ipynb
// Usage
// $ node shc.js "shc:/01234569…"
const zlib = require("zlib");
@troyhunt
troyhunt / rick-roll-content-scraper.js
Created Aug 19, 2020
A Cloudflare worker to redirect image requests from dickhead content scraper's site to a Rick Roll
View rick-roll-content-scraper.js
addEventListener('fetch', event => {
event.respondWith(fetchAndApply(event.request))
})
async function fetchAndApply(request) {
let response = await fetch(request)
let referer = request.headers.get('Referer')
let contentType = response.headers.get('Content-Type') || ''
if (referer && contentType.startsWith('image/')) {
@mikeckennedy
mikeckennedy / speed_of_exceptions.py
Created Jul 9, 2020
Simple example to test how much faster or slower it is to simply try and convert then catch an error vs. testing up front.
View speed_of_exceptions.py
import datetime
import random
from typing import List
def main():
random.seed(172)
count = 1_000_000
data = build_data(count)
run_with_except(data)
View scoreboard-nsec2020.txt
TEAM | POINTS | LAST SUBMIT
----------------------------------+--------+-------------------
<CA> HubrETS Hackin'' | 155 | 2020/05/17 14:58
<CA> Les Gentils Pirates | 133 | 2020/05/17 14:42
<CA> CLICKESTI | 129 | 2020/05/17 14:07
<US> Skiddies as a Service | 125 | 2020/05/17 14:44
<CA> cold_root | 116 | 2020/05/17 14:38
<CA> Panique Au Village | 94 | 2020/05/17 14:47
<CA> Shopify | 84 | 2020/05/17 14:47
<CA> segfaults | 77 | 2020/05/17 14:55
@Neo23x0
Neo23x0 / sysmon_suspicious_keyboard_layout_load.yml
Last active Sep 4, 2020
Sigma Rule to Detect Uncommon Keyboard Layout Loads in Your Organisation
View sysmon_suspicious_keyboard_layout_load.yml
title: Suspicious Keyboard Layout Load
description: Detects the keyboard preload installation with a suspicious keyboard layout, e.g. Chinese, Iranian or Vietnamese layout load in user session on systems maintained by US staff only
references:
- https://renenyffenegger.ch/notes/Windows/registry/tree/HKEY_CURRENT_USER/Keyboard-Layout/Preload/index
author: Florian Roth
date: 2019/10/12
logsource:
product: windows
service: sysmon
definition: 'Requirements: Sysmon config that monitors \Keyboard Layout\Preload subkey of the HKLU hives - see https://github.com/SwiftOnSecurity/sysmon-config/pull/92/files'
@calebporzio
calebporzio / fa.sublime_snippet
Last active Apr 8, 2018
Font Awesome sublime snippet for creating icon tags
View fa.sublime_snippet
<snippet>
<content><![CDATA[
<i class="fa fa-fw fa-${1}"></i>&nbsp;
]]></content>
<tabTrigger>fa</tabTrigger>
<description>Font Awesome Icon</description>
<scope>text.blade, text.html.blade, text.html</scope>
</snippet>
View list of sane mimetypes for a "document" upload
parameters:
file_upload_mime_types:
- application/pdf
- application/x-pdf
- text/plain
- application/rtf
- image/*
- application/msword
- application/vnd.openxmlformats-officedocument.wordprocessingml.document
@sephii
sephii / certcheck.py
Last active Feb 3, 2020
Check for letsencrypt/certbot certificates expiry date. Can be run in a cron
View certcheck.py
#!/usr/bin/env python3
"""
Usage: certcheck.py host1 host2 hostN. Will exit with status code 1 if any of the hosts is about to expire (see
WARNING_DAYS below).
"""
from datetime import datetime
import socket
import ssl
View Sunshine PHP
PHP Extensions Tutorial
The best way to learn about writing extensions is - to write an
extension! If you want to "code along", you'll need to be set up to
compile PHP 7 extensions, have a checkout of the example code we'll be
using, and have the C library we'll be "wrapping" available on your
system.
All the code we'll be working with is available from
https://github.com/auroraeosrose/php-extensions-code