3131#include "ettercap.h"
3232#include "arpspoof.h"
3333#include "tcpdump.h"
34+ #include "fusemounts.h"
3435
3536#include "event.h"
3637
@@ -110,7 +111,7 @@ jobject create_stderrnewline_event(JNIEnv *env, void *arg) {
110111/**
111112 * @brief create an org.csploit.android.events.ChildEnd
112113 * @param arg a pointer to the exit status
113- * @returns the jobject on success, NULLl on error.
114+ * @returns the jobject on success, NULL on error.
114115 */
115116jobject create_child_end_event (JNIEnv * env , void * arg ) {
116117 jobject event ;
@@ -133,7 +134,7 @@ jobject create_child_end_event(JNIEnv *env, void *arg) {
133134/**
134135 * @brief create an org.csploit.android.events.ChildDied
135136 * @param arg a poitner to the signal that caused the death
136- * @returns the jobject on success, NULLl on error.
137+ * @returns the jobject on success, NULL on error.
137138 */
138139jobject create_child_died_event (JNIEnv * env , void * arg ) {
139140 jobject event ;
@@ -185,7 +186,7 @@ jobject inaddr_to_inetaddress(JNIEnv *env, in_addr_t a) {
185186/**
186187 * @brief create an org.csploit.android.events.Hop
187188 * @param arg a pointer to an ::nmap_hop_info
188- * @returns the jobject on success, NULLl on error.
189+ * @returns the jobject on success, NULL on error.
189190 */
190191jobject create_hop_event (JNIEnv * env , void * arg ) {
191192 jobject addr , res ;
@@ -473,6 +474,12 @@ jobject create_message_event(JNIEnv *env, message *m) {
473474 (* env )-> ExceptionClear (env );
474475 }
475476
477+ if (jseverity )
478+ (* env )-> DeleteLocalRef (env , jseverity );
479+
480+ if (jmessage )
481+ (* env )-> DeleteLocalRef (env , jmessage );
482+
476483 return res ;
477484}
478485
@@ -565,7 +572,7 @@ jobject create_login_event(JNIEnv *env, message *m) {
565572/**
566573 * @brief create an org.csploit.android.events.Packet
567574 * @param m the received message
568- * @returns the jobject on success, NULLl on error.
575+ * @returns the jobject on success, NULL on error.
569576 */
570577jobject create_packet_event (JNIEnv * env , message * m ) {
571578 jobject src , dst , res ;
@@ -595,6 +602,67 @@ jobject create_packet_event(JNIEnv *env, message *m) {
595602 return res ;
596603}
597604
605+ /**
606+ * @brief create an org.csploit.android.events.FuseBind
607+ * @param m the received message
608+ * @returns the jobject on success, NULL on error.
609+ */
610+ jobject create_fusebind_event (JNIEnv * env , message * m ) {
611+ jobject res ;
612+ char * src , * mnt ;
613+ jstring * jsrc , * jmnt ;
614+ struct fusemount_bind_info * bind_info ;
615+
616+ bind_info = (struct fusemount_bind_info * ) m -> data ;
617+ jsrc = jmnt = NULL ;
618+
619+ src = string_array_next (m , bind_info -> data , NULL );
620+
621+ if (!src ) {
622+ LOGE ("%s: source not found" , __func__ );
623+ return NULL ;
624+ }
625+
626+ mnt = string_array_next (m , bind_info -> data , src );
627+
628+ if (!mnt ) {
629+ LOGE ("%s: mountpoint not found" , __func__ );
630+ return NULL ;
631+ }
632+
633+ jsrc = (* env )-> NewStringUTF (env , src );
634+
635+ if (!jsrc ) goto jni_error ;
636+
637+ jmnt = (* env )-> NewStringUTF (env , mnt );
638+
639+ if (!jmnt ) goto jni_error ;
640+
641+ res = (* env )-> NewObject (env ,
642+ cache .csploit .events .fusebind .class ,
643+ cache .csploit .events .fusebind .ctor ,
644+ jsrc , jmnt );
645+
646+ goto cleanup ;
647+
648+ jni_error :
649+
650+ if ((* env )-> ExceptionCheck (env )) {
651+ (* env )-> ExceptionDescribe (env );
652+ (* env )-> ExceptionClear (env );
653+ }
654+
655+ cleanup :
656+
657+ if (jsrc )
658+ (* env )-> DeleteLocalRef (env , jsrc );
659+
660+ if (jmnt )
661+ (* env )-> DeleteLocalRef (env , jmnt );
662+
663+ return res ;
664+ }
665+
598666/**
599667 * @brief send an event to java.
600668 * @param c the child that generate this event
0 commit comments