Swift可以抵抗钩吗? [英] Is Swift resistant against hooking?

查看:105
本文介绍了Swift可以抵抗钩吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Cycript是一个基于控制台的应用程序,它结合了Objective-C和JavaScript. Cycript对iOS应用程序的动态分析非常有用.

Cycript is a console based application that is a blend of Objective-C and JavaScript. Cycript is very useful for dynamic analysis of iOS applications.

如果您使用Swift编写任何方法或完整的ipa,仍然可以将应用程序挂在越狱的设备上吗?还是像iOS上的本机C"代码一样安全的Swift代码?

If you write any methods or the complete ipa with Swift is it still possible to hook the application on a jailbroken device? Or is Swift safe like "native C" Code on iOS ?

推荐答案

我对Cycript并不十分熟悉,但对Swift编译器却了解不多.

I'm not really familiar with Cycript but I have a little understanding of the Swift compiler.

快速代码将更能抵抗钩子,但并非完全不可能.声明为@objc的NSObject子类和Swift类应该与Objective-C代码一样可访问.纯Swift代码,尤其是在优化的版本中,将很难注入代码,因为它们通常是静态分配的,并且在许多情况下实际上会内联到调用代码中.

Swift code will be more resistant to hooking but it should not be completely impossible. NSObject subclasses and Swift classes that are declared @objc should be as accessible as Objective-C code. Pure Swift code, especially in optimised builds would be harder to inject code into because they are often statically dispatched and in many cases will actually be inlined into the calling code.

在未内联代码的地方,也许可以修补内存中的函数以跳至其他函数,但这并不像修改函数表那样容易.

Where code hasn't been inlined it may may be possible to patch the functions in memory themselves to jump to an alternative function but it wouldn't be as easy as just modifying function tables.

内联关键功能的地方,如果可以识别出通用的代码模式,并且如果功能足够长,则有可能找到并修改每种用法,这可能是可能的,以便跳到备用版本,但这会变得非常棘手.

Where key functions have been inlined it may be possible to find and modify each usage if common patterns of code that could be identified and if the function is long enough it may be posible to patch in a jump to an alternate version but this would get really quite tricky.

这篇关于Swift可以抵抗钩吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