Failed to remote debugging on using command line `process connect connect://iOSIP:Port` - ios

I'm reading the topic is LLDB and debugserver in iOS Reverse Engineering book and encountering an error in details as below.
All configuration is well.
But when I'm using the lldb of Xcode5 or Xcode6 , the command process connect connect:iOSIP:Port showed up an error as below,
(lldb) process connect connect://10.18.136.168:1234 Assertion failed:
(pointer_byte_size == m_host_arch.GetAddressByteSize()), function
GetHostInfo, file
/SourceCache/lldb/lldb-300.2.53/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp,
line 1266. Abort trap: 6
And when I'm using the lldb of Xcode8 , the command process connect connect:iOSIP:Port showed up an error as below,
(lldb) process connect connect://10.18.136.168:1234 Process 8147
stopped
* thread #1, stop reason = signal SIGSTOP
frame #0: 0x00000001987ace0c error: memory read failed for 0x1987ace00
Environment:
macOS Sierra
Xcode 8.3.2
Xcode 6.0.1
Xcode 5.0.2
iOS 8.2 jailbroken
I've tried the lldb of three versions of Xcode using the command line process connect connect://10.18.136.168:1234, all are failed.

After a little while, I've found a solution and I want to share it here.
Solution Link: http://bbs.iosre.com/t/failed-to-remote-debugging-on-using-command-line-process-connect-connect-iosip-port/8259/4
The problem is about the architecture of the device. When I thinned debugserver using armv7s architecture and it failed to attach process.
However, there is a webpage shown pointer_byte_size == m_host_arch.GetAddressByteSize() in function GetHostInfo in linking to https://reviews.llvm.org/file/data/j3cbbw4262e57hrbundw/PHID-FILE-vojdaczcpqpc5h2sl6hl/file .
So I thinned it by using arm64 to output an new debugserver, the command as shown below
lipo -thin arm64 debugserver -output debugserver
codesign -s - --entitlements ent.plist -f debugserver
Finally, it works to my iphone 5, and to debug any app are okay and smoothly.

Related

Can not make script 'run-sonar-swift' works

