Module: FIR::Info

Included in:
Util::ClassMethods
Defined in:
lib/fir/util/info.rb

Instance Method Summary collapse

Instance Method Details

#aab_info(apk_path, options = {}) ⇒ Object



39
40
41
42
43
44
45
46
47
48
49
50
51
# File 'lib/fir/util/info.rb', line 39

def aab_info(apk_path, options = {})
  path = apk_path.split("/")
  filename = path[-1]
  fileinfo = filename.split("_")

  @info ||= {
      type:       'android',
      identifier: fileinfo[0],
      name:       'AAB',
      build:     fileinfo[2],
      version:   fileinfo[1]
    }
end

#apk_info(apk_path, options = {}) ⇒ Object



33
34
35
36
37
# File 'lib/fir/util/info.rb', line 33

def apk_info(apk_path, options = {})
  apk  = FIR::Parser::Apk.new(apk_path)
  info = apk.full_info(options)
  info
end

#apks_info(apk_path, options = {}) ⇒ Object



53
54
55
56
57
58
59
60
61
62
63
64
65
# File 'lib/fir/util/info.rb', line 53

def apks_info(apk_path, options = {})
  path = apk_path.split("/")
  filename = path[-1]
  fileinfo = filename.split("_")

  @info ||= {
      type:       'android',
      identifier: fileinfo[0],
      name:       'APKS',
      build:     fileinfo[2],
      version:   fileinfo[1]
    }
end

#info(*args, options) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/fir/util/info.rb', line 6

def info(*args, options)
  file_path = File.absolute_path(args.first.to_s)
  is_all    = !options[:all].blank?

  check_file_exist file_path
  check_supported_file file_path

  file_type = File.extname(file_path).delete('.')

  logger.info "Analyzing #{file_type} file......"
  logger_info_dividing_line

  app_info = send("#{file_type}_info", file_path, full_info: is_all)
  app_info.each { |k, v| logger.info "#{k}: #{v}" }

  logger_info_blank_line
end

#ipa_info(ipa_path, options = {}) ⇒ Object



24
25
26
27
28
29
30
31
# File 'lib/fir/util/info.rb', line 24

def ipa_info(ipa_path, options = {})
  ipa  = FIR::Parser::Ipa.new(ipa_path)
  app  = ipa.app
  info = app.full_info(options)

  ipa.cleanup
  info
end

#zip_info(apk_path, options = {}) ⇒ Object



67
68
69
70
71
72
73
74
75
76
77
78
79
# File 'lib/fir/util/info.rb', line 67

def zip_info(apk_path, options = {})
  path = apk_path.split("/")
  filename = path[-1]
  fileinfo = filename.split("_")

  @info ||= {
      type:       'android',
      identifier: fileinfo[0],
      name:       'APKS',
      build:     fileinfo[2],
      version:   fileinfo[1]
    }
end