Skip to content

Instantly share code, notes, and snippets.

@coffeetocode
coffeetocode / example_output.txt
Last active September 15, 2022 18:29
Example of bypasses for naive blacklists of 169.254.169.254 local metadata service. Useful for SSRF testing, among other things. See https://twitter.com/coffeetocode/status/912788650408026112
$ ./try_local_metadata.sh
Trying 169.254.169.254... found metadata
Trying 169.254.43518... found metadata
Trying 169.16689662... found metadata
Trying 2852039166... found metadata
Trying 0251.0376.0251.0376... found metadata
Trying 0251.0376.0124776... found metadata
Trying 251.0775248... -
Trying 25177524776... -
Trying 0xa9.0xfe.0xa9.0xfe... found metadata
@abdullah353
abdullah353 / .gitlab-ci.yml
Created July 15, 2017 11:20
Basic skeleton of Gitlab CI integration with AWS Lambda for auto deployments.
image: docker:latest
before_script:
- apt-get update -y # Updating the Ubuntu Docker instance.
- python -V # Print out python version for debugging.
- apt install -y zip jq
- pip install awscli --upgrade --user
- export PATH=~/.local/bin:$PATH # Required for awscli.
- aws --version # Print out aws cli version for debugging.
@skirdey
skirdey / pubsub_iot.py
Last active March 13, 2024 21:15
Connecting to AWS IoT MQTT topic using Python and Paho MQTT client
import paho.mqtt.client as paho
import os
import socket
import ssl
from time import sleep
from random import uniform
import json
import logging
logging.basicConfig(level=logging.INFO)
@skylander86
skylander86 / lambda-ses-forwarder.py
Created January 4, 2017 18:10
Python port of arithmetric/aws-lambda-ses-forwarder. An AWS Lambda function for forwarding incoming emails through SES.
"""
This code is a Python 2.7 port of [aws-lambda-ses-forwarder](https://github.com/arithmetric/aws-lambda-ses-forwarder). Follow instructions there for setting up SES and AWS Lambda.
"""
from email import message_from_file
import json
import logging
import os
import re
@lopes
lopes / aes-cbc.py
Last active March 21, 2024 04:22
Simple Python example of AES in CBC mode.
#!/usr/bin/env python3
#
# This is a simple script to encrypt a message using AES
# with CBC mode in Python 3.
# Before running it, you must install pycryptodome:
#
# $ python -m pip install PyCryptodome
#
# Author.: José Lopes
# Date...: 2019-06-14
#!/usr/bin/env python
from __future__ import print_function
import boto3
import json
import random
# A list of Role, User, and account ARNs to allow
# assumption from at random.
BACKDOOR_ROLES = [
'your-arn-here'
@woodrow
woodrow / onc_converter.py
Created April 27, 2016 23:54
Convert OpenVPN config files to ChromeOS ONC files
import argparse
import json
import re
import sys
import uuid
class OpenVPNNetworkConfiguration(object):
KNOWN_CONFIG_KEYS = {
'name': {'key': 'Name'},
@josteink
josteink / on_stateful_code.txt
Last active October 21, 2020 05:37
On why stateful code is bad
On why stateful code is bad
===========================
STUDENT: Sir, can I ask a question?
TEACHER: Yes!
STUDENT: How do you put an elephant inside a fridge?
TEACHER: I don't know.
STUDENT: It's easy, you just open the fridge and put it in. I have another question!
TEACHER: Ok, ask.
STUDENT: How to put a donkey inside the fridge?
@stylpen
stylpen / mqtt.py
Created October 7, 2014 18:48
python MQTT wrapper
import thread, mosquitto, random, time
# mosquitto reference and download can be found here: http://mosquitto.org/documentation/python/
class mqtt():
def __init__(self, broker = "127.0.0.1", port = 1883, clientID = None):
self.__broker = broker
self.__port = port
self._client = None
self.__subscriptionsList = []
self.__pendingSubscriptionsList = []
@gravyboat
gravyboat / .aptly.conf
Created August 11, 2014 22:15
aptly formula
{
"rootDir": "{{ salt['pillar.get']('aptly:rootdir') }}",
"downloadConcurrency": 4,
"architectures": [],
"dependencyFollowSuggests": false,
"dependencyFollowRecommends": false,
"dependencyFollowAllVariants": false,
"dependencyFollowSource": false,
"gpgDisableSign": false,
"gpgDisableVerify": false,