Skip to content

Instantly share code, notes, and snippets.

@ttilberg
ttilberg / converter.rb
Last active July 5, 2023 08:24
Utilities to unobfuscate a certain class of js files.
require 'net/http'
require 'json'
require 'uri'
require 'yaml'
##
# Make a certain obfuscated js less obnoxious to analyze.
#
class Obfuscated
attr_accessor :script
from threading import Lock,Condition
import Queue
import time
class TimedQueue:
def __init__(self):
self.itemqueue=Queue.PriorityQueue()
self.getlock=Lock()
self.itemlock=Lock()
self.itemconfirm=Condition(self.itemlock)
def get(self,nowait=False):
import requests
import sys
from requests.packages.urllib3.exceptions import InsecureRequestWarning
requests.packages.urllib3.disable_warnings(InsecureRequestWarning)
FIRSTNAME="John"
LASTNAME="Doe"
def f(sess,username,password):
global FIRSTNAME,LASTNAME
sess.get("http://www.nike.com/us/en_us")
e=sess.post("https://unite.nike.com/loginWithSetCookie?appVersion=287&experienceVersion=249&uxid=com.nike.commerce.nikedotcom.web&locale=en_US&backendEnvironment=identity&browser=Google%20Inc.&os=undefined&mobile=false&native=false",data='{"username":"'+username+'","password":"'+password+'","keepMeLoggedIn":true,"client_id":"HlHa2Cje3ctlaOqnxvgZXNaAs7T9nAuH","ux_id":"com.nike.commerce.nikedotcom.web","grant_type":"password"}',headers={"User-Agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2987.133 Safari/537.36","X-Requested-With":"XMLHttpRequest","Content-Type":"text/plain","Origin":"http://www.nike.com","Referer":"http://www.nike.com/us/en_us","Accept":"*/*","Acc
@justjanne
justjanne / Price Breakdown.md
Last active April 5, 2025 08:10 — forked from kylemanna/price.txt
Server Price Breakdown: DigitalOcean, Amazon AWS LightSail, Vultr, Linode, OVH, Hetzner, Scaleway/Online.net:

Server Price Breakdown: DigitalOcean, Amazon AWS LightSail, Vultr, Linode, OVH, Hetzner, Scaleway/Online.net:

Permalink: git.io/vps

$5/mo

Provider Type RAM Cores Storage Transfer Network Price
@hrchu
hrchu / 99-network-tuning.conf
Last active January 14, 2025 08:29 — forked from kgriffs/sysctl.conf
Linux Web Server Kernel Tuning
# Configuration file for runtime kernel parameters.
# See sysctl.conf(5) for more information.
# See also http://www.nateware.com/linux-network-tuning-for-2013.html for
# an explanation about some of these parameters, and instructions for
# a few other tweaks outside this file.
# See evil packets in your logs.
net.ipv4.conf.all.log_martians = 1
@sage-oli-wood
sage-oli-wood / gist:70e0931f037ea0aac132
Created November 5, 2015 17:38
F.Ugly way to push TCP network stats into DataDog. Can be run from a crontab entry
#!/bin/bash -eux
// set $DATADOGKEY to your API key
DATE=$(date +%s)
HOSTNAME=`hostname`
cat /proc/net/sockstat | grep TCP | cut -d":" -f2 |sed 's/^ //g' | awk '{print $1, $2"\n"$3, $4"\n"$5,$6"\n"$7,$8"\n"$9,$10}' > /tmp/stats.tmp
while read LINE; do
METRIC=$(echo $LINE | cut -d" " -f1)
VALUE=$(echo $LINE | cut -d" " -f2)
curl -X POST -H "Content-type: application/json" \
@jimallman
jimallman / local-devtree-proxy.pac
Last active May 30, 2017 00:00
Test of Proxy Auto-Configuration (PAC) file as a replacement for messing with /etc/hosts
function FindProxyForURL( url, host ) {
var debugging = false;
var debugPAC;
if (debugging) {
debugPAC = "host: "+ host +"\n";
debugPAC += "url: "+ url +"\n";
debugPAC += "dnsDomainIs(host, 'devtree.opentreeoflife.org'): "+ dnsDomainIs(host, "devtree.opentreeoflife.org") +"\n";
debugPAC += "dnsDomainIs( host, '.devtree.opentreeoflife.org' ): "+ dnsDomainIs( host, '.devtree.opentreeoflife.org' ) +"\n";
debugPAC += "shExpMatch(host, 'devtree.opentreeoflife.org'): "+ shExpMatch(host, "devtree.opentreeoflife.org") +"\n";
}
@plentz
plentz / nginx.conf
Last active May 21, 2025 05:22
Best nginx configuration for improved security(and performance)
# to generate your dhparam.pem file, run in the terminal
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048
@dannvix
dannvix / intercept-https-with-python-mitmproxy.md
Last active March 6, 2025 01:41
Intercept and manipulate HTTPs traffic with Python and mitmproxy

Intercepts HTTPs Traffic with Python & mitmproxy

Warning

This Gist is created in 2014, and it's highliy outdated now, according to one of mitmproxy's manjor contributor (check his comment below). Thanks for letting us know, @mhils!

Introduction

Modern applications usually make use of back-end API servers to provide their services. With a non-transparent HTTPs proxy, which intercepts the communication between clients and servers (aka the man-in-the-middle scheme), you can easily manipulate both API requests and responses.