ipa_reader 0.6 → 0.6.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (37) hide show
  1. data/lib/ipa_reader/ipa_file.rb +7 -4
  2. data/lib/ipa_reader/png_file.rb +86 -0
  3. data/version.txt +1 -1
  4. metadata +5 -36
  5. data/test/Payload/MultiG.app/AccountTableViewCell.nib +0 -0
  6. data/test/Payload/MultiG.app/AddAccountView.nib +0 -0
  7. data/test/Payload/MultiG.app/AddAccountView_Phone.nib +0 -0
  8. data/test/Payload/MultiG.app/CodeResources +0 -136
  9. data/test/Payload/MultiG.app/Default-Landscape.png +0 -0
  10. data/test/Payload/MultiG.app/Default-Portrait.png +0 -0
  11. data/test/Payload/MultiG.app/Default.png +0 -0
  12. data/test/Payload/MultiG.app/ExternalWebView.nib +0 -0
  13. data/test/Payload/MultiG.app/ExternalWebView_Phone.nib +0 -0
  14. data/test/Payload/MultiG.app/GmailWebView.nib +0 -0
  15. data/test/Payload/MultiG.app/GmailWebView_Phone.nib +0 -0
  16. data/test/Payload/MultiG.app/Info.plist +0 -0
  17. data/test/Payload/MultiG.app/MainWindow_Pad.nib +0 -0
  18. data/test/Payload/MultiG.app/MainWindow_Phone.nib +0 -0
  19. data/test/Payload/MultiG.app/MultiG +0 -0
  20. data/test/Payload/MultiG.app/MultiMail.momd/MultiMail 2.mom +0 -0
  21. data/test/Payload/MultiG.app/MultiMail.momd/MultiMail 3.mom +0 -0
  22. data/test/Payload/MultiG.app/MultiMail.momd/MultiMail.mom +0 -0
  23. data/test/Payload/MultiG.app/MultiMail.momd/VersionInfo.plist +0 -44
  24. data/test/Payload/MultiG.app/PkgInfo +0 -1
  25. data/test/Payload/MultiG.app/ResourceRules.plist +0 -25
  26. data/test/Payload/MultiG.app/RootView.nib +0 -0
  27. data/test/Payload/MultiG.app/RootView_Phone.nib +0 -0
  28. data/test/Payload/MultiG.app/Settings.nib +0 -0
  29. data/test/Payload/MultiG.app/TableViewCellOnOff.nib +0 -0
  30. data/test/Payload/MultiG.app/_CodeSignature/CodeResources +0 -136
  31. data/test/Payload/MultiG.app/back_small.png +0 -0
  32. data/test/Payload/MultiG.app/dist.plist +0 -0
  33. data/test/Payload/MultiG.app/embedded.mobileprovision +0 -0
  34. data/test/Payload/MultiG.app/forward_small.png +0 -0
  35. data/test/Payload/MultiG.app/icon-ipad.png +0 -0
  36. data/test/Payload/MultiG.app/icon-iphone.png +0 -0
  37. data/test/Payload/MultiG.app/settings_small.png +0 -0
@@ -39,10 +39,13 @@ module IpaReader
39
39
  end
40
40
 
41
41
  def icon_file
42
- if plist["CFBundleIconFile"]
43
- read_file(Regexp.new("#{plist["CFBundleIconFile"]}$"))
44
- elsif plist["CFBundleIconFiles"]
45
- read_file(Regexp.new("#{plist["CFBundleIconFiles"][0]}$"))
42
+ if plist["CFBundleIconFiles"]
43
+ data = read_file(Regexp.new("#{plist["CFBundleIconFiles"][0]}$"))
44
+ elsif plist["CFBundleIconFile"]
45
+ data = read_file(Regexp.new("#{plist["CFBundleIconFile"]}$"))
46
+ end
47
+ if data
48
+ IpaReader::PngFile.normalize_png(data)
46
49
  else
47
50
  nil
48
51
  end
