Skip to content

Instantly share code, notes, and snippets.

@ramann
ramann / resolve.sh
Created November 13, 2019 20:43
resolve list of names
#!/bin/bash
# because Qualys vm can only take names!?!
# usage: ./resolve.sh filename nameserver(optional)
for i in `cat $1`;
do
answer=$(nslookup $i $2)
resp_code=$(echo $?)
if [ $resp_code -eq "0" ]
then
@ramann
ramann / liquorRun.js
Created November 13, 2019 00:50
gotta get that Weller Antique Special Stagg Jr Pappy Van Winkle Reserve Single Barrel 23!!!!!!
/**
* Are you tired of missing out on the latest and greatest alcohols?
* With this one easy script, you can see pretty JSON data about local establishments that cater to your distinguished tastes!
*
* usage: node liquorRun.js zipCodes productId
* example: node liquorRun.js 43240,44118,43065 2941
*/
const request = require('request-promise');
const fs = require('fs');
@ramann
ramann / IncapsulaCefToJson.py
Created August 21, 2018 22:31
Convert CEF logs (from Incapsula) to JSON
# Script to convert CEF logs (from Incapsula) to JSON
import re
import json
import itertools
test = 'CEF:0|Incapsula|SIEMintegration|1|1|IncapRules(bad client)|11| fileId=295037710147327529 sourceServiceName=example.com siteid=10286633 suid=2047415 requestClientApplication=Mozilla/5.0 (compatible; Windows NT 6.1; Catchpoint) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.115 Safari/537.36 deviceFacility=hkg cs2=false cs2Label=Javascript Support cs3=false cs3Label=CO Support src=110.202.200.66 cs1=NA cs1Label=Cap Support cs4=b4010c9c-14b7-4ce5-88e1-a5030cefa1e5 cs4Label=VID cs5=018cc31e00c7af9d29fb2058854cc90ccdd1c753ee28980c54416fe51f565f10eecacbc03108eeebe7554343a3c35bcc31da0cfc81013f2b8cbd5326ec0987ee4a4ea28155765b053669bcf12622383a7dc1702b74a21647b9f9fd9e6421b234 cs5Label=clappsig dproc=Site Helper cs6=Catchpoint cs6Label=clapp ccode=CN cicode=Shanghai cs7=31.0456 cs7Label=latitude cs8=121.3997 cs8Label=longitude Customer=Test - External ver= TLSv1.2 ECDHE-RSA-AES128-GCM-SHA256 start=15247708020
@ramann
ramann / building-copperhead-pixel_XL.md
Last active December 25, 2020 12:56
Building Copperhead OS for Pixel XL

Notes for building Copperhead OS for the Pixel XL. This was done on Ubuntu 14.04.5 LTS, using GNU Make 3.81 (3.81-8.2ubuntu3) and Python 2.7.6 (2.7.6-8ubuntu0.2), as recommended on https://source.android.com/setup/requirements#software-requirements. All below instructions are specific to the Pixel XL (marlin) and come from https://copperhead.co/android/docs/building.

Install build dependencies

sudo apt-get update 
sudo apt-get install git-core gnupg flex bison gperf build-essential zip curl zlib1g-dev gcc-multilib g++-multilib libc6-dev-i386 lib32ncurses5-dev x11proto-core-dev libx11-dev lib32z-dev ccache libgl1-mesa-dev libxml2-utils xsltproc unzip

sudo add-apt-repository ppa:git-core/ppa

Build a grsec-patched kernel for Ubuntu 16.04

This how-to was forked from ageis' gist on building a grsec-patched kernel for Debian 8 and DigitalOcean.

grsecurity is "an extensive security enhancement to the Linux kernel that defends against a wide range of security threats through intelligent access control, memory corruption-based exploit prevention, and a host of other system hardening".

Note: The stable patches are not publicly available anymore, so we'll be applying the free 4.7.2 (test) patch. The URLs and filenames in this document may become outdated, so fetch the latest from grsecurity.net and kernel.org.

Install dependencies:

@ramann
ramann / client-ipsec.conf
Created April 17, 2016 02:38
strongswan notes
conn base
keyexchange=ikev2
ike=aes256gcm128-sha512-modp8192!
esp=aes256gcm128-sha512-modp8192!
rightcert=peerCertServer.pem
leftsourceip=%modecfg
rightsubnet=0.0.0.0/0
leftcert=peerCertClient.pem
#leftid="C=CH, O=strongSwan, CN=peerClient"
=========== ~/openssl_pkcs11_engine.conf ==========
openssl_conf = openssl_def
[ openssl_def ]
engines = engine_section
[ engine_section ]
pkcs11 = pkcs11_section
[ pkcs11_section ]
@ramann
ramann / mapdriver.rb
Created January 20, 2014 18:48
this watir script drives a browser to write a distance matrix for mass transit times.
# google maps has a nice distance matrix api, that allows you to get distance (either
# time or physical), provided that your means of transportation is driving, cycling,
# or walking. this watir script drives a browser to write a distance matrix for
# mass transit times. naturally, it'll have to change when google does a significant
# update to their google maps interface.
#
# robert mann
# january 2014
require 'rubygems'