A Swift port of some of the original PersistentJXA projects by D00MFist

Overview

Persistent-Swift

This repo is a Swift port of some of the original PersistentJXA projects by D00MFist (https://github.com/D00MFist/PersistentJXA). I ported over some of the persistence methods from D00MFist's repo that do not require root.

In this repo, the code that executes the persistence is Swift and I kept the payloads themselves as JXA payloads.


Steps

  1. Ensure you have Xcode installed (which will also install Swift)
  2. If you want to make any changes to the code, open the .xcodeproj file of the desired persistence project (ex: AtomPersist) in XCode and edit the code in main.swift
  3. Once done with any edits or if you don't want to make any edits at all, you can cd into the project directory and then run swift build
  4. This will build the macho binary in the following directory structure of the project directory: .build/debug
  5. You can then cd into that directory and run the macho binary (or copy the macho elsewhere and run it)
  6. Alternatively, you can also build from XCode by clicking Product -> Build. This method will drop the macho at a directory structure similar to: ~/Library/Developer/Xcode/DerivedData/[ProjectName]-[random]/Build/Products/Debug/.

Additional details are below:


Details

Project Description Usage Artifacts Created Commandline Commands Executed
AtomPersist Persistence using the Atom init script. Appends the Atom init script to execute our command. Persistence executes upon Atom opening. ./AtomPersist [path_to_jxa_payload] Modification to end of: /System/Volumes/Data/Users/{User}/.atom/init.coffee Atom will run "osascript [payload] &" upon open
ZshProfilePersistence Modifies user's zsh profile to execute the specified jxa js payload. Persistence executes on zsh terminal open. ./ZshProfilePersistence [path_to_jxa_payload] [yes/no] $HOME/.zshenv If you select "yes" for hidden file creation then: $HOME/.security/apple.sh and $HOME/.security/update.sh If "no" for hidden file creation, then the on disk jxa js payload is run directly from .zshenv; If "yes" for hidden file creation then: $HOME/.security/apple.sh and sh $HOME/.security/update.sh are dropped and run; both options use "osascript [payload] &" during payload execution
CronJobPersistence Persistence using CronJobs. This script will create a hidden file (share.sh) inside of .security in the user’s home directory. You can modify the default cron job time interval 15 mins by editing the main.swift code. ./CronJobPersistence [path_to_jxa_payload] $HOME/.security/.share.sh, crontab entry sh -c echo "$(echo '*/15 * * * * cd $HOME/.security && ./.share.sh' ; crontab -l)"
iTermPersistence Persistence using the iTerm2 application startup script. Adds to the end of the application script for iTerm2 to execute our command. If the folder does not exist then one will be created. Persistence executes upon iTerm2 opening. See https://theevilbit.github.io/beyond/beyond_0002/ for more details. ./iTermAppScriptPersistence [path_to_js_jxa_payload] creates a new file at /Library/Application Support/iTerm2/Scripts/AutoLaunch/iTerm.sh osascript [path_to_app] &
LoginItemPersistence Persistence by adding an app as a Login Item ./LoginItemPersistence [app path] [true/false] Will generate a pop-up if XPC access has not yet been granted from Terminal to System Events, since this implementation leverages System Events via NSAppleScript N/A, as this uses the NSAppleScript API
SSHrcPersistence Creates an SSH rc file to execute persistence when the user logs in with SSH and if the persistence process. This concept was shared by @dade on twitter: See https://twitter.com/0xdade/status/1373145566943711235?s=20 for more details. ./SSHrcPersistence [path_to_jxa_payload] [yes/no]; note: if you select "yes", the callback will only live as long as the ssh session lasts. However, if you select "no", the callback will run independently of the ssh session and continue even after the session closes ~/.ssh/rc created and if "yes" chosen, ~/.security/apple.sh and ~/.security/update.sh also created osascript [payload]
SublimeTextAppScriptPersistence Persistence using the Sublime Text application script. Appends to the end of the application script for Sublime to execute the jxa .js payload provided on the command line when running. Persistence executes upon Sublime opening. See @theevilbit's post: https://theevilbit.github.io/posts/macos_persisting_through-application_script_files/ ./SublimeTextAppScriptPersistence [path_to_js_jxa_app] modification to append to /Applications/Sublime Text.app/Contents/MacOS/sublime.py python spawning -> osascript [payload] &
VimPluginPersistence Persistence using Vim plugins. Creates a plugin file that is executed when vim is run. ./VimPluginPersistence [path_to_js_jxa_app] $HOME/.vim/plugin/d.vim created with a command to run the provided jxa js payload osascript [payload] &
xbarPluginPersistence Creates a plugin file that is executed when xbar is opened. Concept from @bradleyjkemp ./xbarPluginPersistence [path_to_js_jxa_app] $HOME/Library/Application Support/xbar/plugins/xbarUtil.py created osascript [payload] &
You might also like...
A collection of common tools and commands used throughout the development process, customized for Kipple projects.

KippleTools A collection of common tools and commands used throughout the development process, customized for Kipple projects. ⚠️ The code in this lib

BCSwiftTor - Opinionated pure Swift controller for Tor, including full support for Swift 5.5 and Swift Concurrency

BCSwiftTor Opinionated pure Swift controller for Tor, including full support for

Swift Markdown is a Swift package for parsing, building, editing, and analyzing Markdown documents.

Swift Markdown is a Swift package for parsing, building, editing, and analyzing Markdown documents.

Swift-DocC is a documentation compiler for Swift frameworks and packages aimed at making it easy to write and publish great developer documentation.

Swift-DocC is a documentation compiler for Swift frameworks and packages aimed at making it easy to write and publish great developer docum

Cross-Platform, Protocol-Oriented Programming base library to complement the Swift Standard Library. (Pure Swift, Supports Linux)

SwiftFoundation Cross-Platform, Protocol-Oriented Programming base library to complement the Swift Standard Library. Goals Provide a cross-platform in

Swift - ✏️Swift 공부 저장소✏️

Swift 스위프트의 기초 1. Swift의 기본 2. 변수와 상수 [3. 데이터 타입 기본] [4. 데이터 타입 고급] 5. 연산자 6. 흐름 제어 7. 함수 8. 옵셔널 객체지향 프로그래밍과 스위프트 9. 구조체와 클래스 10. 프로퍼티와 메서드 11. 인스턴스 생

Swift-ndi - Swift wrapper around NewTek's NDI SDK

swift-ndi Swift wrapper around NewTek's NDI SDK. Make sure you extracted latest

SNTabBarDemo-Swift - Cool TabBar With Swift
SNTabBarDemo-Swift - Cool TabBar With Swift

SNTabBarDemo-Swift Cool TabBar How To Use // MARK: - setup private func setu

Swift-when - Expression switch support in Swift

Swift When - supporting switch expressions in Swift! What is it? Basically, it a

Owner
Cedric Owens
offensive security engineer
Cedric Owens
__.swift is a port of Underscore.js to Swift.

__.swift Now, __.swift is version 0.2.0! With the chain of methods, __.swift became more flexible and extensible. Documentation: http://lotz84.github.

Tatsuya Hirose 86 Jun 29, 2022
🥷 High-performance polyline simplification library - port of simplify.js

High-performance polyline simplification library SwiftSimplify is a tiny high-performance Swift polyline simplification library ported from Javascript

Daniele Margutti 272 Dec 15, 2022
SwiftExtensionsPlayground - This playground includes some extensions that I like to use

This playground includes some extensions that I like to use. You can find exampl

Fırat Yenidünya 0 Jan 6, 2022
WholesomeExtensions - A SPM package that provides some extensions that I like to use

WholesomeExtensions This package includes some extensions that I like to use. Yo

Fırat Yenidünya 2 Dec 30, 2022
Strong typed, autocompleted resources like images, fonts and segues in Swift projects

R.swift Get strong typed, autocompleted resources like images, fonts and segues in Swift projects Why use this? It makes your code that uses resources

Mathijs Kadijk 8.9k Jan 4, 2023
SharkUtils is a collection of Swift extensions, handy methods and syntactical sugar that we use within our iOS projects at Gymshark.

SharkUtils is a collection of Swift extensions, handy methods and syntactical sugar that we use within our iOS projects at Gymshark.

Gymshark 1 Jul 6, 2021
Useful Swift code samples, extensions, functionalities and scripts to cherry-pick and use in your projects

SwiftyPick ?? ?? Useful Swift code samples, extensions, functionalities and scripts to cherry-pick and use in your projects. Purpose The idea behind t

Manu Herrera 19 May 12, 2022
FeatureFlags.swift - Tools for easily defining feature flags for your projects

FeatureFlags.swift Tools for easily defining feature flags for your projects Int

Eric Rabil 1 Jan 31, 2022
A documentation generator for Swift projects

swift-doc A package for generating documentation for Swift projects. Given a directory of Swift files, swift-doc generates HTML or CommonMark (Markdow

SwiftDoc 1.7k Dec 6, 2022
iOS helper library that contains commonly used code in Uptech iOS projects

iOS helper library that contains commonly used code in Uptech iOS projects.

Uptech 1 Apr 1, 2022