├── .gitignore ├── LICENSE ├── README.md ├── iGoat-Swift.ipa ├── iGoat-Swift ├── Podfile ├── Podfile.lock ├── iGoat-Objc-Bridging-Header.h ├── iGoat-Swift.xcodeproj │ ├── project.pbxproj │ ├── project.xcworkspace │ │ ├── contents.xcworkspacedata │ │ ├── xcshareddata │ │ │ └── IDEWorkspaceChecks.plist │ │ └── xcuserdata │ │ │ ├── anthonyg.xcuserdatad │ │ │ └── UserInterfaceState.xcuserstate │ │ │ ├── swaroop.yermalkar.xcuserdatad │ │ │ └── UserInterfaceState.xcuserstate │ │ │ └── swaroopyermalkar.xcuserdatad │ │ │ └── UserInterfaceState.xcuserstate │ └── xcuserdata │ │ ├── anthonyg.xcuserdatad │ │ ├── xcdebugger │ │ │ └── Breakpoints_v2.xcbkptlist │ │ └── xcschemes │ │ │ └── xcschememanagement.plist │ │ ├── dreamworld.xcuserdatad │ │ └── xcschemes │ │ │ └── xcschememanagement.plist │ │ ├── swaroop.yermalkar.xcuserdatad │ │ └── xcschemes │ │ │ └── xcschememanagement.plist │ │ └── swaroopyermalkar.xcuserdatad │ │ └── xcschemes │ │ └── xcschememanagement.plist ├── iGoat-Swift.xcworkspace │ ├── contents.xcworkspacedata │ ├── xcshareddata │ │ ├── IDEWorkspaceChecks.plist │ │ └── WorkspaceSettings.xcsettings │ └── xcuserdata │ │ └── dreamworld.xcuserdatad │ │ ├── UserInterfaceState.xcuserstate │ │ └── WorkspaceSettings.xcsettings ├── iGoat-Swift │ ├── AppDelegate.swift │ ├── Base.lproj │ │ ├── LaunchScreen.storyboard │ │ └── Main.storyboard │ ├── Info.plist │ ├── Resources │ │ ├── Assets.plist │ │ ├── Assets.xcassets │ │ │ ├── AppIcon.appiconset │ │ │ │ ├── Contents.json │ │ │ │ ├── igoat_icon_1_87x87.png │ │ │ │ ├── igoat_icon_2_120x120.png │ │ │ │ ├── igoat_icon_3_180x180.png │ │ │ │ └── igoat_icon_58x58.png │ │ │ ├── Contents.json │ │ │ ├── Icon.imageset │ │ │ │ ├── Contents.json │ │ │ │ ├── Icon@2x-1.png │ │ │ │ ├── Icon@2x-2.png │ │ │ │ └── Icon@2x.png │ │ │ ├── Image.imageset │ │ │ │ └── Contents.json │ │ │ ├── TouchID.imageset │ │ │ │ ├── Contents.json │ │ │ │ ├── TouchID_off.png │ │ │ │ ├── TouchID_off@2x.png │ │ │ │ └── TouchID_off@3x.png │ │ │ ├── hide.imageset │ │ │ │ ├── Contents.json │ │ │ │ ├── hide@2x-1.png │ │ │ │ ├── hide@2x-2.png │ │ │ │ └── hide@2x.png │ │ │ ├── iphone.imageset │ │ │ │ ├── Contents.json │ │ │ │ └── iphone.png │ │ │ ├── menu.imageset │ │ │ │ ├── Contents.json │ │ │ │ └── Menu2-128.png │ │ │ └── show.imageset │ │ │ │ ├── Contents.json │ │ │ │ ├── show@2x-1.png │ │ │ │ ├── show@2x-2.png │ │ │ │ └── show@2x.png │ │ ├── HTML │ │ │ ├── KRvWAssociates.html │ │ │ ├── Swaroop.html │ │ │ ├── Swaroop_Heefan.html │ │ │ ├── Swaroop_Junard.html │ │ │ ├── Swaroop_anthony.html │ │ │ ├── about.html │ │ │ ├── mansi.html │ │ │ ├── rutger.html │ │ │ └── splash.html │ │ └── Sentinel.txt │ ├── Source │ │ ├── Constants │ │ │ └── Constants.swift │ │ ├── Container │ │ │ ├── AboutCell.swift │ │ │ ├── AboutCell.xib │ │ │ ├── ExerciseDemoVC.swift │ │ │ ├── ExerciseFlowController.swift │ │ │ ├── ExerciseIntroductionVC.swift │ │ │ ├── ExercisesVC.swift │ │ │ ├── HTMLViewController.swift │ │ │ ├── HTMLViewController.xib │ │ │ ├── HintVC.swift │ │ │ └── MenuTableViewController.swift │ │ ├── Exercises │ │ │ ├── Authentication │ │ │ │ └── Remote │ │ │ │ │ ├── RemoteAuthenticationExerciseVC.swift │ │ │ │ │ └── RemoteAuthenticationExerciseVC.xib │ │ │ ├── Binary Patching │ │ │ │ ├── BinaryPatchingVC.swift │ │ │ │ └── BinaryPatchingVC.xib │ │ │ ├── Broken Cryptography │ │ │ │ └── Crypto Challenge │ │ │ │ │ ├── CryptoChallengeVC.swift │ │ │ │ │ └── CryptoChallengeVC.xib │ │ │ ├── Injection Flaws │ │ │ │ ├── SQL Injection │ │ │ │ │ ├── SQLInjectionArticlesVC.swift │ │ │ │ │ ├── SQLInjectionArticlesVC.xib │ │ │ │ │ ├── SQLInjectionExerciseVC.swift │ │ │ │ │ └── SQLInjectionExerciseVC.xib │ │ │ │ └── XSS │ │ │ │ │ ├── CrossSiteScriptingExerciseVC.swift │ │ │ │ │ └── CrossSiteScriptingExerciseVC.xib │ │ │ ├── InsecureLocalDataStorage │ │ │ │ ├── BinaryCookies │ │ │ │ │ ├── BinaryCookiesExerciseVC.swift │ │ │ │ │ └── BinaryCookiesExerciseVC.xib │ │ │ │ ├── CoreData │ │ │ │ │ ├── CoreData.xcdatamodeld │ │ │ │ │ │ └── CoreData.xcdatamodel │ │ │ │ │ │ │ └── contents │ │ │ │ │ ├── CoreDataExerciseVC.swift │ │ │ │ │ ├── CoreDataExerciseVC.xib │ │ │ │ │ └── KeychainUsage │ │ │ │ │ │ └── KeychainDumper.swift │ │ │ │ ├── CouchBase │ │ │ │ │ ├── CouchBaseExerciseVC.swift │ │ │ │ │ └── CouchBaseExerciseVC.xib │ │ │ │ ├── KeychainAnalyze │ │ │ │ │ ├── KeychainExerciseVC.swift │ │ │ │ │ ├── KeychainExerciseVC.xib │ │ │ │ │ └── KeychainPasswordItem.swift │ │ │ │ ├── KeychainUsage │ │ │ │ │ └── KeychainDumper.swift │ │ │ │ ├── NSUserDefaults │ │ │ │ │ ├── NSUserDefaultsStorageExerciseVC.swift │ │ │ │ │ └── NSUserDefaultsStorageExerciseVC.xib │ │ │ │ ├── PlistStorage │ │ │ │ │ ├── Credentials.plist │ │ │ │ │ ├── PlistStorageExerciseViewController.swift │ │ │ │ │ └── PlistStorageExerciseViewController.xib │ │ │ │ ├── Realm │ │ │ │ │ ├── RealmExerciseVC.swift │ │ │ │ │ └── RealmExerciseVC.xib │ │ │ │ ├── WebKit Cache │ │ │ │ │ ├── WebkitCacheExerciseVC.swift │ │ │ │ │ └── WebkitCacheExerciseVC.xib │ │ │ │ └── Yap │ │ │ │ │ ├── YapExerciseVC.swift │ │ │ │ │ └── YapExerciseVC.xib │ │ │ ├── Key Management │ │ │ │ ├── Hard Coded Keys │ │ │ │ │ ├── BrokenCryptographyExerciseVC.swift │ │ │ │ │ └── BrokenCryptographyExerciseVC.xib │ │ │ │ ├── Key Storage Server Side │ │ │ │ │ ├── KeyStorageServerSideVC.swift │ │ │ │ │ └── KeyStorageServerSideVC.xib │ │ │ │ └── Random Key Generation │ │ │ │ │ ├── RandomKeyGenerationExerciseVC.swift │ │ │ │ │ └── RandomKeyGenerationExerciseVC.xib │ │ │ ├── Memory Management │ │ │ │ ├── MemoryManagementVC.swift │ │ │ │ └── MemoryManagementVC.xib │ │ │ ├── Reverse Engineering │ │ │ │ ├── StringAnalysisExerciseVC.swift │ │ │ │ └── StringAnalysisExerciseVC.xib │ │ │ ├── Runtime Analysis │ │ │ │ ├── BruteForce attack │ │ │ │ │ ├── BruteForceRuntimeVC.swift │ │ │ │ │ └── BruteForceRuntimeVC.xib │ │ │ │ └── Runtime Challenge │ │ │ │ │ ├── RuntimeAnalysisChallengeVC.swift │ │ │ │ │ └── RuntimeAnalysisChallengeVC.xib │ │ │ ├── Server Communication │ │ │ │ ├── ServerCommunicationExerciseVC.swift │ │ │ │ └── ServerCommunicationExerciseVC.xib │ │ │ ├── SideChannelDataLeaks │ │ │ │ ├── Backgrounding │ │ │ │ │ ├── BackgroundingExerciseVC.swift │ │ │ │ │ └── BackgroundingExerciseVC.xib │ │ │ │ ├── CloudMisconfiguration │ │ │ │ │ ├── CloudMisconfigurationExerciseVC.swift │ │ │ │ │ └── CloudMisconfigurationExerciseVC.xib │ │ │ │ ├── CutNPaste │ │ │ │ │ ├── CutAndPasteExerciseVC.swift │ │ │ │ │ └── CutAndPasteExerciseVC.xib │ │ │ │ ├── DeviceLogs │ │ │ │ │ ├── DeviceLogsExerciseVC.swift │ │ │ │ │ └── DeviceLogsExerciseVC.xib │ │ │ │ └── KeyStroke │ │ │ │ │ ├── KeystrokeLoggingExerciseVC.swift │ │ │ │ │ └── KeystrokeLoggingExerciseVC.xib │ │ │ ├── Social Engineering │ │ │ │ ├── SocialEngineeringVC.swift │ │ │ │ └── SocialEngineeringVC.xib │ │ │ ├── Tampering │ │ │ │ ├── MethodSwizzlingExerciseVC.swift │ │ │ │ └── MethodSwizzlingExerciseVC.xib │ │ │ └── URL Scheme │ │ │ │ ├── URLSchemeAttackExerciseVC.swift │ │ │ │ └── URLSchemeAttackExerciseVC.xib │ │ ├── Extensions │ │ │ ├── Data+Extension.swift │ │ │ ├── NSObject+Extension.swift │ │ │ ├── NSString+Extension.swift │ │ │ ├── StatusBarView+Extension.swift │ │ │ ├── UIAlertController+Extension.swift │ │ │ ├── UIAplication+Extension.swift │ │ │ ├── UIStoryBoard+Extension.swift │ │ │ ├── UITableViewCell+Extension.swift │ │ │ ├── UIView+Extension.swift │ │ │ ├── UIViewController+Extension.swift │ │ │ └── URL+Extension.swift │ │ ├── External │ │ │ ├── Gif │ │ │ │ ├── UIImage+animatedGIF.h │ │ │ │ └── UIImage+animatedGIF.m │ │ │ ├── SVProgressHUD │ │ │ │ ├── SVIndefiniteAnimatedView.h │ │ │ │ ├── SVIndefiniteAnimatedView.m │ │ │ │ ├── SVProgressAnimatedView.h │ │ │ │ ├── SVProgressAnimatedView.m │ │ │ │ ├── SVProgressHUD-Prefix.pch │ │ │ │ ├── SVProgressHUD.bundle │ │ │ │ │ ├── angle-mask.png │ │ │ │ │ ├── angle-mask@2x.png │ │ │ │ │ ├── angle-mask@3x.png │ │ │ │ │ ├── error.png │ │ │ │ │ ├── error@2x.png │ │ │ │ │ ├── error@3x.png │ │ │ │ │ ├── info.png │ │ │ │ │ ├── info@2x.png │ │ │ │ │ ├── info@3x.png │ │ │ │ │ ├── success.png │ │ │ │ │ ├── success@2x.png │ │ │ │ │ └── success@3x.png │ │ │ │ ├── SVProgressHUD.h │ │ │ │ ├── SVProgressHUD.m │ │ │ │ ├── SVRadialGradientLayer.h │ │ │ │ └── SVRadialGradientLayer.m │ │ │ └── SideBar │ │ │ │ ├── CenterContainmentSegue.swift │ │ │ │ ├── SideContainmentSegue.swift │ │ │ │ ├── SideMenuController+CustomTypes.swift │ │ │ │ ├── SideMenuController+SideOver.swift │ │ │ │ ├── SideMenuController+SideUnder.swift │ │ │ │ ├── SideMenuController.h │ │ │ │ ├── SideMenuController.swift │ │ │ │ ├── TransitionAnimator.swift │ │ │ │ └── UIKitExtensions.swift │ │ └── Model │ │ │ ├── Asset.swift │ │ │ └── Exercise.swift │ ├── ThirdParty │ │ ├── CocoaLumberjack │ │ │ ├── CLI │ │ │ │ ├── CLIColor.h │ │ │ │ └── CLIColor.m │ │ │ ├── DDASLLogCapture.h │ │ │ ├── DDASLLogCapture.m │ │ │ ├── DDASLLogger.h │ │ │ ├── DDASLLogger.m │ │ │ ├── DDAbstractDatabaseLogger.h │ │ │ ├── DDAbstractDatabaseLogger.m │ │ │ ├── DDFileLogger.h │ │ │ ├── DDFileLogger.m │ │ │ ├── DDLog+LOGV.h │ │ │ ├── DDLog.h │ │ │ ├── DDLog.m │ │ │ ├── DDTTYLogger.h │ │ │ ├── DDTTYLogger.m │ │ │ └── Extensions │ │ │ │ ├── DDContextFilterLogFormatter.h │ │ │ │ ├── DDContextFilterLogFormatter.m │ │ │ │ ├── DDDispatchQueueLogFormatter.h │ │ │ │ ├── DDDispatchQueueLogFormatter.m │ │ │ │ ├── DDMultiFormatter.h │ │ │ │ ├── DDMultiFormatter.m │ │ │ │ └── README.txt │ │ ├── CouchBase │ │ │ └── CouchbaseLite.framework │ │ │ │ ├── CouchbaseLite │ │ │ │ ├── Headers │ │ │ │ ├── CBLAttachment.h │ │ │ │ ├── CBLAuthenticator+OpenID.h │ │ │ │ ├── CBLAuthenticator.h │ │ │ │ ├── CBLBase.h │ │ │ │ ├── CBLDatabase.h │ │ │ │ ├── CBLDatabaseChange.h │ │ │ │ ├── CBLDocument.h │ │ │ │ ├── CBLDynamicObject.h │ │ │ │ ├── CBLGeometry.h │ │ │ │ ├── CBLJSON.h │ │ │ │ ├── CBLManager.h │ │ │ │ ├── CBLModel.h │ │ │ │ ├── CBLModelFactory.h │ │ │ │ ├── CBLQuery+FullTextSearch.h │ │ │ │ ├── CBLQuery+Geo.h │ │ │ │ ├── CBLQuery.h │ │ │ │ ├── CBLQueryBuilder.h │ │ │ │ ├── CBLReplication.h │ │ │ │ ├── CBLRevision.h │ │ │ │ ├── CBLUITableSource.h │ │ │ │ ├── CBLView.h │ │ │ │ └── CouchbaseLite.h │ │ │ │ └── Info.plist │ │ └── YapDatabase │ │ │ ├── Extensions │ │ │ ├── CloudKit │ │ │ │ ├── Internal │ │ │ │ │ ├── YDBCKAttachRequest.h │ │ │ │ │ ├── YDBCKAttachRequest.m │ │ │ │ │ ├── YDBCKChangeQueue.h │ │ │ │ │ ├── YDBCKChangeQueue.m │ │ │ │ │ ├── YDBCKChangeRecord.h │ │ │ │ │ ├── YDBCKChangeRecord.m │ │ │ │ │ ├── YDBCKMappingTableInfo.h │ │ │ │ │ ├── YDBCKMappingTableInfo.m │ │ │ │ │ ├── YDBCKRecordTableInfo.h │ │ │ │ │ ├── YDBCKRecordTableInfo.m │ │ │ │ │ └── YapDatabaseCloudKitPrivate.h │ │ │ │ ├── Utilities │ │ │ │ │ ├── YDBCKChangeSet.h │ │ │ │ │ ├── YDBCKChangeSet.m │ │ │ │ │ ├── YDBCKMergeInfo.h │ │ │ │ │ ├── YDBCKMergeInfo.m │ │ │ │ │ ├── YDBCKRecord.h │ │ │ │ │ ├── YDBCKRecord.m │ │ │ │ │ ├── YDBCKRecordInfo.h │ │ │ │ │ └── YDBCKRecordInfo.m │ │ │ │ ├── YapDatabaseCloudKit.h │ │ │ │ ├── YapDatabaseCloudKit.m │ │ │ │ ├── YapDatabaseCloudKitConnection.h │ │ │ │ ├── YapDatabaseCloudKitConnection.m │ │ │ │ ├── YapDatabaseCloudKitOptions.h │ │ │ │ ├── YapDatabaseCloudKitOptions.m │ │ │ │ ├── YapDatabaseCloudKitTransaction.h │ │ │ │ ├── YapDatabaseCloudKitTransaction.m │ │ │ │ ├── YapDatabaseCloudKitTypes.h │ │ │ │ └── YapDatabaseCloudKitTypes.m │ │ │ ├── FilteredViews │ │ │ │ ├── Internal │ │ │ │ │ └── YapDatabaseFilteredViewPrivate.h │ │ │ │ ├── YapDatabaseFilteredView.h │ │ │ │ ├── YapDatabaseFilteredView.m │ │ │ │ ├── YapDatabaseFilteredViewConnection.h │ │ │ │ ├── YapDatabaseFilteredViewConnection.m │ │ │ │ ├── YapDatabaseFilteredViewTransaction.h │ │ │ │ ├── YapDatabaseFilteredViewTransaction.m │ │ │ │ ├── YapDatabaseFilteredViewTypes.h │ │ │ │ └── YapDatabaseFilteredViewTypes.m │ │ │ ├── FullTextSearch │ │ │ │ ├── Internal │ │ │ │ │ └── YapDatabaseFullTextSearchPrivate.h │ │ │ │ ├── YapDatabaseFullTextSearch.h │ │ │ │ ├── YapDatabaseFullTextSearch.m │ │ │ │ ├── YapDatabaseFullTextSearchConnection.h │ │ │ │ ├── YapDatabaseFullTextSearchConnection.m │ │ │ │ ├── YapDatabaseFullTextSearchHandler.h │ │ │ │ ├── YapDatabaseFullTextSearchHandler.m │ │ │ │ ├── YapDatabaseFullTextSearchSnippetOptions.h │ │ │ │ ├── YapDatabaseFullTextSearchSnippetOptions.m │ │ │ │ ├── YapDatabaseFullTextSearchTransaction.h │ │ │ │ └── YapDatabaseFullTextSearchTransaction.m │ │ │ ├── Hooks │ │ │ │ ├── Internal │ │ │ │ │ └── YapDatabaseHooksPrivate.h │ │ │ │ ├── YapDatabaseHooks.h │ │ │ │ ├── YapDatabaseHooks.m │ │ │ │ ├── YapDatabaseHooksConnection.h │ │ │ │ ├── YapDatabaseHooksConnection.m │ │ │ │ ├── YapDatabaseHooksTransaction.h │ │ │ │ └── YapDatabaseHooksTransaction.m │ │ │ ├── Protocol │ │ │ │ ├── Internal │ │ │ │ │ └── YapDatabaseExtensionPrivate.h │ │ │ │ ├── YapDatabaseExtension.h │ │ │ │ ├── YapDatabaseExtension.m │ │ │ │ ├── YapDatabaseExtensionConnection.h │ │ │ │ ├── YapDatabaseExtensionConnection.m │ │ │ │ ├── YapDatabaseExtensionTransaction.h │ │ │ │ └── YapDatabaseExtensionTransaction.m │ │ │ ├── Relationships │ │ │ │ ├── Internal │ │ │ │ │ ├── YapDatabaseRelationshipEdgePrivate.h │ │ │ │ │ └── YapDatabaseRelationshipPrivate.h │ │ │ │ ├── YapDatabaseRelationship.h │ │ │ │ ├── YapDatabaseRelationship.m │ │ │ │ ├── YapDatabaseRelationshipConnection.h │ │ │ │ ├── YapDatabaseRelationshipConnection.m │ │ │ │ ├── YapDatabaseRelationshipEdge.h │ │ │ │ ├── YapDatabaseRelationshipEdge.m │ │ │ │ ├── YapDatabaseRelationshipNode.h │ │ │ │ ├── YapDatabaseRelationshipOptions.h │ │ │ │ ├── YapDatabaseRelationshipOptions.m │ │ │ │ ├── YapDatabaseRelationshipTransaction.h │ │ │ │ └── YapDatabaseRelationshipTransaction.m │ │ │ ├── SearchResults │ │ │ │ ├── Internal │ │ │ │ │ └── YapDatabaseSearchResultsViewPrivate.h │ │ │ │ ├── YapDatabaseSearchQueue.h │ │ │ │ ├── YapDatabaseSearchQueue.m │ │ │ │ ├── YapDatabaseSearchQueuePrivate.h │ │ │ │ ├── YapDatabaseSearchResultsView.h │ │ │ │ ├── YapDatabaseSearchResultsView.m │ │ │ │ ├── YapDatabaseSearchResultsViewConnection.h │ │ │ │ ├── YapDatabaseSearchResultsViewConnection.m │ │ │ │ ├── YapDatabaseSearchResultsViewOptions.h │ │ │ │ ├── YapDatabaseSearchResultsViewOptions.m │ │ │ │ ├── YapDatabaseSearchResultsViewTransaction.h │ │ │ │ └── YapDatabaseSearchResultsViewTransaction.m │ │ │ ├── SecondaryIndex │ │ │ │ ├── Internal │ │ │ │ │ └── YapDatabaseSecondaryIndexPrivate.h │ │ │ │ ├── YapDatabaseSecondaryIndex.h │ │ │ │ ├── YapDatabaseSecondaryIndex.m │ │ │ │ ├── YapDatabaseSecondaryIndexConnection.h │ │ │ │ ├── YapDatabaseSecondaryIndexConnection.m │ │ │ │ ├── YapDatabaseSecondaryIndexHandler.h │ │ │ │ ├── YapDatabaseSecondaryIndexHandler.m │ │ │ │ ├── YapDatabaseSecondaryIndexOptions.h │ │ │ │ ├── YapDatabaseSecondaryIndexOptions.m │ │ │ │ ├── YapDatabaseSecondaryIndexSetup.h │ │ │ │ ├── YapDatabaseSecondaryIndexSetup.m │ │ │ │ ├── YapDatabaseSecondaryIndexTransaction.h │ │ │ │ └── YapDatabaseSecondaryIndexTransaction.m │ │ │ └── Views │ │ │ │ ├── Internal │ │ │ │ ├── YapDatabaseViewChangePrivate.h │ │ │ │ ├── YapDatabaseViewMappingsPrivate.h │ │ │ │ ├── YapDatabaseViewPage.h │ │ │ │ ├── YapDatabaseViewPage.mm │ │ │ │ ├── YapDatabaseViewPageMetadata.h │ │ │ │ ├── YapDatabaseViewPageMetadata.m │ │ │ │ ├── YapDatabaseViewPrivate.h │ │ │ │ ├── YapDatabaseViewRangeOptionsPrivate.h │ │ │ │ ├── YapDatabaseViewState.h │ │ │ │ └── YapDatabaseViewState.m │ │ │ │ ├── Utilities │ │ │ │ ├── YapDatabaseViewChange.h │ │ │ │ ├── YapDatabaseViewChange.m │ │ │ │ ├── YapDatabaseViewMappings.h │ │ │ │ ├── YapDatabaseViewMappings.m │ │ │ │ ├── YapDatabaseViewRangeOptions.h │ │ │ │ └── YapDatabaseViewRangeOptions.m │ │ │ │ ├── YapDatabaseView.h │ │ │ │ ├── YapDatabaseView.m │ │ │ │ ├── YapDatabaseViewConnection.h │ │ │ │ ├── YapDatabaseViewConnection.m │ │ │ │ ├── YapDatabaseViewOptions.h │ │ │ │ ├── YapDatabaseViewOptions.m │ │ │ │ ├── YapDatabaseViewTransaction.h │ │ │ │ ├── YapDatabaseViewTransaction.m │ │ │ │ ├── YapDatabaseViewTypes.h │ │ │ │ └── YapDatabaseViewTypes.m │ │ │ ├── Internal │ │ │ ├── NSDictionary+YapDatabase.h │ │ │ ├── NSDictionary+YapDatabase.m │ │ │ ├── YapDatabaseConnectionDefaults.h │ │ │ ├── YapDatabaseConnectionDefaults.m │ │ │ ├── YapDatabaseConnectionState.h │ │ │ ├── YapDatabaseConnectionState.m │ │ │ ├── YapDatabaseLogging.h │ │ │ ├── YapDatabaseLogging.m │ │ │ ├── YapDatabaseManager.h │ │ │ ├── YapDatabaseManager.m │ │ │ ├── YapDatabasePrivate.h │ │ │ ├── YapDatabaseStatement.h │ │ │ ├── YapDatabaseStatement.m │ │ │ ├── YapDatabaseString.h │ │ │ ├── YapDebugDictionary.h │ │ │ ├── YapDebugDictionary.m │ │ │ ├── YapMemoryTable.h │ │ │ ├── YapMemoryTable.m │ │ │ ├── YapNull.h │ │ │ ├── YapNull.m │ │ │ ├── YapRowidSet.h │ │ │ ├── YapRowidSet.mm │ │ │ ├── YapTouch.h │ │ │ └── YapTouch.m │ │ │ ├── Utilities │ │ │ ├── YapCache.h │ │ │ ├── YapCache.m │ │ │ ├── YapCollectionKey.h │ │ │ ├── YapCollectionKey.m │ │ │ ├── YapDatabaseQuery.h │ │ │ ├── YapDatabaseQuery.m │ │ │ ├── YapMurmurHash.h │ │ │ ├── YapMurmurHash.m │ │ │ ├── YapSet.h │ │ │ ├── YapSet.m │ │ │ ├── YapWhitelistBlacklist.h │ │ │ └── YapWhitelistBlacklist.m │ │ │ ├── YapDatabase.h │ │ │ ├── YapDatabase.m │ │ │ ├── YapDatabaseConnection.h │ │ │ ├── YapDatabaseConnection.m │ │ │ ├── YapDatabaseOptions.h │ │ │ ├── YapDatabaseOptions.m │ │ │ ├── YapDatabaseTransaction.h │ │ │ └── YapDatabaseTransaction.m │ ├── maxpower.c │ └── maxpower.h └── iGoat-SwiftTests │ ├── Info.plist │ └── iGoat_SwiftTests.swift └── server ├── README ├── docker_packaging ├── .gitignore ├── docker-compose.yaml ├── docker-igoat │ ├── Dockerfile │ └── startup.sh └── iGoat.sh ├── hostileSSLServer.crt ├── hostileSSLServer.private.key ├── iGoat-Server-challenges ├── Dockerfile ├── README └── myapp │ ├── SimpleRest.php │ ├── check_php_ini.php │ ├── checkout.php │ ├── cryptoKey.php │ ├── index.php │ ├── new404.php │ └── webkit.php ├── igoat_server.rb ├── legitimateServers.crt ├── legitimateServers.private.key ├── test_client.sh └── test_json.txt /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | Pods/ -------------------------------------------------------------------------------- /iGoat-Swift.ipa: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OWASP/iGoat-Swift/1f44c0826556ae3a44b92ba68fc64cdc4c993b03/iGoat-Swift.ipa -------------------------------------------------------------------------------- /iGoat-Swift/Podfile: -------------------------------------------------------------------------------- 1 | # Uncomment the next line to define a global platform for your project 2 | # platform :ios, '9.0' 3 | 4 | target 'iGoat-Swift' do 5 | # Comment the next line if you don't want to use dynamic frameworks 6 | use_frameworks! 7 | 8 | # Pods for iGoat-Swift 9 | pod 'RealmSwift', '10.7.6' 10 | # pod 'CouchbaseLite-Swift', '3.0.0' 11 | # pod 'CouchbaseLite', '2.5.0' 12 | 13 | target 'iGoat-SwiftTests' do 14 | inherit! :search_paths 15 | # Pods for testing 16 | end 17 | 18 | end 19 | -------------------------------------------------------------------------------- /iGoat-Swift/Podfile.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - Realm (10.7.6): 3 | - Realm/Headers (= 10.7.6) 4 | - Realm/Headers (10.7.6) 5 | - RealmSwift (10.7.6): 6 | - Realm (= 10.7.6) 7 | 8 | DEPENDENCIES: 9 | - RealmSwift (= 10.7.6) 10 | 11 | SPEC REPOS: 12 | trunk: 13 | - Realm 14 | - RealmSwift 15 | 16 | SPEC CHECKSUMS: 17 | Realm: ed860452717c8db8f4bf832b6807f7f2ce708839 18 | RealmSwift: e31c4ddbcc42ac879313d656b86f9ca539f6f4f4 19 | 20 | PODFILE CHECKSUM: f212cc9a572903ecd384ba7a18ba8c8726aaacb8 21 | 22 | COCOAPODS: 1.11.3 23 | -------------------------------------------------------------------------------- /iGoat-Swift/iGoat-Objc-Bridging-Header.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef iGoat_Objc_Bridging_Header_h 3 | #define iGoat_Objc_Bridging_Header_h 4 | 5 | 6 | #endif /* iGoat_Objc_Bridging_Header_h */ 7 | 8 | 9 | #import "UIImage+animatedGIF.h" 10 | #import "SVProgressHUD.h" 11 | #import 12 | #import 13 | #import 14 | //#import 15 | #import 16 | 17 | 18 | char *do_it(void); 19 | -------------------------------------------------------------------------------- /iGoat-Swift/iGoat-Swift.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /iGoat-Swift/iGoat-Swift.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /iGoat-Swift/iGoat-Swift.xcodeproj/project.xcworkspace/xcuserdata/anthonyg.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OWASP/iGoat-Swift/1f44c0826556ae3a44b92ba68fc64cdc4c993b03/iGoat-Swift/iGoat-Swift.xcodeproj/project.xcworkspace/xcuserdata/anthonyg.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /iGoat-Swift/iGoat-Swift.xcodeproj/project.xcworkspace/xcuserdata/swaroop.yermalkar.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OWASP/iGoat-Swift/1f44c0826556ae3a44b92ba68fc64cdc4c993b03/iGoat-Swift/iGoat-Swift.xcodeproj/project.xcworkspace/xcuserdata/swaroop.yermalkar.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /iGoat-Swift/iGoat-Swift.xcodeproj/project.xcworkspace/xcuserdata/swaroopyermalkar.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OWASP/iGoat-Swift/1f44c0826556ae3a44b92ba68fc64cdc4c993b03/iGoat-Swift/iGoat-Swift.xcodeproj/project.xcworkspace/xcuserdata/swaroopyermalkar.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /iGoat-Swift/iGoat-Swift.xcodeproj/xcuserdata/anthonyg.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 8 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /iGoat-Swift/iGoat-Swift.xcodeproj/xcuserdata/anthonyg.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | iGoat-Swift.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /iGoat-Swift/iGoat-Swift.xcodeproj/xcuserdata/dreamworld.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | iGoat-Swift.xcscheme_^#shared#^_ 8 | 9 | orderHint 10 | 4 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /iGoat-Swift/iGoat-Swift.xcodeproj/xcuserdata/swaroop.yermalkar.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | iGoat-Swift.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /iGoat-Swift/iGoat-Swift.xcodeproj/xcuserdata/swaroopyermalkar.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | iGoat-Swift.xcscheme_^#shared#^_ 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /iGoat-Swift/iGoat-Swift.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /iGoat-Swift/iGoat-Swift.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /iGoat-Swift/iGoat-Swift.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PreviewsEnabled 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /iGoat-Swift/iGoat-Swift.xcworkspace/xcuserdata/dreamworld.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OWASP/iGoat-Swift/1f44c0826556ae3a44b92ba68fc64cdc4c993b03/iGoat-Swift/iGoat-Swift.xcworkspace/xcuserdata/dreamworld.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /iGoat-Swift/iGoat-Swift.xcworkspace/xcuserdata/dreamworld.xcuserdatad/WorkspaceSettings.xcsettings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | BuildLocationStyle 6 | UseAppPreferences 7 | CustomBuildLocationType 8 | RelativeToDerivedData 9 | DerivedDataLocationStyle 10 | Default 11 | IssueFilterStyle 12 | ShowActiveSchemeOnly 13 | LiveSourceIssuesEnabled 14 | 15 | ShowSharedSchemesAutomaticallyEnabled 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /iGoat-Swift/iGoat-Swift/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | 2 | //TODO: Comment 3 | 4 | import UIKit 5 | 6 | @UIApplicationMain 7 | class AppDelegate: UIResponder, UIApplicationDelegate { 8 | var window: UIWindow? 9 | 10 | func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool { 11 | configureSideMenu() 12 | configureRootController() 13 | return true 14 | } 15 | 16 | func application(_ app: UIApplication, open url: URL, 17 | options: [UIApplicationOpenURLOptionsKey : Any] = [:]) -> Bool { 18 | if url.scheme?.caseInsensitiveCompare("igoat") == .orderedSame, 19 | let queryInfo = url.parmetersInfo 20 | { 21 | let mobileNo = queryInfo["contactNumber"] ?? "" 22 | let message = queryInfo["message"] ?? "" 23 | UIAlertController.showAlertWith(title: "iGoat", message: "Message \"\(message)\" sent to \(mobileNo)") 24 | return true 25 | } 26 | return false 27 | } 28 | } 29 | 30 | extension AppDelegate { 31 | func configureRootController() { 32 | self.window = UIWindow() 33 | let menuTC = MenuTableViewController() 34 | let sideMenuViewController = SideMenuController() 35 | sideMenuViewController.embed(sideViewController: menuTC) 36 | menuTC.assets = Asset.allAssets() 37 | window?.rootViewController = sideMenuViewController 38 | window?.makeKeyAndVisible() 39 | } 40 | 41 | func configureSideMenu() { 42 | SideMenuController.preferences.drawing.menuButtonImage = UIImage(named: "menu") 43 | SideMenuController.preferences.drawing.sidePanelPosition = .underCenterPanelLeft 44 | SideMenuController.preferences.drawing.sidePanelWidth = 300 45 | SideMenuController.preferences.drawing.centerPanelShadow = true 46 | SideMenuController.preferences.animating.statusBarBehaviour = .horizontalPan 47 | SideMenuController.preferences.animating.transitionAnimator = FadeAnimator.self 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /iGoat-Swift/iGoat-Swift/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /iGoat-Swift/iGoat-Swift/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleURLTypes 20 | 21 | 22 | CFBundleTypeRole 23 | Editor 24 | CFBundleURLName 25 | com.iGoat.myCompany 26 | CFBundleURLSchemes 27 | 28 | iGoat 29 | 30 | 31 | 32 | CFBundleVersion 33 | 1 34 | LSRequiresIPhoneOS 35 | 36 | NSAppTransportSecurity 37 | 38 | NSAllowsArbitraryLoads 39 | 40 | 41 | NSFaceIDUsageDescription 42 | iGoat would like to use FaceID to authenticate you. 43 | UILaunchStoryboardName 44 | LaunchScreen 45 | UIRequiredDeviceCapabilities 46 | 47 | armv7 48 | 49 | UISupportedInterfaceOrientations 50 | 51 | UIInterfaceOrientationPortrait 52 | 53 | UISupportedInterfaceOrientations~ipad 54 | 55 | UIInterfaceOrientationPortrait 56 | UIInterfaceOrientationPortraitUpsideDown 57 | UIInterfaceOrientationLandscapeLeft 58 | UIInterfaceOrientationLandscapeRight 59 | 60 | 61 | 62 | -------------------------------------------------------------------------------- /iGoat-Swift/iGoat-Swift/Resources/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "20x20", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "20x20", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "size" : "29x29", 15 | "idiom" : "iphone", 16 | "filename" : "igoat_icon_58x58.png", 17 | "scale" : "2x" 18 | }, 19 | { 20 | "size" : "29x29", 21 | "idiom" : "iphone", 22 | "filename" : "igoat_icon_1_87x87.png", 23 | "scale" : "3x" 24 | }, 25 | { 26 | "idiom" : "iphone", 27 | "size" : "40x40", 28 | "scale" : "2x" 29 | }, 30 | { 31 | "idiom" : "iphone", 32 | "size" : "40x40", 33 | "scale" : "3x" 34 | }, 35 | { 36 | "size" : "60x60", 37 | "idiom" : "iphone", 38 | "filename" : "igoat_icon_2_120x120.png", 39 | "scale" : "2x" 40 | }, 41 | { 42 | "size" : "60x60", 43 | "idiom" : "iphone", 44 | "filename" : "igoat_icon_3_180x180.png", 45 | "scale" : "3x" 46 | }, 47 | { 48 | "idiom" : "ipad", 49 | "size" : "20x20", 50 | "scale" : "1x" 51 | }, 52 | { 53 | "idiom" : "ipad", 54 | "size" : "20x20", 55 | "scale" : "2x" 56 | }, 57 | { 58 | "idiom" : "ipad", 59 | "size" : "29x29", 60 | "scale" : "1x" 61 | }, 62 | { 63 | "idiom" : "ipad", 64 | "size" : "29x29", 65 | "scale" : "2x" 66 | }, 67 | { 68 | "idiom" : "ipad", 69 | "size" : "40x40", 70 | "scale" : "1x" 71 | }, 72 | { 73 | "idiom" : "ipad", 74 | "size" : "40x40", 75 | "scale" : "2x" 76 | }, 77 | { 78 | "idiom" : "ipad", 79 | "size" : "76x76", 80 | "scale" : "1x" 81 | }, 82 | { 83 | "idiom" : "ipad", 84 | "size" : "76x76", 85 | "scale" : "2x" 86 | }, 87 | { 88 | "idiom" : "ipad", 89 | "size" : "83.5x83.5", 90 | "scale" : "2x" 91 | }, 92 | { 93 | "idiom" : "ios-marketing", 94 | "size" : "1024x1024", 95 | "scale" : "1x" 96 | } 97 | ], 98 | "info" : { 99 | "version" : 1, 100 | "author" : "xcode" 101 | } 102 | } -------------------------------------------------------------------------------- /iGoat-Swift/iGoat-Swift/Resources/Assets.xcassets/AppIcon.appiconset/igoat_icon_1_87x87.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OWASP/iGoat-Swift/1f44c0826556ae3a44b92ba68fc64cdc4c993b03/iGoat-Swift/iGoat-Swift/Resources/Assets.xcassets/AppIcon.appiconset/igoat_icon_1_87x87.png -------------------------------------------------------------------------------- /iGoat-Swift/iGoat-Swift/Resources/Assets.xcassets/AppIcon.appiconset/igoat_icon_2_120x120.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OWASP/iGoat-Swift/1f44c0826556ae3a44b92ba68fc64cdc4c993b03/iGoat-Swift/iGoat-Swift/Resources/Assets.xcassets/AppIcon.appiconset/igoat_icon_2_120x120.png -------------------------------------------------------------------------------- /iGoat-Swift/iGoat-Swift/Resources/Assets.xcassets/AppIcon.appiconset/igoat_icon_3_180x180.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OWASP/iGoat-Swift/1f44c0826556ae3a44b92ba68fc64cdc4c993b03/iGoat-Swift/iGoat-Swift/Resources/Assets.xcassets/AppIcon.appiconset/igoat_icon_3_180x180.png -------------------------------------------------------------------------------- /iGoat-Swift/iGoat-Swift/Resources/Assets.xcassets/AppIcon.appiconset/igoat_icon_58x58.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OWASP/iGoat-Swift/1f44c0826556ae3a44b92ba68fc64cdc4c993b03/iGoat-Swift/iGoat-Swift/Resources/Assets.xcassets/AppIcon.appiconset/igoat_icon_58x58.png -------------------------------------------------------------------------------- /iGoat-Swift/iGoat-Swift/Resources/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /iGoat-Swift/iGoat-Swift/Resources/Assets.xcassets/Icon.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "Icon@2x-2.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "filename" : "Icon@2x.png", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "filename" : "Icon@2x-1.png", 16 | "scale" : "3x" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } -------------------------------------------------------------------------------- /iGoat-Swift/iGoat-Swift/Resources/Assets.xcassets/Icon.imageset/Icon@2x-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OWASP/iGoat-Swift/1f44c0826556ae3a44b92ba68fc64cdc4c993b03/iGoat-Swift/iGoat-Swift/Resources/Assets.xcassets/Icon.imageset/Icon@2x-1.png -------------------------------------------------------------------------------- /iGoat-Swift/iGoat-Swift/Resources/Assets.xcassets/Icon.imageset/Icon@2x-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OWASP/iGoat-Swift/1f44c0826556ae3a44b92ba68fc64cdc4c993b03/iGoat-Swift/iGoat-Swift/Resources/Assets.xcassets/Icon.imageset/Icon@2x-2.png -------------------------------------------------------------------------------- /iGoat-Swift/iGoat-Swift/Resources/Assets.xcassets/Icon.imageset/Icon@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OWASP/iGoat-Swift/1f44c0826556ae3a44b92ba68fc64cdc4c993b03/iGoat-Swift/iGoat-Swift/Resources/Assets.xcassets/Icon.imageset/Icon@2x.png -------------------------------------------------------------------------------- /iGoat-Swift/iGoat-Swift/Resources/Assets.xcassets/Image.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "scale" : "2x" 10 | }, 11 | { 12 | "idiom" : "universal", 13 | "scale" : "3x" 14 | } 15 | ], 16 | "info" : { 17 | "version" : 1, 18 | "author" : "xcode" 19 | } 20 | } -------------------------------------------------------------------------------- /iGoat-Swift/iGoat-Swift/Resources/Assets.xcassets/TouchID.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "TouchID_off.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "filename" : "TouchID_off@2x.png", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "filename" : "TouchID_off@3x.png", 16 | "scale" : "3x" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } -------------------------------------------------------------------------------- /iGoat-Swift/iGoat-Swift/Resources/Assets.xcassets/TouchID.imageset/TouchID_off.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OWASP/iGoat-Swift/1f44c0826556ae3a44b92ba68fc64cdc4c993b03/iGoat-Swift/iGoat-Swift/Resources/Assets.xcassets/TouchID.imageset/TouchID_off.png -------------------------------------------------------------------------------- /iGoat-Swift/iGoat-Swift/Resources/Assets.xcassets/TouchID.imageset/TouchID_off@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OWASP/iGoat-Swift/1f44c0826556ae3a44b92ba68fc64cdc4c993b03/iGoat-Swift/iGoat-Swift/Resources/Assets.xcassets/TouchID.imageset/TouchID_off@2x.png -------------------------------------------------------------------------------- /iGoat-Swift/iGoat-Swift/Resources/Assets.xcassets/TouchID.imageset/TouchID_off@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OWASP/iGoat-Swift/1f44c0826556ae3a44b92ba68fc64cdc4c993b03/iGoat-Swift/iGoat-Swift/Resources/Assets.xcassets/TouchID.imageset/TouchID_off@3x.png -------------------------------------------------------------------------------- /iGoat-Swift/iGoat-Swift/Resources/Assets.xcassets/hide.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "hide@2x.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "filename" : "hide@2x-2.png", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "filename" : "hide@2x-1.png", 16 | "scale" : "3x" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } -------------------------------------------------------------------------------- /iGoat-Swift/iGoat-Swift/Resources/Assets.xcassets/hide.imageset/hide@2x-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OWASP/iGoat-Swift/1f44c0826556ae3a44b92ba68fc64cdc4c993b03/iGoat-Swift/iGoat-Swift/Resources/Assets.xcassets/hide.imageset/hide@2x-1.png -------------------------------------------------------------------------------- /iGoat-Swift/iGoat-Swift/Resources/Assets.xcassets/hide.imageset/hide@2x-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OWASP/iGoat-Swift/1f44c0826556ae3a44b92ba68fc64cdc4c993b03/iGoat-Swift/iGoat-Swift/Resources/Assets.xcassets/hide.imageset/hide@2x-2.png -------------------------------------------------------------------------------- /iGoat-Swift/iGoat-Swift/Resources/Assets.xcassets/hide.imageset/hide@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OWASP/iGoat-Swift/1f44c0826556ae3a44b92ba68fc64cdc4c993b03/iGoat-Swift/iGoat-Swift/Resources/Assets.xcassets/hide.imageset/hide@2x.png -------------------------------------------------------------------------------- /iGoat-Swift/iGoat-Swift/Resources/Assets.xcassets/iphone.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "iphone.png" 6 | } 7 | ], 8 | "info" : { 9 | "version" : 1, 10 | "author" : "xcode" 11 | } 12 | } -------------------------------------------------------------------------------- /iGoat-Swift/iGoat-Swift/Resources/Assets.xcassets/iphone.imageset/iphone.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OWASP/iGoat-Swift/1f44c0826556ae3a44b92ba68fc64cdc4c993b03/iGoat-Swift/iGoat-Swift/Resources/Assets.xcassets/iphone.imageset/iphone.png -------------------------------------------------------------------------------- /iGoat-Swift/iGoat-Swift/Resources/Assets.xcassets/menu.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "scale" : "2x" 10 | }, 11 | { 12 | "idiom" : "universal", 13 | "filename" : "Menu2-128.png", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /iGoat-Swift/iGoat-Swift/Resources/Assets.xcassets/menu.imageset/Menu2-128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OWASP/iGoat-Swift/1f44c0826556ae3a44b92ba68fc64cdc4c993b03/iGoat-Swift/iGoat-Swift/Resources/Assets.xcassets/menu.imageset/Menu2-128.png -------------------------------------------------------------------------------- /iGoat-Swift/iGoat-Swift/Resources/Assets.xcassets/show.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "show@2x.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "filename" : "show@2x-1.png", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "filename" : "show@2x-2.png", 16 | "scale" : "3x" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } -------------------------------------------------------------------------------- /iGoat-Swift/iGoat-Swift/Resources/Assets.xcassets/show.imageset/show@2x-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OWASP/iGoat-Swift/1f44c0826556ae3a44b92ba68fc64cdc4c993b03/iGoat-Swift/iGoat-Swift/Resources/Assets.xcassets/show.imageset/show@2x-1.png -------------------------------------------------------------------------------- /iGoat-Swift/iGoat-Swift/Resources/Assets.xcassets/show.imageset/show@2x-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OWASP/iGoat-Swift/1f44c0826556ae3a44b92ba68fc64cdc4c993b03/iGoat-Swift/iGoat-Swift/Resources/Assets.xcassets/show.imageset/show@2x-2.png -------------------------------------------------------------------------------- /iGoat-Swift/iGoat-Swift/Resources/Assets.xcassets/show.imageset/show@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OWASP/iGoat-Swift/1f44c0826556ae3a44b92ba68fc64cdc4c993b03/iGoat-Swift/iGoat-Swift/Resources/Assets.xcassets/show.imageset/show@2x.png -------------------------------------------------------------------------------- /iGoat-Swift/iGoat-Swift/Resources/HTML/KRvWAssociates.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 |
7 |

