小镇青年


  • Home

  • About

  • Tags

  • Categories

  • Archives

iOS逆向<1>:逆向工程资料整理

Posted on 2019-02-12

架构介绍

模拟器32位处理器是i386架构,

模拟器64位处理器是x86_64架构,

真机32位处理器是armv7,或者armv7s架构,(armv7s是iPhone5C、armv7是iphone4之前的手机版本)

真机64位处理器是arm64架构。(iPhone5s之后的手机)

工具链介绍

工具分类 工具名称 使用平台
砸壳 dumpdecrypted, Clutch mac
查看头文件 class-dump mac
反汇编 Hopper, IDA Pro mac
调试,运行一些动态js脚本,查看APP运行时的信息 Cycript, gdb iPhone
Theos进行动态hook Tweak mac
UI分析 Reveal mac
网络分析 Charles mac

其它博客资源推荐

Blog Link
蒸米的文章 https://github.com/zhengmin1989/MyArticles
念茜(极客学院 Wiki ) http://wiki.jikexueyuan.com/project/ios-security-defense/
杨君的小黑屋 http://blog.imjun.net/
Alone_Monkey http://www.blogfshare.com/
iPhoneDevWiki http://iphonedevwiki.net/index.php/Main_Page

参考资料:

iOS 逆向工程资料整理

iOS逆向开发学习资料整理

iOS逆向之旅 — 总纲 - 掘金里的总结,不错的

iOS安全些许经验和学习笔记 - AloneMonkey 的总结

iOS逆向工程简介 - 系统介绍了越狱的相关技术栈,但部分技术不够详细,知识点较旧

ios 逆向工程-浅析 - 整个链路的介绍,还可以的

移动App入侵与逆向破解技术-iOS篇 - CSDN上的大作,还可以的

iOS逆向工程优秀博客汇集(持续更新…) - 其实已经没有更新了,不过内容值得参考

Hello World

Posted on 2019-01-01

Welcome to Hexo! This is your very first post. Check documentation for more info. If you get any problems when using Hexo, you can find the answer in troubleshooting or you can ask me on GitHub.

Quick Start

Create a new post

1
$ hexo new "My New Post"

More info: Writing

Run server

1
$ hexo server

More info: Server

Generate static files

1
$ hexo generate

More info: Generating

Deploy to remote sites

1
$ hexo deploy

More info: Deployment

Hello World

Posted on 2018-05-01

Welcome to Hexo! This is your very first post. Check documentation for more info. If you get any problems when using Hexo, you can find the answer in troubleshooting or you can ask me on GitHub.

Quick Start

Create a new post

1
$ hexo new "My New Post"

More info: Writing

Run server

1
$ hexo server

More info: Server

Generate static files

1
$ hexo generate

More info: Generating

Deploy to remote sites

1
$ hexo deploy

More info: Deployment

Hello World

Posted on 2017-05-01

Welcome to Hexo! This is your very first post. Check documentation for more info. If you get any problems when using Hexo, you can find the answer in troubleshooting or you can ask me on GitHub.

Quick Start

Create a new post

1
$ hexo new "My New Post"

More info: Writing

Run server

1
$ hexo server

More info: Server

Generate static files

1
$ hexo generate

More info: Generating

Deploy to remote sites

1
$ hexo deploy

More info: Deployment

CoreSportlight内容索引的使用

Posted on 2016-02-12

###【iOS9系列】- CoreSportlight内容索引的使用

前言

在iOS9中新增加了的CoreSportlight内容索引,这个还是比较实用的,当我们的App比较多的时候,我们会实用iOS系统的自带的搜索栏的“搜索”功能(iOS很方便的下拉即可呼出这个选项),去查找APP应用,短信,或者其他内容,这是很方便的,那么我们能不能直接在“搜索”应用内部的东西呢,这样也方便用户查找,同时也有提提高我们APP的出镜率,特别是笔记类的应用,这个很方便用户不进入APP就可以直接进行查找的操作的。