@@ -0,0 +1,86 @@
1
+ # direct port of python code at http://www.axelbrz.com.ar/?mod=iphone-png-images-normalizer
2
+ require 'zlib'
3
+
4
+ module IpaReader
5
+ class PngFile
6
+ def self.normalize_png(oldPNG)
7
+ pngheader = "\x89PNG\r\n\x1a\n"
8
+
9
+ if oldPNG[0...8] != pngheader
10
+ return nil
11
+ end
12
+
13
+ newPNG = oldPNG[0...8]
14
+
15
+ chunkPos = newPNG.length
16
+
17
+ # For each chunk in the PNG file
18
+ while chunkPos < oldPNG.length
19
+
20
+ # Reading chunk
21
+ chunkLength = oldPNG[chunkPos...chunkPos+4]
22
+ chunkLength = chunkLength.unpack("N")[0]
23
+ chunkType = oldPNG[chunkPos+4...chunkPos+8]
24
+ chunkData = oldPNG[chunkPos+8...chunkPos+8+chunkLength]
25
+ chunkCRC = oldPNG[chunkPos+chunkLength+8...chunkPos+chunkLength+12]
26
+ chunkCRC = chunkCRC.unpack("N")[0]
27
+ chunkPos += chunkLength + 12
28
+
29
+ # Parsing the header chunk
30
+ if chunkType == "IHDR"
31
+ width = chunkData[0...4].unpack("N")[0]
32
+ height = chunkData[4...8].unpack("N")[0]
33
+ end
34
+
35
+ # Parsing the image chunk
36
+ if chunkType == "IDAT"
37
+ # Uncompressing the image chunk
38
+ inf = Zlib::Inflate.new(-Zlib::MAX_WBITS)
39
+ chunkData = inf.inflate(chunkData)
40
+ inf.finish
41
+ inf.close
42
+
43
+ # Swapping red & blue bytes for each pixel
44
+ newdata = ""
45
+
46
+ height.times do
47
+ i = newdata.length
48
+ newdata += chunkData[i..i].to_s
49
+ width.times do
50
+ i = newdata.length
51
+ newdata += chunkData[i+2..i+2].to_s
52
+ newdata += chunkData[i+1..i+1].to_s
53
+ newdata += chunkData[i+0..i+0].to_s
54
+ newdata += chunkData[i+3..i+3].to_s
55
+ end
56
+ end
57
+
58
+ # Compressing the image chunk
59
+ chunkData = newdata
60
+ chunkData = Zlib::Deflate.deflate( chunkData )
61
+ chunkLength = chunkData.length
62
+ chunkCRC = Zlib.crc32(chunkType)
63
+ chunkCRC = Zlib.crc32(chunkData, chunkCRC)
64
+ chunkCRC = (chunkCRC + 0x100000000) % 0x100000000
65
+ end
66
+
67
+ # Removing CgBI chunk
68
+ if chunkType != "CgBI"
69
+ newPNG += [chunkLength].pack("N")
70
+ newPNG += chunkType
71
+ if chunkLength > 0
72
+ newPNG += chunkData
73
+ end
74
+ newPNG += [chunkCRC].pack("N")
75
+ end
76
+
77
+ # Stopping the PNG file parsing
78
+ if chunkType == "IEND":
79
+ break
80
+ end
81
+ end
82
+
83
+ return newPNG
84
+ end
85
+ end
86
+ end
data/version.txt CHANGED
@@ -1 +1 @@
1
- 0.6
1
+ 0.6.1
metadata CHANGED
@@ -1,12 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ipa_reader
3
3
  version: !ruby/object:Gem::Version
4
- hash: 7
4
+ hash: 5
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 6
9
- version: "0.6"
9
+ - 1
10
+ version: 0.6.1
10
11
  platform: ruby
11
12
  authors:
12
13
  - Nicholas Schlueter
@@ -14,7 +15,7 @@ autorequire:
14
15
  bindir: bin