I am trying to run sonar swift.
I have already sonarQube with the plugin and I can access it locally using this url http://localhost:9000 . I have installed all prerequisites that you can find here :
https://github.com/Backelite/sonar-swift
But I can't figure out what is this error when i launch run-sonar-swift.sh.
If anyone can bring me the light I would be very grateful.
Here the logs when I run in terminal command ./run-sonar-swift.sh -v :
MacBook-Air:streamus-phoenix-ios oboujaouane$ ./run-sonar-swift.sh -v
Running run-sonar-swift.sh...
Project count is [1]
Xcode project file is: Streamus.xcodeproj
Xcode workspace file is: Streamus.xcworkspace
Xcode application scheme is: Streamus Alpha
Destination simulator is: platform=iOS Simulator,name=iPhone 6,OS=11.3
Excluded paths from coverage are: .Tests.
Creating directory sonar-reports/
Running tests
+ xcodebuild clean build test -workspace Streamus.xcworkspace -scheme 'Streamus Alpha' -configuration Debug -enableCodeCoverage YES -destination 'platform=iOS Simulator,name=iPhone 6,OS=11.3' -destination-timeout 60
2018-05-12 10:34:14.031 xcodebuild[32149:775290] IDETestOperationsObserverDebug: Writing diagnostic log for test session to:
/var/folders/9v/vdbbf4j96hxgcxmtpntznytr0000gn/T/com.apple.dt.XCTest/IDETestRunSession-9A7EF764-6391-4C7D-9F34-066A9DFEC5E9/StreamusUITests-87E838E0-4F8F-4C19-B2AC-C2C0A274E8EC/Session-StreamusUITests-2018-05-12_103414-jhm3wz.log
2018-05-12 10:34:14.032 xcodebuild[32149:769805] [MT] IDETestOperationsObserverDebug: (98FB295E-FE60-46AA-8589-015B0DD2E617) Beginning test session StreamusUITests-98FB295E-FE60-46AA-8589-015B0DD2E617 at 2018-05-12 10:34:14.031 with Xcode 9E145 on target {
SimDevice: iPhone 6 (672DE879-E48B-45DA-BFD9-D0412F51A706, iOS 11.3, Booted)
} (11.3 (15E217))
2018-05-12 10:34:14.061 xcodebuild[32149:769805] [MT] IDETestOperationsObserverDebug: (458F86F6-1492-40F1-9F72-A88FC23BD985) Beginning test session StreamusTests-458F86F6-1492-40F1-9F72-A88FC23BD985 at
2018-05-12 10:34:14.061 with Xcode 9E145 on target {
SimDevice: iPhone 6 (672DE879-E48B-45DA-BFD9-D0412F51A706, iOS 11.3, Booted)
} (11.3 (15E217))
2018-05-12 10:34:14.061 xcodebuild[32149:770075] IDETestOperationsObserverDebug: Writing diagnostic log for test session to:
/var/folders/9v/vdbbf4j96hxgcxmtpntznytr0000gn/T/com.apple.dt.XCTest/IDETestRunSession-9A7EF764-6391-4C7D-9F34-066A9DFEC5E9/StreamusTests-4F203461-1372-49B7-A806-F130F168079E/Session-StreamusTests-2018-05-12_103414-MfIreE.log
2018-05-12 10:34:30.016 xcodebuild[32149:769805]
Error Domain=IDETestOperationsObserverErrorDomain Code=14 "Test operation was canceled. If you believe this error represents a bug, please attach the log file at /var/folders/9v/vdbbf4j96hxgcxmtpntznytr0000gn/T/com.apple.dt.XCTest/IDETestRunSession-9A7EF764-6391-4C7D-9F34-066A9DFEC5E9/StreamusUITests-87E838E0-4F8F-4C19-B2AC-C2C0A274E8EC/Session-StreamusUITests-2018-05-12_103414-jhm3wz.log"
UserInfo={NSLocalizedDescription=Test operation was canceled. If you believe this error represents a bug, please attach the log file at /var/folders/9v/vdbbf4j96hxgcxmtpntznytr0000gn/T/com.apple.dt.XCTest/IDETestRunSession-9A7EF764-6391-4C7D-9F34-066A9DFEC5E9/StreamusUITests-87E838E0-4F8F-4C19-B2AC-C2C0A274E8EC/Session-StreamusUITests-2018-05-12_103414-jhm3wz.log}
2018-05-12 10:34:30.016 xcodebuild[32149:769805] Error Domain=IDETestOperationsObserverErrorDomain Code=14 "Test operation was canceled. If you believe this error represents a bug, please attach the log file at /var/folders/9v/vdbbf4j96hxgcxmtpntznytr0000gn/T/com.apple.dt.XCTest/IDETestRunSession-9A7EF764-6391-4C7D-9F34-066A9DFEC5E9/StreamusTests-4F203461-1372-49B7-A806-F130F168079E/Session-StreamusTests-2018-05-12_103414-MfIreE.log" UserInfo={NSLocalizedDescription=Test operation was canceled. If you believe this error represents a bug, please attach the log file at /var/folders/9v/vdbbf4j96hxgcxmtpntznytr0000gn/T/com.apple.dt.XCTest/IDETestRunSession-9A7EF764-6391-4C7D-9F34-066A9DFEC5E9/StreamusTests-4F203461-1372-49B7-A806-F130F168079E/Session-StreamusTests-2018-05-12_103414-MfIreE.log}
Testing failed:
Linker command failed with exit code 1 (use -v to see invocation)
** TEST FAILED **
The following build commands failed:
Ld /Users/oboujaouane/Library/Developer/Xcode/DerivedData/Streamus-gwtdwpbaxrfgafdtejzjtpxyhhhq/Build/Intermediates.noindex/Streamus.build/Alpha-iphonesimulator/StreamusTests.build/Objects-normal/x86_64/StreamusTests normal x86_64
Ld /Users/oboujaouane/Library/Developer/Xcode/DerivedData/Streamus-gwtdwpbaxrfgafdtejzjtpxyhhhq/Build/Intermediates.noindex/Streamus.build/Alpha-iphonesimulator/StreamusTests.build/Objects-normal/i386/StreamusTests normal i386
(2 failures)
returnValue=65
set +x
ERROR - Command 'xcodebuild clean build test -workspace Streamus.xcworkspace -scheme Streamus Alpha -configuration Debug -enableCodeCoverage YES -destination platform=iOS Simulator,name=iPhone 6,OS=11.3 -destination-timeout 60' failed with error code: 65
In advance thank you,
It seems that error was due to provisioning profile. When I added my Provisioning Profile and try it again the problem was resolved.
Then I had another problem with MessageKit:“Segmentation fault: 11”
It was a CocoaPods Podfile config issue.
So I had to switch compilation mode for Debug from "Single File" to "Whole Module” by click on Pods in Xcode project navigator then select MessageKit in targets of pods then Builds settings tab then in searcher tap ‘compilation mode’ and switch “Single File” to “Whole Module” and re-run script run-sonar-swift.sh