注:本文Demo代码 , 完整的Demo代码下载,欢迎Star。

iOS系统中使用“搜索功能”的截图

1.1集成CoreSportlight

集成CoreSportlight需要导入头文件#import <CoreSpotlight/CoreSpotlight.h>,然后创建一个数组,里面元素的类型是CSSearchableItem *,把我们希望被系统索引到的东西,添加到数组中。

同时要能满足数组的的要求,我们需要通过CSSearchableItemAttributeSet来分别设置title:标题,contentDescription:描述信息,thumbnailData:图片,类型是NSData。

然后利用[[CSSearchableItem alloc]initWithUniqueIdentifier:model.sId domainIdentifier:@"coreSportlightDemo" attributeSet:csSet];来把CSSearchableItemAttributeSet封装成CSSearchableItem,同时UniqueIdentifier字段,是我们的信息被搜索到后,拿到被点击条目唯一值

最后
[[CSSearchableIndex defaultSearchableIndex]indexSearchableItems:(NSArray<CSSearchableItem *> *)items completionHandler:(void (^ __nullable)(NSError * __nullable error))completionHandler,来把需要索引的信息注入到系统中,这样系统就会“搜索”到我们APP中的内容了。

NSMutableArray<CSSearchableItem *> *items = [NSMutableArray array];

for (NewsModel *model in self.dataArray) {
    CSSearchableItemAttributeSet *csSet = [[CSSearchableItemAttributeSet alloc]initWithItemContentType:@"test"];
    csSet.title = model.title;
    csSet.contentDescription = model.webUrl;
    csSet.thumbnailData = UIImagePNGRepresentation([UIImage imageNamed:model.imgUrl]);

    CSSearchableItem *csItem = [[CSSearchableItem alloc]initWithUniqueIdentifier:model.sId domainIdentifier:@"coreSportlightDemo" attributeSet:csSet];
    [items addObject:csItem];
}

//将值注入到系统中
[[CSSearchableIndex defaultSearchableIndex]indexSearchableItems:items completionHandler:^(NSError * _Nullable error) {
    if (error) {
        NSLog(@"had error:%@",error);
    }
}];

完成好以上的操作后,我们运行APP,然后把APP进入到后台,在“搜索”界面中输入title字段的内容,比如“osc”,系统就会匹配到我们APP的内容,点击后,就可以进入到我们的APP了。

1.2使用系统回调

我们点击了被系统搜索出的条目后,想知道具体信息,怎么办呢?

在AppDelegate中添加方法- (BOOL)application:(UIApplication *)application continueUserActivity:(NSUserActivity *)userActivity restorationHandler:(void(^)(NSArray * __nullable restorableObjects))restorationHandler,我们打印引字典信息,发现只有唯一的Key值kCSSearchableItemActivityIdentifier,打印信息,就会发现这就是我们前面所设置的UniqueIdentifier字段了,当然,什么都不设置,默认是会进入APP的。

-(BOOL)application:(UIApplication *)application continueUserActivity:(NSUserActivity *)userActivity restorationHandler:(void (^)(NSArray * _Nullable))restorationHandler{
    NSString *sId = userActivity.userInfo[@"kCSSearchableItemActivityIdentifier"];
    NSLog(@"%@--:%@",userActivity.userInfo,sId);

    return YES;
}

注:本文Demo代码 , 完整的Demo代码下载,欢迎Star。


欢迎您的访问…

作者:Darren

微博:@IT_攻城师

github:@Darren90

博客:http://www.cnblogs.com/fengtengfei/


iOS开发中正则式的使用

Posted on 2015-10-31

iOS开发中正则式的使用

第一:常规的使用方式

    NSString *str = @"abcded111093212qweqw";

    //找到内部一个即可
    NSString *pattern = @"\\d{5,11}";//判断是不是QQ
    // | 匹配多个条件,相当于or\或

    NSRegularExpression *regex = [[NSRegularExpression alloc] initWithPattern:pattern options:0 error:nil];
    // 2.测试字符串
    NSArray *results = [regex matchesInString:str options:0 range:NSMakeRange(0, str.length)];

    // 3.遍历结果
    for (NSTextCheckingResult *result in results) {
        NSLog(@"%@ %@", NSStringFromRange(result.range), [str substringWithRange:result.range]);
    }

第二:使用第三方库RegexKitLite:

RegexKitLite是MRC的

需 在Compile Sources中添加 -fno-objc-arc编译参数,以便在ARC项目下使用
需在Link Binary With Libraries中添加依赖库:libicucore.dylib

使用

2.1:简单使用

NSString str = @”abcded111093212qweqw”;
NSString pattern = @”\d{5,11}”;//判断是不是QQ
// 数组中装的就是匹配的结果
NSArray *cmps = [str componentsMatchedByRegex:pattern];

2.2:高级使用

NSString str = @”abcded111093212qweqw”;
NSString pattern = @”\d{5,11}”;//判断是不是QQ
[str enumerateStringsMatchedByRegex:pattern usingBlock:^(NSInteger captureCount, NSString const __unsafe_unretained capturedStrings, const NSRange capturedRanges, volatile BOOL const stop) {

    NSLog(@"%@ %@", *capturedStrings, NSStringFromRange(*capturedRanges));
}];
// 以正则表达式为分隔符,遍历除规则以外的东西
   [str enumerateStringsSeparatedByRegex:pattern usingBlock:^(NSInteger captureCount, NSString *const __unsafe_unretained *capturedStrings, const NSRange *capturedRanges, volatile BOOL *const stop) {
       NSLog(@"%@ %@", *capturedStrings, NSStringFromRange(*capturedRanges));
   }];

iOS archives 出现的是other items而不是iOS Apps的解决方案

Posted on 2015-09-23

项目打包时出现的是不是出现在iOS Apps栏目下面,而是Other Items而且右边对应的Upload toApp Store和Validate均是不可点击的状态,由于是刚刚升级的Xcode7的问题,所以解决问题时走了不少弯路,在新建项目Archive后是正常的,才觉得问题应该和Xcode没有关系,所以就把问题归结到了项目的配置上,各种google后,使用别人给出的解决方案依然不能用,才把问题放在了cocoapods上,因为能正常打包的的项目是没有用pod管理的,所以借鉴了

http://qiita.com/shoya/items/74b0e57b841271400288

给出的解决方案后,发现问题就是用的pod的beta版本上。

解决方案如下:

$ pod --version

0.39.0.beta.4

//一下指令需要翻墙后才能正常执行。。。
$ sudo gem uninstall cocoapods --version '=0.39.0.beta.4'

$ sudo gem install -v 0.38.2 cocoapods 

有用的参考

http://stackoverflow.com/questions/10715211/cannot-generate-ios-app-archive-in-xcode/31645306#31645306

http://billwangxw.blogspot.jp/2015/05/generice-xcode-archive-vs-ios-app.html

Google的关键字:iOS archives other items

//http://qiita.com/shoya/items/74b0e57b841271400288里面的解决方案如下,为防止不可访问,把关键内容贴出来

$ pod --version
0.38.1

$ gem uninstall cocoapods --version '=0.38.1'
Successfully uninstalled cocoapods-0.38.1

$ gem install -v 0.38.2 cocoapods
Successfully installed cocoapods-0.38.2

$ pod --version
0.38.2

其实就是不要使用beta版本的cocoapods,使用正式版

UIWebview加载搜狐视频,自动跳到搜狐APP客户端问题解决

Posted on 2015-09-05

UIWebview加载搜狐视频,自动跳回搜狐客户端 问题解决

当我们用UIWebview(iOS端)加载网页视频的时候,会发现,当真机上有搜狐客户端的时候,会自动跳转到搜狐客户端进行播放,这样的体验对我们的体验并不好,所以应该禁掉。

问题分析:
首先想到的是这种情况肯定是网页的上的js引发的,于是就查看到网页源码中有这样的js

function() {
    try {
        var u = navigator.userAgent;
        var m = u.match(/iPhone|iPad|iPod/i);
        if ((location.href.indexOf('#pc') === -1) && (m || u.indexOf('Android') > -1)) {
            if (m && m[0] === 'iPad') {
                location.href = location.href.replace('http://tv', 'http://pad.tv');
            } else {
                location.href = location.href.replace('http://tv', 'http://m.tv');
            }
        }
    } catch(e) {}
})