KRvW Associates, LLC

8 | http://www.krvw.com 9 |

10 | Architect: 11 |
12 |     Ken van Wyk (ken@krvw.com) 13 |
14 |

Arxan Technologies

15 | http://www.arxan.com 16 |

17 | Lead Developer: 18 |
19 |     Jonathan Carter (jcarter@arxan.com) 20 |
21 | 22 | -------------------------------------------------------------------------------- /iGoat-Swift/iGoat-Swift/Resources/HTML/Swaroop.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 |
7 |

8 |     Swaroop Yermalkar (@swaroopsy) 9 |     swaroop.yermalkar@owasp.org 10 |

11 |
12 | 13 | 14 | -------------------------------------------------------------------------------- /iGoat-Swift/iGoat-Swift/Resources/HTML/Swaroop_Heefan.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 |
7 |

8 |     1. Swaroop Yermalkar (@swaroopsy) 9 |     swaroop.yermalkar@owasp.org 10 |

11 |     2. Heefan 12 |

13 |
14 | 15 | 16 | -------------------------------------------------------------------------------- /iGoat-Swift/iGoat-Swift/Resources/HTML/Swaroop_Junard.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 |
7 |

8 |     1. Swaroop Yermalkar (@swaroopsy) 9 |     swaroop.yermalkar@owasp.org 10 |

11 |     2. Junard Lebajan (@junard) 12 |

13 |
14 | 15 | 16 | -------------------------------------------------------------------------------- /iGoat-Swift/iGoat-Swift/Resources/HTML/Swaroop_anthony.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 |
7 |

8 |     1. Swaroop Yermalkar (@swaroopsy) 9 |     swaroop.yermalkar@owasp.org 10 |

11 |     2. Anthony Gonsalves 12 |     https://github.com/anthonygp 13 |

14 |
15 | 16 | 17 | -------------------------------------------------------------------------------- /iGoat-Swift/iGoat-Swift/Resources/HTML/mansi.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 |
7 | Architect/Developer: 8 |
9 |     Mansi Sheth (mansi.sheth@gmail.com) 10 |

11 |
12 | 13 | -------------------------------------------------------------------------------- /iGoat-Swift/iGoat-Swift/Resources/HTML/rutger.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 |
7 |

Rutger

8 | My linkedin profile 9 |