⚠️ each time you make a pod install / update or something that can change pods you have to switch compilation mode for Debug from "Single File" to "Whole Module” for the pod which give you an error when you launch run-sonar.swift.sh with -v for verbose.
After that it was not yet the end of my problems! In fact I had a last problem which was an error with SwipeCellKit pod:
“No such module SwipeCellKit”.
To resolve this problem follow instructions given here https://stackoverflow.com/a/37732248/6188918
Then I tried again and the rest of the script started (SwiftLint, Tailor & Lizard) and I thought this time it was finally good but an error occurred once again a new error message at the end of the script concerning Lizard which was:
ERROR: Error during SonarQube Scanner execution
ERROR: File
MyprojectName/Domains/Repositories/Local/cacheManager.swift can't be
indexed twice. Please check that inclusion/exclusion patterns produce
disjoint sets for main and test files
ERROR: Re-run SonarQube Scanner using the -X switch to enable full
debug logging.
To resolve this inclusion/exclusion I followed the answer given here:
https://stackoverflow.com/a/40150551/6188918
by adding these to line in sonar-project.properties file below sonar.swift.excludedPathsFromCoverage line:
sonar.test.inclusions=**/*Test*/**
sonar.exclusions=**/*Test*/**
I tried again but with parameter -notailor(run script and skip Tailor):
./run-sonar-swift.sh -notailor -v
just to save a little time because tailor take time
And after launch the script... Boom a new error... But it was a known issue:
Error: Caused by: org.sonar.api.measures.PersistenceMode
And the issue is explained here https://github.com/Backelite/sonar-swift/issues/118
So I downloaded this .jar file “backelite-sonar-swift-plugin-0.4-sonar-7-quick-fix.jar” found here https://github.com/Hugal31/sonar-swift/releases/tag/0.4-sonar-7-quick-fix and replace it in plugins of my local SonarQube and try again.
…and this time after an umpteenth launch I finally saw the light 🤪💡
Hope this answer will help and if you have a question don’t hesitate.


Good luck & have fun :)
PS: You’ll find here some options to run script with parameters:
./run-sonar-swift.sh -noswiftlint -v (run script with verbose option and skip SwiftLint)
./run-sonar-swift.sh -notailor -v (run script with verbose option and skip Tailor)
./run-sonar-swift.sh -nounittests -v (if your project does not have scheme configured to be tested launch with this parameter)
If you want more info check in run-sonar-swift.sh script and check around lines 125 ## COMMAND LINE OPTIONS
PS2: I have also opened an issue in sonar-swift GitHub if it can help: https://github.com/Backelite/sonar-swift/issues/138
I had an extra issue with oclint: oclint: Not enough positional command line arguments specified!. So I had to modify the run-sonar-swift.sh script a little bit in order to get it working: https://gist.github.com/Edudjr/79a2379842357c33709aecf040d9ae77#file-run-sonar-swift-sh
And this is a model of my sonar-project.properties: https://gist.github.com/Edudjr/db51907068ea76b116d11d9a9b13f05f#file-sonar-project-properties