这个js函数作用时当检测到播放的客户端是手机或者pad时进行url的替换,(电脑端和手机,pad上呈现的效果不一样)。那么问题到这里就很明晰了,后面的肯定就是检测设备上有没有客户端,有的话,就启动客户端。OC中是调用Url Schema,但是在源码中没有找到。

但是如果我们在加载页面的代理中拦截这个js进行替换,应该也能解决问题,但问题这个js是匿名的,OC中怎样进行调用,好像挺困难的。那么路肯定不只有一条。

问题解决:
了解了一下uiwebview的代理方法中

-(BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType{}

文档中的解释是:YES if the web view should begin loading content; otherwise, NO .

所以也就是只要页面有跳转,就会调用这个方法,其返回YES的时候能进行调转,返回NO的时候不能进行调转,

拦截其加载过程的URL发现:

先是: http://tv.sohu.com/
后是: http://m.tv.sohu.com/
最后是:sohuvideo://action.cmd

那么最后一个肯定就是调转回客户端的url了,所以拦截这个

-(BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType
{
     NSString *urlStr = request.URL.absoluteString;
     NSString *urlStr = request.URL.absoluteString;
    if ([urlStr rangeOfString:@"sohuvideo:"].location != NSNotFound || [urlStr rangeOfString:@"action.cmd"].location != NSNotFound ) {
        return NO;
    }else{
        return YES;
    }
}

这样问题得到完美解决,

Demo工程:https://github.com/darren90/iOS_Demo/tree/master/02-UIWebview

后来发现乐视也存在同样的问题,所以同样的思路也可以进行解决。


欢迎您的访问…

作者:Darren

微博:@IT_攻城师

github:@Darren90

博客:http://www.cnblogs.com/fengtengfei/


Hexo引入图片的正确姿势

Posted on 2015-06-01

Hexo资源文件夹中有介绍,Hexo引入图片的有三种方式

1:全部放到source/images文件夹下,但是这种全部图片都在一起,管理起来麻烦,所以我没有用

2:config.yml 文件中的 post_asset_folder 选项设为 true 来打开。

传统方式

使用网络的方式

二:Hexo方式post_asset_folder”#”

根目录下的配置文件_config.yml里的post_asset_folder选项设置为true。新建文章的时候会同时创建一个同名文件夹用于放图片。

执行命令npm install hexo-asset-image --save ,下载安装一个可以上传本地图片的插件:

使用的时候,只需要图片名就可以 ![](test.jpg)

也可以使用Hexo推荐的标签方式

参考:

Hexo 图片插入

Hexo备份之提交themes文件夹

Posted on 2015-05-01

很多人用了Hexo+GitHub搭建了自己的博客,

但是Hexo不会同步themes文件夹下

将themes/next/(我用的是next主题)中的.git/和.gitignore删除,否则无法将主题文件夹push ,注意要把next下面的.gitignore文件一起删除,否则不能成功。

删除后需要remove git cache否则也不会成功,删除.git/和.gitignore后执行

git rm -r --cached .

更改gitignore无效的解决方法

参考:

怎么把Hexo网站备份到GitHub上

123

Tonny

小镇青年不年轻

21 posts
21 tags
GitHub
© 2019 Tonny
Powered by Hexo
|
Theme — NexT.Pisces v5.1.4