15
16
  cert_chain: []
16
17
 
17
- date: 2011-01-24 00:00:00 -05:00
18
+ date: 2011-01-25 00:00:00 -05:00
18
19
  default_executable:
19
20
  dependencies:
20
21
  - !ruby/object:Gem::Dependency
@@ -69,42 +70,10 @@ files:
69
70
  - lib/ipa_reader.rb
70
71
  - lib/ipa_reader/ipa_file.rb
71
72
  - lib/ipa_reader/plist_binary.rb
73
+ - lib/ipa_reader/png_file.rb
72
74
  - spec/ipa_reader_spec.rb
73
75
  - spec/spec_helper.rb
74
76
  - test/MultiG.ipa
75
- - test/Payload/MultiG.app/AccountTableViewCell.nib
76
- - test/Payload/MultiG.app/AddAccountView.nib
77
- - test/Payload/MultiG.app/AddAccountView_Phone.nib
78
- - test/Payload/MultiG.app/CodeResources
79
- - test/Payload/MultiG.app/Default-Landscape.png
80
- - test/Payload/MultiG.app/Default-Portrait.png
81
- - test/Payload/MultiG.app/Default.png
82
- - test/Payload/MultiG.app/ExternalWebView.nib
83
- - test/Payload/MultiG.app/ExternalWebView_Phone.nib
84
- - test/Payload/MultiG.app/GmailWebView.nib
85
- - test/Payload/MultiG.app/GmailWebView_Phone.nib
86
- - test/Payload/MultiG.app/Info.plist
87
- - test/Payload/MultiG.app/MainWindow_Pad.nib
88
- - test/Payload/MultiG.app/MainWindow_Phone.nib
89
- - test/Payload/MultiG.app/MultiG
90
- - test/Payload/MultiG.app/MultiMail.momd/MultiMail 2.mom
91
- - test/Payload/MultiG.app/MultiMail.momd/MultiMail 3.mom
92
- - test/Payload/MultiG.app/MultiMail.momd/MultiMail.mom
93
- - test/Payload/MultiG.app/MultiMail.momd/VersionInfo.plist
94
- - test/Payload/MultiG.app/PkgInfo
95
- - test/Payload/MultiG.app/ResourceRules.plist
96
- - test/Payload/MultiG.app/RootView.nib
97
- - test/Payload/MultiG.app/RootView_Phone.nib
98
- - test/Payload/MultiG.app/Settings.nib
99
- - test/Payload/MultiG.app/TableViewCellOnOff.nib
100
- - test/Payload/MultiG.app/_CodeSignature/CodeResources
101
- - test/Payload/MultiG.app/back_small.png
102
- - test/Payload/MultiG.app/dist.plist
103
- - test/Payload/MultiG.app/embedded.mobileprovision
104
- - test/Payload/MultiG.app/forward_small.png
105
- - test/Payload/MultiG.app/icon-ipad.png
106
- - test/Payload/MultiG.app/icon-iphone.png
107
- - test/Payload/MultiG.app/settings_small.png
108
77
  - test/test_ipa_reader.rb
109
78
  - version.txt
110
79
  has_rdoc: true