Flutter.io (dart) app fails to launch on iOS simulator

I have up-to-date OSX Sierra, up-to-date XCode with applicable plugins, and an iPhone 6 simulator open and ready.
I have followed all the directions at https://flutter.io/setup-macos/#ios-setup.
When I "flutter run" from Terminal, the app fails to install on the simulator with message:
Could not build the application for the simulator.
Error launching application on iPhone 6.
Here is what Terminal said...
Launching lib/main.dart on iPhone 6 in debug mode...
Running pod install... 8.5s
Running Xcode build... 24.1s
Failed to build iOS app
Error output from Xcode build:
↳
2017-11-22 13:13:38.122 xcodebuild[47659:25935636] DVTAssertions: Warning in /Library/Caches/com.apple.xbs/Sources/IDEXcode3ProjectSupport/IDEXcode3ProjectSupport-13510/Xcode3Core/LegacyProjects/Frameworks/DevToolsCore/DevToolsCore/BuildSystem/Runtime/PBXTargetBuildContext.mm:757
Details: unexpected successful exit code from cancelled command <C0009:'CpResource app.flx':P12>
Object: <PBXTargetBuildContext: 0x7fccf1235200>
Method: -createCommandInvocationRecordFromInvocation:
Thread: <NSThread: 0x7fccf2847ea0>{number = 16, name = (null)}
Please file a bug at http://bugreport.apple.com with this warning message and any useful information you can provide.
** BUILD FAILED **
The following build commands failed:
CopyPlistFile /Users/deborah/Desktop/chq_emulator/build/ios/Debug-iphonesimulator/Runner.app/GoogleService-Info.plist Runner/GoogleService-Info.plist
(1 failure)
Xcode's output:
↳
Build settings from command line:
ARCHS = x86_64
BUILD_DIR = /Users/deborah/Desktop/chq_emulator/build/ios
ONLY_ACTIVE_ARCH = YES
SDKROOT = iphonesimulator11.1
=== CLEAN TARGET leveldb-library OF PROJECT Pods WITH CONFIGURATION Debug ===
... list of subsidiary infomation ...
Could not build the application for the simulator.
Error launching application on iPhone 6.
Anyone else out there with advice for how to get Flutter going on the simulator?
Try running your Xcode first and make sure that it's up-to-date. Open the {flutter_project}/ios build on Xcode then try to run the iOS project on the Simulator from there.
If you're still having issues, you can run this command on your Terminal. This should set the path for the active developer directory.
sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer

Swift stdlib tool Error -> Task failed with exit 1 signal - IOS

