Interprocess Communication with MacOS : Apple IPC Methods
معرفی کتاب «Interprocess Communication with MacOS : Apple IPC Methods» نوشتهٔ Hem Dutt (auth.)، منتشرشده توسط نشر Apress : Imprint: Apress در سال 2021. این کتاب در فرمت pdf، زبان انگلیسی ارائه شده است.
Build highly modular software in macOS that interacts deeply and intuitively with other programs. This book explores all techniques available for Inter-process communications (IPC) from high level macOS layers to deep kernel options while applying theoretical concepts into practical implementations on real world scenarios.You'll see how IPC techniques are used for exchanging data and messages among multiple threads in one or more processes, which may be running on one or more computers connected by a network or running locally. IPC methods can be divided into methods for message passing, synchronization, shared memory, and remote procedure calls (RPC). A poorly conceived IPC can even expose an entire network to over-the-network attacks. Despite the risks, processes and applications absolutely need to communicate with each other across your system and the network. You'll see how these communications facilitate information sharing, computational speedup, modularity, convenience, and privilege separation. In macOS, a program has a number of ways to communicate with other programs. These mechanisms for IPC often exist in different layers of the system. You'll examine how each has its own specific purposes, limitations, and intended scenarios. Some are more suitable than others for code written at a certain level of the system. For example, a kernel extension would not make use of Apple events. Additionally, the book reveals that different users have different rights when it comes to accessing files, changing system wide settings, and so on, depending on whether they are admin users or ordinary users. Running code with root or administrative privileges can intensify the dangers posed by security vulnerabilities. You'll learn that to elevate privileges safely, it is mandatory for the application to perform the task through a secure Helper process.**What You'll Learn*** Expand the capabilities of your programs by sharing data within multiple applications * Understand and dig deep into the world of Helper tools to create apps that need user privilege elevation * Enhance the modularity of a system by allowing your applications to interact and share data with a website **Who This Book Is For**Software engineers and architects designing and developing secure applications for macOS and iOS who have hands-on knowledge of Swift with XCode. Table of Contents About the Author About the Technical Reviewer Acknowledgments Chapter 1: Introduction to IPC on macOS Interprocess Communication IPC on macOS IPC Techniques on macOS Shared File Shared Memory Mach Ports Sockets Apple Events Distributed Notifications Pasteboard XPC Summary Chapter 2: IPC Through Shared Memory Introduction to Shared Memory Understanding System Calls shmget shmat shmdt shmctl Implementing IPC Using Shared Memory Implementing Server Process Implementing Client Process Pros and Cons of IPC Using Shared Memory Real-World Scenarios for IPC Using Shared Memory Summary Chapter 3: IPC Through Mach Ports Introduction to Mach Tasks and Threads Ports IPC with Mach IPC Transactions and Event Dispatching Message Queues Semaphores Notifications Locks Remote Procedure Call (RPC) Objects Implementing IPC Using Mach Ports (Low-Level APIs) Implementing Server Process Implementing Client Process Time to Run the Code! Implementing IPC Using Mach Ports (High-Level APIs) Implementing Server Process Implementing Client Process Time to Run the Code! Pros and Cons of IPC Using Mach Ports Real-World Scenarios for IPC Using Mach Ports Summary Chapter 4: IPC Through Sockets Introduction to Socket Programming Implementing IPC Using Sockets (Network Framework) Implementing Server Process Implementing Client Process Testing with Terminal Pros and Cons of IPC Using Sockets Real-World Scenarios for IPC Using Sockets What’s Next? Chapter 5: IPC Through Apple Events Open Scripting Architecture (OSA) Script Execution in the OSA Scripting with AppleScript Script Editor Scriptable Applications Interaction of Scriptable Application with Open Scripting Architecture (OSA) IPC Using AppleScript Example 1 Example 2 Example 3 Example 4 AppleScript with Cocoa Application Invoking AppleScript Handler from Objective-C Code Invoking AppleScript Handler from Swift Code Scripting Bridge How Scripting Bridge Works? Working with Scripting Bridge Code Preparation Creating Application Object and Controlling Scriptable Application Pros and Cons of IPC Using Apple Events Real-World Scenarios for IPC Using Apple Events What’s Next? Chapter 6: IPC Through Distributed Notifications Notifications Notification Center NotificationCenter DistributedNotificationCenter Registering for a Notification Registering for Local Notifications Registering for Distributed Notifications Unregistering an Observer IPC Using Distributed Notifications Server Implementation Client Implementation Time to Run the Code! Delivering Notifications to Threads Pros and Cons of IPC Using Distributed Notifications Real-World Scenarios for IPC Using Distributed Notifications What’s Next? Chapter 7: IPC Through Pasteboards IPC Using Pasteboard Objective-C Implementation Reading/Writing Custom Data Swift Implementation Reading/Writing Custom Data Time to Run the Code! Pros and Cons of IPC Using Pasteboards Real-World Scenarios for IPC Using Pasteboards What’s Next? Chapter 8: IPC Through XPC Introduction to XPC Stability Privilege Separation Architecture and Behavior of XPC NSXPCConnection API XPC Services API Creating XPC Service IPC Using XPC Objective-C Implementation Designing an Interface Implementing Server Interface Accepting Connection XPC Server/Helper Client Implementation Swift Implementation Client Implementation User Interface Time to Run the Code! Pros and Cons of IPC Using XPC Real-World Scenarios for IPC Using XPC What’s Next? Chapter 9: IPC Between Native and Web Apps Introduction to WKWebView IPC Using WKWebView Configuring Web View Web Code Call JavaScript from Native Code Call Native Code from JavaScript Passing Parameters Through URL Time to Run the Code! JavaScript Injection Time to Run the Code! Pros and Cons of IPC Between Web and Native Apps Real-World Scenarios for IPC Between Native and Web Apps What’s Next? Chapter 10: Privilege Elevation When Do We Need Elevated Privileges? Security Vulnerabilities Buffer Overflows Unvalidated Input Race Conditions Insecure File Operations Access Control Problems Principle of Least Privilege in Hostile Environment Launching a New Process Command-Line Arguments Inheriting File Descriptors Abusing Environment Variables Modifying Process Limits File Operation Interference Writing a Privileged Helper SMJobBless For the calling application For the Helper tool Swift Implementation Preparing Client and Helper Targets Setting Up Signing Requirements Shared Code Client Implementation Privileged Helper Tool Implementation Running Privileged Operation Error Logs Python Script Real-World Scenarios for Creating Secure Privileged Helper Tool What’s Next? Conclusion Index Build highly modular software in macOS that interacts deeply and intuitively with other programs. This book explores all techniques available for Inter-process communications (IPC) from high level macOS layers to deep kernel options while applying theoretical concepts into practical implementations on real world scenarios. You'll see how IPC techniques are used for exchanging data and messages among multiple threads in one or more processes, which may be running on one or more computers connected by a network or running locally. IPC methods can be divided into methods for message passing, synchronization, shared memory, and remote procedure calls (RPC). A poorly conceived IPC can even expose an entire network to over-the-network attacks. Despite the risks, processes and applications absolutely need to communicate with each other across your system and the network. You'll see how these communications facilitate information sharing, computational speedup, modularity, convenience, and privilege separation. In macOS, a program has a number of ways to communicate with other programs. These mechanisms for IPC often exist in different layers of the system. You'll examine how each has its own specific purposes, limitations, and intended scenarios. Some are more suitable than others for code written at a certain level of the system. For example, a kernel extension would not make use of Apple events. Additionally, the book reveals that different users have different rights when it comes to accessing files, changing system wide settings, and so on, depending on whether they are admin users or ordinary users. Running code with root or administrative privileges can intensify the dangers posed by security vulnerabilities. You'll learn that to elevate privileges safely, it is mandatory for the application to perform the task through a secure Helper process. What You'll Learn Expand the capabilities of your programs by sharing data within multiple applications Understand and dig deep into the world of Helper tools to create apps that need user privilege elevation Enhance the modularity of a system by allowing your applications to interact and share data with a website Who This Book Is For Software engineers and architects designing and developing secure applications for macOS and iOS who have hands-on knowledge of Swift with XCode. Build highly modular software in macOS that interacts deeply and intuitively with other programs. This book explores all techniques available for Inter-process communications (IPC) from high level macOS layers to deep kernel options while applying theoretical concepts into practical implementations on real world scenarios. You'll see how IPC techniques are used for exchanging data and messages among multiple threads in one or more processes, which may be running on one or more computers connected by a network or running locally. IPC methods can be divided into methods for message passing, synchronization, shared memory, and remote procedure calls (RPC). A poorly conceived IPC can even expose an entire network to over-the-network attacks. Despite the risks, processes and applications absolutely need to communicate with each other across your system and the network. You'll see how these communications facilitate information sharing, computational speedup, modularity, convenience, and privilege separation. In macOS, a program has a number of ways to communicate with other programs. These mechanisms for IPC often exist in different layers of the system. You'll examine how each has its own specific purposes, limitations, and intended scenarios. Some are more suitable than others for code written at a certain level of the system. For example, a kernel extension would not make use of Apple events. Additionally, the book reveals that different users have different rights when it comes to accessing files, changing system wide settings, and so on, depending on whether they are admin users or ordinary users. Running code with root or administrative privileges can intensify the dangers posed by security vulnerabilities. You'll learn that to elevate privileges safely, it is mandatory for the application to perform the task through a secure Helper process. You will: Expand the capabilities of your programs by sharing data within multiple applications Understand and dig deep into the world of Helper tools to create apps that need user privilege elevation Enhance the modularity of a system by allowing your applications to interact and share data with a website
دانلود کتاب Interprocess Communication with MacOS : Apple IPC Methods