@@ -1,136 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3
- <plist version="1.0">
4
- <dict>
5
- <key>files</key>
6
- <dict>
7
- <key>AccountTableViewCell.nib</key>
8
- <data>
9
- AyjJwvw8bbERsI4rmj/I5YduQJ4=
10
- </data>
11
- <key>AddAccountView.nib</key>
12
- <data>
13
- lL4dW5BBRh/yBzE9x1mnpFzZjHM=
14
- </data>
15
- <key>AddAccountView_Phone.nib</key>
16
- <data>
17
- 8ylJH7N1wPHZKz28JrcFETZSzyo=
18
- </data>
19
- <key>Default-Landscape.png</key>
20
- <data>
21
- 9pgDW2LOQyRAPScwkyfDnZllNS0=
22
- </data>
23
- <key>Default-Portrait.png</key>
24
- <data>
25
- VWFZpYKaTfooVdHhD5pbbJVaiK8=
26
- </data>
27
- <key>Default.png</key>
28
- <data>
29
- n0O2VKrKGdgut2gRqfcIfi5ZWRE=
30
- </data>
31
- <key>ExternalWebView.nib</key>
32
- <data>
33
- q902wsmqdPnXgYXZkTyacTOQW98=
34
- </data>
35
- <key>ExternalWebView_Phone.nib</key>
36
- <data>
37
- Iv+UyuRtCTey8RLlmxxOLPv6qXU=
38
- </data>
39
- <key>GmailWebView.nib</key>
40
- <data>
41
- fD725MP8KEJyKfnUHnC1ap6rh84=
42
- </data>
43
- <key>GmailWebView_Phone.nib</key>
44
- <data>
45
- FC922vWks0NwN+B+8NnqLy6hQ10=
46
- </data>
47
- <key>MainWindow_Pad.nib</key>
48
- <data>
49
- +6WOkZsGMKWUOD3vVsL8U9Q0Wm8=
50
- </data>
51
- <key>MainWindow_Phone.nib</key>
52
- <data>
53
- ODbcV8Pc/oTiYbebSoXuc09Bpp0=
54
- </data>
55
- <key>MultiMail.momd/MultiMail 2.mom</key>
56
- <data>
57
- 3LdTFsmpRTddNJ/j4I1BjYmKstM=
58
- </data>
59
- <key>MultiMail.momd/MultiMail 3.mom</key>
60
- <data>
61
- qWHGBfl8YX0Vqns6lfl0pZoZzfw=
62
- </data>
63
- <key>MultiMail.momd/MultiMail.mom</key>
64
- <data>
65
- WK+mfYC00/2DYCr8+JB/b4PLTGs=
66
- </data>
67
- <key>PkgInfo</key>
68
- <data>
69
- n57qDP4tZfLD1rCS43W0B4LQjzE=
70
- </data>
71
- <key>RootView.nib</key>
72
- <data>
73
- Ps04oMGcavkHVN16E6x2qhhiUWg=
74
- </data>
75
- <key>RootView_Phone.nib</key>
76
- <data>
77
- g7HOemeyRsNKeR3J30RPpmJbDqg=
78
- </data>
79
- <key>Settings.nib</key>
80
- <data>
81
- eUqOCJ3o5dC6/G2jYjt0ryAlbmQ=
82
- </data>
83
- <key>TableViewCellOnOff.nib</key>
84
- <data>
85
- FVX2y9YpmV1easO7YO//Fu0mwDE=
86
- </data>
87
- <key>back_small.png</key>
88
- <data>
89
- qIfS3VYnf/vUVFluqgG8iktd814=
90
- </data>
91
- <key>dist.plist</key>
92
- <data>
93
- s45CsB1sm2EFR9Z1NilFQ5hxXrI=
94
- </data>
95
- <key>embedded.mobileprovision</key>
96
- <data>
97
- Y7rOykzYACchiX+HF8Hs7IFgffU=
98
- </data>
99
- <key>forward_small.png</key>
100
- <data>
101
- 50tWCzD+7+7VOfNxZAl3Utjo1xE=
102
- </data>
103
- <key>icon-ipad.png</key>
104
- <data>
105
- kyNNDzUZxPXRZm7Yz/dAwYOQ9TA=
106
- </data>
107
- <key>icon-iphone.png</key>
108
- <data>
109
- RqTBh/HFCJRMKOTX/+KdnCiSdJk=
110
- </data>
111
- <key>settings_small.png</key>
112
- <data>
113
- Xa0iKIHr0w/T/YzLWp1mAipy0Ug=
114
- </data>
115
- </dict>
116
- <key>rules</key>
117
- <dict>
118
- <key>.*</key>
119
- <true/>
120
- <key>Info.plist</key>
121
- <dict>
122
- <key>omit</key>
123
- <true/>
124
- <key>weight</key>
125
- <real>10</real>
126
- </dict>
127
- <key>ResourceRules.plist</key>
128
- <dict>
129
- <key>omit</key>
130
- <true/>
131
- <key>weight</key>
132
- <real>100</real>
133
- </dict>
134
- </dict>
135
- </dict>
136
- </plist>
Binary file
Binary file
Binary file
@@ -1,44 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3
- <plist version="1.0">
4
- <dict>
5
- <key>NSManagedObjectModel_CurrentVersionName</key>
6
- <string>MultiMail 3</string>
7
- <key>NSManagedObjectModel_VersionHashes</key>
8
- <dict>
9
- <key>MultiMail</key>
10
- <dict>
11
- <key>Account</key>
12
- <data>
13
- tmk9q8df4wRRXOWRdYgWfjMKf6i7MDCClb0UujAuJVE=
14
- </data>
15
- <key>State</key>
16
- <data>
17
- tWGVIBtkcvg4I5qx3jIWBJrs1hqpGXih01No+EOcavg=
18
- </data>
19
- </dict>
20
- <key>MultiMail 2</key>
21
- <dict>
22
- <key>Account</key>
23
- <data>
24
- poR+EgneS4FDDKTLtdQ1EsSRyer0XBL13gfFVgwefSE=
25
- </data>
26
- <key>State</key>
27
- <data>
28
- tWGVIBtkcvg4I5qx3jIWBJrs1hqpGXih01No+EOcavg=
29
- </data>
30
- </dict>
31
- <key>MultiMail 3</key>
32
- <dict>
33
- <key>Account</key>
34
- <data>
35
- 2r8uf0oPFCt6YTW4j3WChAzMqF91HIXmkUvU4sTBdtw=
36
- </data>
37
- <key>State</key>
38
- <data>
39
- tWGVIBtkcvg4I5qx3jIWBJrs1hqpGXih01No+EOcavg=
40
- </data>
41
- </dict>
42
- </dict>
43
- </dict>
44
- </plist>
@@ -1 +0,0 @@
1
- APPL????
@@ -1,25 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3
- <plist version="1.0">
4
- <dict>
5
- <key>rules</key>
6
- <dict>
7
- <key>.*</key>
8
- <true/>
9
- <key>Info.plist</key>
10
- <dict>
11
- <key>omit</key>
12
- <true/>
13
- <key>weight</key>
14
- <real>10</real>
15
- </dict>
16
- <key>ResourceRules.plist</key>
17
- <dict>
18
- <key>omit</key>
19
- <true/>
20
- <key>weight</key>
21
- <real>100</real>
22
- </dict>
23
- </dict>
24
- </dict>
25
- </plist>
Binary file
Binary file
@@ -1,136 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3
- <plist version="1.0">
4
- <dict>
5
- <key>files</key>
6
- <dict>
7
- <key>AccountTableViewCell.nib</key>
8
- <data>
9
- AyjJwvw8bbERsI4rmj/I5YduQJ4=
10
- </data>
11
- <key>AddAccountView.nib</key>
12
- <data>
13
- lL4dW5BBRh/yBzE9x1mnpFzZjHM=
14
- </data>
15
- <key>AddAccountView_Phone.nib</key>
16
- <data>
17
- 8ylJH7N1wPHZKz28JrcFETZSzyo=
18
- </data>
19
- <key>Default-Landscape.png</key>
20
- <data>
21
- 9pgDW2LOQyRAPScwkyfDnZllNS0=
22
- </data>
23
- <key>Default-Portrait.png</key>
24
- <data>
25
- VWFZpYKaTfooVdHhD5pbbJVaiK8=
26
- </data>
27
- <key>Default.png</key>
28
- <data>
29
- n0O2VKrKGdgut2gRqfcIfi5ZWRE=
30
- </data>
31
- <key>ExternalWebView.nib</key>
32
- <data>
33
- q902wsmqdPnXgYXZkTyacTOQW98=
34
- </data>
35
- <key>ExternalWebView_Phone.nib</key>
36
- <data>
37
- Iv+UyuRtCTey8RLlmxxOLPv6qXU=
38
- </data>
39
- <key>GmailWebView.nib</key>
40
- <data>
41
- fD725MP8KEJyKfnUHnC1ap6rh84=
42
- </data>
43
- <key>GmailWebView_Phone.nib</key>
44
- <data>
45
- FC922vWks0NwN+B+8NnqLy6hQ10=
46
- </data>
47
- <key>MainWindow_Pad.nib</key>
48
- <data>
49
- +6WOkZsGMKWUOD3vVsL8U9Q0Wm8=
50
- </data>
51
- <key>MainWindow_Phone.nib</key>
52
- <data>
53
- ODbcV8Pc/oTiYbebSoXuc09Bpp0=
54
- </data>
55
- <key>MultiMail.momd/MultiMail 2.mom</key>
56
- <data>
57
- 3LdTFsmpRTddNJ/j4I1BjYmKstM=
58
- </data>
59
- <key>MultiMail.momd/MultiMail 3.mom</key>
60
- <data>
61
- qWHGBfl8YX0Vqns6lfl0pZoZzfw=
62
- </data>
63
- <key>MultiMail.momd/MultiMail.mom</key>
64
- <data>
65
- WK+mfYC00/2DYCr8+JB/b4PLTGs=
66
- </data>
67
- <key>PkgInfo</key>
68
- <data>
69
- n57qDP4tZfLD1rCS43W0B4LQjzE=
70
- </data>
71
- <key>RootView.nib</key>
72
- <data>
73
- Ps04oMGcavkHVN16E6x2qhhiUWg=
74
- </data>
75
- <key>RootView_Phone.nib</key>
76
- <data>
77
- g7HOemeyRsNKeR3J30RPpmJbDqg=
78
- </data>
79
- <key>Settings.nib</key>
80
- <data>
81
- eUqOCJ3o5dC6/G2jYjt0ryAlbmQ=
82
- </data>
83
- <key>TableViewCellOnOff.nib</key>
84
- <data>
85
- FVX2y9YpmV1easO7YO//Fu0mwDE=
86
- </data>
87
- <key>back_small.png</key>
88
- <data>
89
- qIfS3VYnf/vUVFluqgG8iktd814=
90
- </data>
91
- <key>dist.plist</key>
92
- <data>
93
- s45CsB1sm2EFR9Z1NilFQ5hxXrI=
94
- </data>
95
- <key>embedded.mobileprovision</key>
96
- <data>
97
- Y7rOykzYACchiX+HF8Hs7IFgffU=
98
- </data>
99
- <key>forward_small.png</key>
100
- <data>
101
- 50tWCzD+7+7VOfNxZAl3Utjo1xE=
102
- </data>
103
- <key>icon-ipad.png</key>
104
- <data>
105
- kyNNDzUZxPXRZm7Yz/dAwYOQ9TA=
106
- </data>
107
- <key>icon-iphone.png</key>
108
- <data>
109
- RqTBh/HFCJRMKOTX/+KdnCiSdJk=
110
- </data>
111
- <key>settings_small.png</key>
112
- <data>
113
- Xa0iKIHr0w/T/YzLWp1mAipy0Ug=
114
- </data>
115
- </dict>
116
- <key>rules</key>
117
- <dict>
118
- <key>.*</key>
119
- <true/>
120
- <key>Info.plist</key>
121
- <dict>
122
- <key>omit</key>
123
- <true/>
124
- <key>weight</key>
125
- <real>10</real>
126
- </dict>
127
- <key>ResourceRules.plist</key>
128
- <dict>
129
- <key>omit</key>
130
- <true/>
131
- <key>weight</key>
132
- <real>100</real>
133
- </dict>
134
- </dict>
135
- </dict>
136
- </plist>
Binary file
Binary file
Binary file