Skip to content

Instantly share code, notes, and snippets.

var cookieValue = readCookie("sessionID");
console.log(cookieValue);
if (cookieValue === undefined){
document.write("First visit!<br>Will write session id to cookie now")
document.cookie = "sessionID=1000";
}else{
document.write("Session id: " + cookieValue);
}
package so;
import javax.crypto.Cipher;
import javax.crypto.KeyAgreement;
import javax.crypto.SecretKey;
import javax.crypto.interfaces.DHPublicKey;
import javax.crypto.spec.DHParameterSpec;
import javax.crypto.spec.SecretKeySpec;
import java.security.*;
import java.security.spec.X509EncodedKeySpec;
@joubin
joubin / CenterLatLon.py
Last active March 4, 2016 17:57
Python method to find the center of a multiple positions
import math
import unittest
class LatLon(object):
def __init__(self, lat, lon, alt):
"""
:param lat: Latitude in radians
:param lon: Longitude in radians
:param alt: Altitude in any unit
# __ .__
# _______/ |_ ___.__.| | ____
# / ___/\ __< | || | _/ __ \
# \___ \ | | \___ || |_\ ___/
# /____ > |__| / ____||____/\___ >
# \/ \/ \/
export COLOR_NC='\e[0m' # No Color
export COLOR_WHITE='\e[1;37m'
export COLOR_BLACK='\e[0;30m'
export COLOR_BLUE='\e[0;34m'
@joubin
joubin / Reflect.java
Last active March 4, 2016 04:27
A means of getting all subclasses of a class
/**
* Assume class A; class B extends A; class C extends B;
*/
public static void main(String[] args) throws ClassNotFoundException {
A obj = new C();
System.out.println(obj.getClass());
Class.forName(String.valueOf(obj.getClass().getName()));
System.out.println(GetClassesType(obj.getClass()));
}
@joubin
joubin / Test.java
Last active February 13, 2016 00:37
Get all supers to an object
public static List<String> GetClasses(Class cls) throws ClassNotFoundException {
List<String> clsList = new ArrayList<>();
String name;
while (!(name = cls.getGenericSuperclass().getTypeName()).equals("java.lang.Object")){
clsList.add(name);
cls = Class.forName(name);
}
return clsList;
}
@joubin
joubin / work.sh
Created February 23, 2015 03:58
work flow to create a kali image
mkdir ~/arm-pi2
cd ~/arm-pi2
git clone https://github.com/offensive-security/gcc-arm-linux-gnueabihf-4.7
git clone https://github.com/offensive-security/kali-arm-build-scripts
export PATH=${PATH}:~/arm-pi2/gcc-arm-linux-gnueabihf-4.7/bin
cd ~/arm-pi2/kali-arm-build-scripts
curl https://gist.githubusercontent.com/joubin/e454661f82f5f749b2f8/raw/dbf27d37db449d1459f0cea984cb654769597a3c/rpi.sh > rpi.sh
https://gist.githubusercontent.com/joubin/cc7adf5196f8c6b2661e/raw/01db3e60154ce483c00c71c360c979cdc8e98f42/pi2_kernel.config > pi2_kernel.config
./build-deps.sh
./rpi.sh 1.2.3
@joubin
joubin / rpi.sh
Last active October 28, 2016 14:16
Modified rpi.sh file to aid with the building of the Kali image on Raspberry Pi 2
#!/bin/bash
# This is the Raspberry Pi Kali ARM build script - http://www.kali.org/downloads
# A trusted Kali Linux image created by Offensive Security - http://www.offensive-security.com
if [[ $# -eq 0 ]] ; then
echo "Please pass version number, e.g. $0 1.0.1"
exit 0
fi
@joubin
joubin / pi2_kernel.config
Last active August 29, 2015 14:15
Raspberry Pi 2 - Kali Config
#
# Automatically generated file; DO NOT EDIT.
# Linux/arm 3.18.5 Kernel Configuration
#
CONFIG_ARM=y
CONFIG_SYS_SUPPORTS_APM_EMULATION=y
CONFIG_HAVE_PROC_CPU=y
CONFIG_STACKTRACE_SUPPORT=y
CONFIG_LOCKDEP_SUPPORT=y
CONFIG_TRACE_IRQFLAGS_SUPPORT=y
user nginx;
worker_processes 1;
error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}