Skip to content

Instantly share code, notes, and snippets.

View bluet's full-sized avatar
🏠
Working from home

BlueT - Matthew Lien - 練喆明 bluet

🏠
Working from home
View GitHub Profile
@Ovid
Ovid / exception.md
Last active March 21, 2022 06:51
Exceptions in Perl?

Preface

This is something that likely cannot be made into an RFC for the Perl language at this time because implementation would be greatly simplified when the Corinna object model is in core. For example, a base class for what is discussed might look like the following:

# Exception is a poor name for warnings, so a better name is warranted
class Exception :version(v0.1.0) {
    # $message and $description might be from a messaging role
    field $message     :reader :param;
    field $description :reader :param { "" };
@blotus
blotus / log4j_exploitation_attempts_crowdsec.md
Last active December 29, 2023 12:24
IPs exploiting the log4j2 CVE-2021-44228 detected by the crowdsec community

This list is no longer updated, thus the information is no longer reliable.

You can see the latest version (from october 2022) here

@SwitHak
SwitHak / 20211210-TLP-WHITE_LOG4J.md
Last active April 18, 2024 11:20
BlueTeam CheatSheet * Log4Shell* | Last updated: 2021-12-20 2238 UTC

Security Advisories / Bulletins / vendors Responses 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 resources

  • Royce Williams list sorted by vendors responses Royce List
  • Very detailed list NCSC-NL
  • The list maintained by U.S. Cybersecurity and Infrastructure Security Agency: CISA List
@hades2510
hades2510 / limit_file_size_upload.ts
Created March 28, 2021 11:45
Limit Google Storage file upload
import { GetSignedUrlConfig, Storage } from '@google-cloud/storage'
const storage = new Storage()
// this comes from the front end
const input = {
contentType: 'application/jpeg',
contentLength: 10000 // size in bytes
}
6e136e9da8372bc94899ecef857c540567
$1$4UzUg9Tg$yg8DPUJhAhMRxaE6SM6Yl.
!@#$%^&*()1234457890!@#$%^&*()7890
dragos3443gff@665$G455454dragos2sd
$1$rGEspa1r$4XhhKTz4LC7UBgKgp3WWw
rooooooooooooooooooooooooooooooot
%!SOJIE>COMFW%$#@!QWERTGFDSAZXCVB
UIYORYIPRTEWFDJDHGKJRRTEWEGSDFHFS
$1$EdkQIoSn$T3gzKLxlcxF7tsTCFqC8M
cappothebossradiopasiuniisthebest

How to setup a practically free CDN using Backblaze B2 and Cloudflare

⚠️ Note 2023-01-21
Some things have changed since I originally wrote this in 2016. I have updated a few minor details, and the advice is still broadly the same, but there are some new Cloudflare features you can (and should) take advantage of. In particular, pay attention to Trevor Stevens' comment here from 22 January 2022, and Matt Stenson's useful caching advice. In addition, Backblaze, with whom Cloudflare are a Bandwidth Alliance partner, have published their own guide detailing how to use Cloudflare's Web Workers to cache content from B2 private buckets. That is worth reading,

@louisaslett
louisaslett / ec2-spot-price.sh
Last active April 17, 2022 17:41
Check Amazon EC2 spot prices for an instance type across all regions
#!/bin/bash
# 0. Ensure AWS CLI tool installed: pip install awscli
# 1. Make shell script executable: chmod u+x ec2-spot-prices.sh
# 2. Run script and provide instance type to check: ./ec2-spot-prices.sh c4.8xlarge
# 3. Script runs and outputs full stops while querying the Amazon API,
# returning three columns: Region+AZ, Instance Type, Current Spot Price in $
allSpot=""
for Reg in eu-west-1 eu-west-2 eu-west-3 eu-central-1 eu-north-1 ca-central-1 us-east-1 us-east-2 us-west-1 us-west-2 sa-east-1 ap-southeast-1 ap-northeast-1 ap-east-1 ap-northeast-2 ap-southeast-2 ap-south-1
@diegoparrilla
diegoparrilla / cloudflare-workers-apilityio.js
Last active April 19, 2023 12:20
Using Cloudflare Workers and https://Apility.io API add to the request headers information of the blacklists of abusers that contains the IP address of the client.
addEventListener('fetch', event => {
event.respondWith(fetchAndCheckOrigin(event.request))
})
async function fetchAndCheckOrigin(req) {
try {
startTime = new Date();
const body = await req.body;
const ip = req.headers.get('cf-connecting-ip');
const es = req.headers.get('cf-ipcountry');
@bgulla
bgulla / honeypot_counts.txt
Last active February 16, 2024 17:31
Passwords attempted over a 5-day period on a PORT 22 ssh honeypot.
204 password
193 123456
144 admin
125 support
116 123
114 1234
105 default
99 12345
97 1
84 ubnt
@goloroden
goloroden / app.js
Last active June 22, 2023 02:10
Async constructors for JavaScript
// In JavaScript, constructors can only be synchronous right now. This makes sense
// from the point of view that a constructor is a function that returns a newly
// initialized object.
//
// On the other hand, it would sometimes be very handy, if one could have async
// constructors, e.g. when a class represents a database connection, and it is
// desired to establish the connection when you create a new instance.
//
// I know that there have been discussions on this on StackOverflow & co., but
// the so-far mentioned counter arguments (such as: doesn't work as expected