-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
1166 lines (500 loc) · 47.4 KB
/
index.html
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<!doctype html>
<html class="theme-next pisces use-motion" lang="zh-Hans">
<head>
<meta charset="UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"/>
<meta http-equiv="Cache-Control" content="no-transform" />
<meta http-equiv="Cache-Control" content="no-siteapp" />
<link href="/lib/fancybox/source/jquery.fancybox.css?v=2.1.5" rel="stylesheet" type="text/css" />
<link href="//fonts.googleapis.com/css?family=Lato:300,300italic,400,400italic,700,700italic&subset=latin,latin-ext" rel="stylesheet" type="text/css">
<link href="/lib/font-awesome/css/font-awesome.min.css?v=4.6.2" rel="stylesheet" type="text/css" />
<link href="/css/main.css?v=5.1.0" rel="stylesheet" type="text/css" />
<meta name="keywords" content="Hexo, NexT" />
<link rel="shortcut icon" type="image/x-icon" href="/favicon.ico?v=5.1.0" />
<meta property="og:type" content="website">
<meta property="og:title" content="三味猪屋">
<meta property="og:url" content="http://yoursite.com/index.html">
<meta property="og:site_name" content="三味猪屋">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="三味猪屋">
<script type="text/javascript" id="hexo.configurations">
var NexT = window.NexT || {};
var CONFIG = {
root: '/',
scheme: 'Pisces',
sidebar: {"position":"left","display":"post"},
fancybox: true,
motion: true,
duoshuo: {
userId: '0',
author: '博主'
},
algolia: {
applicationID: '',
apiKey: '',
indexName: '',
hits: {"per_page":10},
labels: {"input_placeholder":"Search for Posts","hits_empty":"We didn't find any results for the search: ${query}","hits_stats":"${hits} results found in ${time} ms"}
}
};
</script>
<link rel="canonical" href="http://yoursite.com/"/>
<title> 三味猪屋 </title>
</head>
<body itemscope itemtype="http://schema.org/WebPage" lang="zh-Hans">
<div class="container one-collumn sidebar-position-left
page-home
">
<div class="headband"></div>
<header id="header" class="header" itemscope itemtype="http://schema.org/WPHeader">
<div class="header-inner"><div class="site-meta ">
<div class="custom-logo-site-title">
<a href="/" class="brand" rel="start">
<span class="logo-line-before"><i></i></span>
<span class="site-title">三味猪屋</span>
<span class="logo-line-after"><i></i></span>
</a>
</div>
<p class="site-subtitle"></p>
</div>
<div class="site-nav-toggle">
<button>
<span class="btn-bar"></span>
<span class="btn-bar"></span>
<span class="btn-bar"></span>
</button>
</div>
<nav class="site-nav">
<ul id="menu" class="menu">
<li class="menu-item menu-item-categories">
<a href="/categories" rel="section">
<i class="menu-item-icon fa fa-fw fa-th"></i> <br />
分类
</a>
</li>
<li class="menu-item menu-item-archives">
<a href="/archives" rel="section">
<i class="menu-item-icon fa fa-fw fa-archive"></i> <br />
归档
</a>
</li>
<li class="menu-item menu-item-tags">
<a href="/tags" rel="section">
<i class="menu-item-icon fa fa-fw fa-tags"></i> <br />
标签
</a>
</li>
</ul>
</nav>
</div>
</header>
<main id="main" class="main">
<div class="main-inner">
<div class="content-wrap">
<div id="content" class="content">
<section id="posts" class="posts-expand">
<article class="post post-type-normal " itemscope itemtype="http://schema.org/Article">
<link itemprop="mainEntityOfPage" href="http://yoursite.com/2017/03/31/iOS逆向实践/">
<span style="display:none" itemprop="author" itemscope itemtype="http://schema.org/Person">
<meta itemprop="name" content="luohs">
<meta itemprop="description" content="">
<meta itemprop="image" content="/images/avatar.jpg">
</span>
<span style="display:none" itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
<meta itemprop="name" content="三味猪屋">
<span style="display:none" itemprop="logo" itemscope itemtype="http://schema.org/ImageObject">
<img style="display:none;" itemprop="url image" alt="三味猪屋" src="">
</span>
</span>
<header class="post-header">
<h1 class="post-title" itemprop="name headline">
<a class="post-title-link" href="/2017/03/31/iOS逆向实践/" itemprop="url">
iOS逆向实践
</a>
</h1>
<div class="post-meta">
<span class="post-time">
<span class="post-meta-item-icon">
<i class="fa fa-calendar-o"></i>
</span>
<span class="post-meta-item-text">发表于</span>
<time title="Post created" itemprop="dateCreated datePublished" datetime="2017-03-31T09:47:27+08:00">
2017-03-31
</time>
</span>
<span class="post-category" >
<span class="post-meta-divider">|</span>
<span class="post-meta-item-icon">
<i class="fa fa-folder-o"></i>
</span>
<span class="post-meta-item-text">分类于</span>
<span itemprop="about" itemscope itemtype="http://schema.org/Thing">
<a href="/categories/iOS/" itemprop="url" rel="index">
<span itemprop="name">iOS</span>
</a>
</span>
</span>
</div>
</header>
<div class="post-body" itemprop="articleBody">
<script src="/assets/js/DPlayer.min.js"> </script><script src="/assets/js/APlayer.min.js"> </script><h2 id="iOS设备越狱"><a href="#iOS设备越狱" class="headerlink" title="iOS设备越狱"></a>iOS设备越狱</h2><p>工具:PP助手、TaiG、evasi0n (<a href="http://evasi0n.com" target="_blank" rel="external">http://evasi0n.com</a>)<br>设备:iPhone6,iOS8.3<br>由于我使用了PP助手对手机设备进行越狱操作的,没有什么技术性,这里就暂时略过,以后再研究下使用TaiG、evasi0n等工具进行越狱再补上。</p>
<h2 id="查看越狱iOS设备APP文件夹"><a href="#查看越狱iOS设备APP文件夹" class="headerlink" title="查看越狱iOS设备APP文件夹"></a>查看越狱iOS设备APP文件夹</h2><p>工具:PP助手、iTools、iFunBox<br>iOS8.3之后由于苹果加强了沙盒的安全性,导致工具无法直接查看到APP的沙盒文件夹结构,所以要查看iOS设备沙盒文件就需要进行越狱之后使用文件管理工具查看。<br>文件查看工具查看越狱后的iOS设备文件夹结构如下:<br><img src="/images/iOS逆向实践/iOS_reverse_watch_divice_dir.png" alt=""><br>如果想要查看APP沙盒文件夹结构,需要将iPhone越狱后再安装AFC2。<br>步骤如下:<br>1、打开Cydia<br>2、打开“搜索”Tab项<br>3、输入“Apple File Conduit ‘2’”<br>4、安装“Apple File Conduit ‘2’”<br>此时可通过文件查看工具查看APP沙盒文件夹结构如下:<br><img src="/images/iOS逆向实践/iOS_reverse_watch_app_dir.png" alt=""></p>
<h2 id="远程连接iOS设备"><a href="#远程连接iOS设备" class="headerlink" title="远程连接iOS设备"></a>远程连接iOS设备</h2><p>工具:Terminal.app<br>1、手机中打开Cydia,打开“搜索”Tab项,输入“OpenSSH’”,安装“OpenSSH”<br>2、确保手机已经连接了WIFI并且你的手机的WIFI<br>和你的电脑要在同一个局域网内,打开终端输入:<br>ssh root@xx.xx.xx.xx,(xx.xx.xx.xx)为你的手机的IP地址—>Enter<br>3、接着会提示你输入password:<br>这里的密码一般情况下是alpine,但是如果你更改过的话就用你更改的[这里的密码是手机openssh的密码,不是电脑密码也不是手机解锁密码]<br>4、然后来输入吧,通过cd可以进入到制定的文件夹目录<br>iPhone6:~ root# cd /usr/bin<br><img src="/images/iOS逆向实践/iOS_reverse_connect_remote.png" alt=""></p>
<h2 id="APP砸壳"><a href="#APP砸壳" class="headerlink" title="APP砸壳"></a>APP砸壳</h2><p>工具:Clutch、Terminal.app、iFunBox<br>Clutch源码:(<a href="https://github.com/KJCracks/Clutch/releases" target="_blank" rel="external">https://github.com/KJCracks/Clutch/releases</a>)</p>
<p>1、将Clutch拷贝到手机设备中:/usr/bin/<br>方式1:iFunBox直接拷贝<br><img src="/images/iOS逆向实践/iOS_reverse_clutch_method_1.png" alt=""><br>方式2:scp /path/to/Clutch root@<your.device.ip>:/usr/bin/<br><img src="/images/iOS逆向实践/iOS_reverse_clutch_method_2.png" alt=""></your.device.ip></p>
<p>2、解决运行Clutch时报Permission denied的错误<br>运行Clutch时报错如下:<br><img src="/images/iOS逆向实践/iOS_reverse_clutch_install_1.png" alt=""><br>解决方法如下:<br>从上图可以看出错误的类型,Permission denied就指权限受限,只要赋予其权限即可。<br>1、打开Terminal.app<br>2、终端里输入chmod a+x Clutch,如下图所示:<br><img src="/images/iOS逆向实践/iOS_reverse_clutch_install_2.png" alt=""></p>
<p>3、Clutch使用方法<br><img src="/images/iOS逆向实践/iOS_reverse_clutch_opration.png" alt=""></p>
<p>4、查看iOS设备中所有所安装的APP<br><img src="/images/iOS逆向实践/iOS_reverse_clutch_watch_app.png" alt=""></p>
<p>5、通过Clutch命令砸壳,如图所示:<br><img src="/images/iOS逆向实践/iOS_reverse_clutch_app.png" alt=""><br><img src="/images/iOS逆向实践/iOS_reverse_clutch_app_2.png" alt=""></p>
<p>参考:<br><a href="http://iphonedevwiki.net/index.php/Reverse_Engineering_Tools" target="_blank" rel="external">http://iphonedevwiki.net/index.php/Reverse_Engineering_Tools</a></p>
</div>
<div>
</div>
<div>
</div>
<footer class="post-footer">
<div class="post-eof"></div>
</footer>
</article>
<article class="post post-type-normal " itemscope itemtype="http://schema.org/Article">
<link itemprop="mainEntityOfPage" href="http://yoursite.com/2017/03/29/Android反编译初探/">
<span style="display:none" itemprop="author" itemscope itemtype="http://schema.org/Person">
<meta itemprop="name" content="luohs">
<meta itemprop="description" content="">
<meta itemprop="image" content="/images/avatar.jpg">
</span>
<span style="display:none" itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
<meta itemprop="name" content="三味猪屋">
<span style="display:none" itemprop="logo" itemscope itemtype="http://schema.org/ImageObject">
<img style="display:none;" itemprop="url image" alt="三味猪屋" src="">
</span>
</span>
<header class="post-header">
<h1 class="post-title" itemprop="name headline">
<a class="post-title-link" href="/2017/03/29/Android反编译初探/" itemprop="url">
Android反编译总结
</a>
</h1>
<div class="post-meta">
<span class="post-time">
<span class="post-meta-item-icon">
<i class="fa fa-calendar-o"></i>
</span>
<span class="post-meta-item-text">发表于</span>
<time title="Post created" itemprop="dateCreated datePublished" datetime="2017-03-29T18:24:51+08:00">
2017-03-29
</time>
</span>
<span class="post-category" >
<span class="post-meta-divider">|</span>
<span class="post-meta-item-icon">
<i class="fa fa-folder-o"></i>
</span>
<span class="post-meta-item-text">分类于</span>
<span itemprop="about" itemscope itemtype="http://schema.org/Thing">
<a href="/categories/Android/" itemprop="url" rel="index">
<span itemprop="name">Android</span>
</a>
</span>
</span>
</div>
</header>
<div class="post-body" itemprop="articleBody">
<script src="/assets/js/DPlayer.min.js"> </script><script src="/assets/js/APlayer.min.js"> </script><h1 id="Apk反编译"><a href="#Apk反编译" class="headerlink" title="Apk反编译"></a>Apk反编译</h1><p>Apk反编译使用到的工具:<br>1、apktool (<a href="https://bitbucket.org/iBotPeaches/apktool/downloads/" target="_blank" rel="external">https://bitbucket.org/iBotPeaches/apktool/downloads/</a>)<br>2、enjarify (<a href="https://github.com/google/enjarify" target="_blank" rel="external">https://github.com/google/enjarify</a>)<br>3、Java Decompiler (<a href="http://jd.benow.ca" target="_blank" rel="external">http://jd.benow.ca</a>)</p>
<h2 id="1、apktool"><a href="#1、apktool" class="headerlink" title="1、apktool"></a>1、apktool</h2><p>功能:用于拆解安装包、重新打包。<br>下载地址: (<a href="https://bitbucket.org/iBotPeaches/apktool/downloads/" target="_blank" rel="external">https://bitbucket.org/iBotPeaches/apktool/downloads/</a>)<br>安装方法: (<a href="https://ibotpeaches.github.io/Apktool/install/" target="_blank" rel="external">https://ibotpeaches.github.io/Apktool/install/</a>)<br>使用方法: (<a href="https://ibotpeaches.github.io/Apktool/documentation/" target="_blank" rel="external">https://ibotpeaches.github.io/Apktool/documentation/</a>)<br>apktool安装时注意几点:<br>1、检查是否安装java环境,如果没有,请先安装java环境<br><img src="/images/Android反编译初探/apktool_java_install.png" alt=""><br>2、将apktool脚本变成可执行文件<br>图1:<br><img src="/images/Android反编译初探/apktool_install.png" alt=""><br>图2:<br><img src="/images/Android反编译初探/apktool_shell.png" alt=""><br>图1红框内的脚本当右键保存的如果是apktool.txt格式的文件,本人保存的时候就是txt格式,见图2。当我使用Sublime Text编辑器将其保存为apktool.sh时,无法通过’chmod +x’将其变为可执行文件。最终使用Atom编辑器将其保存为apktool,此时这可使用’chmod +x’将其变为可执行文件。<br>Sublime Text2编辑器<br><img src="/images/Android反编译初探/apktool_shell_sublime_1.png" alt=""><br><img src="/images/Android反编译初探/apktool_shell_sublime_2.png" alt=""><br>Atom编辑器<br><img src="/images/Android反编译初探/apktool_shell_atom_1.png" alt=""><br><img src="/images/Android反编译初探/apktool_shell_atom_2.png" alt=""><br>最终得到如下结果<br><img src="/images/Android反编译初探/apktool_chmod.png" alt=""><br>其实apktool脚本并不是必须的,作用就是在执行apktool.jar时,不必每次都要不厌其烦的输入:java -jar apktool.jar<br>关于这一点网站上也Note出来了:<br><em>Note - Wrapper scripts are not needed, but helpful so you don’t have to type java -jar apktool.jar over and over.</em><br>未使用apktool.sh wrapper shell script时的格式<br><code>java -jar apktool.jar yourapp.apk -o yourapp</code><br>使用enjarify.sh wrapper shell script时的格式<br><code>apktool yourapp.apk -o yourapp</code></p>
<h2 id="2、enjarify"><a href="#2、enjarify" class="headerlink" title="2、enjarify"></a>2、enjarify</h2><p>功能:用于反编译dex文件,得到java源代码,与<a href="https://sourceforge.net/projects/dex2jar/" target="_blank" rel="external">dex2jar</a>类似。<br>下载地址:(<a href="https://github.com/google/enjarify" target="_blank" rel="external">https://github.com/google/enjarify</a>)<br>这个工具是谷歌官方开源的用于反编译dex文件的。<br>enjarify安装注意几点:<br>1、检查是否安装python3<br>因为enjarify是一个纯的python3应用,所以必须确保已经安装了python3,如果没有,则需要安装。<br>此时又要祭出大杀器 <em>Homebrew</em><br>安装Python 2.7的话,请输入:<br><code>$ brew install python</code><br>如果你选择使用Python3,只需要将python替换成python3即可。<br><code>$ brew install python3</code><br>想查看可以安装哪些Python版本的话,可以通过下面的命令在Homebrew上搜索。<br><code>$ brew search python</code><br>这个命令会列出可以安装的全部Python版本。<br><img src="/images/Android反编译初探/enjarify_python_install_versions.png" alt=""><br>2、为了方便原则,方便使用enjarify.sh脚本窍门<br>在终端里执行以下语句<br><code>ln -s "$PWD/enjarify.sh" usr/local/bin/enjarify</code><br>$PWD指enjarify所在的物理位置,我的电脑位置如下:<br><code>/Users/yuntai01/Desktop/下载/enjarify-1.0.3</code><br>执行完,则可在对应的文件夹中找到:<br><img src="/images/Android反编译初探/enjarify_shell_install.png" alt=""><br>未使用enjarify.sh wrapper shell script时的格式<br><code>python3 -O -m enjarify.main yourapp.apk -o yourapp.jar</code><br>使用enjarify.sh wrapper shell script时的格式<br><code>enjarify yourapp.apk -o yourapp.jar</code></p>
<h2 id="3、Java-Decompiler"><a href="#3、Java-Decompiler" class="headerlink" title="3、Java Decompiler"></a>3、Java Decompiler</h2><p>功能:查看java源代码<br>下载地址:(<a href="http://jd.benow.ca)选择jd-gui即可。" target="_blank" rel="external">http://jd.benow.ca)选择jd-gui即可。</a><br>用法:启动jd-gui,直接将enjarify反编译出来得到jar包拖进jd-gui中即可。<br><img src="/images/Android反编译初探/jd_gui_pkg.png" alt=""><br><img src="/images/Android反编译初探/jd_gui_show.png" alt=""></p>
<h1 id="Apk重新打包"><a href="#Apk重新打包" class="headerlink" title="Apk重新打包"></a>Apk重新打包</h1><p>1、使用前文提到的apktool工具解开test.apk<br><code>$ apktool d testapp.apk -o testapp</code><br><img src="/images/Android反编译初探/apktool_decode.png" alt=""><br>2、查看解开的目录下的 META-INF/CERT.RSA,该文件存储有原应用的签名<br><code>$ keytool -printcert -file test/original/META-INF/CERT.RSA</code><br><img src="/images/Android反编译初探/apktool_decode_printcert.png" alt=""><br>3、重新打包应用为 new_testapp.apk<br><code>$ apktool b test -o new_testapp.apk</code><br><img src="/images/Android反编译初探/apktool_build.png" alt=""><br>4、生成一个新的 keystore<br><code>$ keytool -genkey -v -keystore androidse.keystore -alias androidsekey -keyalg RSA -keysize 2048 -validity 365</code><br><img src="/images/Android反编译初探/keytool_keystore.png" alt=""><br>5、用刚刚生成的 keystore 对重新打包生成的 new_testapp.apk 进行重新签名<br><code>$ jarsigner -verbose -sigalg MD5withRSA -digestalg SHA1 -keystore androidse.keystore new_testapp.apk androidsekey</code><br><img src="/images/Android反编译初探/jarsigner_sign_1.png" alt=""><br><img src="/images/Android反编译初探/jarsigner_sign_2.png" alt=""><br>6、验证签名是否正确打到应用上<br><code>$ jarsigner -verify -verbose -certs new_testapp.apk</code><br><img src="/images/Android反编译初探/jarsigner_verify_1.png" alt=""><br><img src="/images/Android反编译初探/jarsigner_verify_2.png" alt=""><br>7、对齐 apk,应用要想上 Google Play 必须进行对齐操作,对齐后生成新的应用 new_testapp_align.apk<br><code>$ ANDROID_HOME/build-tools/23.0.2/zipalign -v 4 new_testapp.apk new_testapp_align.apk</code><br>以上就完成了最简单的重新打包操作。</p>
<h1 id="Mac上安装apk到Android设备"><a href="#Mac上安装apk到Android设备" class="headerlink" title="Mac上安装apk到Android设备"></a>Mac上安装apk到Android设备</h1><p>使用Google官方推荐的工具 Android File Transfer:<br>Android File Transfer:(<a href="https://www.android.com/filetransfer/" target="_blank" rel="external">https://www.android.com/filetransfer/</a>)<br><img src="/images/Android反编译初探/Android_transfer_2.png" alt=""><br><img src="/images/Android反编译初探/Android_transfer_1.png" alt=""></p>
</div>
<div>
</div>
<div>
</div>
<footer class="post-footer">
<div class="post-eof"></div>
</footer>
</article>
<article class="post post-type-normal " itemscope itemtype="http://schema.org/Article">
<link itemprop="mainEntityOfPage" href="http://yoursite.com/2016/11/30/objc_msgSend 的正确使用姿势/">
<span style="display:none" itemprop="author" itemscope itemtype="http://schema.org/Person">
<meta itemprop="name" content="luohs">
<meta itemprop="description" content="">
<meta itemprop="image" content="/images/avatar.jpg">
</span>
<span style="display:none" itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
<meta itemprop="name" content="三味猪屋">
<span style="display:none" itemprop="logo" itemscope itemtype="http://schema.org/ImageObject">
<img style="display:none;" itemprop="url image" alt="三味猪屋" src="">
</span>
</span>
<header class="post-header">
<h1 class="post-title" itemprop="name headline">
<a class="post-title-link" href="/2016/11/30/objc_msgSend 的正确使用姿势/" itemprop="url">
objc_msgSend 的正确使用姿势
</a>
</h1>
<div class="post-meta">
<span class="post-time">
<span class="post-meta-item-icon">
<i class="fa fa-calendar-o"></i>
</span>
<span class="post-meta-item-text">发表于</span>
<time title="Post created" itemprop="dateCreated datePublished" datetime="2016-11-30T10:30:50+08:00">
2016-11-30
</time>
</span>
<span class="post-category" >
<span class="post-meta-divider">|</span>
<span class="post-meta-item-icon">
<i class="fa fa-folder-o"></i>
</span>
<span class="post-meta-item-text">分类于</span>
<span itemprop="about" itemscope itemtype="http://schema.org/Thing">
<a href="/categories/iOS/" itemprop="url" rel="index">
<span itemprop="name">iOS</span>
</a>
</span>
</span>
</div>
</header>
<div class="post-body" itemprop="articleBody">
<script src="/assets/js/DPlayer.min.js"> </script><script src="/assets/js/APlayer.min.js"> </script><p>首先需要import objc_msgSend 所在的头文件<br><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">#import <objc/message.h></div></pre></td></tr></table></figure></p>
<p>‘objc_msgSend’ 同时在 <objc message.h="">和<objc runtime.h="">都有定义,需要进一步了解其异同。</objc></objc></p>
<p>在64位机器上运行‘objc_msgSend’,如果姿势不对,编译器不会提示警告,而是直接crash。</p>
<p>解决办法:</p>
<p>需要将objc_msgSend重新声明成自己想要的参数,如下所示:<br><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div></pre></td><td class="code"><pre><div class="line">//objc_msgSend(self,selector,@"test");</div><div class="line">((void(*)(id, SEL, id))objc_msgSend)(self, selector, @"test");</div></pre></td></tr></table></figure></p>
<p><a href="https://developer.apple.com/library/ios/documentation/General/Conceptual/CocoaTouch64BitGuide/ConvertingYourAppto64-Bit/ConvertingYourAppto64-Bit.html" target="_blank" rel="external">详情请参照苹果官方文档</a><br><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div></pre></td><td class="code"><pre><div class="line">Listing 2-14 Using a cast to call the Objective-C message sending functions</div><div class="line">- (int) doSomething:(int) x { ... }</div><div class="line">- (void) doSomethingElse {</div><div class="line"> int (*action)(id, SEL, int) = (int (*)(id, SEL, int)) objc_msgSend;</div><div class="line"> action(self, @selector(doSomething:), 0);</div><div class="line">}</div></pre></td></tr></table></figure></p>
</div>
<div>
</div>
<div>
</div>
<footer class="post-footer">
<div class="post-eof"></div>
</footer>
</article>
<article class="post post-type-normal " itemscope itemtype="http://schema.org/Article">
<link itemprop="mainEntityOfPage" href="http://yoursite.com/2016/11/30/iOS7中UITextField切换中文时某些协议方法无响应/">
<span style="display:none" itemprop="author" itemscope itemtype="http://schema.org/Person">
<meta itemprop="name" content="luohs">
<meta itemprop="description" content="">
<meta itemprop="image" content="/images/avatar.jpg">
</span>
<span style="display:none" itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
<meta itemprop="name" content="三味猪屋">
<span style="display:none" itemprop="logo" itemscope itemtype="http://schema.org/ImageObject">
<img style="display:none;" itemprop="url image" alt="三味猪屋" src="">
</span>
</span>
<header class="post-header">
<h1 class="post-title" itemprop="name headline">
<a class="post-title-link" href="/2016/11/30/iOS7中UITextField切换中文时某些协议方法无响应/" itemprop="url">
iOS7中UITextField切换中文时某些协议方法无响应
</a>
</h1>
<div class="post-meta">
<span class="post-time">
<span class="post-meta-item-icon">
<i class="fa fa-calendar-o"></i>
</span>
<span class="post-meta-item-text">发表于</span>
<time title="Post created" itemprop="dateCreated datePublished" datetime="2016-11-30T10:13:52+08:00">
2016-11-30
</time>
</span>
<span class="post-category" >
<span class="post-meta-divider">|</span>
<span class="post-meta-item-icon">
<i class="fa fa-folder-o"></i>
</span>
<span class="post-meta-item-text">分类于</span>
<span itemprop="about" itemscope itemtype="http://schema.org/Thing">
<a href="/categories/iOS/" itemprop="url" rel="index">
<span itemprop="name">iOS</span>
</a>
</span>
</span>
</div>
</header>
<div class="post-body" itemprop="articleBody">
<script src="/assets/js/DPlayer.min.js"> </script><script src="/assets/js/APlayer.min.js"> </script><p>UITextField切换中文输入,选中键盘中被mark的中文字符时,iOS7中UITextField不会调用如下协议方法:</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">- (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string;</div></pre></td></tr></table></figure>
<p>解决方法:</p>
<p>1、利用通知中心监听UITextFieldTextDidChangeNotification。</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div><div class="line">11</div><div class="line">12</div><div class="line">13</div><div class="line">14</div><div class="line">15</div><div class="line">16</div><div class="line">17</div></pre></td><td class="code"><pre><div class="line">[[NSNotificationCenter defaultCenter]addObserver:self</div><div class="line"> selector:@selector(textFiledEditChanged:)</div><div class="line"> name:UITextFieldTextDidChangeNotification</div><div class="line"> object:self];</div><div class="line"></div><div class="line">- (void)textFiledEditChanged:(NSNotification *)notification</div><div class="line">{</div><div class="line"> if ([notification.object isKindOfClass:[EzvizTokenTextField class]]) {</div><div class="line"> EzvizTokenTextField *textField = notification.object;</div><div class="line"> UITextRange *selectedRange = [textField markedTextRange];</div><div class="line"> //获取高亮部分</div><div class="line"> UITextPosition *position = [textField positionFromPosition:selectedRange.start offset:0];</div><div class="line"> if (!position) {</div><div class="line"> self.ezvizTokenTextFieldTextLength = [textField.text length];</div><div class="line"> }</div><div class="line"> }</div><div class="line">}</div></pre></td></tr></table></figure>
<p>当键盘中有mark的中文字符时,则根据UITextField实例方法markedTextRange可以获取开始位置以及长度,此时,只要没有选中被mark的字符时,textFiled.text 的 length是不会改变的。只有当选中被mark的字符时,markedTextRange返回的开始位置以及长度为0,则UITextPosition则为nil,此时说明textField.text 的 length改变。</p>
<p>2、通过KVO监听textField.text 的length。<br><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div><div class="line">11</div><div class="line">12</div><div class="line">13</div><div class="line">14</div><div class="line">15</div><div class="line">16</div><div class="line">17</div><div class="line">18</div><div class="line">19</div></pre></td><td class="code"><pre><div class="line">[self addObserver:self</div><div class="line"> forKeyPath:@"ezvizTokenTextFieldTextLength"</div><div class="line"> options:NSKeyValueObservingOptionNew</div><div class="line"> context:NULL];</div><div class="line"></div><div class="line">- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context</div><div class="line">{</div><div class="line"> if (object == self && [keyPath isEqualToString:@"ezvizTokenTextFieldTextLength"]) {</div><div class="line"> //DDLogInfo(@"ezvizTokenTextFieldTextLength: %d", self.ezvizTokenTextFieldTextLength);</div><div class="line"> if (self.ezvizTokenTextFieldTextLength) {</div><div class="line"> if (delegate && [delegate respondsToSelector:@selector(textFieldDidEndChanged:)]) {</div><div class="line"> [delegate textFieldDidEndChanged:self];</div><div class="line"> }</div><div class="line"> }</div><div class="line"> }</div><div class="line"> else {</div><div class="line"> [super observeValueForKeyPath:keyPath ofObject:object change:change context:context];</div><div class="line"> }</div><div class="line">}</div></pre></td></tr></table></figure></p>
<p>从而可以达到在iOS7下监听UITextField输入框内字符变化。</p>
</div>
<div>
</div>
<div>
</div>
<footer class="post-footer">
<div class="post-eof"></div>
</footer>
</article>
<article class="post post-type-normal " itemscope itemtype="http://schema.org/Article">
<link itemprop="mainEntityOfPage" href="http://yoursite.com/2016/11/30/搭建GitHub个人博客/">
<span style="display:none" itemprop="author" itemscope itemtype="http://schema.org/Person">
<meta itemprop="name" content="luohs">
<meta itemprop="description" content="">
<meta itemprop="image" content="/images/avatar.jpg">
</span>
<span style="display:none" itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
<meta itemprop="name" content="三味猪屋">
<span style="display:none" itemprop="logo" itemscope itemtype="http://schema.org/ImageObject">
<img style="display:none;" itemprop="url image" alt="三味猪屋" src="">
</span>
</span>
<header class="post-header">
<h1 class="post-title" itemprop="name headline">
<a class="post-title-link" href="/2016/11/30/搭建GitHub个人博客/" itemprop="url">
GitHub博客搭建
</a>
</h1>
<div class="post-meta">
<span class="post-time">
<span class="post-meta-item-icon">
<i class="fa fa-calendar-o"></i>
</span>
<span class="post-meta-item-text">发表于</span>
<time title="Post created" itemprop="dateCreated datePublished" datetime="2016-11-30T09:24:11+08:00">
2016-11-30
</time>
</span>
</div>
</header>
<div class="post-body" itemprop="articleBody">
<script src="/assets/js/DPlayer.min.js"> </script><script src="/assets/js/APlayer.min.js"> </script><p>工具<br>markdown语法:(<a href="http://www.appinn.com/markdown/#header" target="_blank" rel="external">http://www.appinn.com/markdown/#header</a>)<br>Atom:(<a href="https://atom.io" target="_blank" rel="external">https://atom.io</a>)</p>
<h2 id="1-创建Github-域名和空间"><a href="#1-创建Github-域名和空间" class="headerlink" title="1. 创建Github 域名和空间"></a>1. 创建Github 域名和空间</h2><p>1.1注册</p>
<p>注册<a href="https://github.com/join?source=header-home" target="_blank" rel="external">Github</a>账号。</p>
<p>#注意:博客域名将会为username.github.io,所以username会影响到博客的域名。</p>
<p>1.2 创建仓库</p>
<p>创建一个仓库(repository) 来存储博客的网站,点击首页任意位置出现的 New repository按钮创建仓库。</p>
<p>#注意:Respository name 中的 username 一定与前面的 Owner 一致。</p>
<h2 id="2-环境搭建"><a href="#2-环境搭建" class="headerlink" title="2. 环境搭建"></a>2. 环境搭建</h2><p>这里介绍使用 <a href="https://hexo.io/" target="_blank" rel="external">Hexo</a> 搭建博客框架。下面需要安装的工具包括 <a href="http://brew.sh" target="_blank" rel="external">brew</a>,<a href="https://git-scm.com" target="_blank" rel="external">Git</a>,<a href="https://www.npmjs.com/package/nvm" target="_blank" rel="external">nvm</a>,<a href="https://nodejs.org/en/" target="_blank" rel="external">Nodejs</a>,<a href="https://hexo.io/" target="_blank" rel="external">Hexo</a>。</p>
<p>2.1 安装 brew<br><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">$/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"</div></pre></td></tr></table></figure></p>
<p>2.2 安装 Git<br><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">$ brew install git</div></pre></td></tr></table></figure></p>
<p>2.3 安装 nvm(nvm主要用于安装、管理node)<br><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div></pre></td><td class="code"><pre><div class="line">1. Homebrew 安装方式,此安装方式无需重启</div><div class="line">a、安装nvm</div><div class="line">$ brew install nvm</div><div class="line">$ mkdir ~/.nvm</div><div class="line">$ export NVM_DIR=~/.nvm</div><div class="line">b、启动nvm</div><div class="line">$ . $(brew --prefix nvm)/nvm.sh 或者 source $(brew --prefix nvm)/nvm.sh</div></pre></td></tr></table></figure></p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div></pre></td><td class="code"><pre><div class="line">2. curl安装方式</div><div class="line">$ curl https://raw.github.com/creationix/nvm/master/install.sh | sh</div></pre></td></tr></table></figure>
<p>2.4 安装 Nodejs<br><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div></pre></td><td class="code"><pre><div class="line">查看Nodejs版本</div><div class="line">$ nvm ls-remote</div><div class="line">安装指定版本</div><div class="line">$ nvm install 7.1.0</div><div class="line">安装最新版本</div><div class="line">$ nvm install stable</div></pre></td></tr></table></figure></p>
<p>2.5 安装 Hexo<br><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">$ sudo npm install hexo-cli -g</div></pre></td></tr></table></figure></p>
<h2 id="3-编写博客"><a href="#3-编写博客" class="headerlink" title="3. 编写博客"></a>3. 编写博客</h2><p>3.1 创建博客<br><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">$ hexo init username.github.io</div></pre></td></tr></table></figure></p>
<p>3.2 配置主题</p>
<p>3.2.1 安装主题<br><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div></pre></td><td class="code"><pre><div class="line">$ cd username.github.io</div><div class="line">$ git clone https://github.com/iissnan/hexo-theme-next themes/next</div></pre></td></tr></table></figure></p>
<p><a href="https://hexo.io/themes/" target="_blank" rel="external">更多主题</a></p>
<p>3.2.2 基础配置</p>
<p>打开文件位置username.github.io/_config.yml修改几个键值对,下面把几个必须设置的列出来按需求修改。</p>
<p>#注意配置的键值之间一定要有空格。<br><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div></pre></td><td class="code"><pre><div class="line">title: dimsky 的 9 维空间 //你博客的名字</div><div class="line">author: dimsky //你的名字</div><div class="line">language: zh-Hans //语言 中文</div><div class="line">theme: next //刚刚安装的主题名称</div><div class="line">deploy:</div><div class="line"> type: git //使用Git 发布</div><div class="line"> repo: https://github.com/username/username.github.io.git // 刚创建的Github仓库</div></pre></td></tr></table></figure></p>
<p><a href="https://hexo.io/zh-cn/docs/configuration.html" target="_blank" rel="external">更多设置</a></p>
<p>3.2.3 主题配置</p>
<p>主题配置文件在username.github.io/themes/next/_config.yml中修改。<br><a href="http://theme-next.iissnan.com/getting-started.html#theme-settings" target="_blank" rel="external">更多配置</a></p>
<p>3.3 写文章</p>
<p>在username.github.io/source/_posts下创建你的博客,命名“搭建GitHub个人博客.md”。既然是搭建GitHub个人博客,那么就用GitHub的编辑器 <a href="https://atom.io" target="_blank" rel="external">Atom</a>吧。<br>markdown语法:(<a href="http://www.appinn.com/markdown/#header" target="_blank" rel="external">http://www.appinn.com/markdown/#header</a>)</p>
<p>3.4 本地预览<br><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div></pre></td><td class="code"><pre><div class="line">$ cd username.github.io</div><div class="line">$ hexo s</div></pre></td></tr></table></figure></p>
<p>测试服务启动,浏览器中输入<a href="https://localhost:4000" target="_blank" rel="external">https://localhost:4000</a> 就可以预览了。</p>
<h2 id="4-发布博客"><a href="#4-发布博客" class="headerlink" title="4. 发布博客"></a>4. 发布博客</h2><p>4.1 安装发布工具<br><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">$ npm install hexo-deployer-git --save</div></pre></td></tr></table></figure></p>
<p>4.2 发布<br><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">$ hexo clean && hexo g && hexo d</div></pre></td></tr></table></figure></p>
<h2 id="5-更多有趣的插件"><a href="#5-更多有趣的插件" class="headerlink" title="5 更多有趣的插件"></a>5 更多有趣的插件</h2><p><a href="https://hexo.io/plugins/" target="_blank" rel="external">Hexo插件</a></p>
</div>
<div>
</div>
<div>
</div>
<footer class="post-footer">
<div class="post-eof"></div>
</footer>
</article>
</section>
</div>
</div>
<div class="sidebar-toggle">
<div class="sidebar-toggle-line-wrap">
<span class="sidebar-toggle-line sidebar-toggle-line-first"></span>
<span class="sidebar-toggle-line sidebar-toggle-line-middle"></span>
<span class="sidebar-toggle-line sidebar-toggle-line-last"></span>
</div>
</div>
<aside id="sidebar" class="sidebar">
<div class="sidebar-inner">
<section class="site-overview sidebar-panel sidebar-panel-active">
<div class="site-author motion-element" itemprop="author" itemscope itemtype="http://schema.org/Person">
<img class="site-author-image" itemprop="image"
src="/images/avatar.jpg"
alt="luohs" />
<p class="site-author-name" itemprop="name">luohs</p>
<p class="site-description motion-element" itemprop="description"></p>
</div>
<nav class="site-state motion-element">
<div class="site-state-item site-state-posts">
<a href="/archives">
<span class="site-state-item-count">5</span>
<span class="site-state-item-name">日志</span>
</a>
</div>
<div class="site-state-item site-state-categories">
<a href="/categories">
<span class="site-state-item-count">2</span>
<span class="site-state-item-name">分类</span>
</a>
</div>
<div class="site-state-item site-state-tags">
<a href="/tags">