10 | Architect/Developer: 11 |
12 |     Rutger van Iperen (ophychius@gmail.com) 13 |
14 |
15 | 16 | -------------------------------------------------------------------------------- /iGoat-Swift/iGoat-Swift/Resources/Sentinel.txt: -------------------------------------------------------------------------------- 1 | Note: This file acts as substitute file for jailbreaking detection 2 | -------------------------------------------------------------------------------- /iGoat-Swift/iGoat-Swift/Source/Constants/Constants.swift: -------------------------------------------------------------------------------- 1 | 2 | import Foundation 3 | 4 | let assetsFileName = "Assets.plist" 5 | -------------------------------------------------------------------------------- /iGoat-Swift/iGoat-Swift/Source/Container/AboutCell.swift: -------------------------------------------------------------------------------- 1 | import UIKit 2 | 3 | class AboutCell: UITableViewCell { 4 | @IBOutlet weak var overlayButton: UIButton! 5 | } 6 | -------------------------------------------------------------------------------- /iGoat-Swift/iGoat-Swift/Source/Container/ExerciseDemoVC.swift: -------------------------------------------------------------------------------- 1 | 2 | 3 | import UIKit 4 | 5 | class ExerciseDemoVC: UIViewController { 6 | @IBOutlet weak var containerView: UIView! 7 | 8 | var exercise: Exercise? 9 | 10 | override func viewDidLoad() { 11 | super.viewDidLoad() 12 | configureDemoVC() 13 | } 14 | } 15 | 16 | extension ExerciseDemoVC { 17 | func configureDemoVC() { 18 | guard 19 | let exercise = exercise, 20 | let ViewController = NSClassFromString("iGoat_Swift." + exercise.viewControllerIdentifier) as? UIViewController.Type 21 | else { return } 22 | self.title = exercise.name 23 | let viewController = ViewController.init(nibName: exercise.viewControllerIdentifier, bundle: nil) 24 | let view = viewController.view 25 | view?.translatesAutoresizingMaskIntoConstraints = false 26 | addChildViewController(viewController) 27 | containerView.addSubview(viewController.view) 28 | viewController.didMove(toParentViewController: self) 29 | NSLayoutConstraint.constraints(withVisualFormat: "V:|[childView]|", 30 | options: [], metrics:nil, 31 | views: ["childView": viewController.view]).forEach { $0.isActive = true } 32 | NSLayoutConstraint.constraints(withVisualFormat: "|[childView]|", 33 | options: [], metrics:nil, 34 | views: ["childView": viewController.view]).forEach { $0.isActive = true } 35 | } 36 | 37 | @IBAction func solutionItemPressed() { 38 | let htmlVC = HTMLViewController(nibName: "HTMLViewController", bundle: nil) 39 | _ = htmlVC.view 40 | if let name = exercise?.name { htmlVC.title = name } 41 | htmlVC.contentString = exercise?.htmlSolution ?? "" 42 | navigationController?.pushViewController(htmlVC, animated: true) 43 | } 44 | 45 | @IBAction func hintItemPressed() { 46 | guard let hintVC = storyboard?.instantiateViewController(type: HintVC.self) else { return } 47 | navigationController?.pushViewController(hintVC, animated: true) 48 | _ = hintVC.view 49 | hintVC.exercise = exercise 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /iGoat-Swift/iGoat-Swift/Source/Container/ExerciseFlowController.swift: -------------------------------------------------------------------------------- 1 | 2 | import UIKit 3 | 4 | class ExerciseFlowController: UINavigationController { 5 | var asset: Asset? { 6 | didSet { 7 | title = asset?.title 8 | navigationItem.title = title 9 | } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /iGoat-Swift/iGoat-Swift/Source/Container/ExerciseIntroductionVC.swift: -------------------------------------------------------------------------------- 1 | 2 | 3 | import UIKit 4 | import WebKit 5 | 6 | class ExerciseIntroductionVC: HTMLViewController { 7 | var exercise: Exercise? { 8 | didSet { 9 | guard let exercise = exercise else { return } 10 | contentString = exercise.htmlDescription 11 | } 12 | } 13 | 14 | override func viewDidLoad() { 15 | super.viewDidLoad() 16 | configureNavigationBar() 17 | } 18 | 19 | func configureNavigationBar() { 20 | navigationItem.rightBarButtonItem = UIBarButtonItem(title: "Start", 21 | style: .plain, target: self, 22 | action: #selector(startExerciseItemTapped)) 23 | navigationItem.title = "Introduction" 24 | navigationItem.backBarButtonItem = UIBarButtonItem(title: "", style: .plain, 25 | target: nil, action: nil) 26 | } 27 | } 28 | 29 | extension ExerciseIntroductionVC { 30 | @objc func startExerciseItemTapped() { 31 | guard let demoVC = storyboard?.instantiateViewController(type: ExerciseDemoVC.self) else { return } 32 | demoVC.exercise = exercise 33 | navigationController?.pushViewController(demoVC, animated: true) 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /iGoat-Swift/iGoat-Swift/Source/Container/ExercisesVC.swift: -------------------------------------------------------------------------------- 1 | 2 | import UIKit 3 | 4 | class ExercisesVC: UITableViewController { 5 | // MARK: - Table view data source 6 | var asset: Asset? { 7 | let navVC = navigationController as! ExerciseFlowController 8 | return navVC.asset 9 | } 10 | 11 | override func viewWillAppear(_ animated: Bool) { 12 | super.viewWillAppear(animated) 13 | tableView.reloadData() 14 | title = asset?.title 15 | navigationItem.title = title 16 | } 17 | 18 | override func viewDidLoad() { 19 | super.viewDidLoad() 20 | tableView.register(UITableViewCell.classForCoder(), forCellReuseIdentifier: UITableViewCell.identifier) 21 | self.navigationItem.backBarButtonItem = UIBarButtonItem( 22 | title: "", style: .plain, target: nil, action: nil) 23 | } 24 | } 25 | 26 | // MARK: - Table view data source 27 | extension ExercisesVC { 28 | override func numberOfSections(in tableView: UITableView) -> Int { 29 | return 1 30 | } 31 | 32 | override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { 33 | return asset?.exercises.count ?? 0 34 | } 35 | 36 | override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { 37 | let cell = tableView.dequeueReusableCell(withIdentifier: UITableViewCell.identifier, for: indexPath) 38 | cell.textLabel?.text = asset?.exercises[indexPath.row].name 39 | return cell 40 | } 41 | 42 | override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { 43 | loadExerciseIntroduction(at: indexPath.row) 44 | } 45 | 46 | func loadExerciseIntroduction(at index: Int) { 47 | guard let introVC = storyboard?.instantiateViewController(withIdentifier: "ExerciseIntroductionVC") as? ExerciseIntroductionVC 48 | else { return } 49 | navigationController?.pushViewController(introVC, animated: true) 50 | _ = introVC.view 51 | introVC.exercise = asset?.exercises[index] 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /iGoat-Swift/iGoat-Swift/Source/Container/HTMLViewController.swift: -------------------------------------------------------------------------------- 1 | //TODO: Make a generic HTML handler 2 | import UIKit 3 | 4 | class HTMLViewController: UIViewController { 5 | @IBOutlet weak var webView: UIWebView! 6 | 7 | var contentString: String? = nil { 8 | didSet { 9 | loadWebView(from: contentString ?? "") 10 | } 11 | } 12 | 13 | var contentHTMLFile: String? = nil { 14 | didSet { 15 | let filePath = Bundle.main.path(forResource: contentHTMLFile, ofType: nil) ?? "" 16 | let fileContents = (try? String(contentsOfFile: filePath, encoding: .utf8)) ?? "" 17 | loadWebView(from: fileContents) 18 | } 19 | } 20 | } 21 | 22 | extension HTMLViewController { 23 | func loadWebView(from content:String) { 24 | let baseURL = URL(fileURLWithPath: Bundle.main.resourcePath!, isDirectory: true) 25 | webView.loadHTMLString(content, baseURL: baseURL) 26 | } 27 | 28 | @IBAction func backItemPressed() { 29 | dismiss(animated: true, completion: nil) 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /iGoat-Swift/iGoat-Swift/Source/Container/HintVC.swift: -------------------------------------------------------------------------------- 1 | 2 | import UIKit 3 | 4 | class HintVC: UIViewController { 5 | var exercise: Exercise? { 6 | didSet { 7 | guard let excercise = exercise else { 8 | return 9 | } 10 | loadPages(with: excercise) 11 | } 12 | } 13 | 14 | @IBOutlet weak var scrollView: UIScrollView! 15 | 16 | override func viewDidLoad() { 17 | super.viewDidLoad() 18 | self.title = "Hints" 19 | } 20 | 21 | func loadPages(with exercise: Exercise) { 22 | guard let hints = exercise.hints else { return } 23 | for i in 0.. String { 38 | if text.hasPrefix("") { 39 | return text 40 | } else { 41 | let htmlString = 42 | """ 43 | 44 |

\(exercise?.name ?? "") (\(index + 1)/\(exercise?.hints?.count ?? 0))

\(text) 45 | """ 46 | return htmlString 47 | } 48 | } 49 | 50 | func configureWebviewWith(htmlText: String) -> UIWebView { 51 | let webView = UIWebView() 52 | let baseURL = URL(fileURLWithPath: Bundle.main.resourcePath!, isDirectory: true) 53 | webView.loadHTMLString(htmlText, baseURL: baseURL) 54 | return webView 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /iGoat-Swift/iGoat-Swift/Source/Exercises/Binary Patching/BinaryPatchingVC.swift: -------------------------------------------------------------------------------- 1 | import UIKit 2 | 3 | class BinaryPatchingVC: UIViewController { 4 | @IBOutlet weak var passwordTextField: UITextField! 5 | 6 | @IBAction func loginItemPressed() { 7 | if passwordTextField.text?.isEmpty ?? true { 8 | UIAlertController.showAlertWith(title: "iGoat", message: "Password Field empty!!") 9 | } 10 | 11 | let password = passwordTextField.text! 12 | if password == "root" { 13 | UIAlertController.showAlertWith(title: "Incorrect Password", message: "Enter the correct password") 14 | return 15 | } 16 | UIAlertController.showAlertWith(title: "iGoat", message: "Congratulations") 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /iGoat-Swift/iGoat-Swift/Source/Exercises/Injection Flaws/SQL Injection/SQLInjectionArticlesVC.swift: -------------------------------------------------------------------------------- 1 | import UIKit 2 | 3 | class SQLInjectionArticlesVC: UITableViewController { 4 | var articles = [String]() 5 | 6 | override func viewDidLoad() { 7 | super.viewDidLoad() 8 | self.title = "Articles" 9 | self.tableView.register(UITableViewCell.classForCoder(), forCellReuseIdentifier: "Cell") 10 | } 11 | 12 | // MARK: - Table view data source 13 | override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { 14 | return articles.count 15 | } 16 | 17 | override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { 18 | let cell = tableView.dequeueReusableCell(withIdentifier: "Cell", for: indexPath) 19 | cell.textLabel?.text = articles[indexPath.row] 20 | return cell 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /iGoat-Swift/iGoat-Swift/Source/Exercises/Injection Flaws/SQL Injection/SQLInjectionArticlesVC.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /iGoat-Swift/iGoat-Swift/Source/Exercises/Injection Flaws/SQL Injection/SQLInjectionExerciseVC.swift: -------------------------------------------------------------------------------- 1 | import UIKit 2 | import SQLite3 3 | 4 | class SQLInjectionExerciseVC: UIViewController { 5 | @IBOutlet weak var searchField: UITextField! 6 | 7 | @IBAction func search() { 8 | let dbPath = URL(fileURLWithPath: Bundle.main.resourcePath ?? "").appendingPathComponent("articles.sqlite").absoluteString 9 | var db: OpaquePointer? 10 | if sqlite3_open(dbPath, &db) != SQLITE_OK { 11 | UIAlertController.showAlertWith(title: "Snap!", message: "Error opening articles database.") 12 | return 13 | } 14 | 15 | var searchStr = "%" 16 | if !(searchField.text?.isEmpty ?? true) { 17 | searchStr = "%" + "\(searchField.text!)" + "%" 18 | } 19 | 20 | let query = "SELECT title FROM article WHERE title LIKE '\(searchStr)' AND premium=0" 21 | var stmt: OpaquePointer? 22 | sqlite3_prepare_v2(db, query, -1, &stmt, nil) 23 | var articleTitles = [String]() 24 | while sqlite3_step(stmt) == SQLITE_ROW { 25 | let title = String(cString: sqlite3_column_text(stmt, 0)) 26 | articleTitles.append(title) 27 | } 28 | sqlite3_finalize(stmt) 29 | sqlite3_close(db) 30 | 31 | let sqlInjectionArticlesVC = SQLInjectionArticlesVC(nibName: "SQLInjectionArticlesVC", bundle: nil) 32 | sqlInjectionArticlesVC.articles = articleTitles 33 | navigationController?.pushViewController(sqlInjectionArticlesVC, animated: true) 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /iGoat-Swift/iGoat-Swift/Source/Exercises/Injection Flaws/XSS/CrossSiteScriptingExerciseVC.swift: -------------------------------------------------------------------------------- 1 | import UIKit 2 | 3 | class CrossSiteScriptingExerciseVC: UIViewController { 4 | @IBOutlet weak var webview: UIWebView! 5 | @IBOutlet weak var textField: UITextField! 6 | 7 | @IBAction func loadItemPressed() { 8 | let webText = "Welcome to XSS Exercise !!! \n Here is UIWebView ! \(textField.text ?? "")" 9 | webview.loadHTMLString(webText, baseURL: nil) 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /iGoat-Swift/iGoat-Swift/Source/Exercises/InsecureLocalDataStorage/CoreData/CoreData.xcdatamodeld/CoreData.xcdatamodel/contents: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /iGoat-Swift/iGoat-Swift/Source/Exercises/InsecureLocalDataStorage/CoreData/KeychainUsage/KeychainDumper.swift: -------------------------------------------------------------------------------- 1 | 2 | import Foundation 3 | import SQLite3 4 | import Security 5 | 6 | class KeychainDumper { 7 | let arguments: NSMutableArray 8 | var keychainPath: String 9 | var passwordInGenp = "" 10 | let allKeychainData = NSMutableDictionary() 11 | 12 | init(simulatorPath: String) { 13 | arguments = NSMutableArray() 14 | arguments.add(kSecClassGenericPassword) 15 | arguments.add(kSecClassInternetPassword) 16 | arguments.add(kSecClassIdentity) 17 | arguments.add(kSecClassCertificate) 18 | arguments.add(kSecClassKey) 19 | 20 | keychainPath = simulatorPath 21 | } 22 | 23 | func getKeychainObjects(forSecClass kSecClassType: CFTypeRef?) -> [Any]? { 24 | var genericQuery = [AnyHashable: Any]() 25 | genericQuery[kSecClass] = kSecClassType 26 | genericQuery[kSecMatchLimit] = kSecMatchLimitAll 27 | genericQuery[kSecReturnAttributes] = kCFBooleanTrue 28 | genericQuery[kSecReturnRef] = kCFBooleanTrue 29 | genericQuery[kSecReturnData] = kCFBooleanTrue 30 | var keychainItems: AnyObject? 31 | let ret: OSStatus = SecItemCopyMatching(genericQuery as CFDictionary, &keychainItems) 32 | switch ret { 33 | case errSecSuccess: 34 | print("Keychain Read Successfully") 35 | case errSecItemNotFound: 36 | print("iGoat keychain Record Item has not found") 37 | keychainItems = nil 38 | default: 39 | print("keychain error code : \(ret)") 40 | keychainItems = nil 41 | } 42 | return keychainItems as? [Any] 43 | } 44 | 45 | } 46 | -------------------------------------------------------------------------------- /iGoat-Swift/iGoat-Swift/Source/Exercises/InsecureLocalDataStorage/KeychainUsage/KeychainDumper.swift: -------------------------------------------------------------------------------- 1 | 2 | import Foundation 3 | import SQLite3 4 | import Security 5 | 6 | class KeychainDumper { 7 | let arguments: NSMutableArray 8 | var keychainPath: String 9 | var passwordInGenp = "" 10 | let allKeychainData = NSMutableDictionary() 11 | 12 | init(simulatorPath: String) { 13 | arguments = NSMutableArray() 14 | arguments.add(kSecClassGenericPassword) 15 | arguments.add(kSecClassInternetPassword) 16 | arguments.add(kSecClassIdentity) 17 | arguments.add(kSecClassCertificate) 18 | arguments.add(kSecClassKey) 19 | 20 | keychainPath = simulatorPath 21 | } 22 | 23 | func getKeychainObjects(forSecClass kSecClassType: CFTypeRef?) -> [Any]? { 24 | var genericQuery = [AnyHashable: Any]() 25 | genericQuery[kSecClass] = kSecClassType 26 | genericQuery[kSecMatchLimit] = kSecMatchLimitAll 27 | genericQuery[kSecReturnAttributes] = kCFBooleanTrue 28 | genericQuery[kSecReturnRef] = kCFBooleanTrue 29 | genericQuery[kSecReturnData] = kCFBooleanTrue 30 | var keychainItems: AnyObject? 31 | let ret: OSStatus = SecItemCopyMatching(genericQuery as CFDictionary, &keychainItems) 32 | switch ret { 33 | case errSecSuccess: 34 | print("Keychain Read Successfully") 35 | case errSecItemNotFound: 36 | print("iGoat keychain Record Item has not found") 37 | keychainItems = nil 38 | default: 39 | print("keychain error code : \(ret)") 40 | keychainItems = nil 41 | } 42 | return keychainItems as? [Any] 43 | } 44 | 45 | } 46 | -------------------------------------------------------------------------------- /iGoat-Swift/iGoat-Swift/Source/Exercises/InsecureLocalDataStorage/NSUserDefaults/NSUserDefaultsStorageExerciseVC.swift: -------------------------------------------------------------------------------- 1 | 2 | import UIKit 3 | 4 | class NSUserDefaultsStorageExerciseVC: UIViewController { 5 | @IBOutlet weak var textfield: UITextField! 6 | 7 | override func viewDidLoad() { 8 | super.viewDidLoad() 9 | storeInDefaults() 10 | } 11 | 12 | func storeInDefaults() { 13 | UserDefaults.standard.set("53cr3tP", forKey: "PIN") 14 | } 15 | 16 | @IBAction func verifyItemPressed() { 17 | if textfield.text?.isEmpty == true || textfield.text == "" { 18 | UIAlertController.showAlertWith(title: "Error", message: "Enter details!") 19 | } else if 20 | let pin = UserDefaults.standard.object(forKey: "PIN") as? String, 21 | pin == textfield.text { 22 | textfield.text = "" 23 | UIAlertController.showAlertWith(title: "Success", 24 | message: "Congrats! You're on right track.") 25 | } else { 26 | UIAlertController.showAlertWith(title: "Invalid!", message: "Try harder!!") 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /iGoat-Swift/iGoat-Swift/Source/Exercises/InsecureLocalDataStorage/PlistStorage/Credentials.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | User 6 | admin 7 | Password 8 | Secret@123 9 | 10 | 11 | -------------------------------------------------------------------------------- /iGoat-Swift/iGoat-Swift/Source/Exercises/InsecureLocalDataStorage/PlistStorage/PlistStorageExerciseViewController.swift: -------------------------------------------------------------------------------- 1 | 2 | import UIKit 3 | 4 | class PlistStorageExerciseViewController: UIViewController { 5 | 6 | 7 | @IBOutlet weak var txt_user: UITextField! 8 | @IBOutlet weak var txt_pwd: UITextField! 9 | 10 | let plistPath = NSHomeDirectory() + "/Documents/Credentials.plist" 11 | let bundlePath = Bundle.main.resourcePath!.appending("/Credentials.plist") 12 | 13 | override func viewDidLoad() { 14 | super.viewDidLoad() 15 | self.title = "Plist Storage"; 16 | storeInPlist() 17 | } 18 | 19 | func storeInPlist() { 20 | do { 21 | try FileManager.default.copyItem(atPath: bundlePath, toPath: plistPath) 22 | } catch {} 23 | } 24 | 25 | @IBAction func login(){ 26 | 27 | if self.txt_user.text!.isEmpty || self.txt_pwd.text!.isEmpty { 28 | UIAlertController.showAlertWith(title: "Error", message: "Username and Password must not be blank") 29 | } 30 | else { 31 | let username = txt_user.text 32 | let password = txt_pwd.text 33 | let myDict = NSDictionary(contentsOfFile: plistPath) as! Dictionary 34 | if username == myDict["User"] && password == myDict["Password"] { 35 | txt_user.text = "" 36 | txt_pwd.text = "" 37 | UIAlertController.showAlertWith(title: "Success", message: "Congrats! You're on right track.") 38 | } 39 | else{ 40 | UIAlertController.showAlertWith(title: "Invalid!", message: "Try little bit.") 41 | } 42 | } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /iGoat-Swift/iGoat-Swift/Source/Exercises/InsecureLocalDataStorage/Realm/RealmExerciseVC.swift: -------------------------------------------------------------------------------- 1 | 2 | import UIKit 3 | import Realm 4 | 5 | class RCreditInfo: RLMObject { 6 | @objc dynamic var name:String? 7 | @objc dynamic var cardNumber:String? 8 | @objc dynamic var cvv:String? 9 | } 10 | 11 | class RealmExerciseVC: UIViewController { 12 | 13 | @IBOutlet weak var creditNameTextField: UITextField! 14 | @IBOutlet weak var creditNumberTextField: UITextField! 15 | @IBOutlet weak var creditCVVTextField: UITextField! 16 | 17 | let RealmCardName = "John Doe"; 18 | let RealmCardNumber = "4444 5555 8888 1111"; 19 | let RealmCardCVV = "911"; 20 | 21 | override func viewDidLoad() { 22 | super.viewDidLoad() 23 | do { 24 | try saveData() 25 | } catch { 26 | print("Error writing data") 27 | } 28 | } 29 | 30 | func saveData() throws { 31 | if RCreditInfo.allObjects().count == 0 { 32 | let realm = RLMRealm.default() 33 | let creditInfo = RCreditInfo() 34 | creditInfo.name = RealmCardName 35 | creditInfo.cardNumber = RealmCardNumber 36 | creditInfo.cvv = RealmCardCVV 37 | realm.beginWriteTransaction() 38 | realm.add(creditInfo) 39 | try realm.commitWriteTransactionWithoutNotifying([]) 40 | } 41 | 42 | } 43 | 44 | @IBAction func verifyItemPressed() { 45 | let isVerified = verifyName(name: creditNameTextField.text!, number: creditNumberTextField.text!, cvv: creditCVVTextField.text!) 46 | let message = isVerified ? "Success" : "Failed" 47 | UIAlertController.showAlertWith(title: "iGoat", message: message) 48 | } 49 | 50 | func verifyName(name:String, number:String, cvv:String) -> Bool { 51 | 52 | guard let creditInfo = RCreditInfo.allObjects().firstObject() as? RCreditInfo else { 53 | return false 54 | } 55 | 56 | return name == creditInfo.name && 57 | number.replacingOccurrences(of: " ", with: "") == creditInfo.cardNumber?.replacingOccurrences(of: " ", with: "") && 58 | cvv == creditInfo.cvv 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /iGoat-Swift/iGoat-Swift/Source/Exercises/Key Management/Hard Coded Keys/BrokenCryptographyExerciseVC.swift: -------------------------------------------------------------------------------- 1 | import UIKit 2 | 3 | func pathDocumentDirectory(fileName: String) -> String { 4 | let documentsPath = NSSearchPathForDirectoriesInDomains(.documentDirectory, 5 | .userDomainMask, true)[0] 6 | return documentsPath + "/\(fileName)" 7 | } 8 | 9 | class BrokenCryptographyExerciseVC: UIViewController { 10 | var encryptionKey = "myencrytionkey" 11 | @IBOutlet weak var passwordTextField: UITextField! 12 | 13 | @IBAction func showItemPressed() { 14 | 15 | UIAlertController.showAlertWith(title: "BrokenCryptography", message: "Try Harder!") 16 | 17 | /* let encryptedFilePath = pathDocumentDirectory(fileName: "encrypted") 18 | let encryptedFilePathURL = URL(fileURLWithPath: encryptedFilePath) 19 | guard let encryptedData = try? Data(contentsOf: encryptedFilePathURL) else { 20 | return 21 | } 22 | 23 | let encryptionKeyData = encryptionKey.data(using: .utf8) 24 | let decryptedData = encryptedData.aes(operation: kCCDecrypt, keyData: encryptionKeyData!) 25 | let decryptedPassword = String(data: decryptedData, encoding: .utf8) ?? "" 26 | print(decryptedPassword) 27 | UIAlertController.showAlertWith(title: "BrokenCryptography", message: decryptedPassword) */ 28 | } 29 | 30 | override func viewDidLoad() { 31 | super.viewDidLoad() 32 | let password = "b@nkP@ssword123" 33 | passwordTextField.text = password 34 | let data = password.data(using: .utf8) 35 | print(data!) 36 | 37 | let encryptionKeyData = encryptionKey.data(using: .utf8) 38 | let encryptedData = data?.aes(operation: kCCEncrypt, keyData: encryptionKeyData!) 39 | let url = URL(fileURLWithPath: pathDocumentDirectory(fileName: "encrypted")) 40 | try? encryptedData?.write(to: url, options: .atomic) 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /iGoat-Swift/iGoat-Swift/Source/Exercises/Memory Management/MemoryManagementVC.swift: -------------------------------------------------------------------------------- 1 | import UIKit 2 | 3 | class MemoryManagementVC: UIViewController { 4 | @IBOutlet weak var cardNoTextField: UITextField! 5 | @IBOutlet weak var cardCCVTextField: UITextField! 6 | 7 | var cardNumberString: String = "" 8 | 9 | @IBAction func payItemPressed() { 10 | if cardNoTextField.text?.isEmpty ?? true { 11 | UIAlertController.showAlertWith(title: "iGoat", message: "Enter card number") 12 | return 13 | } 14 | if cardCCVTextField.text?.isEmpty ?? true { 15 | UIAlertController.showAlertWith(title: "iGoat", message: "Enter cvv number") 16 | return 17 | } 18 | self.cardNumberString = self.cardNoTextField.text ?? "" 19 | UIAlertController.showAlertWith(title: "iGoat", message: "Thanks for purchase!! Do you think card details are safe. Check out memory :)") 20 | } 21 | 22 | } 23 | -------------------------------------------------------------------------------- /iGoat-Swift/iGoat-Swift/Source/Exercises/Runtime Analysis/BruteForce attack/BruteForceRuntimeVC.swift: -------------------------------------------------------------------------------- 1 | import UIKit 2 | 3 | class BruteForceRuntimeVC: UIViewController { 4 | @IBOutlet weak var pinTextField: UITextField! 5 | 6 | @IBAction func verifyItemPressed() { 7 | if pinTextField.text?.isEmpty ?? true { 8 | UIAlertController.showAlertWith(title: "iGoat", message: "Empty entry!!") 9 | return 10 | } 11 | 12 | let pinText = pinTextField.text ?? "" 13 | 14 | if validatePin(pinText) { 15 | UIAlertController.showAlertWith(title: "Congratulations!", message: "You found the correct PIN!!!") 16 | return 17 | } 18 | UIAlertController.showAlertWith(title: "Verification Failed.", message: "Try again with correct PIN") 19 | } 20 | 21 | func validatePin(_ pin: String) -> Bool { 22 | // 6765 23 | let reference = "0252B081BDA70B478F0131B310A93CB8D79086D785FB4AE392A8C5FFC3DDC5FE" 24 | let data = ccSha256(data: pin.data(using: .utf8)!) 25 | let pinSHA256 = data.map { String(format: "%02hhx", $0) }.joined() 26 | return reference == pinSHA256.uppercased() 27 | } 28 | 29 | func ccSha256(data: Data) -> Data { 30 | var digest = Data(count: Int(CC_SHA256_DIGEST_LENGTH)) 31 | 32 | _ = digest.withUnsafeMutableBytes { (digestBytes) in 33 | data.withUnsafeBytes { (stringBytes) in 34 | CC_SHA256(stringBytes, CC_LONG(data.count), digestBytes) 35 | } 36 | } 37 | return digest 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /iGoat-Swift/iGoat-Swift/Source/Exercises/Runtime Analysis/Runtime Challenge/RuntimeAnalysisChallengeVC.swift: -------------------------------------------------------------------------------- 1 | import UIKit 2 | 3 | class RuntimeAnalysisChallengeVC: UIViewController { 4 | @IBOutlet weak var hintLabel: UILabel! 5 | @IBOutlet weak var textField: UITextField! 6 | 7 | override func viewDidLoad() { 8 | super.viewDidLoad() 9 | let hiddenText = String(cString: do_it()) 10 | hintLabel.text = hiddenText 11 | } 12 | 13 | @IBAction func sendItemTapped() { 14 | guard textField.text?.isEmpty ?? false 15 | else { 16 | UIAlertController.showAlertWith(title: "iGoat", message: "Empty entry!!") 17 | return 18 | } 19 | 20 | let secret = textField.text ?? "" 21 | if secret == hintLabel.text { 22 | UIAlertController.showAlertWith(title: "Congratulations!", message: "You found the secret!!") 23 | return 24 | } 25 | UIAlertController.showAlertWith(title: "Verification Failed.", message: "This is not the string you are looking for. Try again.") 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /iGoat-Swift/iGoat-Swift/Source/Exercises/SideChannelDataLeaks/Backgrounding/BackgroundingExerciseVC.swift: -------------------------------------------------------------------------------- 1 | import UIKit 2 | 3 | class BackgroundingExerciseVC: UIViewController { 4 | @IBAction func submitItemPressed() { 5 | UIAlertController.showAlertWith(title: "Success", 6 | message: "Data Submitted Successfully") 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /iGoat-Swift/iGoat-Swift/Source/Exercises/SideChannelDataLeaks/CutNPaste/CutAndPasteExerciseVC.swift: -------------------------------------------------------------------------------- 1 | import UIKit 2 | 3 | class CutAndPasteExerciseVC: UIViewController { 4 | @IBAction func loginItemPressed() { 5 | UIAlertController.showAlertWith(title: "Success", 6 | message: "Logged In Successfully") 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /iGoat-Swift/iGoat-Swift/Source/Exercises/SideChannelDataLeaks/DeviceLogs/DeviceLogsExerciseVC.swift: -------------------------------------------------------------------------------- 1 | import UIKit 2 | 3 | class DeviceLogsExerciseVC: UIViewController { 4 | @IBOutlet weak var ccNoTextField: UITextField! 5 | @IBOutlet weak var cvvTextField: UITextField! 6 | @IBOutlet weak var pinTextField: UITextField! 7 | 8 | @IBAction func submitItemPressed() { 9 | NSLog("ccNo: %@", ccNoTextField.text ?? "") 10 | NSLog("cvvNo: %@", cvvTextField.text ?? "") 11 | NSLog("pinNo: %@", pinTextField.text ?? "") 12 | UIAlertController.showAlertWith(title: "Success", 13 | message: "Data Submitted Successfully") 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /iGoat-Swift/iGoat-Swift/Source/Exercises/SideChannelDataLeaks/KeyStroke/KeystrokeLoggingExerciseVC.swift: -------------------------------------------------------------------------------- 1 | 2 | import UIKit 3 | 4 | class KeystrokeLoggingExerciseVC: UIViewController { 5 | @IBAction func sendItemPressed() { 6 | UIAlertController.showAlertWith(title: "Message", 7 | message: "Message Sent Successfully") 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /iGoat-Swift/iGoat-Swift/Source/Exercises/URL Scheme/URLSchemeAttackExerciseVC.swift: -------------------------------------------------------------------------------- 1 | 2 | import UIKit 3 | 4 | class URLSchemeAttackExerciseVC: UIViewController { 5 | @IBOutlet weak var mobileNumberTxtField: UITextField! 6 | @IBOutlet weak var messageTxtField: UITextField! 7 | 8 | @IBAction func sendMessageItemPressed() { 9 | let mobileNoText = mobileNumberTxtField.text ?? "" 10 | let messageText = messageTxtField.text ?? "" 11 | 12 | let urlSchemeText = "iGoat://?contactNumber=\(mobileNoText)&message=\(messageText)" 13 | let urlString = urlSchemeText.addingPercentEncoding(withAllowedCharacters: CharacterSet.urlQueryAllowed) 14 | 15 | let app = UIApplication.shared 16 | if let urlString = urlString, 17 | let url = URL(string: urlString), 18 | app.canOpenURL(url) == true 19 | { 20 | if #available(iOS 10.0, *) { 21 | app.open(url, options: [:], completionHandler: nil) 22 | } else { 23 | app.openURL(url) 24 | } 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /iGoat-Swift/iGoat-Swift/Source/Extensions/Data+Extension.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | extension Data{ 4 | func aes(operation: Int = kCCEncrypt, keyData: Data, 5 | ivData: Data = "abcdefghijklmnop".data(using:String.Encoding.utf8)! 6 | ) -> Data { 7 | let dataLength = self.count 8 | let cryptLength = size_t(dataLength + kCCBlockSizeAES128) 9 | var cryptData = Data(count:cryptLength) 10 | 11 | let keyLength = size_t(kCCKeySizeAES128) 12 | let options = CCOptions(kCCOptionPKCS7Padding) 13 | 14 | var numBytesEncrypted :size_t = 0 15 | 16 | let cryptStatus = cryptData.withUnsafeMutableBytes {cryptBytes in 17 | self.withUnsafeBytes {dataBytes in 18 | ivData.withUnsafeBytes {ivBytes in 19 | keyData.withUnsafeBytes {keyBytes in 20 | CCCrypt(CCOperation(operation), 21 | CCAlgorithm(kCCAlgorithmAES), 22 | options, 23 | keyBytes, keyLength, 24 | ivBytes, 25 | dataBytes, dataLength, 26 | cryptBytes, cryptLength, 27 | &numBytesEncrypted) 28 | } 29 | } 30 | } 31 | } 32 | 33 | if UInt32(cryptStatus) == UInt32(kCCSuccess) { 34 | cryptData.removeSubrange(numBytesEncrypted.. Void)? = nil) -> UIAlertController { 5 | self.addAction(UIAlertAction(title: action, style: .cancel, handler: { alert in 6 | onCancel?(alert) 7 | })) 8 | return self 9 | } 10 | 11 | @discardableResult func destructive(_ action: String, onDestruct: @escaping ((UIAlertAction) -> Void)) -> UIAlertController { 12 | self.addAction(UIAlertAction(title: action, style: .destructive, handler: { action in 13 | onDestruct(action) 14 | })) 15 | return self 16 | } 17 | 18 | func showAlert(with completion: (() -> Void)? = nil) { 19 | let topViewController = UIViewController.topVisibleViewController() 20 | topViewController.present(self, animated: true, completion: completion) 21 | } 22 | 23 | @discardableResult class func showAlertWith(title: String, message: String) -> UIAlertController { 24 | let alertController = UIAlertController(title: title, message: message, preferredStyle: .alert) 25 | alertController.cancel() 26 | alertController.showAlert() 27 | return alertController 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /iGoat-Swift/iGoat-Swift/Source/Extensions/UIAplication+Extension.swift: -------------------------------------------------------------------------------- 1 | // 2 | // UIAplication+Extension.swift 3 | // iGoat-Swift 4 | // 5 | // Copyright © 2023 OWASP. All rights reserved. 6 | // 7 | 8 | import Foundation 9 | 10 | extension UIApplication { 11 | var statusBarUIView: UIView? { 12 | if #available(iOS 13.0, *) { 13 | let tag = 38482458385 14 | if let statusBar = self.keyWindow?.viewWithTag(tag) { 15 | return statusBar 16 | } else { 17 | let statusBarView = UIView(frame: UIApplication.shared.statusBarFrame) 18 | statusBarView.tag = tag 19 | 20 | self.keyWindow?.addSubview(statusBarView) 21 | return statusBarView 22 | } 23 | } else { 24 | if responds(to: Selector(("statusBar"))) { 25 | return value(forKey: "statusBar") as? UIView 26 | } 27 | } 28 | return nil 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /iGoat-Swift/iGoat-Swift/Source/Extensions/UIStoryBoard+Extension.swift: -------------------------------------------------------------------------------- 1 | import UIKit 2 | 3 | extension UIStoryboard { 4 | func instantiateViewController(type: T.Type) -> T { 5 | var fullName: String = String(describing: T.self) 6 | if let range = fullName.range(of: ".", options: .backwards) { 7 | fullName = String(fullName[range.upperBound...]) 8 | } 9 | return self.instantiateViewController(withIdentifier: fullName) as! T 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /iGoat-Swift/iGoat-Swift/Source/Extensions/UITableViewCell+Extension.swift: -------------------------------------------------------------------------------- 1 | import UIKit 2 | 3 | extension UITableViewCell { 4 | class var identifier: String { return self.className } 5 | } 6 | -------------------------------------------------------------------------------- /iGoat-Swift/iGoat-Swift/Source/Extensions/UIView+Extension.swift: -------------------------------------------------------------------------------- 1 | import UIKit 2 | 3 | extension UIView { 4 | @objc open class func loadFromNib() -> Self { 5 | /// Helper required for returning Self while still casting to subclass 6 | func loadFromNibHelper() -> T { 7 | let nib = self.nibBundle.loadNibNamed(self.nibName, owner: self, options: nil) 8 | return nib!.first as! T 9 | } 10 | return loadFromNibHelper() 11 | } 12 | 13 | /// Nib Name for the cell 14 | open class var nibName: String { 15 | return "\(self.self)" 16 | } 17 | 18 | /// NSBundle to fetch the nib resource from 19 | open class var nibBundle: Bundle { 20 | return Bundle(for: self.self) 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /iGoat-Swift/iGoat-Swift/Source/Extensions/UIViewController+Extension.swift: -------------------------------------------------------------------------------- 1 | import UIKit 2 | 3 | extension UIViewController { 4 | class func loadFromNib() -> T { 5 | return T(nibName: String(describing: self), bundle: nil) 6 | } 7 | 8 | class func topVisibleViewController(of viewController: UIViewController? = nil) -> UIViewController { 9 | var viewController = viewController 10 | if viewController == nil { 11 | viewController = UIApplication.shared.keyWindow?.rootViewController 12 | } 13 | 14 | if let navigationController = viewController as? UINavigationController, 15 | navigationController.viewControllers.count != 0 { 16 | return topVisibleViewController(of:navigationController.viewControllers.last) 17 | } 18 | 19 | else if let tabBarController = viewController as? UITabBarController, 20 | let selectedViewController = tabBarController.selectedViewController { 21 | return topVisibleViewController(of: selectedViewController) 22 | } 23 | 24 | else if let presentedController = viewController?.presentedViewController { 25 | return topVisibleViewController(of: presentedController) 26 | } 27 | return viewController! 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /iGoat-Swift/iGoat-Swift/Source/Extensions/URL+Extension.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | extension URL { 4 | var parmetersInfo: [AnyHashable: Any]? { 5 | let urlComponents = URLComponents(url: self as URL, resolvingAgainstBaseURL: false) 6 | let queryItems = urlComponents?.queryItems 7 | var queryStringDictionary = [String: String]() 8 | for queryItem: URLQueryItem? in queryItems ?? [URLQueryItem?]() { 9 | if let name = queryItem?.name { 10 | let value = queryItem?.value != nil ? queryItem?.value : "" 11 | queryStringDictionary[name] = value 12 | } 13 | } 14 | return queryStringDictionary 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /iGoat-Swift/iGoat-Swift/Source/External/Gif/UIImage+animatedGIF.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | /** 4 | UIImage (animatedGIF) 5 | 6 | This category adds class methods to `UIImage` to create an animated `UIImage` from an animated GIF. 7 | */ 8 | @interface UIImage (animatedGIF) 9 | 10 | /* 11 | UIImage *animation = [UIImage animatedImageWithAnimatedGIFData:theData]; 12 | 13 | I interpret `theData` as a GIF. I create an animated `UIImage` using the source images in the GIF. 14 | 15 | The GIF stores a separate duration for each frame, in units of centiseconds (hundredths of a second). However, a `UIImage` only has a single, total `duration` property, which is a floating-point number. 16 | 17 | To handle this mismatch, I add each source image (from the GIF) to `animation` a varying number of times to match the ratios between the frame durations in the GIF. 18 | 19 | For example, suppose the GIF contains three frames. Frame 0 has duration 3. Frame 1 has duration 9. Frame 2 has duration 15. I divide each duration by the greatest common denominator of all the durations, which is 3, and add each frame the resulting number of times. Thus `animation` will contain frame 0 3/3 = 1 time, then frame 1 9/3 = 3 times, then frame 2 15/3 = 5 times. I set `animation.duration` to (3+9+15)/100 = 0.27 seconds. 20 | */ 21 | + (UIImage * _Nullable)animatedImageWithAnimatedGIFData:(NSData * _Nonnull)theData; 22 | 23 | /* 24 | UIImage *image = [UIImage animatedImageWithAnimatedGIFURL:theURL]; 25 | 26 | I interpret the contents of `theURL` as a GIF. I create an animated `UIImage` using the source images in the GIF. 27 | 28 | I operate exactly like `+[UIImage animatedImageWithAnimatedGIFData:]`, except that I read the data from `theURL`. If `theURL` is not a `file:` URL, you probably want to call me on a background thread or GCD queue to avoid blocking the main thread. 29 | */ 30 | + (UIImage * _Nullable)animatedImageWithAnimatedGIFURL:(NSURL * _Nonnull)theURL; 31 | 32 | @end 33 | -------------------------------------------------------------------------------- /iGoat-Swift/iGoat-Swift/Source/External/SVProgressHUD/SVIndefiniteAnimatedView.h: -------------------------------------------------------------------------------- 1 | // 2 | // SVIndefiniteAnimatedView.h 3 | // SVProgressHUD, https://github.com/SVProgressHUD/SVProgressHUD 4 | // 5 | // Copyright (c) 2014-2017 Guillaume Campagna. All rights reserved. 6 | // 7 | 8 | #import 9 | 10 | @interface SVIndefiniteAnimatedView : UIView 11 | 12 | @property (nonatomic, assign) CGFloat strokeThickness; 13 | @property (nonatomic, assign) CGFloat radius; 14 | @property (nonatomic, strong) UIColor *strokeColor; 15 | 16 | @end 17 | 18 | -------------------------------------------------------------------------------- /iGoat-Swift/iGoat-Swift/Source/External/SVProgressHUD/SVProgressAnimatedView.h: -------------------------------------------------------------------------------- 1 | // 2 | // SVProgressAnimatedView.h 3 | // SVProgressHUD, https://github.com/SVProgressHUD/SVProgressHUD 4 | // 5 | // Copyright (c) 2017 Tobias Tiemerding. All rights reserved. 6 | // 7 | 8 | #import 9 | 10 | @interface SVProgressAnimatedView : UIView 11 | 12 | @property (nonatomic, assign) CGFloat radius; 13 | @property (nonatomic, assign) CGFloat strokeThickness; 14 | @property (nonatomic, strong) UIColor *strokeColor; 15 | @property (nonatomic, assign) CGFloat strokeEnd; 16 | 17 | @end 18 | -------------------------------------------------------------------------------- /iGoat-Swift/iGoat-Swift/Source/External/SVProgressHUD/SVProgressHUD-Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header for all source files of the 'SVProgressHUD' target in the 'SVProgressHUD' project 3 | // 4 | 5 | #ifdef __OBJC__ 6 | #import 7 | #endif 8 | -------------------------------------------------------------------------------- /iGoat-Swift/iGoat-Swift/Source/External/SVProgressHUD/SVProgressHUD.bundle/angle-mask.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OWASP/iGoat-Swift/1f44c0826556ae3a44b92ba68fc64cdc4c993b03/iGoat-Swift/iGoat-Swift/Source/External/SVProgressHUD/SVProgressHUD.bundle/angle-mask.png -------------------------------------------------------------------------------- /iGoat-Swift/iGoat-Swift/Source/External/SVProgressHUD/SVProgressHUD.bundle/angle-mask@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OWASP/iGoat-Swift/1f44c0826556ae3a44b92ba68fc64cdc4c993b03/iGoat-Swift/iGoat-Swift/Source/External/SVProgressHUD/SVProgressHUD.bundle/angle-mask@2x.png -------------------------------------------------------------------------------- /iGoat-Swift/iGoat-Swift/Source/External/SVProgressHUD/SVProgressHUD.bundle/angle-mask@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OWASP/iGoat-Swift/1f44c0826556ae3a44b92ba68fc64cdc4c993b03/iGoat-Swift/iGoat-Swift/Source/External/SVProgressHUD/SVProgressHUD.bundle/angle-mask@3x.png -------------------------------------------------------------------------------- /iGoat-Swift/iGoat-Swift/Source/External/SVProgressHUD/SVProgressHUD.bundle/error.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OWASP/iGoat-Swift/1f44c0826556ae3a44b92ba68fc64cdc4c993b03/iGoat-Swift/iGoat-Swift/Source/External/SVProgressHUD/SVProgressHUD.bundle/error.png -------------------------------------------------------------------------------- /iGoat-Swift/iGoat-Swift/Source/External/SVProgressHUD/SVProgressHUD.bundle/error@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OWASP/iGoat-Swift/1f44c0826556ae3a44b92ba68fc64cdc4c993b03/iGoat-Swift/iGoat-Swift/Source/External/SVProgressHUD/SVProgressHUD.bundle/error@2x.png -------------------------------------------------------------------------------- /iGoat-Swift/iGoat-Swift/Source/External/SVProgressHUD/SVProgressHUD.bundle/error@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OWASP/iGoat-Swift/1f44c0826556ae3a44b92ba68fc64cdc4c993b03/iGoat-Swift/iGoat-Swift/Source/External/SVProgressHUD/SVProgressHUD.bundle/error@3x.png -------------------------------------------------------------------------------- /iGoat-Swift/iGoat-Swift/Source/External/SVProgressHUD/SVProgressHUD.bundle/info.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OWASP/iGoat-Swift/1f44c0826556ae3a44b92ba68fc64cdc4c993b03/iGoat-Swift/iGoat-Swift/Source/External/SVProgressHUD/SVProgressHUD.bundle/info.png -------------------------------------------------------------------------------- /iGoat-Swift/iGoat-Swift/Source/External/SVProgressHUD/SVProgressHUD.bundle/info@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OWASP/iGoat-Swift/1f44c0826556ae3a44b92ba68fc64cdc4c993b03/iGoat-Swift/iGoat-Swift/Source/External/SVProgressHUD/SVProgressHUD.bundle/info@2x.png -------------------------------------------------------------------------------- /iGoat-Swift/iGoat-Swift/Source/External/SVProgressHUD/SVProgressHUD.bundle/info@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OWASP/iGoat-Swift/1f44c0826556ae3a44b92ba68fc64cdc4c993b03/iGoat-Swift/iGoat-Swift/Source/External/SVProgressHUD/SVProgressHUD.bundle/info@3x.png -------------------------------------------------------------------------------- /iGoat-Swift/iGoat-Swift/Source/External/SVProgressHUD/SVProgressHUD.bundle/success.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OWASP/iGoat-Swift/1f44c0826556ae3a44b92ba68fc64cdc4c993b03/iGoat-Swift/iGoat-Swift/Source/External/SVProgressHUD/SVProgressHUD.bundle/success.png -------------------------------------------------------------------------------- /iGoat-Swift/iGoat-Swift/Source/External/SVProgressHUD/SVProgressHUD.bundle/success@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OWASP/iGoat-Swift/1f44c0826556ae3a44b92ba68fc64cdc4c993b03/iGoat-Swift/iGoat-Swift/Source/External/SVProgressHUD/SVProgressHUD.bundle/success@2x.png -------------------------------------------------------------------------------- /iGoat-Swift/iGoat-Swift/Source/External/SVProgressHUD/SVProgressHUD.bundle/success@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OWASP/iGoat-Swift/1f44c0826556ae3a44b92ba68fc64cdc4c993b03/iGoat-Swift/iGoat-Swift/Source/External/SVProgressHUD/SVProgressHUD.bundle/success@3x.png -------------------------------------------------------------------------------- /iGoat-Swift/iGoat-Swift/Source/External/SVProgressHUD/SVRadialGradientLayer.h: -------------------------------------------------------------------------------- 1 | // 2 | // SVRadialGradientLayer.h 3 | // SVProgressHUD, https://github.com/SVProgressHUD/SVProgressHUD 4 | // 5 | // Copyright (c) 2014-2017 Tobias Tiemerding. All rights reserved. 6 | // 7 | 8 | #import 9 | 10 | @interface SVRadialGradientLayer : CALayer 11 | 12 | @property (nonatomic) CGPoint gradientCenter; 13 | 14 | @end 15 | -------------------------------------------------------------------------------- /iGoat-Swift/iGoat-Swift/Source/External/SVProgressHUD/SVRadialGradientLayer.m: -------------------------------------------------------------------------------- 1 | // 2 | // SVRadialGradientLayer.m 3 | // SVProgressHUD, https://github.com/SVProgressHUD/SVProgressHUD 4 | // 5 | // Copyright (c) 2014-2017 Tobias Tiemerding. All rights reserved. 6 | // 7 | 8 | #import "SVRadialGradientLayer.h" 9 | 10 | @implementation SVRadialGradientLayer 11 | 12 | - (void)drawInContext:(CGContextRef)context { 13 | size_t locationsCount = 2; 14 | CGFloat locations[2] = {0.0f, 1.0f}; 15 | CGFloat colors[8] = {0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.75f}; 16 | CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB(); 17 | CGGradientRef gradient = CGGradientCreateWithColorComponents(colorSpace, colors, locations, locationsCount); 18 | CGColorSpaceRelease(colorSpace); 19 | 20 | float radius = MIN(self.bounds.size.width , self.bounds.size.height); 21 | CGContextDrawRadialGradient (context, gradient, self.gradientCenter, 0, self.gradientCenter, radius, kCGGradientDrawsAfterEndLocation); 22 | CGGradientRelease(gradient); 23 | } 24 | 25 | @end 26 | -------------------------------------------------------------------------------- /iGoat-Swift/iGoat-Swift/Source/External/SideBar/CenterContainmentSegue.swift: -------------------------------------------------------------------------------- 1 | // 2 | // CenterContainmentSegue.swift 3 | // 4 | // Copyright (c) 2015 Teodor Patraş 5 | // 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to deal 8 | // in the Software without restriction, including without limitation the rights 9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | // copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be included in all 14 | // copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | // SOFTWARE. 23 | 24 | import UIKit 25 | 26 | open class CenterContainmentSegue: UIStoryboardSegue{ 27 | 28 | override open func perform() { 29 | if let sideController = self.source as? SideMenuController { 30 | guard let destinationController = destination as? UINavigationController else { 31 | fatalError("Destination controller needs to be an instance of UINavigationController") 32 | } 33 | sideController.embed(centerViewController: destinationController) 34 | } else { 35 | fatalError("This type of segue must only be used from a SideMenuController") 36 | } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /iGoat-Swift/iGoat-Swift/Source/External/SideBar/SideContainmentSegue.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SideContainmentSegue.swift 3 | // 4 | // Copyright (c) 2015 Teodor Patraş 5 | // 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to deal 8 | // in the Software without restriction, including without limitation the rights 9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | // copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be included in all 14 | // copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | // SOFTWARE. 23 | import UIKit 24 | 25 | open class SideContainmentSegue: UIStoryboardSegue{ 26 | 27 | override open func perform() { 28 | if let sideController = self.source as? SideMenuController { 29 | sideController.embed(sideViewController: destination) 30 | } else { 31 | fatalError("This type of segue must only be used from a SideMenuController") 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /iGoat-Swift/iGoat-Swift/Source/External/SideBar/SideMenuController.h: -------------------------------------------------------------------------------- 1 | // 2 | // SideMenuController.h 3 | // SideMenuController 4 | // 5 | // Created by Teodor Patras on 16/06/16. 6 | // Copyright © 2016 teodorpatras. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | //! Project version number for SideMenuController. 12 | FOUNDATION_EXPORT double SideMenuControllerVersionNumber; 13 | 14 | //! Project version string for SideMenuController. 15 | FOUNDATION_EXPORT const unsigned char SideMenuControllerVersionString[]; 16 | 17 | // In this header, you should import all the public headers of your framework using statements like #import 18 | 19 | 20 | -------------------------------------------------------------------------------- /iGoat-Swift/iGoat-Swift/Source/Model/Asset.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | struct Asset { 4 | enum Key: String { 5 | case name 6 | case description 7 | case exercises 8 | } 9 | 10 | let title: String? 11 | let description: String? 12 | let exercises: [Exercise] 13 | 14 | init(assetInfo: [String: Any]) { 15 | title = assetInfo[Key.name.rawValue] as? String 16 | description = assetInfo[Key.description.rawValue] as? String 17 | var exercises = [Exercise]() 18 | if let exerciseInfos = assetInfo[Key.exercises.rawValue] as? [Any] { 19 | exerciseInfos.forEach { 20 | guard let exercise = $0 as? [String: Any] else { 21 | fatalError("exercise is not strutured") 22 | } 23 | exercises.append(Exercise(exerciseInfo: exercise)) 24 | } 25 | } 26 | self.exercises = exercises 27 | } 28 | 29 | static func allAssets() -> [Asset] { 30 | let bundlePath = Bundle.main.bundlePath 31 | guard let allExercisesInfo = NSDictionary(contentsOfFile: bundlePath + "/" + assetsFileName) as? [String: Any] 32 | else { fatalError("Unable to map th exercises. Please check the format") } 33 | 34 | var assets = [Asset]() 35 | for key in allExercisesInfo.keys { 36 | if var exerciseInfo = allExercisesInfo[key] as? [String: Any] { 37 | exerciseInfo[Asset.Key.name.rawValue] = key 38 | assets.append(Asset(assetInfo: exerciseInfo)) 39 | } 40 | } 41 | return assets 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /iGoat-Swift/iGoat-Swift/ThirdParty/CocoaLumberjack/CLI/CLIColor.h: -------------------------------------------------------------------------------- 1 | // 2 | // CLIColor.h 3 | // CocoaLumberjack 4 | // 5 | // Created by Ernesto Rivera on 2013/12/27. 6 | // 7 | // 8 | 9 | #import 10 | #import 11 | 12 | /** 13 | Simple NSColor replacement for CLI projects that don't link with AppKit 14 | */ 15 | @interface CLIColor : NSObject 16 | 17 | + (CLIColor *)colorWithCalibratedRed:(CGFloat)red green:(CGFloat)green blue:(CGFloat)blue alpha:(CGFloat)alpha; 18 | - (void)getRed:(CGFloat *)red green:(CGFloat *)green blue:(CGFloat *)blue alpha:(CGFloat *)alpha; 19 | 20 | @end 21 | -------------------------------------------------------------------------------- /iGoat-Swift/iGoat-Swift/ThirdParty/CocoaLumberjack/CLI/CLIColor.m: -------------------------------------------------------------------------------- 1 | // 2 | // CLIColor.m 3 | // CocoaLumberjack 4 | // 5 | // Created by Ernesto Rivera on 2013/12/27. 6 | // 7 | // 8 | 9 | #import "CLIColor.h" 10 | 11 | @implementation CLIColor 12 | { 13 | CGFloat _red, _green, _blue, _alpha; 14 | } 15 | 16 | +(CLIColor *)colorWithCalibratedRed:(CGFloat)red green:(CGFloat)green blue:(CGFloat)blue alpha:(CGFloat)alpha 17 | { 18 | CLIColor * color = [CLIColor new]; 19 | color->_red = red; 20 | color->_green = green; 21 | color->_blue = blue; 22 | color->_alpha = alpha; 23 | return color; 24 | } 25 | 26 | - (void)getRed:(CGFloat *)red green:(CGFloat *)green blue:(CGFloat *)blue alpha:(CGFloat *)alpha 27 | { 28 | if (red) *red = _red; 29 | if (green) *green = _green; 30 | if (blue) *blue = _blue; 31 | if (alpha) *alpha = _alpha; 32 | } 33 | 34 | @end 35 | -------------------------------------------------------------------------------- /iGoat-Swift/iGoat-Swift/ThirdParty/CocoaLumberjack/DDASLLogCapture.h: -------------------------------------------------------------------------------- 1 | // 2 | // DDASLLogCapture.h 3 | // Lumberjack 4 | // 5 | // Created by Dario Ahdoot on 3/17/14. 6 | // 7 | // 8 | 9 | #import "DDASLLogger.h" 10 | 11 | @protocol DDLogger; 12 | 13 | @interface DDASLLogCapture : NSObject 14 | 15 | + (void)start; 16 | + (void)stop; 17 | 18 | // Default log level: LOG_LEVEL_VERBOSE (i.e. capture all ASL messages). 19 | + (int)captureLogLevel; 20 | + (void)setCaptureLogLevel:(int)LOG_LEVEL_XXX; 21 | 22 | @end 23 | 24 | -------------------------------------------------------------------------------- /iGoat-Swift/iGoat-Swift/ThirdParty/CocoaLumberjack/DDASLLogger.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | #import "DDLog.h" 4 | 5 | /** 6 | * Welcome to Cocoa Lumberjack! 7 | * 8 | * The project page has a wealth of documentation if you have any questions. 9 | * https://github.com/CocoaLumberjack/CocoaLumberjack 10 | * 11 | * If you're new to the project you may wish to read the "Getting Started" wiki. 12 | * https://github.com/CocoaLumberjack/CocoaLumberjack/wiki/GettingStarted 13 | * 14 | * 15 | * This class provides a logger for the Apple System Log facility. 16 | * 17 | * As described in the "Getting Started" page, 18 | * the traditional NSLog() function directs it's output to two places: 19 | * 20 | * - Apple System Log 21 | * - StdErr (if stderr is a TTY) so log statements show up in Xcode console 22 | * 23 | * To duplicate NSLog() functionality you can simply add this logger and a tty logger. 24 | * However, if you instead choose to use file logging (for faster performance), 25 | * you may choose to use a file logger and a tty logger. 26 | **/ 27 | 28 | @interface DDASLLogger : DDAbstractLogger 29 | 30 | + (instancetype)sharedInstance; 31 | 32 | // Inherited from DDAbstractLogger 33 | 34 | // - (id )logFormatter; 35 | // - (void)setLogFormatter:(id )formatter; 36 | 37 | @end 38 | -------------------------------------------------------------------------------- /iGoat-Swift/iGoat-Swift/ThirdParty/CocoaLumberjack/Extensions/DDMultiFormatter.h: -------------------------------------------------------------------------------- 1 | #import 2 | #import "DDLog.h" 3 | 4 | /** 5 | * Welcome to Cocoa Lumberjack! 6 | * 7 | * The project page has a wealth of documentation if you have any questions. 8 | * https://github.com/CocoaLumberjack/CocoaLumberjack 9 | * 10 | * If you're new to the project you may wish to read the "Getting Started" page. 11 | * https://github.com/CocoaLumberjack/CocoaLumberjack/wiki/GettingStarted 12 | * 13 | * 14 | * This formatter can be used to chain different formatters together. 15 | * The log message will processed in the order of the formatters added. 16 | **/ 17 | 18 | @interface DDMultiFormatter : NSObject 19 | 20 | /** 21 | * Array of chained formatters 22 | */ 23 | @property (readonly) NSArray *formatters; 24 | 25 | - (void)addFormatter:(id)formatter; 26 | - (void)removeFormatter:(id)formatter; 27 | - (void)removeAllFormatters; 28 | - (BOOL)isFormattingWithFormatter:(id)formatter; 29 | 30 | @end 31 | -------------------------------------------------------------------------------- /iGoat-Swift/iGoat-Swift/ThirdParty/CocoaLumberjack/Extensions/README.txt: -------------------------------------------------------------------------------- 1 | This folder contains some sample formatters that may be helpful. 2 | 3 | Feel free to change them, extend them, or use them as the basis for your own custom formatter(s). 4 | 5 | More information about creating your own custom formatters can be found on the wiki: 6 | https://github.com/CocoaLumberjack/CocoaLumberjack/wiki/CustomFormatters 7 | 8 | -------------------------------------------------------------------------------- /iGoat-Swift/iGoat-Swift/ThirdParty/CouchBase/CouchbaseLite.framework/CouchbaseLite: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OWASP/iGoat-Swift/1f44c0826556ae3a44b92ba68fc64cdc4c993b03/iGoat-Swift/iGoat-Swift/ThirdParty/CouchBase/CouchbaseLite.framework/CouchbaseLite -------------------------------------------------------------------------------- /iGoat-Swift/iGoat-Swift/ThirdParty/CouchBase/CouchbaseLite.framework/Headers/CBLBase.h: -------------------------------------------------------------------------------- 1 | // 2 | // CBLBase.h 3 | // CouchbaseLite 4 | // 5 | // Created by Jens Alfke on 6/9/15. 6 | // Copyright © 2015 Couchbase, Inc. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | 12 | #if __has_feature(nullability) 13 | # ifndef NS_ASSUME_NONNULL_BEGIN 14 | // Xcode 6.3: 15 | # define NS_ASSUME_NONNULL_BEGIN _Pragma("clang assume_nonnull begin") 16 | # define NS_ASSUME_NONNULL_END _Pragma("clang assume_nonnull end") 17 | # endif 18 | #else 19 | // Xcode 6.2 and earlier: 20 | # define NS_ASSUME_NONNULL_BEGIN 21 | # define NS_ASSUME_NONNULL_END 22 | # define nullable 23 | # define __nullable 24 | #endif 25 | 26 | 27 | #if __has_feature(objc_generics) 28 | #define CBLArrayOf(VALUE) NSArray 29 | #define CBLDictOf(KEY, VALUE) NSDictionary 30 | #define CBLEnumeratorOf(VALUE) NSEnumerator 31 | #else 32 | #define CBLArrayOf(VALUE) NSArray 33 | #define CBLDictOf(KEY, VALUE) NSDictionary 34 | #define CBLEnumeratorOf(VALUE) NSEnumerator 35 | #endif 36 | 37 | typedef CBLDictOf(NSString*, id) CBLJSONDict; 38 | -------------------------------------------------------------------------------- /iGoat-Swift/iGoat-Swift/ThirdParty/CouchBase/CouchbaseLite.framework/Headers/CBLDatabaseChange.h: -------------------------------------------------------------------------------- 1 | // 2 | // CBLDatabaseChange.h 3 | // CouchbaseLite 4 | // 5 | // Created by Jens Alfke on 1/18/13. 6 | // Copyright (c) 2013 Couchbase, Inc. All rights reserved. 7 | // 8 | // 9 | 10 | #import "CBLBase.h" 11 | 12 | NS_ASSUME_NONNULL_BEGIN 13 | 14 | /** Identifies a change to a database, that is, a newly added document revision. 15 | The CBLDocumentChangeNotification contains one of these in the "change" key of its 16 | userInfo dictionary, and CBLDatabaseChangeNotification contains an NSArray in "changes". */ 17 | @interface CBLDatabaseChange : NSObject 18 | 19 | /** The ID of the document that changed. */ 20 | @property (readonly) NSString* documentID; 21 | 22 | /** The ID of the newly-added revision. A nil value means the document was purged. */ 23 | @property (readonly, nullable) NSString* revisionID; 24 | 25 | /** Is the new revision the document's current (default, winning) one? 26 | If not, there's a conflict. */ 27 | @property (readonly) BOOL isCurrentRevision; 28 | 29 | /** YES if the document is in conflict. (The conflict might pre-date this change.) */ 30 | @property (readonly) BOOL inConflict; 31 | 32 | /** YES of the document is deleted. */ 33 | @property (readonly) BOOL isDeletion; 34 | 35 | /** The remote database URL that this change was pulled from, if any. */ 36 | @property (readonly, nullable) NSURL* source; 37 | 38 | - (instancetype) init NS_UNAVAILABLE; 39 | 40 | @end 41 | 42 | 43 | NS_ASSUME_NONNULL_END 44 | -------------------------------------------------------------------------------- /iGoat-Swift/iGoat-Swift/ThirdParty/CouchBase/CouchbaseLite.framework/Headers/CBLQuery+Geo.h: -------------------------------------------------------------------------------- 1 | // 2 | // CBLQuery+Geo.h 3 | // CouchbaseLite 4 | // 5 | // Created by Jens Alfke on 9/23/13. 6 | // Copyright (c) 2013 Couchbase, Inc. All rights reserved. 7 | // 8 | 9 | #import "CBLQuery.h" 10 | #import "CBLGeometry.h" 11 | 12 | NS_ASSUME_NONNULL_BEGIN 13 | 14 | /** CBLQuery interface for geo-queries. 15 | To use this, the view's map function must have emitted geometries (points, rects, etc.) 16 | as keys using the functions CBLGeoPointKey(), CBLGeoRectKey(), or CBLGeoJSONKey(). */ 17 | @interface CBLQuery (Geo) 18 | 19 | /** The geometric bounding box to search. Setting this property causes the query to 20 | search geometries rather than keys. */ 21 | @property CBLGeoRect boundingBox; 22 | 23 | @end 24 | 25 | 26 | /** A result row from a CouchbaseLite geo-query. 27 | A CBLQuery with its .boundingBox property set will produce CBLGeoQueryRows. */ 28 | @interface CBLGeoQueryRow : CBLQueryRow 29 | 30 | /** The row's geo bounding box in native form. 31 | If the emitted geo object was a point, the boundingBox's min and max will be equal. 32 | Note: The coordinates may have slight round-off error, because SQLite internally stores bounding 33 | boxes as 32-bit floats, but the coordinates are always rounded outwards -- making the bounding 34 | box slightly larger -- to avoid false negatives in searches. */ 35 | @property (readonly, nonatomic) CBLGeoRect boundingBox; 36 | 37 | /** The GeoJSON object emitted as the key of the emit() call by the map function. 38 | The format is a parsed GeoJSON point or polygon; see http://geojson.org/geojson-spec */ 39 | @property (readonly, nullable) CBLJSONDict* geometry; 40 | 41 | /** The GeoJSON object type of the row's geometry. 42 | Usually @"Point" or @"Rectangle", but may be another type if the emitted key was GeoJSON. 43 | (The "Rectangle" type is not standard GeoJSON.) */ 44 | @property (readonly, nonatomic, nullable) NSString* geometryType; 45 | 46 | @end 47 | 48 | 49 | NS_ASSUME_NONNULL_END 50 | -------------------------------------------------------------------------------- /iGoat-Swift/iGoat-Swift/ThirdParty/CouchBase/CouchbaseLite.framework/Headers/CouchbaseLite.h: -------------------------------------------------------------------------------- 1 | // 2 | // CouchbaseLite.h 3 | // CouchbaseLite 4 | // 5 | // Created by Jens Alfke on 12/2/11. 6 | // Copyright (c) 2011-2013 Couchbase, Inc. All rights reserved. 7 | // 8 | // Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file 9 | // except in compliance with the License. You may obtain a copy of the License at 10 | // http://www.apache.org/licenses/LICENSE-2.0 11 | // Unless required by applicable law or agreed to in writing, software distributed under the 12 | // License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 13 | // either express or implied. See the License for the specific language governing permissions 14 | // and limitations under the License. 15 | 16 | 17 | #define CBL_DEPRECATED // Enable deprecated methods. 18 | 19 | #import "CBLManager.h" 20 | #import "CBLDatabase.h" 21 | #import "CBLDatabaseChange.h" 22 | #import "CBLDocument.h" 23 | #import "CBLRevision.h" 24 | #import "CBLAttachment.h" 25 | #import "CBLView.h" 26 | #import "CBLQuery.h" 27 | #import "CBLQuery+FullTextSearch.h" 28 | #import "CBLQuery+Geo.h" 29 | #import "CBLQueryBuilder.h" 30 | #import "CBLAuthenticator.h" 31 | #import "CBLAuthenticator+OpenID.h" 32 | #import "CBLReplication.h" 33 | #import "CBLModel.h" 34 | #import "CBLModelFactory.h" 35 | #import "CBLJSON.h" 36 | 37 | #if TARGET_OS_IPHONE 38 | #import "CBLUITableSource.h" 39 | #else 40 | #import "CBLRegisterJSViewCompiler.h" 41 | #endif 42 | -------------------------------------------------------------------------------- /iGoat-Swift/iGoat-Swift/ThirdParty/CouchBase/CouchbaseLite.framework/Info.plist: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OWASP/iGoat-Swift/1f44c0826556ae3a44b92ba68fc64cdc4c993b03/iGoat-Swift/iGoat-Swift/ThirdParty/CouchBase/CouchbaseLite.framework/Info.plist -------------------------------------------------------------------------------- /iGoat-Swift/iGoat-Swift/ThirdParty/YapDatabase/Extensions/CloudKit/Internal/YDBCKAttachRequest.h: -------------------------------------------------------------------------------- 1 | #import 2 | #import 3 | 4 | 5 | @interface YDBCKAttachRequest : NSObject 6 | 7 | @property (nonatomic, copy, readwrite) NSString *databaseIdentifier; 8 | @property (nonatomic, strong, readwrite) CKRecord *record; 9 | 10 | @property (nonatomic, assign, readwrite) BOOL shouldUploadRecord; 11 | 12 | @end 13 | -------------------------------------------------------------------------------- /iGoat-Swift/iGoat-Swift/ThirdParty/YapDatabase/Extensions/CloudKit/Internal/YDBCKAttachRequest.m: -------------------------------------------------------------------------------- 1 | #import "YDBCKAttachRequest.h" 2 | 3 | 4 | @implementation YDBCKAttachRequest 5 | 6 | @synthesize databaseIdentifier; 7 | @synthesize record; 8 | 9 | @synthesize shouldUploadRecord; 10 | 11 | @end 12 | -------------------------------------------------------------------------------- /iGoat-Swift/iGoat-Swift/ThirdParty/YapDatabase/Extensions/CloudKit/Internal/YDBCKChangeRecord.h: -------------------------------------------------------------------------------- 1 | #import 2 | #import 3 | 4 | 5 | @interface YDBCKChangeRecord : NSObject 6 | 7 | - (instancetype)initWithRecord:(CKRecord *)record; 8 | 9 | @property (nonatomic, strong, readwrite) CKRecord *record; 10 | 11 | @property (nonatomic, assign, readwrite) BOOL needsStoreFullRecord; 12 | @property (nonatomic, strong, readwrite) NSDictionary *originalValues; 13 | 14 | @property (nonatomic, readonly) CKRecordID *recordID; 15 | @property (nonatomic, readonly) NSArray *changedKeys; 16 | @property (nonatomic, readonly) NSSet *changedKeysSet; 17 | 18 | @end 19 | -------------------------------------------------------------------------------- /iGoat-Swift/iGoat-Swift/ThirdParty/YapDatabase/Extensions/CloudKit/Internal/YDBCKMappingTableInfo.h: -------------------------------------------------------------------------------- 1 | #import 2 | #import 3 | 4 | @class YDBCKDirtyMappingTableInfo; 5 | 6 | @protocol YDBCKMappingTableInfo 7 | @property (nonatomic, strong, readonly) NSString *current_recordTable_hash; 8 | @end 9 | 10 | /** 11 | * This class represents information about an unmodified row in the mapping table. 12 | * 13 | * YapDatabaseCloudKitConnection.cleanMappingTableInfo stores instances of this type: 14 | * 15 | * cleanMappingTableInfo.key = rowid (NSNumber) 16 | * cleanMappingTableInfo.value = YDBCKCleanMappingTableInfo 17 | **/ 18 | @interface YDBCKCleanMappingTableInfo : NSObject 19 | 20 | - (instancetype)initWithRecordTableHash:(NSString *)hash; 21 | 22 | @property (nonatomic, strong, readonly) NSString *recordTable_hash; 23 | 24 | - (YDBCKDirtyMappingTableInfo *)dirtyCopy; 25 | 26 | @end 27 | 28 | #pragma mark - 29 | 30 | /** 31 | * This class represents information about a modified row in the mapping table. 32 | * 33 | * YapDatabaseCloudKitConnection.dirtyMappingTableInfo stores instances of this type: 34 | * 35 | * dirtyMappingTableInfo.key = rowid (NSNumber) 36 | * dirtyMappingTableInfo.value = YDBCKDirtyMappingTableInfo 37 | **/ 38 | @interface YDBCKDirtyMappingTableInfo : NSObject 39 | 40 | - (instancetype)initWithRecordTableHash:(NSString *)hash; 41 | 42 | @property (nonatomic, strong, readonly) NSString *clean_recordTable_hash; 43 | @property (nonatomic, strong, readwrite) NSString *dirty_recordTable_hash; 44 | 45 | - (YDBCKCleanMappingTableInfo *)cleanCopy; 46 | 47 | @end -------------------------------------------------------------------------------- /iGoat-Swift/iGoat-Swift/ThirdParty/YapDatabase/Extensions/CloudKit/Internal/YDBCKMappingTableInfo.m: -------------------------------------------------------------------------------- 1 | #import "YDBCKMappingTableInfo.h" 2 | 3 | 4 | @implementation YDBCKCleanMappingTableInfo 5 | 6 | @synthesize recordTable_hash = recordTable_hash; 7 | 8 | - (instancetype)initWithRecordTableHash:(NSString *)hash 9 | { 10 | if ((self = [super init])) 11 | { 12 | recordTable_hash = hash; 13 | } 14 | return self; 15 | } 16 | 17 | - (NSString *)current_recordTable_hash { 18 | return recordTable_hash; 19 | } 20 | 21 | - (YDBCKDirtyMappingTableInfo *)dirtyCopy 22 | { 23 | YDBCKDirtyMappingTableInfo *dirtyCopy = 24 | [[YDBCKDirtyMappingTableInfo alloc] initWithRecordTableHash:recordTable_hash]; 25 | 26 | return dirtyCopy; 27 | } 28 | 29 | @end 30 | 31 | #pragma mark - 32 | 33 | @implementation YDBCKDirtyMappingTableInfo 34 | 35 | @synthesize clean_recordTable_hash = clean_recordTable_hash; 36 | @synthesize dirty_recordTable_hash = dirty_recordTable_hash; 37 | 38 | - (instancetype)initWithRecordTableHash:(NSString *)hash 39 | { 40 | if ((self = [super init])) 41 | { 42 | clean_recordTable_hash = hash; 43 | dirty_recordTable_hash = hash; 44 | } 45 | return self; 46 | } 47 | 48 | - (NSString *)current_recordTable_hash { 49 | return dirty_recordTable_hash; 50 | } 51 | 52 | - (YDBCKCleanMappingTableInfo *)cleanCopy 53 | { 54 | YDBCKCleanMappingTableInfo *cleanCopy = 55 | [[YDBCKCleanMappingTableInfo alloc] initWithRecordTableHash:dirty_recordTable_hash]; 56 | 57 | return cleanCopy; 58 | } 59 | 60 | @end 61 | -------------------------------------------------------------------------------- /iGoat-Swift/iGoat-Swift/ThirdParty/YapDatabase/Extensions/CloudKit/Utilities/YDBCKChangeSet.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | /** 4 | * A change-set represents the set of changes that will be given to a CKModifyRecordsOperation. 5 | * 6 | * A change-set is automatically generated by a readWriteTransaction 7 | * that makes one or more changes that result in modifications that need to be pushed to the CloudKit server. 8 | * 9 | * Changes are grouped by databaseIdentifier. 10 | * So if a single readWriteTransaction makes several modifications that span multiple databaseIdentifiers, 11 | * then the transaction will result in multiple generated change-sets. 12 | * 13 | * You are free to inspect the change-set, however, it is not possible to modify it. 14 | **/ 15 | @interface YDBCKChangeSet : NSObject 16 | 17 | @property (nonatomic, readonly) NSString *databaseIdentifier; 18 | @property (nonatomic, readonly) NSString *uuid; 19 | 20 | @property (nonatomic, readonly) BOOL isInFlight; 21 | 22 | @property (nonatomic, readonly) NSArray *recordIDsToDelete; // Array of CKRecordID's for CKModifyRecordsOperation 23 | @property (nonatomic, readonly) NSArray *recordsToSave; // Array of CKRecord's for CKModifyRecordsOperation 24 | @property (nonatomic, readonly) NSArray *recordIDsToSave; // Array of CKRecordID's (from recordsToSave) 25 | 26 | @property (nonatomic, readonly) NSUInteger recordIDsToDeleteCount; // shortcut if you just want the count 27 | @property (nonatomic, readonly) NSUInteger recordsToSaveCount; // shortcut if you just want the count 28 | 29 | @end 30 | -------------------------------------------------------------------------------- /iGoat-Swift/iGoat-Swift/ThirdParty/YapDatabase/Extensions/CloudKit/Utilities/YDBCKMergeInfo.m: -------------------------------------------------------------------------------- 1 | #import "YDBCKMergeInfo.h" 2 | #import "YapDatabaseCloudKitPrivate.h" 3 | 4 | 5 | @implementation YDBCKMergeInfo 6 | { 7 | NSMutableDictionary *originalValues; 8 | } 9 | 10 | // See header file for documentation 11 | 12 | @dynamic originalValues; 13 | 14 | @synthesize pendingLocalRecord = pendingLocalRecord; 15 | @synthesize updatedPendingLocalRecord = updatedPendingLocalRecord; 16 | 17 | - (NSDictionary *)originalValues 18 | { 19 | return originalValues; 20 | } 21 | 22 | // Private API 23 | 24 | - (void)mergeNewerRecord:(CKRecord *)newerRecord newerOriginalValues:(NSDictionary *)newerOriginalValues 25 | { 26 | // Merge into pendingLocalRecord 27 | // 28 | // Note: For pendingLocalRecord, the most recent value wins. 29 | 30 | if (newerRecord) 31 | { 32 | for (NSString *changedKey in newerRecord.changedKeys) 33 | { 34 | // Remember: nil is a valid value. 35 | // It indicates removal of the value for the key, which is a valid action. 36 | 37 | id value = [newerRecord objectForKey:changedKey]; 38 | [pendingLocalRecord setObject:value forKey:changedKey]; 39 | } 40 | } 41 | 42 | // Merge into originalValues 43 | // 44 | // Note: For originalValues, the least recent value wins. 45 | 46 | if (newerOriginalValues) 47 | { 48 | if (originalValues == nil) 49 | { 50 | originalValues = [newerOriginalValues mutableCopy]; 51 | } 52 | else 53 | { 54 | [newerOriginalValues enumerateKeysAndObjectsUsingBlock:^(id key, id obj, BOOL *stop) { 55 | 56 | if ([originalValues objectForKey:key] == nil) 57 | { 58 | [originalValues setObject:obj forKey:key]; 59 | } 60 | }]; 61 | } 62 | } 63 | } 64 | 65 | @end 66 | -------------------------------------------------------------------------------- /iGoat-Swift/iGoat-Swift/ThirdParty/YapDatabase/Extensions/CloudKit/Utilities/YDBCKRecord.h: -------------------------------------------------------------------------------- 1 | #import 2 | #import 3 | 4 | 5 | @interface CKRecord (YapDatabaseCloudKit) 6 | 7 | /** 8 | * Returns a "sanitized" copy of the given record. 9 | * That is, a copy that ONLY includes the "system fields" of the record. 10 | * It will NOT contain any key/value pairs from the original record. 11 | **/ 12 | - (id)sanitizedCopy; 13 | 14 | /** 15 | * Calling [ckRecord copy] is COMPLETELY BROKEN. 16 | * This is a MAJOR BUG in Apple's CloudKit framework (as I see it). 17 | * 18 | * Until this is fixed, we're forced to use this workaround. 19 | **/ 20 | - (id)safeCopy; 21 | 22 | @end 23 | 24 | #pragma mark - 25 | 26 | @interface YDBCKRecord : NSObject 27 | 28 | /** 29 | * This method serializes just the "system fields" of the given record. 30 | * That is, it won't store any of the user-created key/value pairs. 31 | * It only stores the CloudKit specific stuff, such as the versioning info, syncing info, etc. 32 | **/ 33 | + (NSData *)serializeRecord:(CKRecord *)record; 34 | 35 | /** 36 | * Deserialize the given record data. 37 | * 38 | * If the record data came from [YDBCKRecord serializeRecord:], 39 | * then the returned record will only contain the "system fields". 40 | **/ 41 | + (CKRecord *)deserializeRecord:(NSData *)data; 42 | 43 | #pragma mark Instance 44 | 45 | - (instancetype)initWithRecord:(CKRecord *)record; 46 | 47 | @property (nonatomic, strong, readonly) CKRecord *record; 48 | 49 | @end 50 | -------------------------------------------------------------------------------- /iGoat-Swift/iGoat-Swift/ThirdParty/YapDatabase/Extensions/CloudKit/Utilities/YDBCKRecordInfo.m: -------------------------------------------------------------------------------- 1 | #import "YDBCKRecordInfo.h" 2 | #import "YapDatabaseCloudKitPrivate.h" 3 | 4 | 5 | @implementation YDBCKRecordInfo 6 | 7 | @synthesize databaseIdentifier; 8 | @synthesize originalValues; 9 | 10 | @synthesize keysToRestore; 11 | @synthesize versionInfo; 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /iGoat-Swift/iGoat-Swift/ThirdParty/YapDatabase/Extensions/CloudKit/YapDatabaseCloudKitConnection.h: -------------------------------------------------------------------------------- 1 | #import 2 | #import "YapDatabaseExtensionConnection.h" 3 | 4 | @class YapDatabaseCloudKit; 5 | 6 | 7 | @interface YapDatabaseCloudKitConnection : YapDatabaseExtensionConnection 8 | 9 | /** 10 | * Returns the parent view instance. 11 | **/ 12 | @property (nonatomic, strong, readonly) YapDatabaseCloudKit *cloudKit; 13 | 14 | @end 15 | -------------------------------------------------------------------------------- /iGoat-Swift/iGoat-Swift/ThirdParty/YapDatabase/Extensions/CloudKit/YapDatabaseCloudKitOptions.h: -------------------------------------------------------------------------------- 1 | #import 2 | #import "YapWhitelistBlacklist.h" 3 | 4 | 5 | @interface YapDatabaseCloudKitOptions : NSObject 6 | 7 | /** 8 | * You can configure the extension to pre-filter all but a subset of collections. 9 | * 10 | * The primary motivation for this is to reduce the overhead when first setting up the extension. 11 | * For example, if you're only syncing objects from a single collection, 12 | * then you could specify that collection here. So when the extension first populates itself, 13 | * it will enumerate over just the allowedCollections, as opposed to enumerating over all collections. 14 | * And enumerating a small subset of the entire database during initial setup can improve speed, 15 | * especially with larger databases. 16 | * 17 | * In addition to reducing the overhead during initial setup, 18 | * the allowedCollections will pre-filter while you're making changes to the database. 19 | * So if you add a new object to the database, and the associated collection isn't in allowedCollections, 20 | * then the GetRecordBlock will never be invoked, and the extension will act as if the block returned nil. 21 | * 22 | * For all rows whose collection is in the allowedCollections, the extension acts normally. 23 | * So the GetRecordBlock would still be invoked as normal. 24 | * 25 | * The default value is nil. 26 | **/ 27 | @property (nonatomic, strong, readwrite) YapWhitelistBlacklist *allowedCollections; 28 | 29 | 30 | // Todo: Need ability to set default options for CKModifyRecordsOperation 31 | 32 | @end 33 | -------------------------------------------------------------------------------- /iGoat-Swift/iGoat-Swift/ThirdParty/YapDatabase/Extensions/CloudKit/YapDatabaseCloudKitOptions.m: -------------------------------------------------------------------------------- 1 | #import "YapDatabaseCloudKitOptions.h" 2 | 3 | @implementation YapDatabaseCloudKitOptions 4 | 5 | @synthesize allowedCollections = allowedCollections; 6 | 7 | - (id)copyWithZone:(NSZone *)zone 8 | { 9 | YapDatabaseCloudKitOptions *copy = [[[self class] alloc] init]; // [self class] required to support subclassing 10 | copy->allowedCollections = allowedCollections; 11 | 12 | return copy; 13 | } 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /iGoat-Swift/iGoat-Swift/ThirdParty/YapDatabase/Extensions/CloudKit/YapDatabaseCloudKitTypes.m: -------------------------------------------------------------------------------- 1 | #import "YapDatabaseCloudKitTypes.h" 2 | #import "YapDatabaseCloudKitPrivate.h" 3 | 4 | 5 | @implementation YapDatabaseCloudKitRecordHandler 6 | 7 | @synthesize recordBlock = recordBlock; 8 | @synthesize recordBlockType = recordBlockType; 9 | 10 | + (instancetype)withKeyBlock:(YapDatabaseCloudKitRecordWithKeyBlock)recordBlock 11 | { 12 | if (recordBlock == nil) return nil; 13 | 14 | YapDatabaseCloudKitRecordHandler *handler = [[YapDatabaseCloudKitRecordHandler alloc] init]; 15 | handler->recordBlock = recordBlock; 16 | handler->recordBlockType = YapDatabaseCloudKitBlockTypeWithKey; 17 | 18 | return handler; 19 | } 20 | 21 | + (instancetype)withObjectBlock:(YapDatabaseCloudKitRecordWithObjectBlock)recordBlock 22 | { 23 | if (recordBlock == nil) return nil; 24 | 25 | YapDatabaseCloudKitRecordHandler *handler = [[YapDatabaseCloudKitRecordHandler alloc] init]; 26 | handler->recordBlock = recordBlock; 27 | handler->recordBlockType = YapDatabaseCloudKitBlockTypeWithObject; 28 | 29 | return handler; 30 | } 31 | 32 | + (instancetype)withMetadataBlock:(YapDatabaseCloudKitRecordWithMetadataBlock)recordBlock 33 | { 34 | if (recordBlock == nil) return nil; 35 | 36 | YapDatabaseCloudKitRecordHandler *handler = [[YapDatabaseCloudKitRecordHandler alloc] init]; 37 | handler->recordBlock = recordBlock; 38 | handler->recordBlockType = YapDatabaseCloudKitBlockTypeWithMetadata; 39 | 40 | return handler; 41 | } 42 | 43 | + (instancetype)withRowBlock:(YapDatabaseCloudKitRecordWithRowBlock)recordBlock 44 | { 45 | if (recordBlock == nil) return nil; 46 | 47 | YapDatabaseCloudKitRecordHandler *handler = [[YapDatabaseCloudKitRecordHandler alloc] init]; 48 | handler->recordBlock = recordBlock; 49 | handler->recordBlockType = YapDatabaseCloudKitBlockTypeWithRow; 50 | 51 | return handler; 52 | } 53 | 54 | @end 55 | -------------------------------------------------------------------------------- /iGoat-Swift/iGoat-Swift/ThirdParty/YapDatabase/Extensions/FilteredViews/YapDatabaseFilteredView.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | #import "YapDatabaseView.h" 4 | 5 | #import "YapDatabaseFilteredViewTypes.h" 6 | #import "YapDatabaseFilteredViewConnection.h" 7 | #import "YapDatabaseFilteredViewTransaction.h" 8 | 9 | 10 | @interface YapDatabaseFilteredView : YapDatabaseView 11 | 12 | /** 13 | * @param parentViewName 14 | * 15 | * The parentViewName must be the registered name of a YapDatabaseView or 16 | * YapDatabaseFilteredView extension. 17 | * That is, you must first register the parentView, and then use that registered name here. 18 | * 19 | * @param filtering 20 | * 21 | * The filteringBlock allows you to filter items from this view that exist in the parent view. 22 | * There are multiple filteringBlock types that are supported. 23 | * 24 | * @see YapDatabaseViewTypes.h for block type definitions. 25 | * 26 | * @param versionTag 27 | * 28 | * The filteringBlock may be changed after the filteredView is created (see YapDatabaseFilteredViewTransaction). 29 | * This is often in association with user events. 30 | * The versionTag helps to identify the filteringBlock being used. 31 | * During initialization of the view, the view will compare the passed tag to what it has stored from a previous 32 | * app session. If the tag matches, then the filteredView is already setup. Otherwise the view will automatically 33 | * flush its tables, and re-populate itself. 34 | * 35 | * @param options 36 | * 37 | * The options allow you to specify things like creating an IN-MEMORY-ONLY VIEW (non persistent). 38 | **/ 39 | 40 | - (id)initWithParentViewName:(NSString *)viewName 41 | filtering:(YapDatabaseViewFiltering *)filtering; 42 | 43 | - (id)initWithParentViewName:(NSString *)viewName 44 | filtering:(YapDatabaseViewFiltering *)filtering 45 | versionTag:(NSString *)versionTag; 46 | 47 | - (id)initWithParentViewName:(NSString *)viewName 48 | filtering:(YapDatabaseViewFiltering *)filtering 49 | versionTag:(NSString *)versionTag 50 | options:(YapDatabaseViewOptions *)options; 51 | 52 | 53 | @property (nonatomic, strong, readonly) NSString *parentViewName; 54 | 55 | @property (nonatomic, strong, readonly) YapDatabaseViewFilteringBlock filteringBlock; 56 | @property (nonatomic, assign, readonly) YapDatabaseViewBlockType filteringBlockType; 57 | 58 | @end 59 | -------------------------------------------------------------------------------- /iGoat-Swift/iGoat-Swift/ThirdParty/YapDatabase/Extensions/FilteredViews/YapDatabaseFilteredViewConnection.h: -------------------------------------------------------------------------------- 1 | #import 2 | #import "YapDatabaseViewConnection.h" 3 | 4 | @class YapDatabaseFilteredView; 5 | 6 | 7 | @interface YapDatabaseFilteredViewConnection : YapDatabaseViewConnection 8 | 9 | // Returns properly typed parent view instance 10 | @property (nonatomic, strong, readonly) YapDatabaseFilteredView *filteredView; 11 | 12 | @end 13 | -------------------------------------------------------------------------------- /iGoat-Swift/iGoat-Swift/ThirdParty/YapDatabase/Extensions/FilteredViews/YapDatabaseFilteredViewTransaction.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | #import "YapDatabaseViewTransaction.h" 4 | #import "YapDatabaseFilteredViewTypes.h" 5 | #import "YapDatabaseFilteredView.h" 6 | 7 | 8 | @interface YapDatabaseFilteredViewTransaction : YapDatabaseViewTransaction 9 | 10 | // This class extends YapDatabaseViewTransaction. 11 | // 12 | // Please see YapDatabaseViewTransaction.h 13 | 14 | @end 15 | 16 | #pragma mark - 17 | 18 | @interface YapDatabaseFilteredViewTransaction (ReadWrite) 19 | 20 | /** 21 | * This method allows you to change the filterBlock on-the-fly. 22 | * 23 | * When you do so, the extension will emit the smallest change-set possible. 24 | * That is, it does NOT clear the view and start from scratch. 25 | * Rather it performs a quick in-place update. 26 | * The end result is a minimal change-set that looks nice for tableView / collectionView animations. 27 | * 28 | * For example, in Apple's phone app, in the Recents tab, one can switch between "all" and "missed" calls. 29 | * Tapping the "missed" button smoothly animates away all non-red rows. It looks great. 30 | * You can get the same effect by using a YapDatabaseFilteredView, 31 | * and swapping in/out a filterBlock to allow/disallow non-missed calls. 32 | * 33 | * Note: You must pass a different versionTag, or this method does nothing. 34 | **/ 35 | - (void)setFiltering:(YapDatabaseViewFiltering *)filtering 36 | versionTag:(NSString *)tag; 37 | 38 | @end 39 | -------------------------------------------------------------------------------- /iGoat-Swift/iGoat-Swift/ThirdParty/YapDatabase/Extensions/FilteredViews/YapDatabaseFilteredViewTypes.m: -------------------------------------------------------------------------------- 1 | #import "YapDatabaseFilteredViewTypes.h" 2 | 3 | @implementation YapDatabaseViewFiltering 4 | 5 | @synthesize filteringBlock = filteringBlock; 6 | @synthesize filteringBlockType = filteringBlockType; 7 | 8 | + (instancetype)withKeyBlock:(YapDatabaseViewFilteringWithKeyBlock)filteringBlock 9 | { 10 | if (filteringBlock == NULL) return nil; 11 | 12 | YapDatabaseViewFiltering *filtering = [[YapDatabaseViewFiltering alloc] init]; 13 | filtering->filteringBlock = filteringBlock; 14 | filtering->filteringBlockType = YapDatabaseViewBlockTypeWithKey; 15 | 16 | return filtering; 17 | } 18 | 19 | + (instancetype)withObjectBlock:(YapDatabaseViewFilteringWithObjectBlock)filteringBlock 20 | { 21 | if (filteringBlock == NULL) return nil; 22 | 23 | YapDatabaseViewFiltering *filtering = [[YapDatabaseViewFiltering alloc] init]; 24 | filtering->filteringBlock = filteringBlock; 25 | filtering->filteringBlockType = YapDatabaseViewBlockTypeWithObject; 26 | 27 | return filtering; 28 | } 29 | 30 | + (instancetype)withMetadataBlock:(YapDatabaseViewFilteringWithMetadataBlock)filteringBlock 31 | { 32 | if (filteringBlock == NULL) return nil; 33 | 34 | YapDatabaseViewFiltering *filtering = [[YapDatabaseViewFiltering alloc] init]; 35 | filtering->filteringBlock = filteringBlock; 36 | filtering->filteringBlockType = YapDatabaseViewBlockTypeWithMetadata; 37 | 38 | return filtering; 39 | } 40 | 41 | + (instancetype)withRowBlock:(YapDatabaseViewFilteringWithRowBlock)filteringBlock 42 | { 43 | if (filteringBlock == NULL) return nil; 44 | 45 | YapDatabaseViewFiltering *filtering = [[YapDatabaseViewFiltering alloc] init]; 46 | filtering->filteringBlock = filteringBlock; 47 | filtering->filteringBlockType = YapDatabaseViewBlockTypeWithRow; 48 | 49 | return filtering; 50 | } 51 | 52 | @end 53 | -------------------------------------------------------------------------------- /iGoat-Swift/iGoat-Swift/ThirdParty/YapDatabase/Extensions/FullTextSearch/YapDatabaseFullTextSearch.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | #import "YapDatabaseExtension.h" 4 | #import "YapDatabaseFullTextSearchHandler.h" 5 | #import "YapDatabaseFullTextSearchConnection.h" 6 | #import "YapDatabaseFullTextSearchTransaction.h" 7 | 8 | /** 9 | * Welcome to YapDatabase! 10 | * 11 | * https://github.com/yapstudios/YapDatabase 12 | * 13 | * The project wiki has a wealth of documentation if you have any questions. 14 | * https://github.com/yapstudios/YapDatabase/wiki 15 | * 16 | * YapDatabaseFullTextSearch is an extension for performing text based search. 17 | * Internally it uses sqlite's FTS module which was contributed by Google. 18 | **/ 19 | @interface YapDatabaseFullTextSearch : YapDatabaseExtension 20 | 21 | - (id)initWithColumnNames:(NSArray *)columnNames 22 | handler:(YapDatabaseFullTextSearchHandler *)handler; 23 | 24 | - (id)initWithColumnNames:(NSArray *)columnNames 25 | handler:(YapDatabaseFullTextSearchHandler *)handler 26 | versionTag:(NSString *)versionTag; 27 | 28 | - (id)initWithColumnNames:(NSArray *)columnNames 29 | options:(NSDictionary *)options 30 | handler:(YapDatabaseFullTextSearchHandler *)handler 31 | versionTag:(NSString *)versionTag; 32 | 33 | 34 | /* Inherited from YapDatabaseExtension 35 | 36 | @property (nonatomic, strong, readonly) NSString *registeredName; 37 | 38 | */ 39 | 40 | @property (nonatomic, strong, readonly) YapDatabaseFullTextSearchBlock block; 41 | @property (nonatomic, assign, readonly) YapDatabaseFullTextSearchBlockType blockType; 42 | 43 | /** 44 | * The versionTag assists in making changes to the extension. 45 | * 46 | * If you need to change the columnNames and/or block, 47 | * then simply pass a different versionTag during the init method, 48 | * and the FTS extension will automatically update itself. 49 | **/ 50 | @property (nonatomic, copy, readonly) NSString *versionTag; 51 | 52 | @end 53 | -------------------------------------------------------------------------------- /iGoat-Swift/iGoat-Swift/ThirdParty/YapDatabase/Extensions/FullTextSearch/YapDatabaseFullTextSearchConnection.h: -------------------------------------------------------------------------------- 1 | #import 2 | #import "YapDatabaseExtensionConnection.h" 3 | 4 | @class YapDatabaseFullTextSearch; 5 | 6 | /** 7 | * Welcome to YapDatabase! 8 | * 9 | * https://github.com/yapstudios/YapDatabase 10 | * 11 | * The project wiki has a wealth of documentation if you have any questions. 12 | * https://github.com/yapstudios/YapDatabase/wiki 13 | * 14 | * YapDatabaseFullTextSearch is an extension for performing text based search. 15 | * Internally it uses sqlite's FTS module which was contributed by Google. 16 | * 17 | * As an extension, YapCollectiosnDatabaseFullTextSearchConnection is automatically 18 | * created by YapDatabaseConnnection. You can access this object via: 19 | * 20 | * [databaseConnection extension:@"myRegisteredExtensionName"] 21 | * 22 | * @see YapDatabaseFullTextSearch 23 | * @see YapDatabaseFullTextSearchTransaction 24 | **/ 25 | @interface YapDatabaseFullTextSearchConnection : YapDatabaseExtensionConnection 26 | 27 | /** 28 | * Returns the parent instance. 29 | **/ 30 | @property (nonatomic, strong, readonly) YapDatabaseFullTextSearch *fullTextSearch; 31 | 32 | @end 33 | -------------------------------------------------------------------------------- /iGoat-Swift/iGoat-Swift/ThirdParty/YapDatabase/Extensions/FullTextSearch/YapDatabaseFullTextSearchHandler.m: -------------------------------------------------------------------------------- 1 | #import "YapDatabaseFullTextSearchHandler.h" 2 | 3 | 4 | @implementation YapDatabaseFullTextSearchHandler 5 | 6 | @synthesize block = block; 7 | @synthesize blockType = blockType; 8 | 9 | + (instancetype)withKeyBlock:(YapDatabaseFullTextSearchWithKeyBlock)block 10 | { 11 | if (block == NULL) return nil; 12 | 13 | YapDatabaseFullTextSearchHandler *handler = [[YapDatabaseFullTextSearchHandler alloc] init]; 14 | handler->block = block; 15 | handler->blockType = YapDatabaseFullTextSearchBlockTypeWithKey; 16 | 17 | return handler; 18 | } 19 | 20 | + (instancetype)withObjectBlock:(YapDatabaseFullTextSearchWithObjectBlock)block 21 | { 22 | if (block == NULL) return nil; 23 | 24 | YapDatabaseFullTextSearchHandler *handler = [[YapDatabaseFullTextSearchHandler alloc] init]; 25 | handler->block = block; 26 | handler->blockType = YapDatabaseFullTextSearchBlockTypeWithObject; 27 | 28 | return handler; 29 | } 30 | 31 | + (instancetype)withMetadataBlock:(YapDatabaseFullTextSearchWithMetadataBlock)block 32 | { 33 | if (block == NULL) return nil; 34 | 35 | YapDatabaseFullTextSearchHandler *handler = [[YapDatabaseFullTextSearchHandler alloc] init]; 36 | handler->block = block; 37 | handler->blockType = YapDatabaseFullTextSearchBlockTypeWithMetadata; 38 | 39 | return handler; 40 | } 41 | 42 | + (instancetype)withRowBlock:(YapDatabaseFullTextSearchWithRowBlock)block 43 | { 44 | if (block == NULL) return nil; 45 | 46 | YapDatabaseFullTextSearchHandler *handler = [[YapDatabaseFullTextSearchHandler alloc] init]; 47 | handler->block = block; 48 | handler->blockType = YapDatabaseFullTextSearchBlockTypeWithRow; 49 | 50 | return handler; 51 | } 52 | 53 | @end 54 | -------------------------------------------------------------------------------- /iGoat-Swift/iGoat-Swift/ThirdParty/YapDatabase/Extensions/FullTextSearch/YapDatabaseFullTextSearchSnippetOptions.m: -------------------------------------------------------------------------------- 1 | #import "YapDatabaseFullTextSearchSnippetOptions.h" 2 | 3 | 4 | @implementation YapDatabaseFullTextSearchSnippetOptions 5 | 6 | + (NSString *)defaultStartMatchText { 7 | return @""; 8 | } 9 | 10 | + (NSString *)defaultEndMatchText { 11 | return @""; 12 | } 13 | 14 | + (NSString *)defaultEllipsesText { 15 | return @"..."; 16 | } 17 | 18 | + (int)defaultNumberOfTokens { 19 | return 15; 20 | } 21 | 22 | @synthesize startMatchText = startMatchText; 23 | @synthesize endMatchText = endMatchText; 24 | @synthesize ellipsesText = ellipsesText; 25 | @synthesize columnName = columnName; 26 | @synthesize numberOfTokens = numberOfTokens; 27 | 28 | - (id)init 29 | { 30 | if ((self = [super init])) 31 | { 32 | startMatchText = [[self class] defaultStartMatchText]; 33 | endMatchText = [[self class] defaultEndMatchText]; 34 | ellipsesText = [[self class] defaultEllipsesText]; 35 | 36 | numberOfTokens = [[self class] defaultNumberOfTokens]; 37 | } 38 | return self; 39 | } 40 | 41 | - (id)initForCopy 42 | { 43 | if ((self = [super init])) 44 | { 45 | // copyWithZone will fill out values for us 46 | } 47 | return self; 48 | } 49 | 50 | - (id)copyWithZone:(NSZone __unused *)zone 51 | { 52 | YapDatabaseFullTextSearchSnippetOptions *copy = [[YapDatabaseFullTextSearchSnippetOptions alloc] initForCopy]; 53 | 54 | copy->startMatchText = startMatchText; 55 | copy->endMatchText = endMatchText; 56 | copy->ellipsesText = ellipsesText; 57 | copy->columnName = columnName; 58 | copy->numberOfTokens = numberOfTokens; 59 | 60 | return copy; 61 | } 62 | 63 | - (void)setStartMatchText:(NSString *)text 64 | { 65 | if (text) 66 | startMatchText = [text copy]; 67 | else 68 | startMatchText = [[self class] defaultStartMatchText]; 69 | } 70 | 71 | - (void)setEndMatchText:(NSString *)text 72 | { 73 | if (text) 74 | endMatchText = [text copy]; 75 | else 76 | endMatchText = [[self class] defaultEndMatchText]; 77 | } 78 | 79 | - (void)setEllipsesText:(NSString *)text 80 | { 81 | if (text) 82 | ellipsesText = [text copy]; 83 | else 84 | ellipsesText = [[self class] defaultEllipsesText]; 85 | } 86 | 87 | - (void)setNumberOfTokens:(int)count 88 | { 89 | if (count != 0) 90 | numberOfTokens = count; 91 | else 92 | numberOfTokens = [[self class] defaultNumberOfTokens]; 93 | } 94 | 95 | @end 96 | -------------------------------------------------------------------------------- /iGoat-Swift/iGoat-Swift/ThirdParty/YapDatabase/Extensions/Hooks/YapDatabaseHooksConnection.h: -------------------------------------------------------------------------------- 1 | #import 2 | #import "YapDatabaseExtensionConnection.h" 3 | 4 | @class YapDatabaseHooks; 5 | 6 | 7 | @interface YapDatabaseHooksConnection : YapDatabaseExtensionConnection 8 | 9 | /** 10 | * Returns the parent extension instance. 11 | **/ 12 | @property (nonatomic, strong, readonly) YapDatabaseHooks *parent; 13 | 14 | @end 15 | -------------------------------------------------------------------------------- /iGoat-Swift/iGoat-Swift/ThirdParty/YapDatabase/Extensions/Hooks/YapDatabaseHooksTransaction.h: -------------------------------------------------------------------------------- 1 | #import 2 | #import "YapDatabaseExtensionTransaction.h" 3 | 4 | 5 | @interface YapDatabaseHooksTransaction : YapDatabaseExtensionTransaction 6 | 7 | @end 8 | -------------------------------------------------------------------------------- /iGoat-Swift/iGoat-Swift/ThirdParty/YapDatabase/Extensions/Protocol/YapDatabaseExtension.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | #import "YapDatabaseExtensionConnection.h" 4 | #import "YapDatabaseExtensionTransaction.h" 5 | 6 | @class YapDatabase; 7 | 8 | 9 | @interface YapDatabaseExtension : NSObject 10 | 11 | /** 12 | * After an extension has been successfully registered with a database, 13 | * the registeredName property will be set by the database. 14 | **/ 15 | @property (atomic, copy, readonly) NSString *registeredName; 16 | 17 | /** 18 | * After an extension has been successfully registered with a database, 19 | * the registeredDatabase property will be set to that database. 20 | **/ 21 | @property (atomic, weak, readonly) YapDatabase *registeredDatabase; 22 | 23 | @end 24 | -------------------------------------------------------------------------------- /iGoat-Swift/iGoat-Swift/ThirdParty/YapDatabase/Extensions/Protocol/YapDatabaseExtensionConnection.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | 4 | @interface YapDatabaseExtensionConnection : NSObject 5 | 6 | /** 7 | * This class is abstract and has no public API. 8 | * See concrete implementations such as YapDatabaseViewConnection, YapDatabaseSecondaryIndexConnection, etc. 9 | **/ 10 | 11 | @end 12 | -------------------------------------------------------------------------------- /iGoat-Swift/iGoat-Swift/ThirdParty/YapDatabase/Extensions/Protocol/YapDatabaseExtensionTransaction.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | 4 | @interface YapDatabaseExtensionTransaction : NSObject 5 | 6 | /** 7 | * This class is abstract and has no public API. 8 | * See concrete implementations such as YapDatabaseViewTransaction, YapDatabaseSecondaryIndexTransaction, etc. 9 | **/ 10 | 11 | @end 12 | -------------------------------------------------------------------------------- /iGoat-Swift/iGoat-Swift/ThirdParty/YapDatabase/Extensions/Relationships/Internal/YapDatabaseRelationshipEdgePrivate.h: -------------------------------------------------------------------------------- 1 | #import "YapDatabaseRelationshipEdge.h" 2 | 3 | enum { 4 | YDB_EdgeActionNone = 0, 5 | YDB_EdgeActionInsert = 1, 6 | YDB_EdgeActionUpdate = 2, 7 | YDB_EdgeActionDelete = 3 8 | }; 9 | 10 | enum { 11 | YDB_FlagsNone = 0, 12 | YDB_FlagsSourceDeleted = 1 << 0, 13 | YDB_FlagsDestinationDeleted = 1 << 1, 14 | YDB_FlagsBadSource = 1 << 2, 15 | YDB_FlagsBadDestination = 1 << 3, 16 | YDB_FlagsHasSourceRowid = 1 << 4, // If set, sourceRowid lookup not needed 17 | YDB_FlagsHasDestinationRowid = 1 << 5, // If set, destinationRowid lookup not needed 18 | YDB_FlagsHasEdgeRowid = 1 << 6, 19 | YDB_FlagsNotInDatabase = 1 << 7, 20 | }; 21 | 22 | 23 | @interface YapDatabaseRelationshipEdge () { 24 | @public 25 | 26 | // Public properties. 27 | // Internal code should access these directly. 28 | 29 | NSString *name; 30 | 31 | NSString *sourceKey; 32 | NSString *sourceCollection; 33 | 34 | NSString *destinationKey; 35 | NSString *destinationCollection; 36 | 37 | NSString *destinationFilePath; 38 | 39 | YDB_NodeDeleteRules nodeDeleteRules; 40 | 41 | BOOL isManualEdge; 42 | 43 | // Internal properties. 44 | // Internal code must access these directly. 45 | 46 | int64_t edgeRowid; 47 | int64_t sourceRowid; 48 | int64_t destinationRowid; 49 | 50 | int edgeAction; 51 | int flags; 52 | } 53 | 54 | // Init directly from database row 55 | - (id)initWithRowid:(int64_t)rowid 56 | name:(NSString *)name 57 | src:(int64_t)src 58 | dst:(int64_t)dst 59 | dstFilePath:(NSString *)dstFilePath 60 | rules:(int)rules 61 | manual:(BOOL)isManual; 62 | 63 | // Copy for YapDatabaseRelationshipNode protocol 64 | - (id)copyWithSourceKey:(NSString *)newSrcKey collection:(NSString *)newSrcCollection rowid:(int64_t)newSrcRowid; 65 | 66 | /** 67 | * Compares two manual edges to see if they represent the same relationship. 68 | * That is, if both edges are manual edges, and the following are equal: 69 | * 70 | * - name 71 | * - sourceKey / sourceCollection 72 | * - destinationKey / destinationCollection 73 | * - destinationFilePath 74 | * 75 | * The nodeDeleteRules do NOT need to match. 76 | **/ 77 | - (BOOL)matchesManualEdge:(YapDatabaseRelationshipEdge *)edge; 78 | 79 | @end 80 | -------------------------------------------------------------------------------- /iGoat-Swift/iGoat-Swift/ThirdParty/YapDatabase/Extensions/Relationships/YapDatabaseRelationship.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | #import "YapDatabaseExtension.h" 4 | 5 | #import "YapDatabaseRelationshipNode.h" 6 | #import "YapDatabaseRelationshipEdge.h" 7 | #import "YapDatabaseRelationshipOptions.h" 8 | #import "YapDatabaseRelationshipConnection.h" 9 | #import "YapDatabaseRelationshipTransaction.h" 10 | 11 | /** 12 | * Welcome to YapDatabase! 13 | * 14 | * The project page has a wealth of documentation if you have any questions. 15 | * https://github.com/yapstudios/YapDatabase 16 | * 17 | * If you're new to the project you may want to visit the wiki. 18 | * https://github.com/yapstudios/YapDatabase/wiki 19 | * 20 | * The YapDatabaseRelationship extension allow you to create relationships between objects, 21 | * and configure automatic deletion rules. 22 | * 23 | * For tons of information about this extension, see the wiki article: 24 | * https://github.com/yapstudios/YapDatabase/wiki/Relationships 25 | **/ 26 | 27 | @interface YapDatabaseRelationship : YapDatabaseExtension 28 | 29 | - (id)init; 30 | 31 | - (id)initWithVersionTag:(NSString *)versionTag; 32 | 33 | - (id)initWithVersionTag:(NSString *)versionTag options:(YapDatabaseRelationshipOptions *)options; 34 | 35 | /** 36 | * The versionTag assists in making changes to the extension or any objects that implement YapDatabaseRelationshipNode. 37 | * 38 | * For example, say you have existing objects that implement the YapDatabaseRelationshipNode protocol. 39 | * And you decide to add additional relationship connections from within the yapDatabaseRelationshipEdges method 40 | * of some of your objects. All you have to do is change the versionTag. And next time you run the app, 41 | * the YapDatabaseRelationship extension will notice the different versionTag, and will then automatically 42 | * remove all protocol edges from the database, and automatically repopulate its list of protocol edges 43 | * by enumerating the nodes in the database. 44 | **/ 45 | @property (nonatomic, copy, readonly) NSString *versionTag; 46 | 47 | /** 48 | * The options that were used to initialize the instance. 49 | **/ 50 | @property (nonatomic, copy, readonly) YapDatabaseRelationshipOptions *options; 51 | 52 | @end 53 | -------------------------------------------------------------------------------- /iGoat-Swift/iGoat-Swift/ThirdParty/YapDatabase/Extensions/Relationships/YapDatabaseRelationshipConnection.h: -------------------------------------------------------------------------------- 1 | #import 2 | #import "YapDatabaseExtensionConnection.h" 3 | 4 | @class YapDatabaseRelationship; 5 | 6 | /** 7 | * Welcome to YapDatabase! 8 | * 9 | * The project page has a wealth of documentation if you have any questions. 10 | * https://github.com/yapstudios/YapDatabase 11 | * 12 | * If you're new to the project you may want to visit the wiki. 13 | * https://github.com/yapstudios/YapDatabase/wiki 14 | * 15 | * The YapDatabaseRelationship extension allow you to create relationships between objects, 16 | * and configure automatic deletion rules. 17 | * 18 | * For tons of information about this extension, see the wiki article: 19 | * https://github.com/yapstudios/YapDatabase/wiki/Relationships 20 | **/ 21 | 22 | @interface YapDatabaseRelationshipConnection : YapDatabaseExtensionConnection 23 | 24 | /** 25 | * Returns the parent view instance. 26 | **/ 27 | @property (nonatomic, strong, readonly) YapDatabaseRelationship *relationship; 28 | 29 | @end 30 | -------------------------------------------------------------------------------- /iGoat-Swift/iGoat-Swift/ThirdParty/YapDatabase/Extensions/Relationships/YapDatabaseRelationshipOptions.m: -------------------------------------------------------------------------------- 1 | #import "YapDatabaseRelationshipOptions.h" 2 | #import "YapDatabaseRelationshipPrivate.h" 3 | 4 | 5 | @implementation YapDatabaseRelationshipOptions 6 | 7 | @synthesize disableYapDatabaseRelationshipNodeProtocol = disableYapDatabaseRelationshipNodeProtocol; 8 | @synthesize allowedCollections = allowedCollections; 9 | @synthesize destinationFilePathEncryptor; 10 | @synthesize destinationFilePathDecryptor; 11 | 12 | - (id)init 13 | { 14 | if ((self = [super init])) 15 | { 16 | disableYapDatabaseRelationshipNodeProtocol = NO; 17 | allowedCollections = nil; 18 | } 19 | return self; 20 | } 21 | 22 | - (id)copyWithZone:(NSZone __unused *)zone 23 | { 24 | YapDatabaseRelationshipOptions *copy = [[YapDatabaseRelationshipOptions alloc] init]; 25 | copy->disableYapDatabaseRelationshipNodeProtocol = disableYapDatabaseRelationshipNodeProtocol; 26 | copy->allowedCollections = allowedCollections; 27 | 28 | if (destinationFilePathEncryptor && destinationFilePathDecryptor) 29 | { 30 | copy->destinationFilePathEncryptor = destinationFilePathEncryptor; 31 | copy->destinationFilePathDecryptor = destinationFilePathDecryptor; 32 | } 33 | 34 | return copy; 35 | } 36 | 37 | @end 38 | -------------------------------------------------------------------------------- /iGoat-Swift/iGoat-Swift/ThirdParty/YapDatabase/Extensions/SearchResults/YapDatabaseSearchQueuePrivate.h: -------------------------------------------------------------------------------- 1 | #import "YapDatabaseSearchQueue.h" 2 | 3 | /** 4 | * This header file is PRIVATE, and is only to be used by the YapDatabaseSearchResultsTransaction class. 5 | **/ 6 | 7 | @interface YapDatabaseSearchQueue () 8 | 9 | - (NSString *)flushQueue; 10 | 11 | - (BOOL)shouldAbortSearchInProgressAndRollback:(BOOL *)shouldRollbackPtr; 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /iGoat-Swift/iGoat-Swift/ThirdParty/YapDatabase/Extensions/SearchResults/YapDatabaseSearchResultsViewConnection.h: -------------------------------------------------------------------------------- 1 | #import 2 | #import "YapDatabaseViewConnection.h" 3 | 4 | @class YapDatabaseSearchResultsView; 5 | 6 | 7 | @interface YapDatabaseSearchResultsViewConnection : YapDatabaseViewConnection 8 | 9 | // Returns properly typed parent instance 10 | @property (nonatomic, strong, readonly) YapDatabaseSearchResultsView *searchResultsView; 11 | 12 | @end 13 | -------------------------------------------------------------------------------- /iGoat-Swift/iGoat-Swift/ThirdParty/YapDatabase/Extensions/SearchResults/YapDatabaseSearchResultsViewOptions.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | #import "YapDatabaseViewOptions.h" 4 | #import "YapWhitelistBlacklist.h" 5 | #import "YapDatabaseFullTextSearchSnippetOptions.h" 6 | 7 | 8 | /** 9 | * Note: This class extends YapDatabaseViewOptions. 10 | **/ 11 | @interface YapDatabaseSearchResultsViewOptions : YapDatabaseViewOptions 12 | 13 | /** 14 | * Inherited by YapDatabaseViewOptions. 15 | * See YapDatabaseViewOptions.h for documentation. 16 | * 17 | * The default value is ** NO **. <<-- This is changed for YapDatabaseSearchResultsOptions 18 | **/ 19 | //@property (nonatomic, assign, readwrite) BOOL isPersistent; 20 | 21 | 22 | /** 23 | * Allows you to filter which groups in the parentView are used to create the union'd search results. 24 | * 25 | * This is especially powerful if the parentView is rather large, but you're only displaying a few groups from it. 26 | * That way the YapDatabaseSearchResults ignores all but the given groups when performing the merge. 27 | * 28 | * Note: This property only applies if using a parentView. 29 | * 30 | * The default value is nil. 31 | **/ 32 | @property (nonatomic, strong, readwrite) YapWhitelistBlacklist *allowedGroups; 33 | 34 | /** 35 | * Set this option to include snippets with the search results. 36 | * 37 | * The default value is nil. 38 | **/ 39 | @property (nonatomic, copy, readwrite) YapDatabaseFullTextSearchSnippetOptions *snippetOptions; 40 | 41 | @end 42 | -------------------------------------------------------------------------------- /iGoat-Swift/iGoat-Swift/ThirdParty/YapDatabase/Extensions/SearchResults/YapDatabaseSearchResultsViewOptions.m: -------------------------------------------------------------------------------- 1 | #import "YapDatabaseSearchResultsViewOptions.h" 2 | #import "YapDatabaseSearchResultsViewPrivate.h" 3 | 4 | 5 | @implementation YapDatabaseSearchResultsViewOptions 6 | 7 | @synthesize allowedGroups = allowedGroups; 8 | @synthesize snippetOptions = snippetOptions; 9 | 10 | - (id)init 11 | { 12 | if ((self = [super init])) 13 | { 14 | self.isPersistent = NO; // <<-- This is changed for YapDatabaseSearchResultsOptions 15 | } 16 | return self; 17 | } 18 | 19 | - (YapDatabaseFullTextSearchSnippetOptions *)snippetOptions 20 | { 21 | // The internal snippetOptions ivar MUST remain immutable. 22 | // So we MUST return a copy. 23 | return [snippetOptions copy]; // <- Do NOT change 24 | } 25 | 26 | /** 27 | * Private/Internal method (to avoid a copy) 28 | **/ 29 | - (YapDatabaseFullTextSearchSnippetOptions *)snippetOptions_NoCopy 30 | { 31 | return snippetOptions; 32 | } 33 | 34 | - (id)copyWithZone:(NSZone *)zone 35 | { 36 | YapDatabaseSearchResultsViewOptions *copy = [super copyWithZone:zone]; 37 | 38 | copy->allowedGroups = allowedGroups; 39 | copy->snippetOptions = snippetOptions; 40 | 41 | return copy; 42 | } 43 | 44 | @end 45 | -------------------------------------------------------------------------------- /iGoat-Swift/iGoat-Swift/ThirdParty/YapDatabase/Extensions/SearchResults/YapDatabaseSearchResultsViewTransaction.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | #import "YapDatabaseViewTransaction.h" 4 | #import "YapDatabaseSearchQueue.h" 5 | 6 | 7 | @interface YapDatabaseSearchResultsViewTransaction : YapDatabaseViewTransaction 8 | 9 | // This class extends YapDatabaseViewTransaction. 10 | // 11 | // Please see YapDatabaseViewTransaction.h 12 | 13 | /** 14 | * Returns the snippet for the given collection/key tuple. 15 | * 16 | * Note: snippets must be enabled via YapDatabaseSearchResultsViewOptions. 17 | **/ 18 | - (NSString *)snippetForKey:(NSString *)key inCollection:(NSString *)collection; 19 | 20 | @end 21 | 22 | @interface YapDatabaseSearchResultsViewTransaction (ReadWrite) 23 | 24 | /** 25 | * Represents the most recent search query that is providing the search results. 26 | **/ 27 | - (NSString *)query; 28 | 29 | /** 30 | * Updates the view to include search results for the given query. 31 | * 32 | * This method will run the given query on the parent FTS extension, 33 | * and then properly pipe the results into the view. 34 | * 35 | * @see performSearchWithQueue: 36 | **/ 37 | - (void)performSearchFor:(NSString *)query; 38 | 39 | /** 40 | * This method works similar to performSearchFor:, 41 | * but allows you to use a special search "queue" that gives you more control over how the search progresses. 42 | * 43 | * With a search queue, the transaction will skip intermediate queries, 44 | * and always perform the most recent query in the queue. 45 | * 46 | * A search queue can also be used to abort an in-progress search. 47 | **/ 48 | - (void)performSearchWithQueue:(YapDatabaseSearchQueue *)queue; 49 | 50 | @end 51 | -------------------------------------------------------------------------------- /iGoat-Swift/iGoat-Swift/ThirdParty/YapDatabase/Extensions/SecondaryIndex/YapDatabaseSecondaryIndexConnection.h: -------------------------------------------------------------------------------- 1 | #import 2 | #import "YapDatabaseExtensionConnection.h" 3 | 4 | @class YapDatabaseSecondaryIndex; 5 | 6 | 7 | @interface YapDatabaseSecondaryIndexConnection : YapDatabaseExtensionConnection 8 | 9 | /** 10 | * Returns the parent instance. 11 | **/ 12 | @property (nonatomic, strong, readonly) YapDatabaseSecondaryIndex *secondaryIndex; 13 | 14 | /** 15 | * The queryCache speeds up the transaction methods. (enumerateXMatchingQuery:usingBlock:) 16 | * 17 | * In order for a query to be executed, it first has to be compiled by SQLite into an executable routine. 18 | * The queryCache stores these compiled reusable routines, so that repeated queries can be executed faster. 19 | * 20 | * Please note that, in terms of caching, only the queryString matters. The queryParameters do not. 21 | * That is, if you use the same queryString over and over, but with different parameters, 22 | * you will get a nice benefit from caching as it will be able to recyle the compiled routine, 23 | * and simply bind the different parameters each time. 24 | * 25 | * By default the queryCache is enabled and has a limit of 10. 26 | * 27 | * To disable the cache entirely, set queryCacheEnabled to NO. 28 | * To use an inifinite cache size, set the queryCacheLimit to ZERO. 29 | **/ 30 | @property (atomic, assign, readwrite) BOOL queryCacheEnabled; 31 | @property (atomic, assign, readwrite) NSUInteger queryCacheLimit; 32 | 33 | @end 34 | -------------------------------------------------------------------------------- /iGoat-Swift/iGoat-Swift/ThirdParty/YapDatabase/Extensions/SecondaryIndex/YapDatabaseSecondaryIndexHandler.m: -------------------------------------------------------------------------------- 1 | #import "YapDatabaseSecondaryIndexHandler.h" 2 | 3 | 4 | @implementation YapDatabaseSecondaryIndexHandler 5 | 6 | @synthesize block = block; 7 | @synthesize blockType = blockType; 8 | 9 | + (instancetype)withKeyBlock:(YapDatabaseSecondaryIndexWithKeyBlock)block 10 | { 11 | if (block == NULL) return nil; 12 | 13 | YapDatabaseSecondaryIndexHandler *handler = [[YapDatabaseSecondaryIndexHandler alloc] init]; 14 | handler->block = block; 15 | handler->blockType = YapDatabaseSecondaryIndexBlockTypeWithKey; 16 | 17 | return handler; 18 | } 19 | 20 | + (instancetype)withObjectBlock:(YapDatabaseSecondaryIndexWithObjectBlock)block 21 | { 22 | if (block == NULL) return nil; 23 | 24 | YapDatabaseSecondaryIndexHandler *handler = [[YapDatabaseSecondaryIndexHandler alloc] init]; 25 | handler->block = block; 26 | handler->blockType = YapDatabaseSecondaryIndexBlockTypeWithObject; 27 | 28 | return handler; 29 | } 30 | 31 | + (instancetype)withMetadataBlock:(YapDatabaseSecondaryIndexWithMetadataBlock)block 32 | { 33 | if (block == NULL) return nil; 34 | 35 | YapDatabaseSecondaryIndexHandler *handler = [[YapDatabaseSecondaryIndexHandler alloc] init]; 36 | handler->block = block; 37 | handler->blockType = YapDatabaseSecondaryIndexBlockTypeWithMetadata; 38 | 39 | return handler; 40 | } 41 | 42 | + (instancetype)withRowBlock:(YapDatabaseSecondaryIndexWithRowBlock)block 43 | { 44 | if (block == NULL) return nil; 45 | 46 | YapDatabaseSecondaryIndexHandler *handler = [[YapDatabaseSecondaryIndexHandler alloc] init]; 47 | handler->block = block; 48 | handler->blockType = YapDatabaseSecondaryIndexBlockTypeWithRow; 49 | 50 | return handler; 51 | } 52 | 53 | @end 54 | -------------------------------------------------------------------------------- /iGoat-Swift/iGoat-Swift/ThirdParty/YapDatabase/Extensions/SecondaryIndex/YapDatabaseSecondaryIndexOptions.h: -------------------------------------------------------------------------------- 1 | #import 2 | #import "YapWhitelistBlacklist.h" 3 | 4 | /** 5 | * Welcome to YapDatabase! 6 | * https://github.com/yapstudios/YapDatabase 7 | * 8 | * The project wiki has a wealth of documentation if you have any questions. 9 | * https://github.com/yapstudios/YapDatabase/wiki 10 | * 11 | * This class provides extra options when initializing YapDatabaseSecondaryIndex. 12 | * 13 | * For more information, see the wiki article about secondary indexes: 14 | * https://github.com/yapstudios/YapDatabase/wiki/Secondary-Indexes 15 | **/ 16 | @interface YapDatabaseSecondaryIndexOptions : NSObject 17 | 18 | /** 19 | * You can configure the extension to pre-filter all but a subset of collections. 20 | * 21 | * The primary motivation for this is to reduce the overhead when first populating the secondary index table. 22 | * For example, if you're creating secondary indexes from a single collection, 23 | * then you could specify that collection here. So when the extension first populates itself, 24 | * it will enumerate over just the allowedCollections, as opposed to enumerating over the entire database. 25 | * And enumerating a small subset of the entire database during population can improve speed, 26 | * especially with larger databases. 27 | * 28 | * In addition to reducing the overhead when first populating the extension, 29 | * the allowedCollections will pre-filter while you're making changes to the database. 30 | * So if you add a new object to the database, and the associated collection isn't in allowedCollections, 31 | * then the secondaryIndexBlock will never be invoked, 32 | * and the extension will act as if the secondaryIndexBlock left the dictionary empty. 33 | * 34 | * For all rows whose collection is in the allowedCollections, the extension acts normally. 35 | * So the secondaryIndexBlock would still be invoked as normal. 36 | * 37 | * The default value is nil. 38 | **/ 39 | @property (nonatomic, strong, readwrite) YapWhitelistBlacklist *allowedCollections; 40 | 41 | @end 42 | -------------------------------------------------------------------------------- /iGoat-Swift/iGoat-Swift/ThirdParty/YapDatabase/Extensions/SecondaryIndex/YapDatabaseSecondaryIndexOptions.m: -------------------------------------------------------------------------------- 1 | #import "YapDatabaseSecondaryIndexOptions.h" 2 | 3 | /** 4 | * Welcome to YapDatabase! 5 | * https://github.com/yapstudios/YapDatabase 6 | * 7 | * The project wiki has a wealth of documentation if you have any questions. 8 | * https://github.com/yapstudios/YapDatabase/wiki 9 | * 10 | * This class provides extra options when initializing YapDatabaseSecondaryIndex. 11 | * 12 | * For more information, see the wiki article about secondary indexes: 13 | * https://github.com/yapstudios/YapDatabase/wiki/Secondary-Indexes 14 | **/ 15 | @implementation YapDatabaseSecondaryIndexOptions 16 | 17 | @synthesize allowedCollections = allowedCollections; 18 | 19 | - (id)copyWithZone:(NSZone __unused *)zone 20 | { 21 | YapDatabaseSecondaryIndexOptions *copy = [[YapDatabaseSecondaryIndexOptions alloc] init]; 22 | copy->allowedCollections = allowedCollections; 23 | 24 | return copy; 25 | } 26 | 27 | @end 28 | -------------------------------------------------------------------------------- /iGoat-Swift/iGoat-Swift/ThirdParty/YapDatabase/Extensions/SecondaryIndex/YapDatabaseSecondaryIndexSetup.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | @class YapDatabaseSecondaryIndexColumn; 4 | 5 | typedef NS_ENUM(NSInteger, YapDatabaseSecondaryIndexType) { 6 | YapDatabaseSecondaryIndexTypeInteger, 7 | YapDatabaseSecondaryIndexTypeReal, 8 | YapDatabaseSecondaryIndexTypeText 9 | }; 10 | 11 | @interface YapDatabaseSecondaryIndexSetup : NSObject 12 | 13 | - (id)init; 14 | - (id)initWithCapacity:(NSUInteger)capacity; 15 | 16 | - (void)addColumn:(NSString *)name withType:(YapDatabaseSecondaryIndexType)type; 17 | 18 | - (NSUInteger)count; 19 | - (YapDatabaseSecondaryIndexColumn *)columnAtIndex:(NSUInteger)index; 20 | 21 | - (NSArray *)columnNames; 22 | 23 | @end 24 | 25 | #pragma mark - 26 | 27 | @interface YapDatabaseSecondaryIndexColumn : NSObject 28 | 29 | @property (nonatomic, copy, readonly) NSString *name; 30 | @property (nonatomic, assign, readonly) YapDatabaseSecondaryIndexType type; 31 | 32 | @end 33 | -------------------------------------------------------------------------------- /iGoat-Swift/iGoat-Swift/ThirdParty/YapDatabase/Extensions/Views/Internal/YapDatabaseViewPage.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | @interface YapDatabaseViewPage : NSObject 4 | 5 | - (id)init; 6 | - (id)initWithCapacity:(NSUInteger)capacity; 7 | 8 | - (NSData *)serialize; 9 | - (void)deserialize:(NSData *)data; 10 | 11 | - (NSUInteger)count; 12 | 13 | - (int64_t)rowidAtIndex:(NSUInteger)index; 14 | 15 | - (void)addRowid:(int64_t)rowid; 16 | - (void)insertRowid:(int64_t)rowid atIndex:(NSUInteger)index; 17 | 18 | - (void)removeRowidAtIndex:(NSUInteger)index; 19 | - (void)removeRange:(NSRange)range; 20 | - (void)removeAllRowids; 21 | 22 | - (void)appendPage:(YapDatabaseViewPage *)page; 23 | - (void)prependPage:(YapDatabaseViewPage *)page; 24 | 25 | - (void)appendRange:(NSRange)range ofPage:(YapDatabaseViewPage *)page; 26 | - (void)prependRange:(NSRange)range ofPage:(YapDatabaseViewPage *)page; 27 | 28 | - (BOOL)getIndex:(NSUInteger *)indexPtr ofRowid:(int64_t)rowid; 29 | 30 | - (void)enumerateRowidsUsingBlock:(void (^)(int64_t rowid, NSUInteger idx, BOOL *stop))block; 31 | 32 | - (void)enumerateRowidsWithOptions:(NSEnumerationOptions)options 33 | usingBlock:(void (^)(int64_t rowid, NSUInteger index, BOOL *stop))block; 34 | 35 | - (void)enumerateRowidsWithOptions:(NSEnumerationOptions)options 36 | range:(NSRange)range 37 | usingBlock:(void (^)(int64_t rowid, NSUInteger index, BOOL *stop))block; 38 | 39 | @end 40 | -------------------------------------------------------------------------------- /iGoat-Swift/iGoat-Swift/ThirdParty/YapDatabase/Extensions/Views/Internal/YapDatabaseViewPageMetadata.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | /** 4 | * This class stores the metadata about each "page" in the view. 5 | * 6 | * That is, a "page" is a subset of the array of rowids in a group. 7 | * The metadata does the following: 8 | * 9 | * - stores the associated group 10 | * - keeps the pages ordered (via prevPageKey). 11 | * - keeps the count on hand to make it easier to find a particular index 12 | * 13 | * This class is designed only to store the metadata in RAM. 14 | * When the metadata is stored to disk, the individual ivars have an associated column. 15 | **/ 16 | @interface YapDatabaseViewPageMetadata : NSObject { 17 | @public 18 | 19 | NSString * pageKey; 20 | NSString * prevPageKey; 21 | NSString * group; 22 | NSUInteger count; 23 | 24 | BOOL isNew; // Is NOT copied. Relevant only to connection. 25 | } 26 | 27 | @end 28 | -------------------------------------------------------------------------------- /iGoat-Swift/iGoat-Swift/ThirdParty/YapDatabase/Extensions/Views/Internal/YapDatabaseViewPageMetadata.m: -------------------------------------------------------------------------------- 1 | #import "YapDatabaseViewPageMetadata.h" 2 | 3 | 4 | @implementation YapDatabaseViewPageMetadata 5 | 6 | - (id)copyWithZone:(NSZone __unused *)zone 7 | { 8 | YapDatabaseViewPageMetadata *copy = [[YapDatabaseViewPageMetadata alloc] init]; 9 | 10 | copy->pageKey = pageKey; 11 | copy->prevPageKey = prevPageKey; 12 | copy->group = group; 13 | copy->count = count; 14 | 15 | // Do NOT copy the isNew property. 16 | // This value is relavent only to a single connection. 17 | 18 | return copy; 19 | } 20 | 21 | - (NSString *)description 22 | { 23 | return [NSString stringWithFormat: 24 | @"", 25 | self, group, (unsigned long)count, pageKey, prevPageKey]; 26 | } 27 | 28 | @end 29 | -------------------------------------------------------------------------------- /iGoat-Swift/iGoat-Swift/ThirdParty/YapDatabase/Extensions/Views/Internal/YapDatabaseViewRangeOptionsPrivate.h: -------------------------------------------------------------------------------- 1 | #import "YapDatabaseViewRangeOptions.h" 2 | 3 | /** 4 | * This header file is PRIVATE, and is only to be used by the YapDatabaseView classes. 5 | **/ 6 | 7 | @interface YapDatabaseViewRangeOptions () 8 | 9 | /** 10 | * This method returns a copy with the pin value switched. 11 | * 12 | * That is, if the range was pinned to the beginning, the returned copy will be pinned to the end. 13 | * And vice versa. 14 | **/ 15 | - (id)copyAndReverse; 16 | 17 | @end 18 | -------------------------------------------------------------------------------- /iGoat-Swift/iGoat-Swift/ThirdParty/YapDatabase/Extensions/Views/Internal/YapDatabaseViewState.h: -------------------------------------------------------------------------------- 1 | #import 2 | #import "YapDatabaseViewPageMetadata.h" 3 | 4 | 5 | @interface YapDatabaseViewState : NSObject // 6 | 7 | @property (nonatomic, readonly) BOOL isImmutable; 8 | 9 | #pragma mark Access 10 | 11 | - (NSArray *)pagesMetadataForGroup:(NSString *)group; 12 | - (NSString *)groupForPageKey:(NSString *)pageKey; 13 | 14 | - (NSUInteger)numberOfGroups; 15 | 16 | - (void)enumerateGroupsWithBlock:(void (^)(NSString *group, BOOL *stop))block; 17 | - (void)enumerateWithBlock:(void (^)(NSString *group, NSArray *pagesMetadataForGroup, BOOL *stop))block; 18 | 19 | #pragma mark Mutation 20 | 21 | - (NSArray *)createGroup:(NSString *)group; 22 | - (NSArray *)createGroup:(NSString *)group withCapacity:(NSUInteger)capacity; 23 | 24 | - (NSArray *)addPageMetadata:(YapDatabaseViewPageMetadata *)pageMetadata 25 | toGroup:(NSString *)group; 26 | 27 | - (NSArray *)insertPageMetadata:(YapDatabaseViewPageMetadata *)pageMetadata 28 | atIndex:(NSUInteger)index 29 | inGroup:(NSString *)group; 30 | 31 | - (NSArray *)removePageMetadataAtIndex:(NSUInteger)index inGroup:(NSString *)group; 32 | 33 | - (void)removeGroup:(NSString *)group; 34 | - (void)removeAllGroups; 35 | 36 | @end 37 | -------------------------------------------------------------------------------- /iGoat-Swift/iGoat-Swift/ThirdParty/YapDatabase/Extensions/Views/YapDatabaseViewOptions.m: -------------------------------------------------------------------------------- 1 | #import "YapDatabaseViewOptions.h" 2 | 3 | 4 | @implementation YapDatabaseViewOptions 5 | 6 | @synthesize isPersistent = isPersistent; 7 | @synthesize allowedCollections = allowedCollections; 8 | @synthesize skipInitialViewPopulation = skipInitialViewPopulation; 9 | 10 | - (id)init 11 | { 12 | if ((self = [super init])) 13 | { 14 | isPersistent = YES; 15 | } 16 | return self; 17 | } 18 | 19 | - (id)copyWithZone:(NSZone __unused *)zone 20 | { 21 | YapDatabaseViewOptions *copy = [[[self class] alloc] init]; // [self class] required to support subclassing 22 | copy->isPersistent = isPersistent; 23 | copy->allowedCollections = allowedCollections; 24 | copy->skipInitialViewPopulation = skipInitialViewPopulation; 25 | 26 | return copy; 27 | } 28 | 29 | @end 30 | -------------------------------------------------------------------------------- /iGoat-Swift/iGoat-Swift/ThirdParty/YapDatabase/Internal/NSDictionary+YapDatabase.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | 4 | @interface NSDictionary (YapDatabase) 5 | 6 | - (BOOL)ydb_containsKey:(id)key; 7 | 8 | @end 9 | -------------------------------------------------------------------------------- /iGoat-Swift/iGoat-Swift/ThirdParty/YapDatabase/Internal/NSDictionary+YapDatabase.m: -------------------------------------------------------------------------------- 1 | #import "NSDictionary+YapDatabase.h" 2 | 3 | 4 | @implementation NSDictionary (YapDatabase) 5 | 6 | /** 7 | * Originally I named this method simply 'containsKey:'. 8 | * But then immediately got a stack overflow when using the category. 9 | * 10 | * Apparently Apple's code actually registers the 'containsKey:' method in the objective-c space. 11 | * And invoking CFDictionaryContainsKey results in a method call back to our 'containsKey:' method, 12 | * and thus we get an infinite loop. 13 | **/ 14 | - (BOOL)ydb_containsKey:(id)key 15 | { 16 | return CFDictionaryContainsKey((CFDictionaryRef)self, (const void *)key); 17 | } 18 | 19 | @end 20 | -------------------------------------------------------------------------------- /iGoat-Swift/iGoat-Swift/ThirdParty/YapDatabase/Internal/YapDatabaseConnectionDefaults.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | #import "YapDatabaseConnection.h" 4 | 5 | /** 6 | * When a connection is created via [database newConnection] is will be handed one of these objects. 7 | * Thus the connection will inherit its initial configuration via the defaults configured for the parent database. 8 | * 9 | * Of course, the connection may then override these default configuration values, and configure itself as needed. 10 | * 11 | * @see YapDatabase defaultObjectCacheEnabled 12 | * @see YapDatabase defaultObjectCacheLimit 13 | * 14 | * @see YapDatabase defaultMetadataCacheEnabled 15 | * @see YapDatabase defaultMetadataCacheLimit 16 | * 17 | * @see YapDatabase defaultObjectPolicy 18 | * @see YapDatabase defaultMetadataPolicy 19 | * 20 | * @see YapDatabase defaultAutoFlushMemoryLevel 21 | **/ 22 | @interface YapDatabaseConnectionDefaults : NSObject 23 | 24 | @property (nonatomic, assign, readwrite) BOOL objectCacheEnabled; 25 | @property (nonatomic, assign, readwrite) NSUInteger objectCacheLimit; 26 | 27 | @property (nonatomic, assign, readwrite) BOOL metadataCacheEnabled; 28 | @property (nonatomic, assign, readwrite) NSUInteger metadataCacheLimit; 29 | 30 | @property (nonatomic, assign, readwrite) YapDatabasePolicy objectPolicy; 31 | @property (nonatomic, assign, readwrite) YapDatabasePolicy metadataPolicy; 32 | 33 | #if TARGET_OS_IPHONE 34 | @property (nonatomic, assign, readwrite) YapDatabaseConnectionFlushMemoryFlags autoFlushMemoryFlags; 35 | #endif 36 | 37 | @end 38 | -------------------------------------------------------------------------------- /iGoat-Swift/iGoat-Swift/ThirdParty/YapDatabase/Internal/YapDatabaseConnectionState.h: -------------------------------------------------------------------------------- 1 | #import 2 | #import "YapDatabaseConnection.h" 3 | 4 | 5 | @interface YapDatabaseConnectionState : NSObject { 6 | @private 7 | dispatch_semaphore_t writeSemaphore; 8 | 9 | @public 10 | __weak YapDatabaseConnection *connection; 11 | 12 | BOOL activeReadTransaction; 13 | BOOL longLivedReadTransaction; 14 | BOOL sqlLevelSharedReadLock; 15 | 16 | BOOL activeWriteTransaction; 17 | BOOL waitingForWriteLock; 18 | 19 | uint64_t lastTransactionSnapshot; 20 | uint64_t lastTransactionTime; 21 | } 22 | 23 | - (id)initWithConnection:(YapDatabaseConnection *)connection; 24 | 25 | - (void)prepareWriteLock; 26 | 27 | - (void)waitForWriteLock; 28 | - (void)signalWriteLock; 29 | 30 | @end -------------------------------------------------------------------------------- /iGoat-Swift/iGoat-Swift/ThirdParty/YapDatabase/Internal/YapDatabaseConnectionState.m: -------------------------------------------------------------------------------- 1 | #import "YapDatabaseConnectionState.h" 2 | 3 | #if ! __has_feature(objc_arc) 4 | #warning This file must be compiled with ARC. Use -fobjc-arc flag (or convert project to ARC). 5 | #endif 6 | 7 | 8 | @implementation YapDatabaseConnectionState 9 | 10 | - (id)initWithConnection:(YapDatabaseConnection *)inConnection 11 | { 12 | if ((self = [super init])) 13 | { 14 | connection = inConnection; 15 | } 16 | return self; 17 | } 18 | 19 | - (void)dealloc 20 | { 21 | #if !OS_OBJECT_USE_OBJC 22 | if (writeSemaphore) 23 | dispatch_release(writeSemaphore); 24 | #endif 25 | } 26 | 27 | - (void)prepareWriteLock 28 | { 29 | if (writeSemaphore == NULL) { 30 | writeSemaphore = dispatch_semaphore_create(0); 31 | } 32 | } 33 | 34 | - (void)waitForWriteLock 35 | { 36 | if (writeSemaphore) { 37 | dispatch_semaphore_wait(writeSemaphore, DISPATCH_TIME_FOREVER); 38 | } 39 | } 40 | 41 | - (void)signalWriteLock 42 | { 43 | if (writeSemaphore) { 44 | dispatch_semaphore_signal(writeSemaphore); 45 | } 46 | } 47 | 48 | @end 49 | -------------------------------------------------------------------------------- /iGoat-Swift/iGoat-Swift/ThirdParty/YapDatabase/Internal/YapDatabaseLogging.m: -------------------------------------------------------------------------------- 1 | #import "YapDatabaseLogging.h" 2 | 3 | 4 | #if YapDatabaseLoggingTechnique != YapDatabaseLoggingTechnique_Lumberjack 5 | 6 | /** 7 | * This method is based on CocoaLumberjack's DDExtractFileNameWithoutExtension function. 8 | * The copy option has been removed, as we only use __FILE__ as the filePath parameter. 9 | **/ 10 | NSString *YDBExtractFileNameWithoutExtension(const char *filePath) 11 | { 12 | if (filePath == NULL) return nil; 13 | 14 | char *lastSlash = NULL; 15 | char *lastDot = NULL; 16 | 17 | char *p = (char *)filePath; 18 | 19 | while (*p != '\0') 20 | { 21 | if (*p == '/') 22 | lastSlash = p; 23 | else if (*p == '.') 24 | lastDot = p; 25 | 26 | p++; 27 | } 28 | 29 | char *subStr; 30 | NSUInteger subLen; 31 | 32 | if (lastSlash) 33 | { 34 | if (lastDot) 35 | { 36 | // lastSlash -> lastDot 37 | subStr = lastSlash + 1; 38 | subLen = lastDot - subStr; 39 | } 40 | else 41 | { 42 | // lastSlash -> endOfString 43 | subStr = lastSlash + 1; 44 | subLen = p - subStr; 45 | } 46 | } 47 | else 48 | { 49 | if (lastDot) 50 | { 51 | // startOfString -> lastDot 52 | subStr = (char *)filePath; 53 | subLen = lastDot - subStr; 54 | } 55 | else 56 | { 57 | // startOfString -> endOfString 58 | subStr = (char *)filePath; 59 | subLen = p - subStr; 60 | } 61 | } 62 | 63 | // We can take advantage of the fact that __FILE__ is a string literal. 64 | // Specifically, we don't need to waste time copying the string. 65 | // We can just tell NSString to point to a range within the string literal. 66 | 67 | return [[NSString alloc] initWithBytesNoCopy:subStr 68 | length:subLen 69 | encoding:NSUTF8StringEncoding 70 | freeWhenDone:NO]; 71 | } 72 | 73 | #endif 74 | -------------------------------------------------------------------------------- /iGoat-Swift/iGoat-Swift/ThirdParty/YapDatabase/Internal/YapDatabaseManager.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | /** 4 | * There should only be one YapDatabase or YapCollectionDatabase per file. 5 | * 6 | * The architecture design is to create a single parent database instance, 7 | * and then spawn connections to the database as needed from the parent. 8 | * 9 | * The architecture is built around this restriction, and is dependent upon it for proper operation. 10 | * This class simply helps maintain this requirement. 11 | **/ 12 | @interface YapDatabaseManager : NSObject 13 | 14 | + (BOOL)registerDatabaseForPath:(NSString *)path; 15 | + (void)deregisterDatabaseForPath:(NSString *)path; 16 | 17 | @end 18 | -------------------------------------------------------------------------------- /iGoat-Swift/iGoat-Swift/ThirdParty/YapDatabase/Internal/YapDatabaseManager.m: -------------------------------------------------------------------------------- 1 | #import "YapDatabaseManager.h" 2 | #import 3 | 4 | /** 5 | * There should only be one YapDatabase or YapCollectionDatabase per file. 6 | * 7 | * The architecture design is to create a single parent database instance, 8 | * and then spawn connections to the database as needed from the parent. 9 | * 10 | * The architecture is built around this restriction, and is dependent upon it for proper operation. 11 | * This class simply helps maintain this requirement. 12 | **/ 13 | @implementation YapDatabaseManager 14 | 15 | static NSMutableSet *registeredPaths; 16 | static OSSpinLock lock; 17 | 18 | + (void)initialize 19 | { 20 | static dispatch_once_t onceToken; 21 | dispatch_once(&onceToken, ^{ 22 | 23 | registeredPaths = [[NSMutableSet alloc] init]; 24 | lock = OS_SPINLOCK_INIT; 25 | }); 26 | } 27 | 28 | + (BOOL)registerDatabaseForPath:(NSString *)path 29 | { 30 | if (path == nil) return NO; 31 | 32 | // Note: The path has already been standardized by the caller (path = [inPath stringByStandardizingPath]). 33 | 34 | BOOL result = NO; 35 | 36 | OSSpinLockLock(&lock); 37 | if (![registeredPaths containsObject:path]) 38 | { 39 | [registeredPaths addObject:path]; 40 | result = YES; 41 | } 42 | OSSpinLockUnlock(&lock); 43 | 44 | return result; 45 | } 46 | 47 | + (void)deregisterDatabaseForPath:(NSString *)inPath 48 | { 49 | NSString *path = [inPath stringByStandardizingPath]; 50 | if (path == nil) return; 51 | 52 | OSSpinLockLock(&lock); 53 | [registeredPaths removeObject:path]; 54 | OSSpinLockUnlock(&lock); 55 | } 56 | 57 | @end 58 | -------------------------------------------------------------------------------- /iGoat-Swift/iGoat-Swift/ThirdParty/YapDatabase/Internal/YapDatabaseStatement.h: -------------------------------------------------------------------------------- 1 | #import 2 | #import "sqlite3.h" 3 | 4 | /** 5 | * Simple wrapper class to facilitate storing sqlite3_stmt items as objects (primarily in YapCache). 6 | **/ 7 | @interface YapDatabaseStatement : NSObject 8 | 9 | - (id)initWithStatement:(sqlite3_stmt *)stmt; 10 | 11 | @property (nonatomic, assign, readonly) sqlite3_stmt *stmt; 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /iGoat-Swift/iGoat-Swift/ThirdParty/YapDatabase/Internal/YapDatabaseStatement.m: -------------------------------------------------------------------------------- 1 | #import "YapDatabaseStatement.h" 2 | #import "YapDatabasePrivate.h" 3 | 4 | 5 | @implementation YapDatabaseStatement 6 | { 7 | sqlite3_stmt *stmt; 8 | } 9 | 10 | @synthesize stmt = stmt; 11 | 12 | - (id)initWithStatement:(sqlite3_stmt *)inStmt 13 | { 14 | if ((self = [super init])) 15 | { 16 | stmt = inStmt; 17 | } 18 | return self; 19 | } 20 | 21 | - (void)dealloc 22 | { 23 | sqlite_finalize_null(&stmt); 24 | } 25 | 26 | @end 27 | -------------------------------------------------------------------------------- /iGoat-Swift/iGoat-Swift/ThirdParty/YapDatabase/Internal/YapDebugDictionary.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | 4 | /** 5 | * This is a simple class to ensure that keys & objects we're putting into a dictionary are all of the desired class. 6 | * It's intended only for debugging purposes, especially in refactoring cases. 7 | **/ 8 | @interface YapDebugDictionary : NSObject 9 | 10 | - (instancetype)initWithKeyClass:(Class)keyClass objectClass:(Class)objectClass; 11 | - (instancetype)initWithKeyClass:(Class)keyClass objectClass:(Class)objectClass capacity:(NSUInteger)capacity; 12 | 13 | - (instancetype)initWithDictionary:(YapDebugDictionary *)dictionary copyItems:(BOOL)copyItems; 14 | 15 | // Inspection 16 | 17 | - (id)objectForKey:(id)aKey; 18 | 19 | - (void)setObject:(id)anObject forKey:(id)aKey; 20 | 21 | - (void)removeObjectForKey:(id)aKey; 22 | 23 | // Pass through 24 | 25 | @property (nonatomic, readonly) NSUInteger count; 26 | 27 | @property (nonatomic, readonly, copy) NSArray *allKeys; 28 | @property (nonatomic, readonly, copy) NSArray *allValues; 29 | 30 | - (NSEnumerator *)objectEnumerator; 31 | 32 | - (void)enumerateKeysAndObjectsUsingBlock:(void (^)(id key, id obj, BOOL *stop))block; 33 | 34 | @end 35 | -------------------------------------------------------------------------------- /iGoat-Swift/iGoat-Swift/ThirdParty/YapDatabase/Internal/YapNull.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | /** 4 | * There are various situations in which we need to add a placeholder to signify a nil value. 5 | * For example, we need to cache the fact that the metadata for a given key is nil. 6 | * 7 | * However, we cannot add a nil object to a dictionary. 8 | * And we cannot use NSNull, or we prevent the user from using NSNull for their own purposes. 9 | * 10 | * And thus, we replicate NSNull, and use it instead. 11 | * And now the user is free to use NSNull if needed. 12 | **/ 13 | @interface YapNull : NSObject 14 | 15 | + (id)null; 16 | 17 | @end 18 | -------------------------------------------------------------------------------- /iGoat-Swift/iGoat-Swift/ThirdParty/YapDatabase/Internal/YapNull.m: -------------------------------------------------------------------------------- 1 | #import "YapNull.h" 2 | 3 | 4 | @implementation YapNull 5 | 6 | static YapNull *singleton; 7 | 8 | + (void)initialize 9 | { 10 | static BOOL initialized = NO; 11 | if (!initialized) 12 | { 13 | initialized = YES; 14 | singleton = [[YapNull alloc] init]; 15 | } 16 | } 17 | 18 | + (id)null 19 | { 20 | return singleton; 21 | } 22 | 23 | - (id)init 24 | { 25 | NSAssert(singleton == nil, @"Must use singleton via [YapNull null]"); 26 | 27 | #ifdef NS_BLOCK_ASSERTIONS 28 | if (singleton != nil) return nil; 29 | #endif 30 | 31 | self = [super init]; 32 | return self; 33 | } 34 | 35 | @end 36 | -------------------------------------------------------------------------------- /iGoat-Swift/iGoat-Swift/ThirdParty/YapDatabase/Internal/YapRowidSet.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Wrapper for C++ code (std::unordered_set) 3 | **/ 4 | 5 | #import 6 | 7 | #ifndef YapDatabase_YapRowidSet_h 8 | #define YapDatabase_YapRowidSet_h 9 | 10 | #if defined(__cplusplus) 11 | extern "C" { 12 | #endif 13 | 14 | typedef struct _YapRowidSet YapRowidSet; 15 | 16 | YapRowidSet* YapRowidSetCreate(NSUInteger capacity); 17 | 18 | YapRowidSet* YapRowidSetCopy(YapRowidSet *set); 19 | 20 | void YapRowidSetRelease(YapRowidSet *set); 21 | 22 | void YapRowidSetAdd(YapRowidSet *set, int64_t rowid); 23 | void YapRowidSetRemove(YapRowidSet *set, int64_t rowid); 24 | void YapRowidSetRemoveAll(YapRowidSet *set); 25 | 26 | NSUInteger YapRowidSetCount(YapRowidSet *set); 27 | 28 | BOOL YapRowidSetContains(YapRowidSet *set, int64_t rowid); 29 | 30 | void YapRowidSetEnumerate(YapRowidSet *set, void (^block)(int64_t rowid, BOOL *stop)); 31 | 32 | #if defined(__cplusplus) 33 | } 34 | #endif 35 | 36 | #endif 37 | -------------------------------------------------------------------------------- /iGoat-Swift/iGoat-Swift/ThirdParty/YapDatabase/Internal/YapRowidSet.mm: -------------------------------------------------------------------------------- 1 | #include "YapRowidSet.h" 2 | #include 3 | 4 | struct _YapRowidSet { 5 | std::unordered_set *rowids; 6 | }; 7 | 8 | YapRowidSet* YapRowidSetCreate(NSUInteger capacity) 9 | { 10 | YapRowidSet *set = (YapRowidSet *)malloc(sizeof(YapRowidSet)); 11 | 12 | set->rowids = new std::unordered_set(); 13 | if (capacity > 0) { 14 | set->rowids->reserve(capacity); 15 | } 16 | 17 | return set; 18 | } 19 | 20 | YapRowidSet* YapRowidSetCopy(YapRowidSet *set) 21 | { 22 | if (set == NULL) return NULL; 23 | 24 | YapRowidSet *copy = (YapRowidSet *)malloc(sizeof(YapRowidSet)); 25 | 26 | if (set->rowids) { 27 | copy->rowids = new std::unordered_set(*(set->rowids)); 28 | } 29 | else { 30 | copy->rowids = new std::unordered_set(); 31 | } 32 | 33 | return copy; 34 | } 35 | 36 | void YapRowidSetRelease(YapRowidSet *set) 37 | { 38 | if (set == NULL) return; 39 | 40 | if (set->rowids) { 41 | free(set->rowids); 42 | set->rowids = NULL; 43 | } 44 | 45 | free(set); 46 | } 47 | 48 | void YapRowidSetAdd(YapRowidSet *set, int64_t rowid) 49 | { 50 | set->rowids->insert(rowid); 51 | } 52 | 53 | void YapRowidSetRemove(YapRowidSet *set, int64_t rowid) 54 | { 55 | set->rowids->erase(rowid); 56 | } 57 | 58 | void YapRowidSetRemoveAll(YapRowidSet *set) 59 | { 60 | set->rowids->clear(); 61 | } 62 | 63 | NSUInteger YapRowidSetCount(YapRowidSet *set) 64 | { 65 | return (NSUInteger)(set->rowids->size()); 66 | } 67 | 68 | BOOL YapRowidSetContains(YapRowidSet *set, int64_t rowid) 69 | { 70 | return (set->rowids->find(rowid) != set->rowids->end()); 71 | } 72 | 73 | void YapRowidSetEnumerate(YapRowidSet *set, void (^block)(int64_t rowid, BOOL *stop)) 74 | { 75 | __block BOOL stop = NO; 76 | 77 | std::unordered_set::iterator iterator = set->rowids->begin(); 78 | std::unordered_set::iterator end = set->rowids->end(); 79 | 80 | while (iterator != end) 81 | { 82 | int64_t rowid = *iterator; 83 | 84 | block(rowid, &stop); 85 | 86 | if (stop) break; 87 | iterator++; 88 | } 89 | } 90 | -------------------------------------------------------------------------------- /iGoat-Swift/iGoat-Swift/ThirdParty/YapDatabase/Internal/YapTouch.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | /** 4 | * Singleton class to represent the "value" for a key that was touched. (i.e. value didn't change) 5 | * 6 | * YapDatabase stores changesets in dictionaries, where the object represents the updated value for a key. 7 | * When an item is touched, we use this singleton as the value to signify internally that the item didn't change. 8 | * This allows us to act as if the item did change in most all respects, 9 | * but internally won't cause us to flush the item from the caches. 10 | **/ 11 | @interface YapTouch : NSObject 12 | 13 | + (id)touch; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /iGoat-Swift/iGoat-Swift/ThirdParty/YapDatabase/Internal/YapTouch.m: -------------------------------------------------------------------------------- 1 | #import "YapTouch.h" 2 | 3 | 4 | @implementation YapTouch 5 | 6 | static YapTouch *singleton; 7 | 8 | + (void)initialize 9 | { 10 | static BOOL initialized = NO; 11 | if (!initialized) 12 | { 13 | initialized = YES; 14 | singleton = [[YapTouch alloc] init]; 15 | } 16 | } 17 | 18 | + (id)touch 19 | { 20 | return singleton; 21 | } 22 | 23 | - (id)init 24 | { 25 | NSAssert(singleton == nil, @"Must use singleton via [YapTouch touch]"); 26 | 27 | self = [super init]; 28 | return self; 29 | } 30 | 31 | @end 32 | -------------------------------------------------------------------------------- /iGoat-Swift/iGoat-Swift/ThirdParty/YapDatabase/Utilities/YapCollectionKey.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | 4 | // Macro for lazy programmer (less typing than alloc/init) 5 | #define YapCollectionKeyCreate(_collection, _key) [[YapCollectionKey alloc] initWithCollection:_collection key:_key] 6 | 7 | /** 8 | * An efficient collection/key tuple class. 9 | * 10 | * Combines collection & key into a single object, 11 | * and provides the proper methods to use the object in various classes (such as NSDictionary, NSSet, etc). 12 | **/ 13 | @interface YapCollectionKey : NSObject 14 | 15 | - (id)initWithCollection:(NSString *)collection key:(NSString *)key; 16 | 17 | @property (nonatomic, strong, readonly) NSString *collection; 18 | @property (nonatomic, strong, readonly) NSString *key; 19 | 20 | - (BOOL)isEqualToCollectionKey:(YapCollectionKey *)collectionKey; 21 | 22 | // These methods are overriden and optimized: 23 | - (BOOL)isEqual:(id)anObject; 24 | - (NSUInteger)hash; 25 | 26 | // For optimizing usage in YapCache 27 | + (CFDictionaryKeyCallBacks)keyCallbacks; 28 | 29 | // Super optimized (c function call faster than obj-c method invocation): 30 | BOOL YapCollectionKeyEqual(const __unsafe_unretained YapCollectionKey *ck1, 31 | const __unsafe_unretained YapCollectionKey *ck2); 32 | 33 | @end 34 | -------------------------------------------------------------------------------- /iGoat-Swift/iGoat-Swift/ThirdParty/YapDatabase/Utilities/YapDatabaseQuery.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | 4 | /** 5 | * A YapDatabaseQuery is used to pass SQL style queries into various extension classes. 6 | * The query that you pass represents everything after the SELECT clause of a query. 7 | **/ 8 | @interface YapDatabaseQuery : NSObject 9 | 10 | /** 11 | * A YapDatabaseQuery is everything after the SELECT clause of a query. 12 | * Methods that take YapDatabaseQuery parameters will prefix your query string similarly to: 13 | * 14 | * fullQuery = @"SELECT rowid FROM 'database' " + [yapDatabaseQuery queryString]; 15 | * 16 | * Example 1: 17 | * 18 | * query = [YapDatabaseQuery queryWithFormat:@"WHERE jid = ?", message.jid]; 19 | * [secondaryIndex enumerateKeysAndObjectsMatchingQuery:query 20 | * usingBlock:^(NSString *key, id object, BOOL *stop){ 21 | * ... 22 | * }]; 23 | * 24 | * Please note that you can ONLY pass objective-c objects as parameters. 25 | * Primitive types such as int, float, double, etc are NOT supported. 26 | * You MUST wrap these using NSNumber. 27 | * 28 | * Example 2: 29 | * 30 | * query = [YapDatabaseQuery queryWithFormat:@"WHERE department = ? AND salary >= ?", dept, @(minSalary)]; 31 | * [secondaryIndex enumerateKeysAndObjectsMatchingQuery:query 32 | * usingBlock:^(NSString *key, id object, BOOL *stop){ 33 | * ... 34 | * }]; 35 | **/ 36 | + (instancetype)queryWithFormat:(NSString *)format, ...; 37 | 38 | /** 39 | * Shim that allows YapDatabaseQuery to be used from Swift. 40 | * 41 | * Define the following somewhere in your Swift code: 42 | * 43 | * extension YapDatabaseQuery { 44 | * class func queryWithFormat(format: String, _ arguments: CVarArgType...) -> YapDatabaseQuery? { 45 | * return withVaList(arguments, { YapDatabaseQuery(format: format, arguments: $0) }) 46 | * } 47 | * } 48 | **/ 49 | + (instancetype)queryWithFormat:(NSString *)format arguments:(va_list)arguments; 50 | 51 | /** 52 | * Shorthand for a query with no 'WHERE' clause. 53 | * Equivalent to [YapDatabaseQuery queryWithFormat:@""]. 54 | **/ 55 | + (instancetype)queryMatchingAll; 56 | 57 | @property (nonatomic, strong, readonly) NSString *queryString; 58 | @property (nonatomic, strong, readonly) NSArray *queryParameters; 59 | 60 | @end 61 | -------------------------------------------------------------------------------- /iGoat-Swift/iGoat-Swift/ThirdParty/YapDatabase/Utilities/YapMurmurHash.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | /** 4 | * MurmurHash2 was written by Austin Appleby, and is placed in the public domain. 5 | * http://code.google.com/p/smhasher 6 | **/ 7 | 8 | #ifndef YapDatabase_YapMurmurHash_h 9 | #define YapDatabase_YapMurmurHash_h 10 | 11 | NSUInteger YapMurmurHash2(NSUInteger hash1, NSUInteger hash2); 12 | 13 | NSUInteger YapMurmurHash3(NSUInteger hash1, NSUInteger hash2, NSUInteger hash3); 14 | 15 | NSUInteger YapMurmurHashData(NSData *data); 16 | 17 | int32_t YapMurmurHashData_32(NSData *data); 18 | int64_t YapMurmurHashData_64(NSData *data); 19 | 20 | #endif 21 | -------------------------------------------------------------------------------- /iGoat-Swift/iGoat-Swift/ThirdParty/YapDatabase/Utilities/YapSet.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | /** 4 | * The YapSet class can be treated more or less like a regular NSSet. 5 | * 6 | * It is designed to expose internal mutable objects to the external world. 7 | * That is, we skip all the overhead associated with making immutable copies, 8 | * and instead just use this simple wrapper class. 9 | * 10 | * In general, the external world won't interact with this class. 11 | * They are encouraged to instead use the changeset methods exposed in the connection classes. 12 | * 13 | * @see YapDatabaseConnection hasChangeForKey:inNotifications: 14 | * @see YapDatabaseConnection hasChangeForAnyKeys:inNotifications: 15 | **/ 16 | @interface YapSet : NSObject 17 | 18 | - (id)initWithSet:(NSMutableSet *)set; 19 | - (id)initWithDictionary:(NSMutableDictionary *)dictionary; 20 | 21 | // NSSet methods 22 | 23 | - (BOOL)containsObject:(id)anObject; 24 | - (BOOL)intersectsSet:(NSSet *)otherSet; 25 | 26 | - (void)enumerateObjectsUsingBlock:(void (^)(id obj, BOOL *stop))block; 27 | 28 | // It's open source! 29 | // You are encouraged to add any methods you may need that are available in the NSSet API. 30 | // 31 | // Not every method from NSSet is available here because the author is lazy, 32 | // and only implemented what was needed at the time. 33 | // 34 | // If you add something, keep in mind the spirit of this class. 35 | // It is designed to expose mutable internals in a safe (immutable) manner. 36 | // It is designed to expose them in the form of a set. 37 | // 38 | // If you make improvements, feel free to submit a patch to the github project and get some good karma for it! 39 | // https://github.com/yapstudios/YapDatabase 40 | 41 | @end 42 | -------------------------------------------------------------------------------- /iGoat-Swift/iGoat-Swift/ThirdParty/YapDatabase/Utilities/YapSet.m: -------------------------------------------------------------------------------- 1 | #import "YapSet.h" 2 | 3 | 4 | @implementation YapSet 5 | { 6 | NSDictionary *dictionary; 7 | NSSet *set; 8 | } 9 | 10 | - (id)initWithSet:(NSMutableSet *)inSet 11 | { 12 | if ((self = [super init])) 13 | { 14 | set = inSet; // retain, do NOT copy (which would defeat the entire purpose of this class) 15 | } 16 | return self; 17 | } 18 | 19 | - (id)initWithDictionary:(NSMutableDictionary *)inDictionary 20 | { 21 | if ((self = [super init])) 22 | { 23 | dictionary = inDictionary; // retain, do NOT copy (which would defeat the entire purpose of this class) 24 | } 25 | return self; 26 | } 27 | 28 | // NSSet methods 29 | 30 | - (BOOL)containsObject:(id)object 31 | { 32 | if (set) 33 | return [set containsObject:object]; 34 | else 35 | return CFDictionaryContainsKey((__bridge CFDictionaryRef)dictionary, (const void *)object); 36 | } 37 | 38 | - (BOOL)intersectsSet:(NSSet *)otherSet 39 | { 40 | if (set) 41 | { 42 | return [set intersectsSet:otherSet]; 43 | } 44 | else 45 | { 46 | for (id object in otherSet) 47 | { 48 | if (CFDictionaryContainsKey((__bridge CFDictionaryRef)dictionary, (const void *)object)) 49 | return YES; 50 | } 51 | 52 | return NO; 53 | } 54 | } 55 | 56 | - (void)enumerateObjectsUsingBlock:(void (^)(id obj, BOOL *stop))block 57 | { 58 | if (set) 59 | { 60 | [set enumerateObjectsUsingBlock:block]; 61 | } 62 | else 63 | { 64 | if (block == NULL) return; 65 | [dictionary enumerateKeysAndObjectsUsingBlock:^(id key, id __unused obj, BOOL *stop) { 66 | 67 | block(key, stop); 68 | }]; 69 | } 70 | } 71 | 72 | - (NSUInteger)countByEnumeratingWithState:(NSFastEnumerationState *)state 73 | objects:(__unsafe_unretained id *)stackbuf 74 | count:(NSUInteger)len 75 | { 76 | if (set) 77 | return [set countByEnumeratingWithState:state objects:stackbuf count:len]; 78 | else 79 | return [dictionary countByEnumeratingWithState:state objects:stackbuf count:len]; 80 | } 81 | 82 | @end 83 | -------------------------------------------------------------------------------- /iGoat-Swift/iGoat-Swift/ThirdParty/YapDatabase/Utilities/YapWhitelistBlacklist.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | 4 | typedef BOOL (^YapWhitelistBlacklistFilterBlock)(id item); 5 | 6 | /** 7 | * This class provides a standardized way to create a sort of whitelist / blacklist. 8 | * It is used often within the options of extensions to create the set of allowedCollections. 9 | **/ 10 | @interface YapWhitelistBlacklist : NSObject 11 | 12 | /** 13 | * Creates a whitelist based instance. 14 | * 15 | * Only items in the whitelist are allowed. 16 | * Any items not in the whitelist are disallowed. 17 | **/ 18 | - (instancetype)initWithWhitelist:(NSSet *)whitelist; 19 | 20 | /** 21 | * Creates a blacklist based instance. 22 | * 23 | * Only items in the blacklist are disallowed. 24 | * Any items not in the blacklist are allowed. 25 | **/ 26 | - (instancetype)initWithBlacklist:(NSSet *)blacklist; 27 | 28 | /** 29 | * Creates a filterBlock based instance. 30 | * 31 | * Rather than a known whitelist/blacklist, the filterBlock makes it possible to use app-specific criteria. 32 | * For example, using prefix matching, regular expressions, etc. 33 | * 34 | * When creating your block, you must keep in mind 2 things: 35 | * 36 | * 1.) YapDatabase extensions may invoke the filterBlock from background threads durind readWriteTransactions. 37 | * Thus your filterBlock MUST be thread-safe. 38 | * 39 | * 2.) The filterBlock is expected to be IMMUTABLE. 40 | * That is, if the fitlerBlock is invoked with item X, and the filterBlock returns YES, 41 | * then the filterBlock must always return YES for X. 42 | * It should not "change its mind" about X. 43 | * 44 | * If the filterBlock returns YES for a given item, that item is allowed. 45 | * If the filterBlock returns NO for a given item, that item is disallowed. 46 | **/ 47 | - (instancetype)initWithFilterBlock:(YapWhitelistBlacklistFilterBlock)block; 48 | 49 | /** 50 | * Inspects the whitelist or blacklist, or consults the filterBlock (depending on initialization), 51 | * and returns whether or not the item is allowed. 52 | **/ 53 | - (BOOL)isAllowed:(id)item; 54 | 55 | @end 56 | -------------------------------------------------------------------------------- /iGoat-Swift/iGoat-Swift/ThirdParty/YapDatabase/Utilities/YapWhitelistBlacklist.m: -------------------------------------------------------------------------------- 1 | #import "YapWhitelistBlacklist.h" 2 | 3 | 4 | @implementation YapWhitelistBlacklist 5 | { 6 | NSSet *whitelist; 7 | NSSet *blacklist; 8 | 9 | YapWhitelistBlacklistFilterBlock filterBlock; 10 | } 11 | 12 | // See header file for documentation 13 | - (instancetype)initWithWhitelist:(NSSet *)inWhitelist 14 | { 15 | if ((self = [super init])) 16 | { 17 | whitelist = inWhitelist ? [inWhitelist copy] : [[NSSet alloc] init]; 18 | } 19 | return self; 20 | } 21 | 22 | // See header file for documentation 23 | - (instancetype)initWithBlacklist:(NSSet *)inBlacklist 24 | { 25 | if ((self = [super init])) 26 | { 27 | blacklist = inBlacklist ? [inBlacklist copy] : [[NSSet alloc] init]; 28 | } 29 | return self; 30 | } 31 | 32 | // See header file for documentation 33 | - (instancetype)initWithFilterBlock:(YapWhitelistBlacklistFilterBlock)block 34 | { 35 | if (block == NULL) return nil; 36 | 37 | if ((self = [super init])) 38 | { 39 | filterBlock = block; 40 | } 41 | return self; 42 | } 43 | 44 | // See header file for documentation 45 | - (BOOL)isAllowed:(id)item 46 | { 47 | if (whitelist) 48 | { 49 | return [whitelist containsObject:item]; 50 | } 51 | else if (blacklist) 52 | { 53 | return ![blacklist containsObject:item]; 54 | } 55 | else 56 | { 57 | return filterBlock(item); 58 | } 59 | } 60 | 61 | @end 62 | -------------------------------------------------------------------------------- /iGoat-Swift/iGoat-Swift/ThirdParty/YapDatabase/YapDatabaseOptions.m: -------------------------------------------------------------------------------- 1 | #import "YapDatabaseOptions.h" 2 | 3 | /** 4 | * Welcome to YapDatabase! 5 | * 6 | * The project page has a wealth of documentation if you have any questions. 7 | * https://github.com/yapstudios/YapDatabase 8 | * 9 | * If you're new to the project you may want to visit the wiki. 10 | * https://github.com/yapstudios/YapDatabase/wiki 11 | * 12 | * This class provides extra configuration options that may be passed to YapDatabase. 13 | * The configuration options provided by this class are advanced (beyond the basic setup options). 14 | **/ 15 | @implementation YapDatabaseOptions 16 | 17 | @synthesize corruptAction = corruptAction; 18 | @synthesize pragmaSynchronous = pragmaSynchronous; 19 | @synthesize pragmaJournalSizeLimit = pragmaJournalSizeLimit; 20 | @synthesize pragmaPageSize = pragmaPageSize; 21 | #ifdef SQLITE_HAS_CODEC 22 | @synthesize cipherKeyBlock = cipherKeyBlock; 23 | #endif 24 | @synthesize aggressiveWALTruncationSize = aggressiveWALTruncationSize; 25 | 26 | - (id)init 27 | { 28 | if ((self = [super init])) 29 | { 30 | corruptAction = YapDatabaseCorruptAction_Rename; 31 | pragmaSynchronous = YapDatabasePragmaSynchronous_Full; 32 | pragmaJournalSizeLimit = 0; 33 | pragmaPageSize = 0; 34 | aggressiveWALTruncationSize = (1024 * 1024); // 1 MB 35 | } 36 | return self; 37 | } 38 | 39 | - (id)copyWithZone:(NSZone __unused *)zone 40 | { 41 | YapDatabaseOptions *copy = [[[self class] alloc] init]; 42 | copy->corruptAction = corruptAction; 43 | copy->pragmaSynchronous = pragmaSynchronous; 44 | copy->pragmaJournalSizeLimit = pragmaJournalSizeLimit; 45 | copy->pragmaPageSize = pragmaPageSize; 46 | #ifdef SQLITE_HAS_CODEC 47 | copy->cipherKeyBlock = cipherKeyBlock; 48 | #endif 49 | copy->aggressiveWALTruncationSize = aggressiveWALTruncationSize; 50 | 51 | return copy; 52 | } 53 | 54 | @end 55 | -------------------------------------------------------------------------------- /iGoat-Swift/iGoat-Swift/maxpower.h: -------------------------------------------------------------------------------- 1 | // 2 | // maxpower.h 3 | // UnDebuggable 4 | // 5 | // Created by Bernhard Mueller on 1/26/17. 6 | // Copyright © 2017 Bernhard Mueller. All rights reserved. 7 | // 8 | 9 | #ifndef maxpower_h 10 | #define maxpower_h 11 | 12 | #include 13 | 14 | char *do_it(void); 15 | 16 | #endif /* maxpower_h */ 17 | -------------------------------------------------------------------------------- /iGoat-Swift/iGoat-SwiftTests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | 1 21 | 22 | 23 | -------------------------------------------------------------------------------- /iGoat-Swift/iGoat-SwiftTests/iGoat_SwiftTests.swift: -------------------------------------------------------------------------------- 1 | // 2 | // iGoat_SwiftTests.swift 3 | // iGoat-SwiftTests 4 | // 5 | // Created by Anthony G on 07/04/18. 6 | // Copyright © 2018 OWASP. All rights reserved. 7 | // 8 | 9 | import XCTest 10 | @testable import iGoat_Swift 11 | 12 | class iGoat_SwiftTests: XCTestCase { 13 | 14 | override func setUp() { 15 | super.setUp() 16 | // Put setup code here. This method is called before the invocation of each test method in the class. 17 | } 18 | 19 | override func tearDown() { 20 | // Put teardown code here. This method is called after the invocation of each test method in the class. 21 | super.tearDown() 22 | } 23 | 24 | func testExample() { 25 | // This is an example of a functional test case. 26 | // Use XCTAssert and related functions to verify your tests produce the correct results. 27 | } 28 | 29 | func testPerformanceExample() { 30 | // This is an example of a performance test case. 31 | self.measure { 32 | // Put the code you want to measure the time of here. 33 | } 34 | } 35 | 36 | } 37 | -------------------------------------------------------------------------------- /server/README: -------------------------------------------------------------------------------- 1 | =============================================================================== 2 | iGoat Server 3 | ------------------------------------------------------------------------------- 4 | 5 | ABOUT 6 | 7 | This file contains a very simple web server used by iGoat in some of 8 | its exercises. It is a special purpose web server for very specific 9 | purposes, not anything for general purpose use. It takes a specially 10 | constructed input from iGoat, and responds back with information 11 | needed by iGoat. 12 | 13 | REQUIREMENTS 14 | 15 | Most of what you'll need to run the server already comes with the default OS X 16 | install (Ruby, etc.), but there are a few external gem requirements, which you 17 | can install with the following command: 18 | 19 | sudo gem install sinatra json 20 | 21 | RUNNING 22 | 23 | Simply invoke the igoat-server.rb script from the Terminal... 24 | 25 | ./igoat-server.rb 26 | 27 | Ctrl-C to quit. 28 | 29 | FURTHER DETAILS 30 | 31 | See the comments in the script itself for ports, endpoints, etc. 32 | 33 | And of course: ken@krvw.com, sean@krvw.com 34 | 35 | ****************************************************************************** 36 | 37 | This file is part of iGoat, an Open Web Application Security 38 | Project tool. For details, please see http://www.owasp.org 39 | 40 | Copyright(c) 2013 KRvW Associates, LLC (http://www.krvw.com) 41 | The iGoat project is principally sponsored by KRvW Associates, LLC 42 | Project Leader, Kenneth R. van Wyk (ken@krvw.com) 43 | Lead Developer: Sean Eidemiller (sean@krvw.com) 44 | 45 | iGoat is free software; you may redistribute it and/or modify it 46 | under the terms of the GNU General Public License as published by 47 | the Free Software Foundation; version 3. 48 | 49 | iGoat is distributed in the hope it will be useful, but WITHOUT ANY 50 | WARRANTY; without even the implied warranty of MERCHANTABILITY or 51 | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public 52 | License for more details. 53 | 54 | You should have received a copy of the GNU General Public License 55 | along with this program; if not, write to the Free Software 56 | Foundation, Inc. 59 Temple Place, suite 330, Boston, MA 02111-1307 57 | USA. 58 | 59 | Source Code: http://code.google.com/p/owasp-igoat/ 60 | Project Home: https://www.owasp.org/index.php/OWASP_iGoat_Project 61 | 62 | ****************************************************************************** 63 | -------------------------------------------------------------------------------- /server/docker_packaging/.gitignore: -------------------------------------------------------------------------------- 1 | *~ 2 | -------------------------------------------------------------------------------- /server/docker_packaging/docker-compose.yaml: -------------------------------------------------------------------------------- 1 | version: '3' 2 | 3 | services: 4 | igoat_server: 5 | build: 6 | context: ./docker-igoat 7 | dockerfile: Dockerfile 8 | args: 9 | buildno: 1 10 | ports: 11 | - "8080:8080" 12 | - "8443:8443" 13 | - "8442:8442" 14 | environment: 15 | - MAIN_APP_FILE=igoat_server.rb 16 | restart: always 17 | -------------------------------------------------------------------------------- /server/docker_packaging/docker-igoat/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM ruby:2.3 2 | 3 | RUN mkdir -p /usr/src/app 4 | 5 | ENV RACK_ENV production 6 | 7 | RUN git clone https://github.com/OWASP/igoat.git /tmp/ 8 | 9 | RUN mv /tmp/server/* /usr/src/app/ 10 | 11 | ADD startup.sh / 12 | 13 | WORKDIR /usr/src/app 14 | 15 | EXPOSE 8080 16 | 17 | CMD ["/bin/bash", "/startup.sh"] 18 | -------------------------------------------------------------------------------- /server/docker_packaging/docker-igoat/startup.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | gem install sinatra 3 | ruby $MAIN_APP_FILE -------------------------------------------------------------------------------- /server/docker_packaging/iGoat.sh: -------------------------------------------------------------------------------- 1 | docker run \ 2 | -p 8080:8080 \ 3 | -p 8443:8443 \ 4 | -p 8442:8442 \ 5 | -e MAIN_APP_FILE=igoat_server.rb \ 6 | -d b9e6e94d431a 7 | -------------------------------------------------------------------------------- /server/hostileSSLServer.crt: -------------------------------------------------------------------------------- 1 | -----BEGIN CERTIFICATE----- 2 | MIICuzCCAiQCCQC7Yg+vMMWt1DANBgkqhkiG9w0BAQUFADCBoTELMAkGA1UEBhMC 3 | VVMxEzARBgNVBAgTCkNhbGlmb3JuaWExFjAUBgNVBAcTDVNhbiBGcmFuY2lzY28x 4 | HDAaBgNVBAoTE0RvZGd5IEJyb3RoZXJzIEluYy4xDjAMBgNVBAsTBUZyYXVkMRAw 5 | DgYDVQQDEwdIYWNrZXJzMSUwIwYJKoZIhvcNAQkBFhZsZWdpdHVzZXJAaG9zdG5h 6 | bWUuY29tMB4XDTE0MDkwODIxMTkxM1oXDTI0MDkwNTIxMTkxM1owgaExCzAJBgNV 7 | BAYTAlVTMRMwEQYDVQQIEwpDYWxpZm9ybmlhMRYwFAYDVQQHEw1TYW4gRnJhbmNp 8 | c2NvMRwwGgYDVQQKExNEb2RneSBCcm90aGVycyBJbmMuMQ4wDAYDVQQLEwVGcmF1 9 | ZDEQMA4GA1UEAxMHSGFja2VyczElMCMGCSqGSIb3DQEJARYWbGVnaXR1c2VyQGhv 10 | c3RuYW1lLmNvbTCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEAq46B0d2qKKlw 11 | +qx0yE/g3do8SmZI9d3h+yFE1srYAsR0KJajt0JbcOqeZzP6ELo7ScyduLvVViJR 12 | qFEg28OwrE4CjJUt6HTDUnHFl9PkCnRU3DXk8yFuqLvWPM73o/RNnhXJXf6IVZzk 13 | yEL9RTst6X5c9RV3G4wUjpUc+0JroEECAwEAATANBgkqhkiG9w0BAQUFAAOBgQCU 14 | /4ACgM/MAXonQrd8XSejXpAbCyZvge9zZ3+mMwPRdcpHH7e0Bo+3ZNCrbkERTaa2 15 | rTcIXp8OXnAX2tcWnZGuaJzGpGqBGofMaG/glYuJ6R+Xg/mAddBiMUf0DshaPhXc 16 | UwiX9atvKpLGIU5X/Jluxdy6K4dtel/PHXQ9aUklyA== 17 | -----END CERTIFICATE----- 18 | -------------------------------------------------------------------------------- /server/hostileSSLServer.private.key: -------------------------------------------------------------------------------- 1 | -----BEGIN RSA PRIVATE KEY----- 2 | MIICXAIBAAKBgQCrjoHR3aooqXD6rHTIT+Dd2jxKZkj13eH7IUTWytgCxHQolqO3 3 | Qltw6p5nM/oQujtJzJ24u9VWIlGoUSDbw7CsTgKMlS3odMNSccWX0+QKdFTcNeTz 4 | IW6ou9Y8zvej9E2eFcld/ohVnOTIQv1FOy3pflz1FXcbjBSOlRz7QmugQQIDAQAB 5 | AoGAeCvLzgk6z17ZkA5Lg6FIf78GKot5ohg52qLUSK0wIMgiIehbZ9xolzERonMr 6 | QJpjO2/EL4oLh1lk38VsgeSTFQixZh3uUIB8kZslABJqrJZ2EXPATU+MwCagX1I0 7 | 5KRtpqfnSFwWc29RY4u1iIFVh7MKygU7cB80wQ1JUgrc9s0CQQDj8SK+k/3/Jn4x 8 | x35kk7n2n700snIAgreR2x+99nVedhrW4E4pcFsDWAtCUTr2/vOR8Y0/HexA7clA 9 | 3SMZc9D/AkEAwKyRuDIfsCpWb0zWlN4DVutaXKLqPDIoRjvsf14mBJ4B5skS2OMB 10 | QPwikoIMRN/uL4vwQq4ptTj7cXIhn6tOvwJAYGXmT7q+vF1HGT5JEbf3+Xjsx5B/ 11 | 7f9aKvEEp43HbT99ckpCQ/wkQXHGsTExQqvnzlzdY0gAViU565iZ83WreQJAE1d/ 12 | jWEiwzmM0cGB7RHYffpEaPZF02MpndtYI3UdFeuSv0tCJBmtv4tQISsC9ksQix9e 13 | MCNxtmqQ+1N8wp2c2wJBALKQblBKChHJhXboi1XzSNHwBsCbVAbNDp8mm1ZdvJI5 14 | podGHiqc+Nq4uh7CNQvkt6Q+PTtpt0we3/dB6+X8Fgc= 15 | -----END RSA PRIVATE KEY----- 16 | -------------------------------------------------------------------------------- /server/iGoat-Server-challenges/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM php:7.0-apache 2 | 3 | RUN apt-get update && \ 4 | apt-get clean 5 | 6 | COPY myapp /var/www/html/ 7 | -------------------------------------------------------------------------------- /server/iGoat-Server-challenges/README: -------------------------------------------------------------------------------- 1 | # build the docker image 2 | docker build -t php-docker-apache-example . 3 | 4 | # run the docker container on this machine. Expose its internal 5 | # port 80 to this machine's port 8080 6 | docker run -d -p 8081:80 php-docker-apache-example -------------------------------------------------------------------------------- /server/iGoat-Server-challenges/myapp/SimpleRest.php: -------------------------------------------------------------------------------- 1 | getHttpStatusMessage($statusCode); 7 | header($this->httpVersion." ".$statusCode." ".$statusMessage); 8 | header("Content-Type:".$contentType); 9 | } 10 | 11 | public function getHttpStatusMessage($statusCode){ 12 | $httpStatus = array( 13 | 100 => 'Continue', 14 | 101 => 'Switching Protocols', 15 | 200 => 'OK', 16 | 201 => 'Created', 17 | 202 => 'Accepted', 18 | 203 => 'Non-Authoritative Information', 19 | 204 => 'No Content', 20 | 205 => 'Reset Content', 21 | 206 => 'Partial Content', 22 | 300 => 'Multiple Choices', 23 | 301 => 'Moved Permanently', 24 | 302 => 'Found', 25 | 303 => 'See Other', 26 | 304 => 'Not Modified', 27 | 305 => 'Use Proxy', 28 | 306 => '(Unused)', 29 | 307 => 'Temporary Redirect', 30 | 400 => 'Bad Request', 31 | 401 => 'Unauthorized', 32 | 402 => 'Payment Required', 33 | 403 => 'Forbidden', 34 | 404 => 'Not Found', 35 | 405 => 'Method Not Allowed', 36 | 406 => 'Not Acceptable', 37 | 407 => 'Proxy Authentication Required', 38 | 408 => 'Request Timeout', 39 | 409 => 'Conflict', 40 | 410 => 'Gone', 41 | 411 => 'Length Required', 42 | 412 => 'Precondition Failed', 43 | 413 => 'Request Entity Too Large', 44 | 414 => 'Request-URI Too Long', 45 | 415 => 'Unsupported Media Type', 46 | 416 => 'Requested Range Not Satisfiable', 47 | 417 => 'Expectation Failed', 48 | 500 => 'Internal Server Error', 49 | 501 => 'Not Implemented', 50 | 502 => 'Bad Gateway', 51 | 503 => 'Service Unavailable', 52 | 504 => 'Gateway Timeout', 53 | 505 => 'HTTP Version Not Supported' 54 | ); 55 | return ($httpStatus[$statusCode])? $httpStatus[$statusCode] :$status[500]; 56 | } 57 | } 58 | ?> 59 | -------------------------------------------------------------------------------- /server/iGoat-Server-challenges/myapp/check_php_ini.php: -------------------------------------------------------------------------------- 1 | 5 | -------------------------------------------------------------------------------- /server/iGoat-Server-challenges/myapp/checkout.php: -------------------------------------------------------------------------------- 1 | Checkout "; 4 | 5 | $checksum = $_POST['checksum']; 6 | $secret = "H@cKIm_2@15*nu11(0N"; 7 | 8 | $newmsg = urldecode($_POST['msg']); 9 | 10 | 11 | if($checksum === hash("sha256", $secret . $newmsg)) 12 | { 13 | $a = explode("|" , $newmsg); 14 | $price = end($a); 15 | echo $msg; 16 | 17 | if(is_numeric($price)) 18 | { 19 | if($price == 0) 20 | { 21 | echo "Congratualtion You bought iPhone in ZERO dollar!"; 22 | echo "Flag is BuG@2@i7}"; 23 | 24 | } 25 | else 26 | { 27 | echo "You must buy iPhone in ZERO rupee"; 28 | } 29 | 30 | } 31 | else 32 | { 33 | 34 | echo "Checksum Matched but Something went wrong"; 35 | 36 | echo "price". $price; 37 | } 38 | 39 | } 40 | else 41 | { 42 | echo "Fail! You must buy iPhone in ZERO rupee.\n"; 43 | 44 | } 45 | ?> 46 | -------------------------------------------------------------------------------- /server/iGoat-Server-challenges/myapp/cryptoKey.php: -------------------------------------------------------------------------------- 1 | "iG0@t_L0cK"); 10 | 11 | $requestContentType = $_SERVER['HTTP_ACCEPT']; 12 | $this->setHttpHeaders($requestContentType, $statusCode); 13 | 14 | if(strpos($requestContentType,'application/json') !== false){ 15 | $response = $this->encodeJson($keyValue); 16 | echo $response; 17 | } 18 | else if(strpos($requestContentType,'text/html') !== false){ 19 | $response = $this->encodeHtml($keyValue); 20 | echo $response; 21 | } 22 | 23 | } 24 | 25 | public function encodeJson($responseData) { 26 | $jsonResponse = json_encode($responseData); 27 | return $jsonResponse; 28 | } 29 | 30 | public function encodeHtml($responseData){ 31 | $htmlResponse = ""; 32 | foreach($responseData as $key=>$value){ 33 | $htmlResponse .= ""; 34 | } 35 | $htmlResponse .= "
".$key."".$value."
"; 36 | return $htmlResponse; 37 | } 38 | 39 | } 40 | 41 | if($_SERVER['REQUEST_METHOD'] === 'GET') 42 | { 43 | echo "Invalid attempt"; 44 | } 45 | 46 | if($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST["token"])) 47 | { 48 | $token = $_POST["token"]; 49 | // echo $_POST["token"]; 50 | } 51 | 52 | switch($token){ 53 | 54 | case "key": 55 | $cryptokey = new cryptoKey(); 56 | $cryptokey->getKey(); 57 | 58 | } 59 | 60 | 61 | ?> 62 | -------------------------------------------------------------------------------- /server/iGoat-Server-challenges/myapp/index.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Hello 7 | 8 | 9 | 10 | 11 | 12 |

Hi

13 | 14 | -------------------------------------------------------------------------------- /server/iGoat-Server-challenges/myapp/new404.php: -------------------------------------------------------------------------------- 1 | 4 | -------------------------------------------------------------------------------- /server/iGoat-Server-challenges/myapp/webkit.php: -------------------------------------------------------------------------------- 1 | "66435@J0hn"); 10 | 11 | $requestContentType = $_SERVER['HTTP_ACCEPT']; 12 | $this->setHttpHeaders($requestContentType, $statusCode); 13 | 14 | if(strpos($requestContentType,'application/json') !== false){ 15 | $response = $this->encodeJson($keyValue); 16 | echo $response; 17 | } 18 | else if(strpos($requestContentType,'text/html') !== false){ 19 | $response = $this->encodeHtml($keyValue); 20 | echo $response; 21 | } 22 | 23 | } 24 | 25 | public function encodeJson($responseData) { 26 | $jsonResponse = json_encode($responseData); 27 | return $jsonResponse; 28 | } 29 | 30 | public function encodeHtml($responseData){ 31 | $htmlResponse = ""; 32 | foreach($responseData as $key=>$value){ 33 | $htmlResponse .= ""; 34 | } 35 | $htmlResponse .= "
".$key."".$value."
"; 36 | return $htmlResponse; 37 | } 38 | 39 | } 40 | 41 | if($_SERVER['REQUEST_METHOD'] === 'GET') 42 | { 43 | echo "Invalid attempt"; 44 | } 45 | 46 | if($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST["token"])) 47 | { 48 | $token = $_POST["token"]; 49 | // echo $_POST["token"]; 50 | } 51 | 52 | switch($token){ 53 | 54 | case "key": 55 | $cryptokey = new cryptoKey(); 56 | $cryptokey->getKey(); 57 | 58 | } 59 | 60 | 61 | ?> 62 | -------------------------------------------------------------------------------- /server/legitimateServers.crt: -------------------------------------------------------------------------------- 1 | -----BEGIN CERTIFICATE----- 2 | MIIC2zCCAkSgAwIBAgIJAJ7X+FzDNpKdMA0GCSqGSIb3DQEBBQUAMFMxCzAJBgNV 3 | BAYTAlVTMREwDwYDVQQIEwhWaXJnaW5pYTEdMBsGA1UEChMUS1J2VyBBc3NvY2lh 4 | dGVzLCBMTEMxEjAQBgNVBAMTCWxvY2FsaG9zdDAeFw0xMTAxMTkxNzUwNDlaFw0x 5 | NDAxMTgxNzUwNDlaMFMxCzAJBgNVBAYTAlVTMREwDwYDVQQIEwhWaXJnaW5pYTEd 6 | MBsGA1UEChMUS1J2VyBBc3NvY2lhdGVzLCBMTEMxEjAQBgNVBAMTCWxvY2FsaG9z 7 | dDCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEAuOqQyzHYWKm0Z2nyQc2b6vlj 8 | ZHVoadWaZABKTBZVWG2+dUT5JAZhUFJOVpZL+j2GNsoFpj7QqC3OZZqrMZeFHS9a 9 | 4xQFw0lYPpS3nCXOm4nL2ONH88pp9k+8/ZxckCN792crJUpV9oLoW0Q3RxeHxdbD 10 | ingP9kzkXbuPH7fRKx0CAwEAAaOBtjCBszAdBgNVHQ4EFgQUnIEiVLzmMng72W4h 11 | dJwRzd91RPcwgYMGA1UdIwR8MHqAFJyBIlS85jJ4O9luIXScEc3fdUT3oVekVTBT 12 | MQswCQYDVQQGEwJVUzERMA8GA1UECBMIVmlyZ2luaWExHTAbBgNVBAoTFEtSdlcg 13 | QXNzb2NpYXRlcywgTExDMRIwEAYDVQQDEwlsb2NhbGhvc3SCCQCe1/hcwzaSnTAM 14 | BgNVHRMEBTADAQH/MA0GCSqGSIb3DQEBBQUAA4GBAJADIaLBeT7ELEFmw1Dw4ifu 15 | 9NxvW9rXxNp6EmXec5EQKnApFf8CLdhNaJVpVnXtrWr9pAR2gtK/TrxKeEAojj5d 16 | m9+o/d44HPismqdYY6tskq8XScnZTFkXor5jPHmS0mdiIqyXbY2wQM2Xw6IsNxJ3 17 | NKXCkyl8Xd7ktTmyIZU6 18 | -----END CERTIFICATE----- 19 | -------------------------------------------------------------------------------- /server/legitimateServers.private.key: -------------------------------------------------------------------------------- 1 | -----BEGIN RSA PRIVATE KEY----- 2 | MIICXgIBAAKBgQC46pDLMdhYqbRnafJBzZvq+WNkdWhp1ZpkAEpMFlVYbb51RPkk 3 | BmFQUk5Wlkv6PYY2ygWmPtCoLc5lmqsxl4UdL1rjFAXDSVg+lLecJc6bicvY40fz 4 | ymn2T7z9nFyQI3v3ZyslSlX2guhbRDdHF4fF1sOKeA/2TORdu48ft9ErHQIDAQAB 5 | AoGBAJGNgT+QEp1np2snR9tn/mystQGkMPXtfsNsPw85HSCn8ZzZF8q1gu/4eVVK 6 | pK9qsjR6PIwpMZDPzYDIiCxW+h0xpskpzSIGndDgGKA5sEagBOqObmNuDTMm6rVR 7 | 3SVp1gG2T7RCfVQgXBSHrYSxhK+q3DU7+2PNRZqGvZjpDm95AkEA6BNoMtiHxRul 8 | 3X6ZgmT+LD383E/JcOnnoJoQ2BHz/oAaPOwMo/U+WlTk/fI445AobtkR9p3MdZkq 9 | xmaYk4PS3wJBAMv6mHawIu7iK7pSYytEDmllq2q+Eva2O5/uh1k3Y3Juz0IekZPH 10 | sy131flmJ3KO98bhba0ktV2k0woAJOOnHYMCQQCmGOW1pmWdvAj9OtOxkIidr4vf 11 | PjeFWdNOjZXKnybLGnIs8iCl5CtJSYNPAWKX9CAMHc4OfKfN7t6/esRup6VvAkBb 12 | KOaEfJlQG2Ihhfpt9p9eOSLPtJyzB6RECI0SsS9Pj/gue4zh96i7FEhbimzsxLo1 13 | dr/WVoZ7kFMEsCXMW/5TAkEAyFtcJF5x5SEDKpi3d3ybMTMaD1qfrVG96HLkC0ZG 14 | lh8yGjHpPR593nl8YG7tAoI5bG18pngRqLEGeyfjOShq6Q== 15 | -----END RSA PRIVATE KEY----- 16 | -------------------------------------------------------------------------------- /server/test_client.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | if [ "$1" = "user" ]; then 4 | if [ "$2" = "--ssl" ]; then 5 | curl -v -k -X POST -H "Content-Type: application/json" -H "Accept: application/json" \ 6 | --sslv3 --data-binary @test_json.txt https://localhost:8443/igoat/user 7 | else 8 | curl -v -X POST -H "Content-Type: application/json" -H "Accept: application/json" \ 9 | --data-binary @test_json.txt http://localhost:8080/igoat/user 10 | fi 11 | elif [ "$1" = "token" ]; then 12 | if [ "$2" = "--ssl" ]; then 13 | curl -v -k --sslv3 https://localhost:8443/igoat/token 14 | else 15 | curl -v http://localhost:8080/igoat/token 16 | fi 17 | else 18 | echo "Usage: ./test_client.sh [--ssl]" 19 | exit 1 20 | fi 21 | -------------------------------------------------------------------------------- /server/test_json.txt: -------------------------------------------------------------------------------- 1 | { 2 | "firstName": "Sean", 3 | "lastName": "Eidemiller", 4 | "accountNumber": "0123456789", 5 | "socialSecurityNumber": "111-22-3344" 6 | } 7 | --------------------------------------------------------------------------------