Skip to content

Instantly share code, notes, and snippets.

Avatar

sh1n0b1

  • Bishop Fox
View GitHub Profile
View FederatedLogin.py
# Original source code: https://docs.aws.amazon.com/en_us/IAM/latest/UserGuide/id_roles_providers_enable-console-custom-url.html
import urllib, json
import requests
access_key = ''
secret_key = ''
session_token = ''
json_string_with_temp_credentials = '{'
json_string_with_temp_credentials += '"sessionId":"' + access_key + '",'
@sh1n0b1
sh1n0b1 / urldecode.sh
Created Mar 1, 2019
URL decode one-liner command
View urldecode.sh
alias urldecode='python -c "import sys, urllib as ul; print ul.unquote_plus(sys.argv[1])"'
@sh1n0b1
sh1n0b1 / outline.sh
Last active Feb 23, 2019
Parse Shaodowsocks Config and encoded it to an Outline Shadowsocks URI
View outline.sh
# Ensure jq 1.5 or greater is installed on your linux system
# ex. apt-get install jq or https://stackoverflow.com/questions/36462955/upgrading-jq-to-1-5-on-ubuntu?answertab=votes#tab-top
#
# If you have a single port/password config like the following:
# {
# "server":"my_server_ip",
# "server_port":8388,
# "local_address": "127.0.0.1",
# "local_port":1080,
# "password":"mypassword",
@sh1n0b1
sh1n0b1 / shadowsocks.sh
Last active Jan 31, 2019
Shadowsocks Server deployment script for Debian 9 - Tools to bypass internet censorship
View shadowsocks.sh
#!/bin/bash
#===============================================================================================
# System Required: Debian 9
# Description: Shadowsocks Server deployment script for Debian 9
# Author: https://github.com/sh1n0b1
#===============================================================================================
apt update
apt install -y curl sudo
sudo apt install -y shadowsocks-libev
sudo systemctl start shadowsocks-libev
@sh1n0b1
sh1n0b1 / lambda_function.py
Created Jun 27, 2018
HashTag Lambda Function
View lambda_function.py
import subprocess, json
def lambda_handler(event, context):
command = ['python','HashTag.py', '-sh', event['pathParameters']['hash']]
process = subprocess.Popen(command, shell=False, stdout=subprocess.PIPE)
message = process.stdout.read()
response = {
"isBase64Encoded": False,
"statusCode": 200,
"headers": {},
"body": message
View AssumeRole.py
import urllib, json
import requests # 'pip install requests'
from boto.sts import STSConnection # AWS SDK for Python (Boto) 'pip install boto'
# Step 1: Authenticate user in your own identity system.
# Step 2: Using the access keys for an IAM user in your AWS account,
# call "AssumeRole" to get temporary access keys for the federated user
# Note: Calls to AWS STS AssumeRole must be signed using the access key ID
@sh1n0b1
sh1n0b1 / osx-irssi-sasl
Created Feb 12, 2017 — forked from tho/osx-irssi-sasl
OS X, irssi, sasl
View osx-irssi-sasl
$ brew install irssi gmp
$ cpan install Crypt::OpenSSL::Bignum Crypt::Blowfish Crypt::DH::GMP
$ echo '[[ $SHLVL -eq 1 ]] && eval "$(perl -I$HOME/perl5/lib/perl5 -Mlocal::lib)"' >> ~/.bashrc
$ mkdir -p ~/.irssi/scripts/autorun
$ (cd ~/.irssi/scripts/; wget https://scripts.irssi.org/scripts/cap_sasl.pl; ln -s ../cap_sasl.pl autorun/)
$ irssi
/sasl set <network> <nick> <password> DH-BLOWFISH
/sasl save
View gen_secret.py
#!/bin/python3
from base64 import b64encode
from os import urandom
random_bytes = urandom(64)
token = b64encode(random_bytes).decode('utf-8')
print(token)
@sh1n0b1
sh1n0b1 / pem2plex.py
Created Jan 21, 2017 — forked from lokulin/pem2plex.py
Convert the x509 certificate to certificate.p12 that Plex requires.
View pem2plex.py
#!/usr/bin/python
import sys
import hashlib
from OpenSSL.crypto import *
def main():
if(len(sys.argv) != 4):
print sys.argv[0] + " /path/to/ssl.crt /path/to/ssl.key ProcessedMachineIdentifier"
sys.exit(0)
@sh1n0b1
sh1n0b1 / s3.sh
Last active May 21, 2019
AWS S3 basic operations via AWS Access Key & Session Token
View s3.sh
# You don't need Fog in Ruby or some other library to upload to S3 -- shell works perfectly fine
# This is how I upload my new Sol Trader builds (http://soltrader.net)
# Based on a modified script from here: http://tmont.com/blargh/2014/1/uploading-to-s3-in-bash
# ====================================================================================
# Aug 25, 2016 sh1n0b1
# Modified this script to support AWS session token
# More work will be done on this.
#
# S3KEY="ASIAJLFN####################"
You can’t perform that action at this time.