Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions AppResign/AppResign/AppResign.swift
Original file line number Diff line number Diff line change
Expand Up @@ -433,6 +433,8 @@ class AppResign {


recursiveDirectorySearch(appBundlePath, extensions: signableExtensions, found: signingFunction)
hiddenDylibSearch(appBundlePath, found: signingFunction)

signingFunction(appBundlePath)

// MARK: Codesigning - Verification
Expand Down Expand Up @@ -542,6 +544,28 @@ class AppResign {
}
}

func hiddenDylibSearch(_ path: String, found: ((_ file: String) -> Void)){

if let files = try? fileManager.contentsOfDirectory(atPath: path) {
var isDirectory: ObjCBool = true

for file in files {
let currentFile = path.stringByAppendingPathComponent(file)
fileManager.fileExists(atPath: currentFile, isDirectory: &isDirectory)
if !isDirectory.boolValue {
let fileTask = Process().execute(fileCmdPath, workingDirectory: nil, arguments: [currentFile])
let pattern = "dynamically linked shared library"
let regex = try! NSRegularExpression(pattern: pattern, options: .caseInsensitive)
let res = regex.matches(in: fileTask.output, options: [], range: NSMakeRange(0, fileTask.output.characters.count))
if res.count > 0 && file.pathExtension != "dylib" {
print("find hidden dylib \(file)")
found(currentFile)
}
}
}
}
}

// MARK: Codesigning
func codeSign(_ file: String, certificate: String, entitlements: String?, before: ((_ file: String, _ certificate: String, _ entitlements: String?)->Void)?, after: ((_ file: String, _ certificate: String, _ entitlements: String?, _ codesignTask: AppSignerTaskOutput)->Void)?) -> AppSignerTaskOutput {

Expand Down