Skip to content

Instantly share code, notes, and snippets.

@k3170makan
k3170makan / APK_class
Created November 5, 2014 21:50
Sample from Androguard source
# This file is part of Androguard.
#
# Copyright (C) 2012, Anthony Desnos <desnos at t0t0.fr>
# All rights reserved.
#
# Androguard is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
@k3170makan
k3170makan / decompile_dex.py
Last active August 29, 2015 14:08
A simple Androgaurd Script that Decompiles Dex bytecode into Java.
#!/usr/bin/python
from sys import argv
from sys import exit
import os
from androguard.core.bytecodes import apk
from androguard.core.bytecodes import dvm
from androguard.decompiler.dad import decompile
from androguard.core.analysis import analysis
def convert_descriptor(name):
name = name[1:]
@k3170makan
k3170makan / PrimeCrackers.py
Last active August 29, 2015 14:11
Hacked up thread management example in python
#!/usr/bin/python
import threading
from sys import argv
from sys import exit
"""
**Please note this class finds factors not prime factors, I cut the example short because its 1am in the morning here (-__-)
Spawn a whole bunch of threads from a single process and check if each have completed their task
"""
class StoppableThread(threading.Thread):
def __init__(self):
@k3170makan
k3170makan / RM2MP3CoverterROPExploit.py
Created March 18, 2015 02:03
Simple Example of an alternative ROP Exploit for RM2MP3 converter for Windows 7 Ultimate 32bit
from sys import argv
import struct
"""
ROP Exploit for RM converter example from Corelans blog, written here for educational purposes
Tested on: Windows 7 32bit Ultimate
author: Keith (k3170) Makan
Refs:
http://www.fuzzysecurity.com/tutorials/expDev/7.html
@k3170makan
k3170makan / padding_oracle
Created July 15, 2015 14:34
A script I used to learn padding oracle attacks
#!/usr/bin/python
from base64 import b64encode,b64decode
import readline
import struct
from Crypto.Cipher import AES
from sys import argv,exit
from os import urandom
from random import random
BS = 16
pad = lambda s: s + (BS - len(s) % BS) * chr((BS - len(s) % BS))
@k3170makan
k3170makan / diffme.py
Created July 22, 2015 20:04
DiffMe Cipher implementation
#!/usr/bin/python
"""
Disclaimer
The encryption algorithm included in this file is not be used for the protection of information. It is merely purposed to aid education.
The author does not except any responisiblity for its use.
- Keith Makan
"""
from random import random
@k3170makan
k3170makan / CircuitPlayground04_soundSensorExperiment.ino
Last active June 19, 2016 20:02
Sound Sensor Experiment (Adafruit Circuit Playground)
/**
Sound Sensor with Neo Pixel indicator.
this little sketch correlates the MEMs Microphone onthe board to the nep pixels for out put.
the sketch also tries to perform a rough attempt at dynamically changing the max and min ranges to keep the neo pixels lively
should the ambient sound change.
developed by Keith Makan (@k3170makan)
https://www.adafruit.com/product/3000
**/
#include <Adafruit_CircuitPlayground.h>
@k3170makan
k3170makan / dump_methods.py
Last active August 4, 2016 01:01
Dump Method bytecode from an APK using Androguard
#!/usr/bin/python
from sys import argv
from androguard.core.bytecodes import apk
from androguard.core.bytecodes import dvm
if __name__=="__main__":
a = apk.APK(argv[1])
d = dvm.DalvikVMFormat(a.get_dex())
for current_class in d.get_classes():
for method in current_class.get_methods():
print "[*] ",method.get_name(), method.get_descriptor()
@k3170makan
k3170makan / diffme_2.py
Created August 16, 2016 10:34
Simpler implementation of the diffme cipher to be used for cryptanalysis demonstration
import random
import os
class diffme: #numerical implementation of the diff me cipher
"""
sbox()
"""
def __init__(self,k_1,k_2,p):
self.sbox = dict({0:3,1:14,2:1,3:10,4:4,5:9,6:5,7:6,8:8,9:11,10:15,11:2,12:13,13:12,14:0,15:7}) #substitutionbox
self.k_1 = k_1 #round key 1
self.k_2 = k_2 #round key 2
@k3170makan
k3170makan / AndroidManifestFuzzer
Last active October 5, 2016 09:06
Nifty Little Bash Script for Fuzzing Application AndroidManifest.xml's
#!/bin/bash
#Basic set up for an Application AndroidManifest Fuzzer
#this requires a preexisting ant buildable application project to be set up! so get the SDK and ant1.8
#this file reproduces the bug mentioned here http://ibrahimbalic.com/2014/android-os-memory-corruption-bug/
#NOTE: values from 260000 and up cause SIGSEGvs to be sent to the system_server (test on KitKat 4.4.2)
#NOTE: you should probably monitor $(adb logcat)||(/system/bin/gdbserver) for responsiveness to the issue
APP_PROJ_DIR="..." #<-- PATH TO PROJ DIR
APP_PACKAGE_NAME="..." #<-- PACKAGE NAME
APP_LAUNCH_COMP="..." # <--- MAIN ACTIVITY NAME