Simulated OnePassword Extension for using 1Password app extension during development.
Simonex creates a single dylib which on load hooks via Objc's runtime into the current application under development and replaces findLoginForURLString:forViewController:sender:completion: to provide username and password with a single tap onto the 1Password icon.
Q: How to insert/change username/password within Simonex?
A: Usernames and passwords are hardcoded and found in simonex.m. Customize _credentials within viewDidLoad, recreate the dylib, and restart your application or reload the dylib to let the changes take effect.
Q: Why hardcoded usernames and passwords?
A: Very simple to move username and password between simulators and devices without worrying about sandboxes and access rights, if the dylib could be loaded, username and password could be too.
Q: How to create the simonex.dylib
?
A: Just call make
and that should do the trick.
Q: Code signing of simonex.dylib did not work, what can I do?
A: Either call make dylib
and sign manually via
codesign -f -s YOUR_CODESIGN_IDENTITY
or call
make CODESIGN_IDENTITY="Your iPhone Developer identity"
Q: How to install simonex.dylib
?
A: Via Xcode and environment variables
DYLD_INSERT_LIBRARIES="/YOUR_PATH_TO/simonex.dylib"
or lldb
exp (void *)dlopen("/YOUR_PATH_TO/simonex.dylib", 0x2)
Q: Why use a dylib with method swizzling instead of creating an iOS extension?
A: Less project overhead and very simple to use it on multiple simulators or devices without creating and installing an app exension every time.
Q: Will it run within the simulator only or on devices too?
A: Simonex runs on both simulator and devices.
Q: It doesn't run on the device/Xcode throws an error if DYLD_INSERT_LIBRARIES
is used, what can I do?
A: To use it on a device, you have to copy simonex.dylib
into the iOS application and adjust the path to the dylib accordingly.
Q: How can I automatically inject simonex.dylib
via lldb?
A: Insert following lines into your .lldbinit file.
br set -S "+[OnePasswordExtension sharedExtension]" -o true -N simonex
br command add
exp (void *)dlopen("/YOUR_PATH_TO/simonex.dylib", 0x2)
continue
DONE
To disable automatic lldb injection either delete above lines from your .lldbinit file or insert
br dis -N simonex
to temporarily disable the breakpoint and therefore the code injection.
Use it in conjunction with Trampoline to inject simonex.dylib
only for a
specific target and/or architecture.
Q: Will it affect my AppStore app in any way?
A: Nope, Simonex runs only during development, either injected via Xcode or lldb.