headdesk 0.5.2 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +10 -10
- data/lib/headdesk/analize.rb +3 -3
- data/lib/headdesk/apk.rb +1 -1
- data/lib/headdesk/cli.rb +10 -10
- data/lib/headdesk/version.rb +1 -1
- data/lib/headdesk.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c4f09aef81b208b6caa7f4fa1157bdf763d9146b7649b32f274268fbe1c28848
|
4
|
+
data.tar.gz: 7b8222dfc6af2276eb9d1ce2ae28becbe283f39a804b0aa106e81930ca70a59c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '085550d31184907ff0e996116c4b8fdb5f886a7cea92c679e5521d166aae9d39892c9fd96cc855ac633fd9b4220646cc82c0d7f9eb77863aee4f2767841cc9e1'
|
7
|
+
data.tar.gz: ee5999dec6baa9d40edb242cf8dc0fc6e7da97decd6c05df7f06cfeb6fdff2e566daf168edee5eb494c517366ab9da0bba515fa9aab7c9a20876fff70ecabe7d
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -48,17 +48,17 @@ Command line usage instruction:
|
|
48
48
|
|
49
49
|
$ headdesk help [COMMAND]
|
50
50
|
|
51
|
-
|
51
|
+
Analyze an APK
|
52
52
|
|
53
|
-
$ headdesk
|
53
|
+
$ headdesk analyze [APK]
|
54
54
|
|
55
|
-
This will unpack the APK to a temporary path,
|
55
|
+
This will unpack the APK to a temporary path, analyze and print to STDOUT the results in plaintext.
|
56
56
|
|
57
57
|
For JSON output pass `--json`.
|
58
58
|
|
59
|
-
$ headdesk
|
59
|
+
$ headdesk analyze --path [path to unpacked APK]
|
60
60
|
|
61
|
-
This will
|
61
|
+
This will analyze an already unpacked APK.
|
62
62
|
|
63
63
|
Unpack an APK
|
64
64
|
|
@@ -66,7 +66,7 @@ Unpack an APK
|
|
66
66
|
|
67
67
|
This will unpack an APK to the specified DESTINATION, or to the current working directory.
|
68
68
|
|
69
|
-
$ headdesk unpack APK [DESTINATION] --
|
69
|
+
$ headdesk unpack APK [DESTINATION] --analyze
|
70
70
|
|
71
71
|
This will unpack an APK to the specified DESTINATION, or to the current working directory, and then perform analysis.
|
72
72
|
|
@@ -81,17 +81,17 @@ Single Command:
|
|
81
81
|
|
82
82
|
$ curl -w "%{url_effective}" --upload-file "PATH_TO_YOUR_APK_FILE" \
|
83
83
|
-L "`curl https://headdesk.cli-apps.teak.io/v1/url`" | \
|
84
|
-
curl --data @- --retry 10 https://headdesk.cli-apps.teak.io/v1/
|
84
|
+
curl --data @- --retry 10 https://headdesk.cli-apps.teak.io/v1/analyze
|
85
85
|
|
86
|
-
Replace `PATH_TO_YOUR_APK_FILE` with the path to the APK file you want to
|
86
|
+
Replace `PATH_TO_YOUR_APK_FILE` with the path to the APK file you want to analyze.
|
87
87
|
|
88
88
|
### What this Does
|
89
89
|
1. Requests a URL to upload the APK
|
90
90
|
* `curl https://headdesk.cli-apps.teak.io/v1/url`
|
91
91
|
2. Upload the APK to that URL, and write to STDOUT the URL it just used to upload
|
92
92
|
* `curl -w "%{url_effective}" --upload-file "PATH_TO_YOUR_APK_FILE" -L [Result from Step 1]`
|
93
|
-
3. Invoke the '
|
94
|
-
* `curl --data @- --retry 10 https://headdesk.cli-apps.teak.io/v1/
|
93
|
+
3. Invoke the 'analyze' endpoint, passing the result from Step 2 as the data (via reading from STDIN)
|
94
|
+
* `curl --data @- --retry 10 https://headdesk.cli-apps.teak.io/v1/analyze`
|
95
95
|
|
96
96
|
## Development
|
97
97
|
|
data/lib/headdesk/analize.rb
CHANGED
data/lib/headdesk/apk.rb
CHANGED
data/lib/headdesk/cli.rb
CHANGED
@@ -12,7 +12,7 @@ module Headdesk
|
|
12
12
|
# :reek:TooManyStatements
|
13
13
|
class CLI < Thor
|
14
14
|
desc 'unpack FILE [DESTINATION]', 'Unpack an APK or IPA to [DESTINATION] or to the current directory'
|
15
|
-
method_option :
|
15
|
+
method_option :analyze, type: :boolean, aliases: '-a'
|
16
16
|
def unpack(file, destination = nil)
|
17
17
|
# Make sure the input file exists
|
18
18
|
unless File.exist?(file)
|
@@ -43,8 +43,8 @@ module Headdesk
|
|
43
43
|
stdout = Headdesk::ApkTool.unpack_to(file, destination)
|
44
44
|
end
|
45
45
|
|
46
|
-
#
|
47
|
-
Headdesk::
|
46
|
+
# analyze if requested
|
47
|
+
Headdesk::Analyze.at(output_path) if options[:analyze]
|
48
48
|
rescue CliError => cli_err
|
49
49
|
STDERR.puts cli_err.message
|
50
50
|
CLI.command_help(Thor::Base.shell.new, 'unpack')
|
@@ -56,14 +56,14 @@ module Headdesk
|
|
56
56
|
end
|
57
57
|
end
|
58
58
|
|
59
|
-
desc '
|
59
|
+
desc 'analyze [FILE]', 'Analyze an APK or IPA'
|
60
60
|
method_option :path, type: :string
|
61
61
|
method_option :json, type: :boolean
|
62
|
-
def
|
62
|
+
def analyze(file = nil)
|
63
63
|
# Make sure input file exsts, if specified
|
64
64
|
unless !file || File.exist?(file)
|
65
65
|
STDERR.puts "Could not find input file: #{file}"
|
66
|
-
CLI.command_help(Thor::Base.shell.new, '
|
66
|
+
CLI.command_help(Thor::Base.shell.new, 'analyze')
|
67
67
|
return 1
|
68
68
|
end
|
69
69
|
|
@@ -78,13 +78,13 @@ module Headdesk
|
|
78
78
|
# Make sure path exists
|
79
79
|
unless Dir.exist?(path)
|
80
80
|
STDERR.puts "Could not find path: #{path}"
|
81
|
-
CLI.command_help(Thor::Base.shell.new, '
|
81
|
+
CLI.command_help(Thor::Base.shell.new, 'analyze')
|
82
82
|
return 1
|
83
83
|
end
|
84
84
|
|
85
|
-
#
|
85
|
+
# analyze
|
86
86
|
begin
|
87
|
-
report = Headdesk::
|
87
|
+
report = Headdesk::Analyze.at(path)
|
88
88
|
|
89
89
|
if options[:json]
|
90
90
|
STDOUT.puts report.to_json
|
@@ -93,7 +93,7 @@ module Headdesk
|
|
93
93
|
end
|
94
94
|
rescue CliError => cli_err
|
95
95
|
STDERR.puts cli_err.message
|
96
|
-
CLI.command_help(Thor::Base.shell.new, '
|
96
|
+
CLI.command_help(Thor::Base.shell.new, 'analyze')
|
97
97
|
return 1
|
98
98
|
rescue StandardError => err
|
99
99
|
STDERR.puts err.message.red
|
data/lib/headdesk/version.rb
CHANGED
data/lib/headdesk.rb
CHANGED