Skip to content

Instantly share code, notes, and snippets.

View angad's full-sized avatar

Angad Singh angad

View GitHub Profile
@angad
angad / umit.portfile
Created April 24, 2011 21:13
Umit 1.0 Portfile
# $Id: Portfile 51955 2009-06-07 10:04:10Z arthurk@macports.org $
PortSystem 1.0
PortGroup python26 1.0
name umit
version 1.0
revision 1
epoch 1
categories net
@angad
angad / Android.mk
Created May 11, 2011 13:17
libpcap android
#LOCAL_PATH := $(call my-dir)
LOCAL_PATH := ./jni
include $(CLEAR_VARS)
LOCAL_MODULE := libpcap-t
LOCAL_SRC_FILES := libpcap-native.c
LOCAL_C_INCLUDES := $(NDK_ROOT)/external/libpcap
@angad
angad / libpcap_debug.log
Created May 11, 2011 15:12
libpcap crash log
.
.
.
.
D/dalvikvm( 9630): GC_EXPLICIT freed 39 objects / 1936 bytes in 1004ms
D/dalvikvm( 102): GC_EXPLICIT freed 14083 objects / 797472 bytes in 347ms
I/installd( 74): unlink /data/dalvik-cache/data@app@com.umit.android.libpcap-1.apk@classes.dex
D/AndroidRuntime(10099): Shutting down VM
I/AndroidRuntime(10099): NOTE: attach of thread 'Binder Thread #3' failed
D/dalvikvm(10099): Debugger has detached; object registry had 1 entries
@angad
angad / libpcap-native.c
Created May 11, 2011 15:13
Native JNI libpcap
#include <jni.h>
#include <string.h>
#include <android/log.h>
#include <pcap.h>
#define DEBUG_TAG "Sample_LIBPCAP_DEBUGGING"
void Java_com_umit_android_libpcap_libpcap_testLog(JNIEnv * env, jobject this, jstring logThis)
{
jboolean isCopy;
@angad
angad / gist:968486
Created May 12, 2011 13:30
ndk-build logs
Angad-Singhs-MacBook:libpcaptest angadsg$ ~/android-ndk-r5b/ndk-build
Gdbserver : [arm-linux-androideabi-4.4.3] libs/armeabi/gdbserver
Gdbsetup : libs/armeabi/gdb.setup
Compile thumb : pcaptest <= libpcap-native.c
Compile thumb : pcap <= bpf_dump.c
Compile thumb : pcap <= bpf_filter.c
Compile thumb : pcap <= bpf_image.c
Compile thumb : pcap <= etherent.c
Compile thumb : pcap <= fad-gifc.c
Compile thumb : pcap <= gencode.c
I/ActivityManager( 102): Start proc org.umit.android.libpcaptest for activity org.umit.android.libpcaptest/.libpcaptest: pid=24234 uid=10134 gids={}
W/ResourceType( 223): getEntry failing because entryIndex 638 is beyond type entryCount 112
W/ResourceType( 223): Failure getting entry for 0x7f02027e (t=1 e=638) in package 0: 0x80000001
W/ResourceType( 102): Skipping entry 0x7f040007 in package table 0 because it is not complex!
W/ResourceType( 102): Skipping entry 0x7f040008 in package table 0 because it is not complex!
W/ResourceType( 223): getEntry failing because entryIndex 335 is beyond type entryCount 112
W/ResourceType( 223): Failure getting entry for 0x7f02014f (t=1 e=335) in package 0: 0x80000001
W/dalvikvm(24234): Exception Ljava/lang/UnsatisfiedLinkError; thrown during Lorg/umit/android/libpcaptest/libpcaptest;.<clinit>
W/dalvikvm(24234): Class init failed in newInstance call (Lorg/umit/android/libpcaptest/libpcaptest;)
D/AndroidRuntime(24234): Shutting down VM
D/AndroidRuntime( 574): >>>>>>>>>>>>>> AndroidRuntime START <<<<<<<<<<<<<<
D/AndroidRuntime( 574): CheckJNI is ON
D/AndroidRuntime( 574): --- registering native functions ---
D/AndroidRuntime( 574): Shutting down VM
D/dalvikvm( 574): Debugger has detached; object registry had 1 entries
I/AndroidRuntime( 574): NOTE: attach of thread 'Binder Thread #3' failed
D/AndroidRuntime( 582):
D/AndroidRuntime( 582): >>>>>>>>>>>>>> AndroidRuntime START <<<<<<<<<<<<<<
D/AndroidRuntime( 582): CheckJNI is ON
D/AndroidRuntime( 582): --- registering native functions ---
USER PID PPID VSIZE RSS WCHAN PC NAME
root 1 0 296 204 c009b74c 0000ca4c S /init
root 2 0 0 0 c004e72c 00000000 S kthreadd
root 3 2 0 0 c003fdc8 00000000 S ksoftirqd/0
root 4 2 0 0 c004b2c4 00000000 S events/0
root 5 2 0 0 c004b2c4 00000000 S khelper
root 6 2 0 0 c004b2c4 00000000 S suspend
root 7 2 0 0 c004b2c4 00000000 S kblockd/0
root 8 2 0 0 c004b2c4 00000000 S cqueue
root 9 2 0 0 c018179c 00000000 S kseriod
D/AndroidRuntime( 345): >>>>>>>>>>>>>> AndroidRuntime START <<<<<<<<<<<<<<
D/AndroidRuntime( 345): CheckJNI is ON
D/AndroidRuntime( 345): --- registering native functions ---
D/dalvikvm( 177): GC_EXPLICIT freed 339 objects / 19944 bytes in 95ms
D/PackageParser( 71): Scanning package: /data/app/vmdl35976.tmp
I/PackageManager( 71): Removing non-system package:org.umit.android.libpcaptest
I/ActivityManager( 71): Force stopping package org.umit.android.libpcaptest uid=10036
D/PackageManager( 71): Scanning package org.umit.android.libpcaptest
I/PackageManager( 71): Package org.umit.android.libpcaptest codePath changed from /data/app/org.umit.android.libpcaptest-1.apk to /data/app/org.umit.android.libpcaptest-2.apk; Retaining data and using new
I/PackageManager( 71): /data/app/org.umit.android.libpcaptest-2.apk changed; unpacking
Process p;
try {
p = Runtime.getRuntime().exec("su");
try {
p.waitFor();
if (p.exitValue() != 255) {
// TODO Code to run on success
Log.v("Sample_LIBPCAP_DEBUGGING", "ROOT");
}
else {