Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
node-simctl
Advanced tools
The node-simctl package is a Node.js wrapper for simctl, a command-line utility used to control the iOS Simulator. It allows developers to manage iOS simulators programmatically, including creating, deleting, booting, and shutting down simulators, as well as installing and uninstalling apps.
Create a new simulator
This feature allows you to create a new iOS simulator with a specified name, device type, and iOS version. The code sample demonstrates how to create an iPhone 8 simulator running iOS 13.3.
const simctl = require('node-simctl');
async function createSimulator() {
const udid = await simctl.createDevice('My Simulator', 'iPhone 8', '13.3');
console.log('Created simulator with UDID:', udid);
}
createSimulator();
Boot a simulator
This feature allows you to boot an existing iOS simulator using its UDID. The code sample demonstrates how to boot a simulator by providing its UDID.
const simctl = require('node-simctl');
async function bootSimulator(udid) {
await simctl.bootDevice(udid);
console.log('Booted simulator with UDID:', udid);
}
bootSimulator('your-simulator-udid');
Install an app on a simulator
This feature allows you to install an app on a specified iOS simulator. The code sample demonstrates how to install an app by providing the simulator's UDID and the path to the app.
const simctl = require('node-simctl');
async function installApp(udid, appPath) {
await simctl.installApp(udid, appPath);
console.log('Installed app on simulator with UDID:', udid);
}
installApp('your-simulator-udid', '/path/to/your/app.app');
Shutdown a simulator
This feature allows you to shut down an existing iOS simulator using its UDID. The code sample demonstrates how to shut down a simulator by providing its UDID.
const simctl = require('node-simctl');
async function shutdownSimulator(udid) {
await simctl.shutdownDevice(udid);
console.log('Shutdown simulator with UDID:', udid);
}
shutdownSimulator('your-simulator-udid');
The ios-sim package is a command-line utility that launches an iOS application on the iOS Simulator. It provides functionalities to start the simulator, install apps, and launch apps. Compared to node-simctl, ios-sim is more focused on launching and managing apps on the simulator rather than managing the simulators themselves.
Appium is an open-source tool for automating mobile applications. It supports iOS and Android platforms and allows you to write tests using various programming languages. While Appium provides broader functionality for mobile automation, including interacting with simulators, node-simctl is more specialized in managing iOS simulators.
Detox is an end-to-end testing library for mobile apps. It supports both iOS and Android and allows you to write tests that run on simulators and real devices. Detox includes functionalities to manage simulators, but its primary focus is on testing and automation, whereas node-simctl is specifically designed for simulator management.
ES6/7 Node wrapper around Apple's simctl
binary, the "Command line utility to control the iOS Simulator". simctl
is run as a sub-command of xcrun
Install through npm.
npm install node-simctl
Exported methods:
installApp(udid, appPath)
udid
- the unique identifier of the simulator to which to install the applicationappPath
- the path to the application to be installedremoveApp(udid, bundleId)
udid
- the unique identifier of the simulator from which to remove the applicationbundleId
- the bundle identifier of the application (e.g., com.corp.app
)launch(udid, bundleId)
udid
- the unique identifier of the simulator on which to launch the appbundleId
- the bundle identifier of the application (e.g., com.corp.app
)openUrl(udid, url)
udid
- the unique identifier of the simulator on which to open the url (in safari)url
- the url to navigate toshutdown(udid)
udid
- the unique identifier of the simulator to be stoppedcreateDevice(name, deviceType, runtime)
name
- any name you choose for this simulatordeviceType
- e.g., "iPhone 6"
or "iPad Air"
, see more possibilities from the output of getDevices
runtime
- iOS sdk version. eg "8.3"
returns: udid
of the created simulator.
deleteDevice(udid)
udid
- the unique identifier of the simulator to be deletederaseDevice(udid)
udid
- the unique identifier of the simulator to be erasedgetDevices()
output looks like:
{
'7.1': [
{ name: 'iPhone 4s',
udid: 'C09B34E5-7DCB-442E-B79C-AB6BC0357417',
state: 'Shutdown' },
{ name: 'iPhone 5',
udid: 'B236B73C-8EFA-4284-AC1F-2A45F3286E4C',
state: 'Shutdown' },
{ name: 'iPhone 5s',
udid: '8E248C90-0F79-46AD-9CAA-8DF3B6E3FBA6',
state: 'Shutdown' },
{ name: 'iPad 2',
udid: 'B4179FA5-B9C4-4F79-BDDF-314ED66B889C',
state: 'Shutdown' },
{ name: 'iPad Retina',
udid: '707AC76E-319C-4215-BAF7-5D6D3B3BA4D2',
state: 'Shutdown' },
{ name: 'iPad Air',
udid: 'FA5C971D-4E05-4AA3-B48B-C9619C7453BE',
state: 'Shutdown' } ],
'8.1': [
{ name: 'iPhone 4s',
udid: '0829568F-7479-4ADE-9E51-B208DC99C107',
state: 'Shutdown' },
{ name: 'iPhone 5',
udid: 'B5048708-566E-45D5-9885-C878EF7D6D13',
state: 'Shutdown' },
{ name: 'iPhone 5s',
udid: '2F7678F2-FD52-497F-9383-41D3BB401FBD',
state: 'Shutdown' },
{ name: 'iPhone 6 Plus',
udid: '013D6994-B4E6-4548-AD77-C0D7C6C6D245',
state: 'Shutdown' },
{ name: 'iPhone 6',
udid: '1CA836DA-2A2D-428A-846D-C378E0C39B09',
state: 'Shutdown' },
{ name: 'iPad 2',
udid: '47D8FF29-4E76-4E7B-A412-FCE9C3B8A9AC',
state: 'Shutdown' },
{ name: 'iPad Retina',
udid: '82071785-2C47-4AF2-BD27-1FAF2B12DF32',
state: 'Shutdown' },
{ name: 'iPad Air',
udid: '342872EB-7559-4D42-B601-0FCF816B2E78',
state: 'Shutdown' },
{ name: 'Resizable iPhone',
udid: 'E46EFA59-E2B4-4FF9-B290-B61F3CFECC65',
state: 'Shutdown' },
{ name: 'Resizable iPad',
udid: '6DAB91C9-CCD1-4C17-9124-D765E2F0567A',
state: 'Shutdown' } ],
'8.3': [
{ name: 'iPhone 4s',
udid: '3D1A8D2A-615A-4C1E-A73C-91E92D6637FF',
state: 'Shutdown' },
{ name: 'iPhone 5',
udid: '813AAB6A-32C8-4859-A5CF-F3355C244F54',
state: 'Shutdown' },
{ name: 'iPhone 5s',
udid: '9D3A405E-65D6-4743-85DA-E644DA9A8373',
state: 'Shutdown' },
{ name: 'iPhone 6 Plus',
udid: 'D94E4CD7-D412-4198-BCD4-26799672975E',
state: 'Shutdown' },
{ name: 'iPhone 6',
udid: '26EAADAE-1CD5-42F9-9A4C-50554CDF0910',
state: 'Shutdown' },
{ name: 'iPad 2',
udid: 'C8E68217-82E6-42A8-8326-9824CA2E7C7C',
state: 'Shutdown' },
{ name: 'iPad Retina',
udid: '8F4A3349-3ABF-4597-953A-285C5C0FFD00',
state: 'Shutdown' },
{ name: 'iPad Air',
udid: '7DEA409E-159A-4730-B1C6-7C18279F72B8',
state: 'Shutdown' },
{ name: 'Resizable iPhone',
udid: 'F33783B2-9EE9-4A99-866E-E126ADBAD410',
state: 'Shutdown' },
{ name: 'Resizable iPad',
udid: 'DFBC2970-9455-4FD9-BB62-9E4AE5AA6954',
state: 'Shutdown' } ]
}
spawn(udid, executablePath, env)
udid
with given environment variable in env
spawnSubProcess(udid, executablePath, env)
udid
with given environment variable in env
getScreenshot(udid)
udid
See specs for examples of usage.
FAQs
Wrapper around Apple's simctl binary
We found that node-simctl demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 7 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.