I am trying to launch my developed app on my iphone and I am getting a build fail with the following error. I do not know how to address the problem. Please can someone advise? I can build the app on the simulator but not on the iphone.
error: Task failed with exit 1 signal 0 {
/usr/bin/codesign '--force' '--sign' 'CF34DF6AAC83D040CB9CA5907F171518DB7A331F' '--verbose' '/Users/johnDow/Library/Developer/Xcode/DerivedData/myApp-dfuggtbkfdkixtemtcsnzflclljy/Build/Products/Debug-iphoneos/myApp.app/Frameworks/libswiftCore.dylib'
}
Try to reset the derived Data
rm -rf /Users/johnDow/Library/Developer/Xcode/DerivedData/*
If that doesn't work I had to re install xcode AND restart computer to fix it

Appium starting IoS default Map application in iphone4S : specified target process is invalid

I am currently trying to automate (starting the Default MAP-App) on real device (Iphone4S) with Appium.
I have the following code:
def setCapabilities():
desired_caps['platformName'] = 'iOS'
desired_caps['platformVersion'] = '8.1'
desired_caps['deviceName'] = 'iPhone4s'
desired_caps['udId'] = '<phoneUDID>'
desired_caps['bundleId'] = 'com.apple.Maps'
appium_url = 'http://0.0.0.0:4723/wd/hub'
webdriver.Remote(appium_url,desired_caps)
I kept getting an exception on the Client side
"Original error: Instruments crashed on Startup" ,
and on the Server side I have the following error:
Attempting to run app on real device with UDID -phoneUDID-
"Instruments Usage Error: Specified target process is invalid:
com.apple.Maps"
Instruments exited with code 255
I made sure that the bundleId is the correct one as is defined in the Default BundleId of Iphone, however I kept getting this error. I tried different Default Iphone package (com.apple.safari, com.apple.maps), all returned the same error.
How can I start the apple maps using appium as is written in the code snippet above?
-update : it seems I Need a developer assigned certificate for the app. It means native apps are not possible to be automated (more to be found out..)
I got the same error and have found two reasons that can make this happen:
The iOS version is not compatible with your Xcode version, e.g. Xcode 7.3.1 and iOS 10.0.1.
If your iOS device runs on 9.x or higher you might have forgot to "trust an Enterprise app" (Guidelines for installing custom enterprise apps on iOS)
Just for comparison if needed, this was my trace:
[debug] [Instruments] [INST STDERR] Instruments Usage Error: Specified target process is invalid: bundleid.of.my.app
instruments, version 7.3 (60134)
usage: instruments [-t template] [-D document] [-l timeLimit] [-i #] [-w device] [[-p pid] | [application [-e variable value] [argument ...]]]
[debug] [Instruments] Instruments exited with code 255
[Instruments] Error launching instruments: Instruments crashed on startup
My device is running under v9.3.4. Xcode version is 7.3.1. Also note that both iOS v10.0.1 and Xcode 8 is not yet supported by latest stable Appium v1.5.3.

Error "Command failed with exit code 66" running ios simulator on meteor app

I am trying to run a simulation for ios of my meteor app, following all the steps:
meteor install-sdk ios
meteor add-platform ios
meteor run ios
But when I run the latter it gives me the following error:
Error while running for mobile platforms: Error running
/Users/ivanmac/.meteor/packages/meteor-
tool/.1.0.41.azxhr5++os.osx.x86_64+web.browser+web.cordova/meteor-tool-
os.osx.x86_64/tools/cordova-scripts/cordova.sh
xcodebuild: error: 'test_app.xcodeproj.xcodeproj' does not exist.
Error: /Users/ivanmac/Desktop/test_app/.meteor/local/cordova-
build/platforms/ios/cordova/build: Command failed with exit
code 66
at ChildProcess.whenDone
(/Users/ivanmac/.meteor/packages/meteor-
tool/.1.0.41.azxhr5++os.osx.x86_64+web.browser+web.cordova/meteor-tool-
os.osx.x86_64/dev_bundle/lib/node_modules/cordova/node_modules/cordova-
lib/src/cordova/superspawn.js:135:23)
at ChildProcess.emit (events.js:98:17)
at maybeClose (child_process.js:756:16)
at Process.ChildProcess._handle.onexit (child_process.js:823:5)
Running command: /Users/ivanmac/Desktop/test_app/.meteor/local/cordova-
build/platforms/ios/cordova/build
Build settings from command line:
ARCHS = i386
CONFIGURATION_BUILD_DIR =
/Users/ivanmac/Desktop/test_app/.meteor/local/cordova-
build/platforms/ios/build/emulator
SDKROOT = iphonesimulator8.1
VALID_ARCHS = i386
Only post I found on the internet talking about this was solved by changing the path, which I tried but didn't help. I'm using Meteor 1.0.3.2 and my xcode is on version 6. Does anyone have any idea of what might be happening?
Update to question
I just found out that if I run the .xcodeproj file on the cordova/ios folder manually the project runs fine, so I guess the path to look for the file to run on xcode when I run "meteor run ios" has an error.
Open platforms/ios/cordova/build and change
XCODEPROJ=$( ls "$PROJECT_PATH" | grep .xcodeproj )
PROJECT_NAME=$(basename "$XCODEPROJ" .xcodeproj)
to
XCODEPROJ=$( ls "$PROJECT_PATH" | grep --color=never .xcodeproj )
PROJECT_NAME=$(basename "$XCODEPROJ" .xcodeproj)
Source: phonegap build ios exception with HelloWorld Application

Resources