Skip to content

Instantly share code, notes, and snippets.

@joubin
joubin / MacUsageHelper.sh
Created May 13, 2014 01:10
Get kernel related usage stats from your mac. For the geeky with highly modified os installs.
kextstat -kl | awk '!/com\.apple/{printf "%s %s\n", $6, $7}' | open -ef
{ sudo launchctl list | sed 1d | awk '!/0x|com\.(apple|openssh|vix\.cron)|org\.(amav|apac|cups|isc|ntp|postf|x)/{print $3}'; echo; sudo defaults read com.apple.loginwindow LoginHook; echo; sudo crontab -l; } 2> /dev/null | open -ef
{ launchctl list | sed 1d | awk '!/0x|com\.apple|org\.(x|openbsd)/{print $3}'; echo; crontab -l 2> /dev/null; } | open -ef
@joubin
joubin / bypassSafeConnect.py
Last active July 13, 2020 17:37
This is a small script to bypass SafeConnect. SaveConnect is a small tool some universities use to manage you system. It installs their third party tool to monitor your usage and to check to see if you are running a virus scanner. The system is pretty flawed both in code and implementation. You can bypass it all together by running this.
#!/usr/bin/python
#
# Version 1.0
# This script will pass a linux HTML header causing safe connect to ignor the host mac address as safeconnect is not developed for *nix machines
# For educational purposes only.
# Joubin Jabbari
import sys
import urllib2
import random
@joubin
joubin / vm-usage.sh
Created August 17, 2014 16:50
Simple script to get cpu usage for virtual machines on a mac.
VMOS=$1
set -e
#Making sure I have everything I need
for i in brew spark
do
command -v $i >/dev/null 2>&1 || { echo >&2 "I require $i but it's not installed. Aborting."; exit 1; }
done
command -v spark >/dev/null 2>&1 || { echo >&2 "I require spark but it's not installed. Going to install."; brew install spark; }
#Setting up a killGroup so that the process all close cleanly
user nginx;
worker_processes 1;
error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
@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
@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 / 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 / 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 / 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()));
}
# __ .__
# _______/ |_ ___.__.| | ____
# / ___/\ __< | || | _/ __ \
# \___ \ | | \___ || |_\ ___/
# /____ > |__| / ____||____/\___ >
# \/ \/ \/
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'