Category filter

Script to List Internet-connected Apps and Processes on Mac

High-speed network connectivity is necessary for the efficient and smooth functioning of organizations. However, some apps and processes may consume loads of data and cause bandwidth-hogging within the enterprise. Hence, the organization may need to track down apps connected to the internet and terminate them to reduce network traffic. Hexnode makes it easier to identify apps and processes connected to the internet by deploying this script on macOS devices with the help of Execute Custom Script remote action.

Scripting language – Bash

File extension – .sh

Disclaimer:


The sample scripts provided below are adapted from third-party open-source sites.

List internet-connected apps and processes

Here the “lsof” command, which stands for “list open files“, is used to provide information on files, network connections, and various resources currently open or in use by active processes on a system, giving a complete overview of the system activity.

This script helps find out which programs on the macOS device are connected to the internet. It fetches the list of these programs, removes any duplicates, and shows the unique program names starting from the second line of the output.

The output will consist of a list of unique process names involved in network connections, with one process name per line. Each process name represents a command or process running on the system that is currently using a network connection.

For example, if you get locationd as one of the outputs, it means that this process manages location services on macOS, which may involve network interactions for GPS or Wi-Fi-based location determination.

To view the output from the Hexnode portal, head on to the Manage tab, select required device, go to the Action History tab, and click on Show Output corresponding to the executed script.

The script outputs a list of the internet connected apps and processes.

Notes:

  • It is recommended to manually validate the script execution on a system before executing the action in bulk.
  • Hexnode will not be responsible for any damage/loss to the system on the behavior of the script.

  • Sample Script Repository