From 7fd8c796a1cefacbc12599af2e7e9f7e6b4aeaf8 Mon Sep 17 00:00:00 2001 From: Daniel Baier Date: Fri, 6 Dec 2024 22:08:24 +0100 Subject: [PATCH] add minor bug in parsing arguments and fixed some issues with full packet capture on Android devices --- .gitignore | 2 + INTEGRATION.md | 18 +- agent/misc/socket_tracer.ts | 117 +++++++--- agent/shared/shared_functions.ts | 27 ++- agent/shared/shared_structures.ts | 16 +- agent/ssl_log.ts | 21 ++ friTap/_ssl_log.js | 357 ++++++++++++++++++++++++++++-- friTap/about.py | 2 +- friTap/android.py | 54 +++-- friTap/friTap.py | 23 +- friTap/pcap.py | 144 +++++++++--- friTap/ssl_logger.py | 165 +++++++++++--- package.json | 2 +- 13 files changed, 801 insertions(+), 147 deletions(-) diff --git a/.gitignore b/.gitignore index 3dc77be..8c78269 100644 --- a/.gitignore +++ b/.gitignore @@ -3,6 +3,8 @@ frida-server* __handlers__ friTap.egg-info dist/ +*.pcap +*.trace # debian package generation stuff deb_dist/ diff --git a/INTEGRATION.md b/INTEGRATION.md index 658f214..4f8496c 100644 --- a/INTEGRATION.md +++ b/INTEGRATION.md @@ -32,17 +32,15 @@ try: keylog="keylogtest.log", # Path to save SSL key log debug_output=True # Enable debug output ) - + + ssl_log.install_signal_handler() + # Start friTap session - process = ssl_log.start_fritap_session() + process, script = ssl_log.start_fritap_session() - # Wait for user input to stop - sys.stdin.read() - -except KeyboardInterrupt: - # Detach process on interruption - process.detach() - print("Logging stopped.") + # Wait for user input or interrupt which will invoke the internal signal handler + while ssl_log.running: + pass ``` --- @@ -154,7 +152,7 @@ try: ) # Hook friTap into the target process without immediately loading the script - script = ssl_log.start_fritap_session_instrumentation(myAwesomeHandler, process) + process, script = ssl_log.start_fritap_session_instrumentation(myAwesomeHandler, process) # Manually load the friTap script into the target process script.load() diff --git a/agent/misc/socket_tracer.ts b/agent/misc/socket_tracer.ts index 1b59694..6e351f7 100644 --- a/agent/misc/socket_tracer.ts +++ b/agent/misc/socket_tracer.ts @@ -3,9 +3,21 @@ import { get_process_architecture } from "../util/process_infos.js"; import { readAddresses, getPortsAndAddresses } from "../shared/shared_functions.js"; import { enable_default_fd } from "../ssl_log.js"; -export function execute(moduleName:string) { +function has_valid_socket_type(fd : number): boolean{ + var socktype = Socket.type(fd); + if (socktype === 'tcp' || socktype === 'tcp6' || socktype === 'udp' || socktype === 'udp6'){ + if(socktype === 'udp6' && ObjC.available){ + return false // on iOS this leads always to empty addresses + } + return true; + } + + return true; +} + +export function socket_trace_execute() { - log("Doing a full packet capture\nUse -k in order to get TLS keys."); + //log("Doing a full packet capture\nUse -k in order to get TLS keys."); var socket_library:string ="" switch(Process.platform){ @@ -22,31 +34,30 @@ export function execute(moduleName:string) { log(`Platform "${Process.platform} currently not supported!`) } -var library_method_mapping: { [key: string]: Array } = {} +var library_method_mapping: { [key: string]: Array } = {}; const socketFDs = new Map() if(ObjC.available){ // currently those libraries gets only detected on iOS if we add an *-sign library_method_mapping[`*${socket_library}*`] = ["getpeername*", "getsockname*","socket*", "ntohs*", "ntohl*", "recv*", "recvfrom*", "send*", "sendto*", "read*", "write*"] }else{ - library_method_mapping[`*${socket_library}*`] = ["getpeername", "getsockname", "ntohs", "ntohl","socket", "recv", "recvfrom", "send", "sendto", "read", "write"] + library_method_mapping[`*${socket_library}*`] = ["getpeername", "getsockname", "ntohs", "ntohl","socket", "recv", "recvfrom", "send", "sendto", "read", "write", "connect"] } -var addresses: { [key: string]: NativePointer } = readAddresses(library_method_mapping) +var addresses: { [libraryName: string]: { [functionName: string]: NativePointer } }; +addresses = readAddresses(socket_library,library_method_mapping); -function has_valid_socket_type(fd : number): boolean{ - var socktype = Socket.type(fd); - if (socktype === 'tcp' || socktype === 'tcp6' || socktype === 'udp' || socktype === 'udp6'){ - if(socktype === 'udp6' && ObjC.available){ - return false // on iOS this leads always to empty addresses - } - return true; - } - - return true; + +if (!addresses[socket_library] || !addresses[socket_library]["socket"] || !addresses[socket_library]["connect"]) { + throw new Error( + `Missing required functions in ${socket_library}. Ensure "socket" and "connect" are exported by the library.` + ); } -Interceptor.attach(addresses["socket"], + + + +Interceptor.attach(addresses[socket_library]["socket"], { onEnter: function (args: any) { @@ -57,7 +68,11 @@ Interceptor.attach(addresses["socket"], return; } if(has_valid_socket_type(this.fd)){ - var message = getPortsAndAddresses(this.fd as number, false, addresses, enable_default_fd) + var message = getPortsAndAddresses(this.fd as number, false, addresses[socket_library], enable_default_fd) + if (message === null) { + + return; + } message["function"] = "Full_read" message["contentType"] = "netlog" socketFDs.set(this.fd, message["dst_addr"]) @@ -68,7 +83,7 @@ Interceptor.attach(addresses["socket"], -Interceptor.attach(addresses["connect"], +Interceptor.attach(addresses[socket_library]["connect"], { onEnter: function (args: any) { this.fd = args[0].toInt32(); @@ -80,7 +95,11 @@ Interceptor.attach(addresses["connect"], return; } if(has_valid_socket_type(this.fd)){ - var message = getPortsAndAddresses(this.fd as number, false, addresses, enable_default_fd) + var message = getPortsAndAddresses(this.fd as number, false, addresses[socket_library], enable_default_fd) + if (message === null) { + + return; + } message["function"] = "Full_read" message["contentType"] = "netlog" socketFDs.set(this.fd, message["dst_addr"]) @@ -90,7 +109,7 @@ Interceptor.attach(addresses["connect"], }); -Interceptor.attach(addresses["read"], +Interceptor.attach(addresses[socket_library]["read"], { onEnter: function (args: any) { this.fd = args[0].toInt32(); @@ -100,7 +119,11 @@ Interceptor.attach(addresses["read"], return; } if(has_valid_socket_type(this.fd)){ - var message = getPortsAndAddresses(this.fd as number, true, addresses, enable_default_fd) + var message = getPortsAndAddresses(this.fd as number, true, addresses[socket_library], enable_default_fd) + if (message === null) { + + return; + } message["function"] = "Full_read" message["contentType"] = "netlog" socketFDs.set(this.fd, message["src_addr"]) @@ -111,7 +134,7 @@ Interceptor.attach(addresses["read"], }) -Interceptor.attach(addresses["recv"], +Interceptor.attach(addresses[socket_library]["recv"], { onEnter: function (args: any) { this.fd= args[0].toInt32(); @@ -122,7 +145,11 @@ Interceptor.attach(addresses["recv"], return; } if(has_valid_socket_type(this.fd)){ - var message = getPortsAndAddresses(this.fd as number, true, addresses, enable_default_fd) + var message = getPortsAndAddresses(this.fd as number, true, addresses[socket_library], enable_default_fd) + if (message === null) { + + return; + } message["function"] = "Full_read" message["contentType"] = "netlog" socketFDs.set(this.fd, message["src_addr"]) @@ -135,7 +162,7 @@ Interceptor.attach(addresses["recv"], } }) -Interceptor.attach(addresses["recvfrom"], +Interceptor.attach(addresses[socket_library]["recvfrom"], { onEnter: function (args: any) { this.fd = args[0].toInt32(); @@ -146,7 +173,11 @@ Interceptor.attach(addresses["recvfrom"], return; } if(has_valid_socket_type(this.fd)){ - var message = getPortsAndAddresses(this.fd as number, true, addresses, enable_default_fd) + var message = getPortsAndAddresses(this.fd as number, true, addresses[socket_library], enable_default_fd) + if (message === null) { + + return; + } message["function"] = "Full_read" message["contentType"] = "netlog" socketFDs.set(this.fd, message["src_addr"]) @@ -156,7 +187,7 @@ Interceptor.attach(addresses["recvfrom"], }) -Interceptor.attach(addresses["send"], +Interceptor.attach(addresses[socket_library]["send"], { onEnter: function (args: any) { this.fd = args[0].toInt32(); @@ -168,7 +199,11 @@ Interceptor.attach(addresses["send"], return; } if(has_valid_socket_type(this.fd)){ - var message = getPortsAndAddresses(this.fd as number, false, addresses, enable_default_fd) + var message = getPortsAndAddresses(this.fd as number, false, addresses[socket_library], enable_default_fd) + if (message === null) { + + return; + } message["function"] = "Full_write" message["contentType"] = "netlog" socketFDs.set(this.fd, message["dst_addr"]) @@ -178,7 +213,7 @@ Interceptor.attach(addresses["send"], }) -Interceptor.attach(addresses["sendto"], +Interceptor.attach(addresses[socket_library]["sendto"], { onEnter: function (args: any) { this.fd = args[0].toInt32(); @@ -188,7 +223,11 @@ Interceptor.attach(addresses["sendto"], return; } if(has_valid_socket_type(this.fd)){ - var message = getPortsAndAddresses(this.fd as number, false, addresses, enable_default_fd) + var message = getPortsAndAddresses(this.fd as number, false, addresses[socket_library], enable_default_fd) + if (message === null) { + + return; + } message["function"] = "Full_write" message["contentType"] = "netlog" socketFDs.set(this.fd, message["dst_addr"]) @@ -197,7 +236,7 @@ Interceptor.attach(addresses["sendto"], } }) -Interceptor.attach(addresses["write"], +Interceptor.attach(addresses[socket_library]["write"], { onEnter: function (args: any) { this.fd = args[0].toInt32(); @@ -207,7 +246,11 @@ Interceptor.attach(addresses["write"], return; } if(has_valid_socket_type(this.fd)){ - var message = getPortsAndAddresses(this.fd as number, false, addresses, enable_default_fd) + var message = getPortsAndAddresses(this.fd as number, false, addresses[socket_library], enable_default_fd) + if (message === null) { + + return; + } message["function"] = "Full_write" message["contentType"] = "netlog" socketFDs.set(this.fd, message["dst_addr"]) @@ -225,7 +268,11 @@ if(ObjC.available){ return; } if(has_valid_socket_type(fd)){ - var message = getPortsAndAddresses(fd as number, false, addresses, enable_default_fd) + var message = getPortsAndAddresses(fd as number, false, addresses[socket_library], enable_default_fd) + if (message === null) { + //devlog("Skipping this socket due to unsupported address family."); To noisy + return; + } message["function"] = "Full_write" message["contentType"] = "netlog" socketFDs.set(this.fd, message["dst_addr"]) @@ -250,7 +297,11 @@ Interceptor.attach(Module.getExportByName("libsystem_kernel.dylib","read"), return; } if(has_valid_socket_type(this.fd)){ - var message = getPortsAndAddresses(this.fd as number, true, addresses, enable_default_fd) + var message = getPortsAndAddresses(this.fd as number, true, addresses[socket_library], enable_default_fd) + if (message === null) { + + return; + } message["function"] = "Full_read" message["contentType"] = "netlog" socketFDs.set(this.fd, message["src_addr"]) diff --git a/agent/shared/shared_functions.ts b/agent/shared/shared_functions.ts index b4f73d2..f183b34 100644 --- a/agent/shared/shared_functions.ts +++ b/agent/shared/shared_functions.ts @@ -1,5 +1,5 @@ import { log, devlog, devlog_error } from "../util/log.js"; -import { AF_INET, AF_INET6, ModuleHookingType } from "./shared_structures.js"; +import { AF_INET, AF_INET6, AddressFamilyMapping, unwantedFDs, ModuleHookingType } from "./shared_structures.js"; function wait_for_library_loaded(module_name: string){ @@ -233,6 +233,11 @@ export function getPortsAndAddresses(sockfd: number, isRead: boolean, methodAddr return message } + // Check if this fd is already marked as unwanted + if (unwantedFDs.has(sockfd)) { + return null; // Skip further processing + } + var getpeername = new NativeFunction(methodAddresses["getpeername"], "int", ["int", "pointer", "pointer"]) var getsockname = new NativeFunction(methodAddresses["getsockname"], "int", ["int", "pointer", "pointer"]) var ntohs = new NativeFunction(methodAddresses["ntohs"], "uint16", ["uint16"]) @@ -241,7 +246,7 @@ export function getPortsAndAddresses(sockfd: number, isRead: boolean, methodAddr var addrlen = Memory.alloc(4) var addr = Memory.alloc(128) var src_dst = ["src", "dst"] - for (var i = 0; i < src_dst.length; i++) { + for (let i = 0; i < src_dst.length; i++) { addrlen.writeU32(128) if ((src_dst[i] == "src") !== isRead) { devlog("src") @@ -251,6 +256,11 @@ export function getPortsAndAddresses(sockfd: number, isRead: boolean, methodAddr devlog("dst") getpeername(sockfd, addr, addrlen) } + + var family = addr.readU16(); + const familyName = AddressFamilyMapping[family] || `UNKNOWN`; + + if (addr.readU16() == AF_INET) { message[src_dst[i] + "_port"] = ntohs(addr.add(2).readU16()) as number message[src_dst[i] + "_addr"] = ntohl(addr.add(4).readU32()) as number @@ -270,10 +280,19 @@ export function getPortsAndAddresses(sockfd: number, isRead: boolean, methodAddr message["ss_family"] = "AF_INET6" } } else { - devlog("[-] getPortsAndAddresses resolving error: "+addr.readU16()) - throw "Only supporting IPv4/6" + // only uncomment this if you really need to debug this + //devlog("[-] getPortsAndAddresses resolving error: Only supporting IPv4/6"); + //devlog(`[-] Inspecting fd: ${sockfd}, Address family: ${family} (${familyName})`); + //throw "Only supporting IPv4/6" + + if (!unwantedFDs.has(sockfd)) { + //devlog(`Skipping unsupported address family: ${family}:${familyName} (fd: ${sockfd})`); + } + unwantedFDs.add(sockfd); // Mark this fd as unwanted + return null; } } + return message } diff --git a/agent/shared/shared_structures.ts b/agent/shared/shared_structures.ts index 7fa35f8..2be61fd 100644 --- a/agent/shared/shared_structures.ts +++ b/agent/shared/shared_structures.ts @@ -3,7 +3,17 @@ export type ModuleHookingType = (moduleName: string, is_base_hook: boolean) => void; export var module_library_mapping:{ [key: string]: Array<[any, ModuleHookingType]> } = {}; +export const unwantedFDs = new Set(); // this helps us to track if we alredy encountered this fd -export const AF_INET = 2 -export const AF_INET6 = 10 -export const pointerSize = Process.pointerSize; \ No newline at end of file +export const AF_INET = 2; +export const AF_INET6 = 10; +export const AF_UNIX = 1; +export const pointerSize = Process.pointerSize; + +export const AddressFamilyMapping: { [key: number]: string } = { + 2: "AF_INET", // IPv4 + 10: "AF_INET6", // IPv6 + 1: "AF_UNIX", // Unix domain sockets + 17: "AF_PACKET", // Raw packets + // Add other address families as needed +}; \ No newline at end of file diff --git a/agent/ssl_log.ts b/agent/ssl_log.ts index 09e9375..f8f956b 100644 --- a/agent/ssl_log.ts +++ b/agent/ssl_log.ts @@ -5,6 +5,7 @@ import { load_linux_hooking_agent } from "./linux/linux_agent.js"; import { load_windows_hooking_agent } from "./windows/windows_agent.js"; import { isWindows, isLinux, isAndroid, isiOS, isMacOS } from "./util/process_infos.js"; import { anti_root_execute } from "./util/anti_root.js"; +import { socket_trace_execute } from "./misc/socket_tracer.js" import { devlog, log } from "./util/log.js"; // global address which stores the addresses of the hooked modules which aren't loaded via the dynamic loader @@ -93,6 +94,8 @@ export let offsets: IOffsets = "{OFFSETS}"; //@ts-ignore export let experimental: boolean = false; //@ts-ignore +export let enable_socket_tracing: boolean = false; +//@ts-ignore export let anti_root: boolean = false; //@ts-ignore export let enable_default_fd: boolean = false; @@ -122,6 +125,12 @@ enable_pattern_based_hooking_state.wait(); /* This way we are providing boolean values from the commandline directly to our frida script */ +send("socket_tracing") +const enable_socket_tracing_state = recv('socket_tracing', value => { + enable_socket_tracing = value.payload; +}); +enable_socket_tracing_state.wait(); + send("defaultFD") const enable_default_fd_state = recv('defaultFD', value => { @@ -178,14 +187,26 @@ function load_os_specific_agent() { log('Applying anti root checks'); anti_root_execute(); } + if(enable_socket_tracing){ + socket_trace_execute(); + } load_android_hooking_agent() }else if(isLinux()){ + if(enable_socket_tracing){ + socket_trace_execute(); + } log('Running Script on Linux') load_linux_hooking_agent() }else if(isiOS()){ + if(enable_socket_tracing){ + socket_trace_execute(); + } log('Running Script on iOS') load_ios_hooking_agent() }else if(isMacOS()){ + if(enable_socket_tracing){ + socket_trace_execute(); + } log('Running Script on MacOS') load_macos_hooking_agent() }else{ diff --git a/friTap/_ssl_log.js b/friTap/_ssl_log.js index 97e1f9b..aa7ceee 100644 --- a/friTap/_ssl_log.js +++ b/friTap/_ssl_log.js @@ -1,6 +1,6 @@ 📦 -2860 /agent/ssl_log.js.map -3711 /agent/ssl_log.js +3346 /agent/ssl_log.js.map +4339 /agent/ssl_log.js 3136 /agent/android/android_agent.js.map 3797 /agent/android/android_agent.js 937 /agent/android/android_java_tls_libs.js.map @@ -59,12 +59,14 @@ 2384 /agent/macos/macos_agent.js 1875 /agent/macos/openssl_boringssl_macos.js.map 2619 /agent/macos/openssl_boringssl_macos.js +9219 /agent/misc/socket_tracer.js.map +10733 /agent/misc/socket_tracer.js 7608 /agent/shared/pattern_based_hooking.js.map 10664 /agent/shared/pattern_based_hooking.js -10665 /agent/shared/shared_functions.js.map -13463 /agent/shared/shared_functions.js -397 /agent/shared/shared_structures.js.map -201 /agent/shared/shared_structures.js +11002 /agent/shared/shared_functions.js.map +14175 /agent/shared/shared_functions.js +650 /agent/shared/shared_structures.js.map +501 /agent/shared/shared_structures.js 2864 /agent/ssl_lib/cronet.js.map 3948 /agent/ssl_lib/cronet.js 2867 /agent/ssl_lib/flutter.js.map @@ -112,7 +114,7 @@ 1292 /agent/windows/wolfssl_windows.js.map 1426 /agent/windows/wolfssl_windows.js ✄ -{"version":3,"file":"ssl_log.js","sourceRoot":"/Users/danielbaier/research/projects/github/issues/2024 fritap issues/friTap/","sources":["agent/ssl_log.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,0BAA0B,EAAE,MAAM,4BAA4B,CAAC;AACxE,OAAO,EAAE,sBAAsB,EAAE,MAAM,oB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E,EAAC;QACjB,GAAG,CAAC,2BAA2B,CAAC,CAAA;QAChC,IAAG,SAAS,EAAC;YACT,GAAG,CAAC,2BAA2B,CAAC,CAAC;YACjC,iBAAiB,EAAE,CAAC;SACvB;QACD,0BAA0B,EAAE,CAAA;KAC/B;SAAK,IAAG,OAAO,EAAE,EAAC;QACf,GAAG,CAAC,yBAAyB,CAAC,CAAA;QAC9B,wBAAwB,EAAE,CAAA;KAC7B;SAAK,IAAG,KAAK,EAAE,EAAC;QACb,GAAG,CAAC,uBAAuB,CAAC,CAAA;QAC5B,sBAAsB,EAAE,CAAA;KAC3B;SAAK,IAAG,OAAO,EAAE,EAAC;QACf,GAAG,CAAC,yBAAyB,CAAC,CAAA;QAC9B,wBAAwB,EAAE,CAAA;KAC7B;SAAI;QACD,GAAG,CAAC,qCAAqC,CAAC,CAAA;QAC1C,GAAG,CAAC,0HAA0H,CAAC,CAAA;KAClI;AAEL,CAAC;AAED,sBAAsB,EAAE,CAAA"} +{"version":3,"file":"ssl_log.js","sourceRoot":"/Users/danielbaier/research/projects/github/issues/2024 fritap issues/friTap/","sources":["agent/ssl_log.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,0BAA0B,EAAE,MAAM,4BAA4B,CAAC;AACxE,OAAO,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAC5D,OAAO,EAAE,wBAAwB,EAAE,MAAM,wBAAwB,CAAC;AAClE,OAAO,EAAE,wBAAwB,EAAE,MAAM,wBAAwB,CAAC;AAClE,OAAO,EAAE,0BAA0B,EAAE,MAAM,4BAA4B,CAAC;AACxE,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AACxF,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAA;AAC9D,OAAO,EAAU,GAAG,EAAE,MAAM,eAAe,CAA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BAA2B,CAAC,CAAC;YACjC,iBAAiB,EAAE,CAAC;SACvB;QACD,IAAG,qBAAqB,EAAC;YACrB,oBAAoB,EAAE,CAAC;SAC1B;QACD,0BAA0B,EAAE,CAAA;KAC/B;SAAK,IAAG,OAAO,EAAE,EAAC;QACf,IAAG,qBAAqB,EAAC;YACrB,oBAAoB,EAAE,CAAC;SAC1B;QACD,GAAG,CAAC,yBAAyB,CAAC,CAAA;QAC9B,wBAAwB,EAAE,CAAA;KAC7B;SAAK,IAAG,KAAK,EAAE,EAAC;QACb,IAAG,qBAAqB,EAAC;YACrB,oBAAoB,EAAE,CAAC;SAC1B;QACD,GAAG,CAAC,uBAAuB,CAAC,CAAA;QAC5B,sBAAsB,EAAE,CAAA;KAC3B;SAAK,IAAG,OAAO,EAAE,EAAC;QACf,IAAG,qBAAqB,EAAC;YACrB,oBAAoB,EAAE,CAAC;SAC1B;QACD,GAAG,CAAC,yBAAyB,CAAC,CAAA;QAC9B,wBAAwB,EAAE,CAAA;KAC7B;SAAI;QACD,GAAG,CAAC,qCAAqC,CAAC,CAAA;QAC1C,GAAG,CAAC,0HAA0H,CAAC,CAAA;KAClI;AAEL,CAAC;AAED,sBAAsB,EAAE,CAAA"} ✄ import { load_android_hooking_agent } from "./android/android_agent.js"; import { load_ios_hooking_agent } from "./ios/ios_agent.js"; @@ -121,6 +123,7 @@ import { load_linux_hooking_agent } from "./linux/linux_agent.js"; import { load_windows_hooking_agent } from "./windows/windows_agent.js"; import { isWindows, isLinux, isAndroid, isiOS, isMacOS } from "./util/process_infos.js"; import { anti_root_execute } from "./util/anti_root.js"; +import { socket_trace_execute } from "./misc/socket_tracer.js"; import { log } from "./util/log.js"; // global address which stores the addresses of the hooked modules which aren't loaded via the dynamic loader global.init_addresses = {}; @@ -130,6 +133,8 @@ export let offsets = "{OFFSETS}"; //@ts-ignore export let experimental = false; //@ts-ignore +export let enable_socket_tracing = false; +//@ts-ignore export let anti_root = false; //@ts-ignore export let enable_default_fd = false; @@ -155,6 +160,11 @@ enable_pattern_based_hooking_state.wait(); /* This way we are providing boolean values from the commandline directly to our frida script */ +send("socket_tracing"); +const enable_socket_tracing_state = recv('socket_tracing', value => { + enable_socket_tracing = value.payload; +}); +enable_socket_tracing_state.wait(); send("defaultFD"); const enable_default_fd_state = recv('defaultFD', value => { enable_default_fd = value.payload; @@ -200,17 +210,29 @@ function load_os_specific_agent() { log('Applying anti root checks'); anti_root_execute(); } + if (enable_socket_tracing) { + socket_trace_execute(); + } load_android_hooking_agent(); } else if (isLinux()) { + if (enable_socket_tracing) { + socket_trace_execute(); + } log('Running Script on Linux'); load_linux_hooking_agent(); } else if (isiOS()) { + if (enable_socket_tracing) { + socket_trace_execute(); + } log('Running Script on iOS'); load_ios_hooking_agent(); } else if (isMacOS()) { + if (enable_socket_tracing) { + socket_trace_execute(); + } log('Running Script on MacOS'); load_macos_hooking_agent(); } @@ -1894,6 +1916,293 @@ export function boring_execute(moduleName, is_base_hook) { } } ✄ +{"version":3,"file":"socket_tracer.js","sourceRoot":"/Users/danielbaier/research/projects/github/issues/2024 fritap issues/friTap/","sources":["agent/misc/socket_tracer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAU,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,wBAAwB,EAAE,MAAM,0BAA0B,CAAC;AACpE,OAAO,EAAE,aAAa,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAC;AACpF,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAElD,SAAS,qBAAqB,CAAC,EAAW;IACtC,IAAI,QAAQ,GAAG,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAC/B,IAAI,QAAQ,KAAK,KAAK,IAAI,QAAQ,KAAK,MAAM,IAAI,QAAQ,KAAK,KAAK,IAAI,QAAQ,KAAK,MAAM,EAAC;QACvF,IAAG,QAAQ,KAAK,MAAM,IAAI,IAAI,CAAC,SAAS,EAAC;YACrC,OAAO,KAAK,C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K,CAAC;KACxB;SAAK,IAAG,IAAI,KAAK,MAAM,EAAC;QACrB,YAAY,GAAG,UAAU,CAAC;KAC7B;SAAI;QACD,YAAY,GAAG,SAAS,CAAA;KAC3B;IACD,OAAO,YAAY,CAAA;AAEvB,CAAC;AAID;;;;;;;iFAOiF;AAGjF,SAAS,yBAAyB;IAC9B,OAAO,2BAA2B,CAAC,sBAAsB,EAAE,CAAC,CAAC;AACjE,CAAC;AAED;;;GAGG"} +✄ +import { log } from "../util/log.js"; +import { get_process_architecture } from "../util/process_infos.js"; +import { readAddresses, getPortsAndAddresses } from "../shared/shared_functions.js"; +import { enable_default_fd } from "../ssl_log.js"; +function has_valid_socket_type(fd) { + var socktype = Socket.type(fd); + if (socktype === 'tcp' || socktype === 'tcp6' || socktype === 'udp' || socktype === 'udp6') { + if (socktype === 'udp6' && ObjC.available) { + return false; // on iOS this leads always to empty addresses + } + return true; + } + return true; +} +export function socket_trace_execute() { + //log("Doing a full packet capture\nUse -k in order to get TLS keys."); + var socket_library = ""; + switch (Process.platform) { + case "linux": + socket_library = "libc"; + break; + case "windows": + socket_library = "WS2_32.dll"; + break; + case "darwin": + socket_library = "libSystem.B.dylib"; + break; + default: + log(`Platform "${Process.platform} currently not supported!`); + } + var library_method_mapping = {}; + const socketFDs = new Map(); + if (ObjC.available) { + // currently those libraries gets only detected on iOS if we add an *-sign + library_method_mapping[`*${socket_library}*`] = ["getpeername*", "getsockname*", "socket*", "ntohs*", "ntohl*", "recv*", "recvfrom*", "send*", "sendto*", "read*", "write*"]; + } + else { + library_method_mapping[`*${socket_library}*`] = ["getpeername", "getsockname", "ntohs", "ntohl", "socket", "recv", "recvfrom", "send", "sendto", "read", "write", "connect"]; + } + var addresses; + addresses = readAddresses(socket_library, library_method_mapping); + if (!addresses[socket_library] || !addresses[socket_library]["socket"] || !addresses[socket_library]["connect"]) { + throw new Error(`Missing required functions in ${socket_library}. Ensure "socket" and "connect" are exported by the library.`); + } + Interceptor.attach(addresses[socket_library]["socket"], { + onEnter: function (args) { + }, + onLeave: function (retval) { + this.fd = retval.toInt32(); + if (socketFDs.has(this.fd)) { + return; + } + if (has_valid_socket_type(this.fd)) { + var message = getPortsAndAddresses(this.fd, false, addresses[socket_library], enable_default_fd); + if (message === null) { + return; + } + message["function"] = "Full_read"; + message["contentType"] = "netlog"; + socketFDs.set(this.fd, message["dst_addr"]); + send(message); + } + } + }); + Interceptor.attach(addresses[socket_library]["connect"], { + onEnter: function (args) { + this.fd = args[0].toInt32(); + }, + onLeave: function (retval) { + if (socketFDs.has(this.fd)) { + return; + } + if (has_valid_socket_type(this.fd)) { + var message = getPortsAndAddresses(this.fd, false, addresses[socket_library], enable_default_fd); + if (message === null) { + return; + } + message["function"] = "Full_read"; + message["contentType"] = "netlog"; + socketFDs.set(this.fd, message["dst_addr"]); + send(message); + } + } + }); + Interceptor.attach(addresses[socket_library]["read"], { + onEnter: function (args) { + this.fd = args[0].toInt32(); + }, + onLeave: function (retval) { + if (socketFDs.has(this.fd)) { + return; + } + if (has_valid_socket_type(this.fd)) { + var message = getPortsAndAddresses(this.fd, true, addresses[socket_library], enable_default_fd); + if (message === null) { + return; + } + message["function"] = "Full_read"; + message["contentType"] = "netlog"; + socketFDs.set(this.fd, message["src_addr"]); + send(message); + } + } + }); + Interceptor.attach(addresses[socket_library]["recv"], { + onEnter: function (args) { + this.fd = args[0].toInt32(); + }, + onLeave: function (retval) { + if (socketFDs.has(this.fd)) { + return; + } + if (has_valid_socket_type(this.fd)) { + var message = getPortsAndAddresses(this.fd, true, addresses[socket_library], enable_default_fd); + if (message === null) { + return; + } + message["function"] = "Full_read"; + message["contentType"] = "netlog"; + socketFDs.set(this.fd, message["src_addr"]); + send(message); + } + } + }); + Interceptor.attach(addresses[socket_library]["recvfrom"], { + onEnter: function (args) { + this.fd = args[0].toInt32(); + }, + onLeave: function (retval) { + if (socketFDs.has(this.fd)) { + return; + } + if (has_valid_socket_type(this.fd)) { + var message = getPortsAndAddresses(this.fd, true, addresses[socket_library], enable_default_fd); + if (message === null) { + return; + } + message["function"] = "Full_read"; + message["contentType"] = "netlog"; + socketFDs.set(this.fd, message["src_addr"]); + send(message); + } + } + }); + Interceptor.attach(addresses[socket_library]["send"], { + onEnter: function (args) { + this.fd = args[0].toInt32(); + }, + onLeave: function (retval) { + if (socketFDs.has(this.fd)) { + return; + } + if (has_valid_socket_type(this.fd)) { + var message = getPortsAndAddresses(this.fd, false, addresses[socket_library], enable_default_fd); + if (message === null) { + return; + } + message["function"] = "Full_write"; + message["contentType"] = "netlog"; + socketFDs.set(this.fd, message["dst_addr"]); + send(message); + } + } + }); + Interceptor.attach(addresses[socket_library]["sendto"], { + onEnter: function (args) { + this.fd = args[0].toInt32(); + }, + onLeave: function (retval) { + if (socketFDs.has(this.fd)) { + return; + } + if (has_valid_socket_type(this.fd)) { + var message = getPortsAndAddresses(this.fd, false, addresses[socket_library], enable_default_fd); + if (message === null) { + return; + } + message["function"] = "Full_write"; + message["contentType"] = "netlog"; + socketFDs.set(this.fd, message["dst_addr"]); + send(message); + } + } + }); + Interceptor.attach(addresses[socket_library]["write"], { + onEnter: function (args) { + this.fd = args[0].toInt32(); + }, + onLeave: function (retval) { + if (socketFDs.has(this.fd)) { + return; + } + if (has_valid_socket_type(this.fd)) { + var message = getPortsAndAddresses(this.fd, false, addresses[socket_library], enable_default_fd); + if (message === null) { + return; + } + message["function"] = "Full_write"; + message["contentType"] = "netlog"; + socketFDs.set(this.fd, message["dst_addr"]); + send(message); + } + } + }); + if (ObjC.available) { + Interceptor.attach(Module.getExportByName("libsystem_kernel.dylib", "write"), { + onEnter: function (args) { + var fd = args[0].toInt32(); + if (socketFDs.has(fd)) { + return; + } + if (has_valid_socket_type(fd)) { + var message = getPortsAndAddresses(fd, false, addresses[socket_library], enable_default_fd); + if (message === null) { + //devlog("Skipping this socket due to unsupported address family."); To noisy + return; + } + message["function"] = "Full_write"; + message["contentType"] = "netlog"; + socketFDs.set(this.fd, message["dst_addr"]); + send(message); + } + }, + onLeave: function (retval) { + } + }); + Interceptor.attach(Module.getExportByName("libsystem_kernel.dylib", "read"), { + onEnter: function (args) { + this.fd = args[0].toInt32(); + }, + onLeave: function (retval) { + if (socketFDs.has(this.fd)) { + return; + } + if (has_valid_socket_type(this.fd)) { + var message = getPortsAndAddresses(this.fd, true, addresses[socket_library], enable_default_fd); + if (message === null) { + return; + } + message["function"] = "Full_read"; + message["contentType"] = "netlog"; + socketFDs.set(this.fd, message["src_addr"]); + send(message); + } + } + }); + } +} +// the low level part is under development and currently not exported for usage +var socket_syscall_lookup_table = { + "Android_arm64": 198 +}; +function get_syscall_intruction() { + var arch = get_process_architecture(); + var syscall_inst = ""; + if (arch === "arm") { + syscall_inst = "swi"; + } + else if (arch === "arm64") { + syscall_inst = "svc"; + } + else if (arch === "ia32") { + syscall_inst = "int 0x80"; + } + else { + syscall_inst = "syscall"; + } + return syscall_inst; +} +/* + +Process +Process.id: property containing the PID as a number + +Process.arch: property containing the string ia32, x64, arm or arm64 + +Process.platform: property containing the string windows, darwin, linux or qnx */ +function get_socket_syscall_number() { + return socket_syscall_lookup_table[get_syscall_intruction()]; +} +/* +fuction get_socket_syscall(){ + // ARM64 [198,"socket",0xc6,["int","int","int"]], +}*/ +✄ {"version":3,"file":"pattern_based_hooking.js","sourceRoot":"/Users/danielbaier/research/projects/github/issues/2024 fritap issues/friTap/","sources":["agent/shared/pattern_based_hooking.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAC;AAC3D,OAAO,EAAE,SAAS,EAAE,KAAK,EAAC,OAAO,EAAE,MAAM,0BAA0B,CAAA;AAenE,MAAM,UAAU,wBAAwB,CAAC,eAA2E;IAChH,IAAI,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAC,yCAAyC;IAC7E,IAAG,IAAI,IAAI,MAAM,EAAC;QACd,IAAI,GAAG,KAAK,CAAA;KACf;IAED,IA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AAQ,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,EAAE;YAChD,IAAI,CAAC,4BAA4B,CAAC,WAAW,EAAE,WAAW,EAAE,QAAQ,EAAE,IAAI,EAAE,YAAY,CAAC,CAAC;SACjG;aAAK,IAAI,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,gBAAgB,CAAC;YAC7C,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,gBAAgB,CAAC,CAAC,QAAQ,CAAC;YACjD,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,gBAAgB,CAAC,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,EAAE;YACrD,IAAI,CAAC,4BAA4B,CAAC,WAAW,EAAE,gBAAgB,EAAE,QAAQ,EAAE,IAAI,EAAE,YAAY,CAAC,CAAC;SACtG;aAAK;YACF,KAAK,MAAM,cAAc,IAAI,IAAI,CAAC,QAAQ,CAAC,OAAO,EAAE;gBAChD,IAAI,KAAK,CAAC,IAAI,CAAC,WAAW,CAAC,EAAE;oBACzB,IAAI,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,cAAc,CAAC,CAAC,QAAQ,CAAC,IAAI,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,cAAc,CAAC,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,EAAE;wBAC1G,IAAI,CAAC,4BAA4B,CAAC,WAAW,EAAE,cAAc,EAAE,QAAQ,EAAE,IAAI,EAAE,YAAY,CAAC,CAAC;qBAChG;iBACJ;qBAAI;oBACD,MAAM,CAAC,qEAAqE,CAAC,CAAC;iBACjF;aACJ;SAEJ;IACL,CAAC;CACJ"} ✄ import { devlog, devlog_error, log } from "../util/log.js"; @@ -2115,10 +2424,10 @@ export class PatternBasedHooking { } } ✄ -{"version":3,"file":"shared_functions.js","sourceRoot":"/Users/danielbaier/research/projects/github/issues/2024 fritap issues/friTap/","sources":["agent/shared/shared_functions.ts"],"names":[],"mappings":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AAE,CAAC,CAAC,4CAA4C;SAC1G,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,uCAAuC;AAC1D,CAAC"} +{"version":3,"file":"shared_functions.js","sourceRoot":"/Users/danielbaier/research/projects/github/issues/2024 fritap issues/friTap/","sources":["agent/shared/shared_functions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC3D,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,oBAAoB,EAAE,WAAW,EAAqB,MAAM,wBAAwB,CAAC;AAGjH,SAAS,uBAAuB,CAAC,WAAmB;IAChD,IAAI,eAAe,GAAG,CAAC,CAAC;IACxB,IAAI,aAAa,GAAG,MAAM,CAAC,eAAe,CAAC,WAAW,CAAC,CAAC;IACxD,IAAG,aAAa,KAAK,IAAI,IAAI,aAAa,KAAK,IAAI,EAAC;QAChD,GAAG,CAAC,cAAc,GAAC,eAAe,GAAC,mCAAmC,GAAC,WAAW,CAAC,CAAC;QACpF,UAAU,CAAC,uBAAuB,EAAC,eAAe,CAAC,CAAA;KACtD;AACL,CAAC;AAED;;;;;GAKG;AAEH,MAAM,UAAU,kBAAkB,CAAC,cAAsB,EAAE,sBAA0E,EAAE,WAA0B,EAAG,YAAoB,EAAE,YAAqB;IAC3M,KAAI,IAAI,GAAG,IAAI,sBAAsB,CAAC,cAAc,CAAC,EAAC;QAClD,IAAI,KAAK,GAAG,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAA;QAC9B,IAAI,IAAI,GAAG,GAAG,CAAC,CAAC,CAAC,CAAA;QACjB,KAAI,IAAI,MAAM,IAAI,WAAW,EAAC;YAC1B,IAAI,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,EAAC;gBACnB,IAAG;oBACC,GAAG,CAAC,GAAG,MAAM,8BAA8B,YAAY,GAAG,CAAC,CAAA;oBAC3D,IAAI;wBACA,MAAM,CAAC,iBAAiB,CA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U,CAAC,CAAC;IACtF,wCAAwC;IAExC,IAAG,OAAO,EAAC;QACP,OAAO,OAAO,CAAC,MAAM,GAAG,CAAC,CAAC;KAC7B;SAAI;QACD,OAAO,KAAK,CAAC;KAChB;AAGL,CAAC;AAGD,qFAAqF;AACrF,MAAM,UAAU,qBAAqB,CAAC,IAAyD;IAC3F,OAAO,CAAC,UAAkB,EAAE,YAAqB,EAAE,EAAE;QACjD,IAAI,CAAC,UAAU,EAAE,YAAY,CAAC,CAAC;IACnC,CAAC,CAAC;AACN,CAAC;AAGD,MAAM,UAAU,8BAA8B,CAAC,OAAiC;IAC5E,OAAO,KAAK;SACP,IAAI,CAAC,IAAI,UAAU,CAAC,OAAO,CAAC,CAAC,CAAC,qDAAqD;SACnF,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,WAAW,EAAE,CAAC,CAAC,4CAA4C;SAC1G,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,uCAAuC;AAC1D,CAAC"} ✄ import { log, devlog, devlog_error } from "../util/log.js"; -import { AF_INET, AF_INET6 } from "./shared_structures.js"; +import { AF_INET, AF_INET6, AddressFamilyMapping, unwantedFDs } from "./shared_structures.js"; function wait_for_library_loaded(module_name) { let timeout_library = 5; let module_adress = Module.findBaseAddress(module_name); @@ -2313,6 +2622,10 @@ export function getPortsAndAddresses(sockfd, isRead, methodAddresses, enable_def message["ss_family"] = "AF_INET"; return message; } + // Check if this fd is already marked as unwanted + if (unwantedFDs.has(sockfd)) { + return null; // Skip further processing + } var getpeername = new NativeFunction(methodAddresses["getpeername"], "int", ["int", "pointer", "pointer"]); var getsockname = new NativeFunction(methodAddresses["getsockname"], "int", ["int", "pointer", "pointer"]); var ntohs = new NativeFunction(methodAddresses["ntohs"], "uint16", ["uint16"]); @@ -2320,7 +2633,7 @@ export function getPortsAndAddresses(sockfd, isRead, methodAddresses, enable_def var addrlen = Memory.alloc(4); var addr = Memory.alloc(128); var src_dst = ["src", "dst"]; - for (var i = 0; i < src_dst.length; i++) { + for (let i = 0; i < src_dst.length; i++) { addrlen.writeU32(128); if ((src_dst[i] == "src") !== isRead) { devlog("src"); @@ -2330,6 +2643,8 @@ export function getPortsAndAddresses(sockfd, isRead, methodAddresses, enable_def devlog("dst"); getpeername(sockfd, addr, addrlen); } + var family = addr.readU16(); + const familyName = AddressFamilyMapping[family] || `UNKNOWN`; if (addr.readU16() == AF_INET) { message[src_dst[i] + "_port"] = ntohs(addr.add(2).readU16()); message[src_dst[i] + "_addr"] = ntohl(addr.add(4).readU32()); @@ -2351,8 +2666,15 @@ export function getPortsAndAddresses(sockfd, isRead, methodAddresses, enable_def } } else { - devlog("[-] getPortsAndAddresses resolving error: " + addr.readU16()); - throw "Only supporting IPv4/6"; + // only uncomment this if you really need to debug this + //devlog("[-] getPortsAndAddresses resolving error: Only supporting IPv4/6"); + //devlog(`[-] Inspecting fd: ${sockfd}, Address family: ${family} (${familyName})`); + //throw "Only supporting IPv4/6" + if (!unwantedFDs.has(sockfd)) { + //devlog(`Skipping unsupported address family: ${family}:${familyName} (fd: ${sockfd})`); + } + unwantedFDs.add(sockfd); // Mark this fd as unwanted + return null; } } return message; @@ -2442,13 +2764,22 @@ export function get_hex_string_from_byte_array(keyData) { .join(''); // Join all the hex values with a space } ✄ -{"version":3,"file":"shared_structures.js","sourceRoot":"/Users/danielbaier/research/projects/github/issues/2024 fritap issues/friTap/","sources":["agent/shared/shared_structures.ts"],"names":[],"mappings":"AAAA,2DAA2D;AAG3D,MAAM,CAAC,IAAI,sBAAsB,GAAuD,EAAE,CAAC;AAG3F,MAAM,CAAC,MAAM,OAAO,GAAG,CAAC,CAAA;AACxB,MAAM,CAAC,MAAM,QAAQ,GAAG,EAAE,CAAA;AAC1B,MAAM,CAAC,MAAM,WAAW,GAAG,OAAO,CAAC,WAAW,CAAC"} +{"version":3,"file":"shared_structures.js","sourceRoot":"/Users/danielbaier/research/projects/github/issues/2024 fritap issues/friTap/","sources":["agent/shared/shared_structures.ts"],"names":[],"mappings":"AAAA,2DAA2D;AAG3D,MAAM,CAAC,IAAI,sBAAsB,GAAuD,EAAE,CAAC;AAE3F,MAAM,CAAC,MAAM,WAAW,GAAG,IAAI,GAAG,EAAU,CAAC,CAAC,0DAA0D;AAExG,MAAM,CAAC,MAAM,OAAO,GAAG,CAAC,CAAC;AACzB,MAAM,CAAC,MAAM,QAAQ,GAAG,EAAE,CAAC;AAC3B,MAAM,CAAC,MAAM,OAAO,GAAG,CAAC,CAAC;AACzB,MAAM,CAAC,MAAM,WAAW,GAAG,OAAO,CAAC,WAAW,CAAC;AAE/C,MAAM,CAAC,MAAM,oBAAoB,GAA8B;IAC3D,CAAC,EAAE,SAAS;IACZ,EAAE,EAAE,UAAU;IACd,CAAC,EAAE,SAAS;IACZ,EAAE,EAAE,WAAW,EAAE,cAAc;IAC/B,uCAAuC;CAC1C,CAAC"} ✄ /* In this file we store global variables and structures */ export var module_library_mapping = {}; +export const unwantedFDs = new Set(); // this helps us to track if we alredy encountered this fd export const AF_INET = 2; export const AF_INET6 = 10; +export const AF_UNIX = 1; export const pointerSize = Process.pointerSize; +export const AddressFamilyMapping = { + 2: "AF_INET", + 10: "AF_INET6", + 1: "AF_UNIX", + 17: "AF_PACKET", // Raw packets + // Add other address families as needed +}; ✄ {"version":3,"file":"cronet.js","sourceRoot":"/Users/danielbaier/research/projects/github/issues/2024 fritap issues/friTap/","sources":["agent/ssl_lib/cronet.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,8BAA8B,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAC9F,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAKxC,MAAM,OAAO,MAAM;IAUf,YAAmB,UAAiB,EAAS,cAAqB,EAAC,YAAqB,EAAS,6BAAgE;QAA9I,eAAU,GAAV,UAAU,CAAO;QAAS,mBAAc,GAAd,cAAc,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,CAAC;SACvB;aAAM;YACH,MAAM,CAAC,gCAAgC,CAAC,CAAC;SAC5C;QAED,mFAAmF;QACnF,IAAI,OAAO,GAA8C,EAAE,CAAA;QAC3D,OAAO,CAAC,aAAa,CAAC,GAAG,QAAQ,CAAA;QACjC,OAAO,CAAC,QAAQ,CAAC,GAAG,QAAQ,GAAC,GAAG,GAAC,aAAa,GAAC,GAAG,GAAC,UAAU,CAAC;QAC9D,IAAI,CAAC,OAAO,CAAC,CAAA;IACjB,CAAC;IAED,2BAA2B;QACvB,MAAM;IACV,CAAC;IAED,4BAA4B;QACxB,MAAM;IACV,CAAC;IAED,2BAA2B;QACvB,+CAA+C;IACnD,CAAC;CACJ"} ✄ diff --git a/friTap/about.py b/friTap/about.py index a204f07..07ecbe8 100644 --- a/friTap/about.py +++ b/friTap/about.py @@ -2,5 +2,5 @@ # -*- coding: utf-8 -*- __author__ = "Daniel Baier, Francois Egner, Max Ufer" -__version__ = "1.2.4.3" +__version__ = "1.2.6.0" debug = False # are we running in debug mode? \ No newline at end of file diff --git a/friTap/android.py b/friTap/android.py index b01dbae..a239f70 100755 --- a/friTap/android.py +++ b/friTap/android.py @@ -35,7 +35,7 @@ def adb_check_root(self): def run_adb_command_as_root(self,command): if self.adb_check_root() == False: - print("[-] none rooted device. Please root it before using FridaAndroidManager and ensure that you are able to run commands with the su-binary....") + print("[-] none rooted device. Please root it before trying a full-capture with friTap and ensure that you are able to run commands with the su-binary....") exit(2) if self.is_magisk_mode: @@ -85,15 +85,13 @@ def _get_appropriate_android_tcpdump_version(self,passed_arch): return tcpdump_version - def is_tcpdump_available(): + def is_tcpdump_available(self): try: # Check if tcpdump is available on the device - result = subprocess.run(['adb', 'shell', 'tcpdump', '--version'], stdout=subprocess.PIPE, stderr=subprocess.PIPE) + result = self.run_adb_command_as_root("tcpdump --version") if result.returncode == 0: - #print("tcpdump is available on the device.") return True else: - #print("tcpdump is not available on the device.") return False except Exception as e: print(f"Error checking tcpdump availability: {e}") @@ -106,7 +104,6 @@ def _get_tcpdump_version(self): # Construct the path to the assets directory tcpdump_path = os.path.join(current_dir, 'assets', 'tcpdump_binaries', self.tcpdump_version) - #tcpdump_path = files('friTap.assets.tcpdump_binaries').joinpath(self.tcpdump_version) if file_exists(tcpdump_path): print(f"[*] installing tcpdump to Android device: {tcpdump_path}") @@ -134,16 +131,47 @@ def pull_pcap_from_device(self): self.close_friTap_if_none_android() pcap_path = self.dst_path + self.pcap_name return_Value = self._adb_pull_file(pcap_path,".") - print("[*] pulling capture from device") + print(f"[*] pulling capture from device: {return_Value}") if self.print_debug_infos: + print("---------------------------------") print(return_Value) if return_Value.returncode !=0: print(f"[-] error pulling pcap ({pcap_path}) from android device") + + def get_pid_via_adb(self, process_name): + try: + pid_result =self.run_adb_command_as_root(f"pidof -s {process_name}") + pid = pid_result.stdout.strip() + + if not pid: + if self.print_debug_infos: + print("[-] No PID found. Process may not be running.") + return "-1" + return pid + except subprocess.CalledProcessError as e: + if self.print_debug_infos: + print(f"Error: {e.stderr.strip()}") + return "-1" def send_ctrlC_over_adb(self): self.close_friTap_if_none_android() - self.run_adb_command_as_root(f"kill -INT $(pidof -s {self.tcpdump_version})") + if self.is_tcpdump_available(): + pid = self.get_pid_via_adb("tcpdump") + else: + pid = self.get_pid_via_adb(self.tcpdump_version) + + if int(pid) > 0: + self.run_adb_command_as_root(f"kill -INT {pid}") + + def send_kill_tcpdump_over_adb(self): + self.close_friTap_if_none_android() + if self.is_tcpdump_available(): + pid = self.get_pid_via_adb("tcpdump") + else: + pid = self.get_pid_via_adb(self.tcpdump_version) + if int(pid) > 0: + self.run_adb_command_as_root(f"kill -9 {pid}") def close_friTap_if_none_android(self): if self.is_Android == False: @@ -154,9 +182,8 @@ def run_tcpdump_capture(self,pcap_name): self.close_friTap_if_none_android() self.pcap_name = pcap_name - if self.is_tcpdump_available: - tcpdump_cmd = f'tcpdump -i any -s 0 -w {self.dst_path}{pcap_name} not \\(tcp port 5555 or tcp port 27042\\)' - #testen + if self.is_tcpdump_available(): + tcpdump_cmd = f'tcpdump -U -i any -s 0 -w {self.dst_path}{pcap_name} \\"not \\(tcp port 5555 or tcp port 27042\\)\\"' else: tcpdump_cmd = f'{self.dst_path}./{self.tcpdump_version} -i any -s 0 -w {self.dst_path}{pcap_name} \\"not \\(tcp port 5555 or tcp port 27042\\)\\"' @@ -166,11 +193,10 @@ def run_tcpdump_capture(self,pcap_name): else: cmd = f'adb shell su 0 "{tcpdump_cmd}"' - print("[*] Running tcpdump in background:", cmd) + if self.print_debug_infos: + print("[*] Running tcpdump in background:", cmd) process = subprocess.Popen(shlex.split(cmd), stdout=subprocess.PIPE, stderr=subprocess.PIPE) - - return process diff --git a/friTap/friTap.py b/friTap/friTap.py index 39edd1d..1122b5a 100755 --- a/friTap/friTap.py +++ b/friTap/friTap.py @@ -2,7 +2,6 @@ # -*- coding: utf-8 -*- import argparse -import os import sys import frida from AndroidFridaManager import FridaBasedException @@ -52,7 +51,7 @@ def main(): %(prog)s -m --patterns pattern.json -k keys.log -s com.google.android.youtube %(prog)s --pcap log.pcap "$(which curl) https://www.google.com" %(prog)s -H --pcap log.pcap 192.168.0.1:1234 com.example.app - %(prog)s -m -p log.pcap --enable_spawn_gating -v -do --full_capture -k keys.log com.example.app + %(prog)s -m -p log.pcap --enable_spawn_gating -v -do -sot --full_capture -k keys.log com.example.app %(prog)s -m -p log.pcap --enable_spawn_gating -v -do --anti_root --full_capture -k keys.log com.example.app %(prog)s -m -p log.pcap --enable_default_fd com.example.app """) @@ -76,7 +75,7 @@ def main(): help="Log the keys used for tls traffic") args.add_argument("-l", "--live", required=False, action="store_const", const=True, help="Creates a named pipe /tmp/sharkfin which can be read by Wireshark during the capturing process") - args.add_argument("-p ", "--pcap", metavar="", required=False, + args.add_argument("-p", "--pcap", metavar="", required=False, help="Name of PCAP file to write") args.add_argument("-s", "--spawn", required=False, action="store_const", const=True, help="Spawn the executable/app instead of attaching to a running process") @@ -112,13 +111,16 @@ def main(): input() try: print("Start logging") - print("Press Ctrl+C to stop logging") + print("Press Ctrl+C to stop logging\n") ssl_log = SSL_Logger(parsed.exec, parsed.pcap, parsed.verbose, parsed.spawn, parsed.keylog, parsed.enable_spawn_gating, parsed.mobile, parsed.live, parsed.environment, parsed.debug, parsed.full_capture, parsed.socket_tracing, parsed.host, parsed.offsets, parsed.debugoutput, parsed.experimental, parsed.anti_root, parsed.payload_modification, parsed.enable_default_fd, parsed.patterns, parsed.custom_script) + + ssl_log.install_signal_handler() + ssl_log.start_fritap_session() - process = ssl_log.start_fritap_session() - - sys.stdin.read() + # Wait for user input or interrupt + while ssl_log.running: + pass except frida.TransportError as fe: print(f"[-] Problems while attaching to frida-server: {fe}") exit(2) @@ -131,9 +133,6 @@ def main(): except frida.ProcessNotFoundError as pe: print(f"[-] ProcessNotFoundError: {pe}") exit(2) - except KeyboardInterrupt: - process.detach() - pass except Exception as ar: # Get current system exception ex_type, ex_value, ex_traceback = sys.exc_info() @@ -157,9 +156,9 @@ def main(): print("\n[-] frida-server is not running in remote device. Please run frida-server and rerun") print(f"\n[-] Unknown error: {ex_value}") - + + ssl_log.pcap_cleanup(parsed.full_capture,parsed.mobile,parsed.pcap) ssl_log.cleanup(parsed.live,parsed.socket_tracing,parsed.full_capture,parsed.debug,parsed.debugoutput) - os._exit(2) finally: ssl_log.pcap_cleanup(parsed.full_capture,parsed.mobile,parsed.pcap) diff --git a/friTap/pcap.py b/friTap/pcap.py index 8a9c7d9..b01f638 100755 --- a/friTap/pcap.py +++ b/friTap/pcap.py @@ -5,10 +5,14 @@ import random import logging import time +import psutil import struct # ensure that we only see errors from scapy logging.getLogger("scapy.runtime").setLevel(logging.ERROR) +import warnings +warnings.simplefilter("ignore", ResourceWarning) + try: from scapy.all import * except ImportError: @@ -17,6 +21,19 @@ from .android import Android +INVALID_IPV4 = "0.0.0.0" +INVALID_IPV6 = "::" + +def terminate_lingering_processes(parent_pid): + parent = psutil.Process(parent_pid) + for child in parent.children(recursive=True): + print(f"Terminating child process: {child.pid} ({child.name()})") + child.terminate() + try: + child.wait(timeout=2) + except psutil.TimeoutExpired: + print(f"Forcing kill of child process: {child.pid}") + child.kill() class PCAP: @@ -24,6 +41,7 @@ def __init__(self,pcap_file_name,SSL_READ,SSL_WRITE, doFullCapture, isMobile, pr self.pcap_file_name = pcap_file_name self.pkt ={} self.print_debug_infos = print_debug_infos + self.is_Mobile = isMobile @@ -35,10 +53,10 @@ def __init__(self,pcap_file_name,SSL_READ,SSL_WRITE, doFullCapture, isMobile, pr if doFullCapture: if isMobile: - print("[*] capturing whole traffic of target app") self.android_Instance = Android(self.print_debug_infos) self.full_capture_thread = self.get_instance_of_FullCaptureThread() self.full_capture_thread.start() + print("[*] capturing whole traffic of target app") else: print("[*] capturing only plaintext data") self.pcap_file = self.__create_plaintext_pcap() @@ -59,7 +77,8 @@ def __init__(self): self.stop_capture = Event() self.tmp_pcap_name = self._get_tmp_pcap_name() - self.mobile_pid = -1 + self.mobile_subprocess = -1 + self.android_capture_process = -1 self.is_Mobile = pcap_class.is_Mobile @@ -100,13 +119,25 @@ def full_local_capture(self): def run(self): if self.is_Mobile: - self.mobile_pid = self.full_mobile_capture() + self.mobile_subprocess = self.full_mobile_capture() else: self.full_local_capture() def join(self, timeout=None): self.stop_capture.set() + + # Terminate the tcpdump process if running + #if self.android_capture_process and self.android_capture_process.poll() in {None, -2, -15}: + if self.android_capture_process and self.android_capture_process.poll() is None: + pcap_class.android_Instance.send_ctrlC_over_adb() + self.android_capture_process.terminate() + try: + self.android_capture_process.wait(timeout=2) # Wait for graceful termination + except subprocess.TimeoutExpired: + print(f"[-] Android capture thread did not terminate. Forcing kill.") + self.android_capture_process.kill() + super().join(timeout) @@ -118,10 +149,10 @@ def full_mobile_capture(self): if pcap_class.android_Instance.is_Android(): if pcap_class.android_Instance.is_tcpdump_available == False: pcap_class.android_Instance.push_tcpdump_to_device() - android_capture_process = pcap_class.android_Instance.run_tcpdump_capture("_"+self._get_pcap_base_name()) + self.android_capture_process = pcap_class.android_Instance.run_tcpdump_capture("_"+self._get_pcap_base_name()) - print("[*] doing full capture on Android") - return android_capture_process + print(f"[*] doing full capture on Android") + return self.android_capture_process else: print("[-] currently a full capture on iOS is not supported\nAbborting...") exit(2) @@ -274,34 +305,85 @@ def log_plaintext_payload(self, ss_family, function, src_addr, src_port, # creating a filter for scapy or wiresharks display filter depending on the provided socket_trace_set which looks like @staticmethod - def get_filter_from_traced_sockets(socket_trace_set): - filter = "" - first_element = True - for length_of_socket_Set in range(len(socket_trace_set)): - if len(socket_trace_set) == 1: - filter = socket_trace_set.pop() + " or " + filter - break - if first_element: - first_element = False - filter = socket_trace_set.pop() + def get_filter_from_traced_sockets(traced_Socket_Set, filter_type="bpf"): + """ + Generate a filter string from traced sockets. + + :param traced_Socket_Set: Set of frozensets containing socket info. + :param filter_type: "bpf" for BPF filters or "display" for Wireshark display filters. + :return: Filter string. + """ + filters = [] + for socket_info in traced_Socket_Set: + socket_dict = dict(socket_info) # Convert frozenset back to a dictionary + src_addr = socket_dict.get("src_addr", "0.0.0.0") + dst_addr = socket_dict.get("dst_addr", "0.0.0.0") + + if src_addr == "::" or dst_addr == "::" or not src_addr or not dst_addr: + continue # Skip invalid entries + + if filter_type == "bpf": + filter_part = PCAP.get_bpf_filter(src_addr, dst_addr) + elif filter_type == "display": + filter_part = PCAP.get_display_filter(src_addr, dst_addr) else: - filter = socket_trace_set.pop() + " or " + filter - - length_of_socket_Set = length_of_socket_Set - 1 + raise ValueError("Invalid filter_type. Use 'bpf' or 'display'.") - return filter + if filter_part: + filters.append(filter_part) + + return " or ".join(filters) + + # this function is able to reduce a capture to the traffic from the traced target application by using the information from the socket trace and applying a bpf filter of those traced packets - def create_application_traffic_pcap(self,traced_Socket_Set): - bpf_filter = PCAP.get_filter_from_traced_sockets(traced_Socket_Set) - print("[*] filtering the capture for the target application this might take a while...") + def create_application_traffic_pcap(self, traced_Socket_Set,pcap_obj, is_verbose=False): + def is_valid_socket(socket_info): + return ( + socket_info.get("src_addr") and socket_info.get("dst_addr") + and socket_info.get("src_addr") != INVALID_IPV4 + and socket_info.get("dst_addr") != INVALID_IPV4 + and socket_info.get("src_addr") != INVALID_IPV6 + and socket_info.get("dst_addr") != INVALID_IPV6 + ) + + if not traced_Socket_Set: + print("[-] No sockets traced. The resulting PCAP will contain all traffic from the device.") + return + + # Convert each frozenset in the traced_Socket_Set back to a dictionary + socket_dicts = [dict(frozenset_entry) for frozenset_entry in traced_Socket_Set] + + valid_sockets = [socket for socket in socket_dicts if is_valid_socket(socket)] + if not valid_sockets: + print("[-] No valid sockets found. The resulting PCAP will contain all traffic.") + return + + bpf_filter = PCAP.get_filter_from_traced_sockets(valid_sockets, filter_type="bpf") + if not bpf_filter: + print("[-] Failed to generate a valid BPF filter.") + return + + if is_verbose: + print(f"[*] Filtering with BPF filter:\n{bpf_filter}") try: - filtered_capture = sniff(offline="_"+self.pcap_file_name,filter=bpf_filter) - wrpcap(self.pcap_file_name,filtered_capture) - except Exception as ar: - print(ar) - print(f"[*] finished and written to {self.pcap_file_name}") + """ + There is currently a bug which is happening when invoking sniff. Currently we just ignore this warning: + Exception ignored in: + Traceback (most recent call last): + File ".../subprocess.py", line 1127, in __del__ + _warn("subprocess %s is still running" % self.pid, + ResourceWarning: subprocess 63901 is still running + reading from file .pcap, link-type LINUX_SLL2 (Linux cooked v2) + """ + filtered_capture = sniff(offline="_" + self.pcap_file_name, filter=bpf_filter) + wrpcap(self.pcap_file_name, filtered_capture) + except Exception as e: + print(f"[-] Error during PCAP filtering: {e}") + else: + print(f"[*] Successfully filtered. Output written to {self.pcap_file_name}") + def get_pcap_name(self): @@ -310,12 +392,14 @@ def get_pcap_name(self): @staticmethod def get_display_filter(src_addr,dst_addr): - return "ip.src == " +src_addr+ "and ip.dst =="+dst_addr + return f"ip.src == {src_addr} and ip.dst == {dst_addr}" @staticmethod def get_bpf_filter(src_addr,dst_addr): - return "(src host " +src_addr+ " and dst host "+dst_addr+")" + if src_addr == "::" or dst_addr == "::" or not src_addr or not dst_addr: + return "" # Skip invalid entries + return f"(src host {src_addr} and dst host {dst_addr})" diff --git a/friTap/ssl_logger.py b/friTap/ssl_logger.py index 03b7e7a..01ecc8c 100644 --- a/friTap/ssl_logger.py +++ b/friTap/ssl_logger.py @@ -9,7 +9,9 @@ import pprint import signal import time +import sys import json +import threading from .pcap import PCAP from watchdog.observers import Observer from watchdog.events import FileSystemEventHandler, LoggingEventHandler @@ -55,6 +57,7 @@ def __init__(self, app, pcap_name=None, verbose=False, spawn=False, keylog=False self.experimental = experimental self.custom_hook_script = custom_hook_script self.script = None + self.running = True self.tmpdir = None self.filename = "" @@ -114,11 +117,14 @@ def init_fritap(self): def on_detach(self, reason): - if reason != "application-requested": - print(f"\n[*] Target process stopped: {reason}\n") - + + if reason == "application-requested": + return + + print(f"\n[*] Target process stopped: {reason}\n") self.pcap_cleanup(self.full_capture,self.mobile,self.pcap_name) self.cleanup(self.live,self.socket_trace,self.full_capture,self.debug) + def temp_fifo(self): @@ -155,6 +161,9 @@ def on_fritap_message(self,job, message, data): if self.startup and message['payload'] == 'defaultFD': self.script.post({'type':'defaultFD', 'payload': self.enable_default_fd}) + if self.startup and message['payload'] == 'socket_tracing': + self.script.post({'type':'socket_tracing', 'payload': self.socket_trace}) + if self.startup and message['payload'] == 'pattern_hooking': self.script.post({'type':'pattern_hooking', 'payload': self.pattern_data}) @@ -195,16 +204,38 @@ def on_fritap_message(self,job, message, data): else: src_addr = get_addr_string(p["src_addr"], p["ss_family"]) dst_addr = get_addr_string(p["dst_addr"], p["ss_family"]) - - if self.socket_trace == False and self.full_capture == False: + + if self.socket_trace == False and self.full_capture == False: print("SSL Session: " + str(p["ssl_session_id"])) + if self.full_capture: - scapy_filter = PCAP.get_bpf_filter(src_addr,dst_addr) - self.traced_scapy_socket_Set.add(scapy_filter) + # Add to traced_scapy_socket_Set as a frozenset dictionary + scapy_filter_entry = { + "src_addr": src_addr, + "dst_addr": dst_addr, + "ss_family": p["ss_family"] + } + self.traced_scapy_socket_Set.add(frozenset(scapy_filter_entry.items())) # Use frozenset for uniqueness + if self.socket_trace: - display_filter = PCAP.get_display_filter(src_addr,dst_addr) - self.traced_Socket_Set.add(display_filter) - print("[socket_trace] %s:%d --> %s:%d" % (src_addr, p["src_port"], dst_addr, p["dst_port"])) + display_filter_entry = { + "src_addr": src_addr, + "dst_addr": dst_addr, + "src_port": p["src_port"], + "dst_port": p["dst_port"], + "ss_family": p["ss_family"] + } + self.traced_Socket_Set.add(frozenset(display_filter_entry.items())) + scapy_filter_entry = { + "src_addr": src_addr, + "dst_addr": dst_addr, + "ss_family": p["ss_family"] + } + self.traced_scapy_socket_Set.add(frozenset(scapy_filter_entry.items())) + + # Use structured data for the debug print + print(f"[socket_trace] {src_addr}:{p['src_port']} --> {dst_addr}:{p['dst_port']}") + else: print("[%s] %s:%d --> %s:%d" % (p["function"], src_addr, p["src_port"], dst_addr, p["dst_port"])) hexdump.hexdump(data) @@ -217,8 +248,8 @@ def on_fritap_message(self,job, message, data): self.pcap_obj.log_plaintext_payload(p["ss_family"], p["function"], p["src_addr"], p["src_port"], p["dst_addr"], p["dst_port"], data) except (BrokenPipeError, IOError): - self.process.detach() - self.cleanup(self.live) + self.detach_with_timeout(self.process) + self.cleanup(self.live, self.socket_trace, self.full_capture, self.debug) if self.keylog and p["contentType"] == "keylog": if p["keylog"] not in self.keydump_Set: @@ -232,12 +263,25 @@ def on_fritap_message(self,job, message, data): src_addr = get_addr_string(p["src_addr"], p["ss_family"]) dst_addr = get_addr_string(p["dst_addr"], p["ss_family"]) + if self.socket_trace: - display_filter = PCAP.get_display_filter(src_addr,dst_addr) - self.traced_Socket_Set.add(display_filter) - else: - scapy_filter = PCAP.get_bpf_filter(src_addr,dst_addr) - self.traced_scapy_socket_Set.add(scapy_filter) + # Add a structured dictionary to traced_Socket_Set + display_filter_entry = { + "src_addr": src_addr, + "dst_addr": dst_addr, + "src_port": p["src_port"], + "dst_port": p["dst_port"], + "ss_family": p["ss_family"] + } + self.traced_Socket_Set.add(frozenset(display_filter_entry.items())) # Use frozenset for uniqueness + # Add a structured dictionary to traced_scapy_socket_Set + scapy_filter_entry = { + "src_addr": src_addr, + "dst_addr": dst_addr, + "ss_family": p["ss_family"] + } + self.traced_scapy_socket_Set.add(frozenset(scapy_filter_entry.items())) # Use frozenset for uniqueness + @@ -450,6 +494,47 @@ def wrapped_handler(message, data): return wrapped_handler + def detach_with_timeout(self, timeout=5): + """ + Attempt to detach from the Frida process with a timeout. + + Args: + process: The Frida process to detach from. + timeout: Time in seconds to wait before forcing detachment. + """ + def detach(): + try: + if self.debug_output or self.debug: + print("[*] Attempting to detach from Frida process...") + try: + self.script.unload() + except: + pass + + self.process.detach() + if self.debug_output or self.debug: + print("[*] Successfully detached from Frida process.") + except Exception as e: + print(f"[-] Error while detaching: {e}") + + # Create a thread to run the detach method + detach_thread = threading.Thread(target=detach) + detach_thread.start() + + # Wait for the thread to complete + detach_thread.join(timeout=timeout) + + if detach_thread.is_alive(): + if self.debug_output: + print(f"[-] Detach process timed out after {timeout} seconds.") + # Force cleanup if necessary + # Note: Frida doesn't provide a "force detach," so handle gracefully + else: + if self.debug_output: + print("[*] Detached friTap from process successfully.") + + + def set_keylog_file(self, keylog_name): self.keylog_file = open(keylog_name, "w") @@ -460,10 +545,12 @@ def pcap_cleanup(self, is_full_capture, is_mobile, pcap_name): self.pcap_obj.full_capture_thread.join(2.0) if self.pcap_obj.full_capture_thread.is_alive() and is_mobile == False: self.pcap_obj.full_capture_thread.socket.close() - if self.pcap_obj.full_capture_thread.mobile_pid != -1: + if self.pcap_obj.full_capture_thread.mobile_subprocess != -1: capture_type = "mobile" - self.pcap_obj.full_capture_thread.mobile_pid.terminate() self.pcap_obj.android_Instance.send_ctrlC_over_adb() + time.sleep(1) + self.pcap_obj.full_capture_thread.mobile_subprocess.terminate() + self.pcap_obj.full_capture_thread.mobile_subprocess.wait() self.pcap_obj.android_Instance.pull_pcap_from_device() print(f"[*] full {capture_type} capture safed to _{pcap_name}") if self.keylog_file is None: @@ -473,6 +560,10 @@ def pcap_cleanup(self, is_full_capture, is_mobile, pcap_name): def cleanup(self, live=False, socket_trace=False, full_capture=False, debug_output=False, debug=False): + if self.pcap_obj is not None: + if self.pcap_obj.full_capture_thread.is_alive(): + self.pcap_obj.full_capture_thread.join() + time.sleep(2) if live: os.unlink(self.filename) # Remove file os.rmdir(self.tmpdir) # Remove directory @@ -480,17 +571,25 @@ def cleanup(self, live=False, socket_trace=False, full_capture=False, debug_outp print(f"[*] Write traced sockets into {socket_trace}") self.write_socket_trace(socket_trace) if socket_trace == True: - print("[*] Traced sockets") - print(PCAP.get_filter_from_traced_sockets(self.traced_Socket_Set)) + display_filter = PCAP.get_filter_from_traced_sockets(self.traced_Socket_Set, filter_type="display") + print(f"[*] Generated Display Filter for Wireshark:\n{display_filter}") if full_capture and len(self.traced_scapy_socket_Set) > 0: if debug_output or debug: - print("[*] traced sockets: "+str(self.traced_scapy_socket_Set)) + display_filter = PCAP.get_filter_from_traced_sockets(self.traced_Socket_Set, filter_type="display") + print(f"[*] Generated Display Filter for Wireshark:\n{display_filter}") + + try: + self.pcap_obj.create_application_traffic_pcap(self.traced_scapy_socket_Set,self.pcap_obj) + except Exception as e: + print(f"Error: {e}") - self.pcap_obj.create_application_traffic_pcap(self.traced_scapy_socket_Set) elif full_capture and len(self.traced_scapy_socket_Set) < 1: print(f"[-] friTap was unable to indentify the used sockets.\n[-] The resulting PCAP will contain all trafic from the device.") + self.running = False + if self.process: + self.detach_with_timeout() # Detach Frida process if applicable print("\n\nThx for using friTap\nHave a great day\n") os._exit(0) @@ -509,6 +608,22 @@ def get_custom_frida_script(self): def get_fritap_frida_script_path(self): return os.path.join(os.path.dirname(__file__), self.frida_agent_script) + + def install_signal_handler(self): + def signal_handler(signum, frame): + print("\n[*] Ctrl+C detected. Cleaning up...") + self.pcap_cleanup(self.full_capture, self.mobile, self.pcap_name) + self.cleanup(self.live, self.socket_trace, self.full_capture, self.debug_output, self.debug) # Call the instance's cleanup method + + + signal.signal(signal.SIGINT, signal_handler) + + + def write_socket_trace(self, socket_trace_name): + with open(socket_trace_name, 'a') as trace_file: + trace_file.write(PCAP.get_filter_from_traced_sockets(self.traced_Socket_Set, filter_type="display") + '\n') + + def get_addr_string(socket_addr,ss_family): if ss_family == "AF_INET": @@ -518,7 +633,5 @@ def get_addr_string(socket_addr,ss_family): return socket.inet_ntop(socket.AF_INET6, struct.pack(">16s", raw_addr)) -def write_socket_trace(self, socket_trace_name): - with open(socket_trace_name, 'a') as trace_file: - trace_file.write(PCAP.get_filter_from_traced_sockets(self.traced_Socket_Set) + '\n') + \ No newline at end of file diff --git a/package.json b/package.json index 5ea77e1..50198e9 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "friTap", - "version": "1.2.4.3", + "version": "1.2.6.0", "description": "Frida agent for logging SSL traffic as plaintext and extracting SSL keys", "private": true, "main": "agent/ssl_log.ts",