JamfReports 0.1.1 → 0.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 77a38bd8791ce0cc7a828f3d99301e9bc3c263e2e94ddebd7396da49de534c43
4
- data.tar.gz: 52e54858b28f7d94695007554123401e26c9ff3dd7fc83de20a06ba350f96adc
3
+ metadata.gz: 36bfc7c47df15153e367ff9f91e65fde6e597c9a75bf493a9d8934369d2242dd
4
+ data.tar.gz: 6dac11a44c6825c79202c044b19d8d745a7427c0ddcdde9d51b349dae14f384d
5
5
  SHA512:
6
- metadata.gz: 07e344536853fca76d8b07ae166cff9dccae9c5d3acca87045569b9244662d878f34d11cbfbde0ce87e363cc1be21a39ea58f73d7cb59507c92da08498f239e2
7
- data.tar.gz: 6d1c9e64d051340b8702bd7e5fb1aae7106fda7f02c349929807a7e92e5c681a10b7540f06ecb30a7401ba7c65f7e1e0189ad1bfebd1396a9a3614ef48f16daf
6
+ metadata.gz: 7374ba89f88a305014d16a8709064e3a60e9865e47a200931331d933a6557ae67c58039d843ea3cdfe27780473afc60e0b17c2ef0128304a442aeb432106ea02
7
+ data.tar.gz: 344c87ab2ca1469792ac9f991944c2ef32fbb62156c71e637ae20859f47937bfdc5ffa0af21560cd7703054dcf808c86de9fc1e7b0bd54e2b9f72768f3b20585
data/CHANGELOG.md CHANGED
@@ -1,6 +1,16 @@
1
+ ## 0.2.2
2
+ - Fixed: Documentation updates
1
3
 
2
- ## 0.1.1 (2023.06.28)
3
- - Update: update module syntax
4
4
 
5
- ## 0.1.0 (2023.06.28)
5
+ ## 0.2.1
6
+ - Fixed: Issue with getting current user
7
+
8
+
9
+ ## 0.2.0
10
+ - Add: Option for `listAllInstalledApps_exporttocsv` that exports the results to the users desktop as a csv file named `Installed Applications Report.csv`
11
+
12
+ ## 0.1.1
13
+ - Update: Update module syntax
14
+
15
+ ## 0.1.0
6
16
  - Initial Build
data/JamfReports.gemspec CHANGED
@@ -10,7 +10,7 @@ Gem::Specification.new do |spec|
10
10
  spec.email = ["nls.inbox@gmail.com"]
11
11
 
12
12
  spec.summary = %q{A gem that uses the Jamf Pro API to generate reports for hosted Jamf Pro instance}
13
- spec.homepage = "https://github.com/nlscott/marshmallow"
13
+ spec.homepage = "https://github.com/nlscott/JamfReports"
14
14
  spec.license = "MIT"
15
15
 
16
16
  # Specify which files should be added to the gem when it is released.
data/README.md CHANGED
@@ -1,9 +1,12 @@
1
1
  # JamfReports
2
2
 
3
- Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/JamfReports`. To experiment with that code, run `bin/console` for an interactive prompt.
3
+ ## Summary
4
4
 
5
- TODO: Delete this and the text above, and describe your gem
5
+ JamfReports is a ruby gem that uses the Jamf Pro API for hosted instances. Currently, it only reports on Applications. Pulling from the `/api/v1/computers-inventory?section=APPLICATIONS` endpoint.
6
6
 
7
+ Future reports may be added.
8
+
9
+ ---
7
10
  ## Installation
8
11
 
9
12
  Add this line to your application's Gemfile:
@@ -20,20 +23,109 @@ Or install it yourself as:
20
23
 
21
24
  $ gem install JamfReports
22
25
 
26
+ ---
23
27
  ## Usage
24
28
 
25
- TODO: Write usage instructions here
29
+ In order to run JamfReports, you are required to add these two lines to the top of your file, under the require `JamfReports` line
30
+
31
+ ```ruby
32
+ #!/usr/bin/ruby
33
+ require "JamfReports"
34
+
35
+ ## UPDATE THESE VARIABLES ------------------------------------------------------
36
+ $jamfpro_url = "https://company.jamfcloud.com"
37
+ $api_pw = "Your API KEY HERE"
38
+ ```
39
+
40
+ If you don't have your api key for the `$api_pw` variable, run this command to create it and paste it into the variable.
41
+
42
+ ```bash
43
+ printf "jamfUserName:JamfPassword" | iconv -t ISO-8859-1 | base64 -i -
44
+ ```
45
+
46
+
47
+
48
+ And these 3 lines to generate the api token and pull the data from Jamf so you can run the report commands.
49
+
50
+ ```ruby
51
+ JamfReports.getToken
52
+ JamfReports.checkTokenExpiration
53
+ JamfReports.getAllApplicationInventory
54
+ ```
55
+
56
+ A full working file might look like this.
57
+
58
+ ```ruby
59
+ #!/usr/bin/ruby
60
+ require "JamfReports"
61
+
62
+ ## UPDATE THESE VARIABLES ------------------------------------------------------
63
+ $jamfpro_url = "https://company.jamfcloud.com"
64
+ $api_pw = "Your API KEY HERE"
65
+
66
+ ## COMMANDS --------------------------------------------------------------------
67
+ JamfReports.getToken
68
+ JamfReports.checkTokenExpiration
69
+ JamfReports.getAllApplicationInventory
70
+
71
+ ## REPORTS --------------------------------------------------------------------
72
+ JamfReports.listAllInstalledApps
73
+ # JamfReports.webBrowserReport
74
+ # JamfReports.totalNumberOfOneInstalledApps
75
+ # JamfReports.listofOneInstallApps
76
+
77
+ ## After reporting, revoke current token
78
+ JamfReports.invalidateToken
79
+ ```
80
+
81
+
82
+ ---
83
+ ## Examples
84
+
85
+ #### listAllInstalledApps
86
+
87
+ ![listAllInstalledApps](images/listAllInstalledApps.png)
88
+
89
+ Returns a sorted list of all apps installed across your fleet of computers in Jamf. Sorted from most installed app, to least.
90
+
91
+ #### webBrowserReport
92
+ ![webBrowserReport](images/webBrowserReport.png)
93
+ Returns a list of installed web browsers. Current browsers searched are:
94
+ - Google Chrome.app
95
+ - Google Chrome Canary.app
96
+ - Firefox.app
97
+ - Firefox Developer Edition.app
98
+ - Safari.app
99
+ - Safari Technology Preview.app
100
+ - Microsoft Edge.app
101
+ - Brave Browser.app
102
+ - Arc.app
103
+ - Opera.app
104
+ - LinCastor Browser.app
105
+ - LockDown Browser.app
106
+ - Tor Browser.app
107
+ - Vivaldi.app
108
+ - DuckDuckGo.app
109
+
110
+ #### totalNumberOfOneInstalledApps
111
+ ![totalNumberOfOneInstalledApps](images/totalNumberOfOneInstalledApps.png)
112
+ Returns a single metric to show the number of "One-off" or single installed apps across your fleet.
113
+
114
+ #### listofOneInstallApps
115
+ ![listofOneInstallApps](images/listofOneInstallApps.png)
116
+
117
+ Returns a list of all the "One-off" or single installed apps across your fleet. This can be helpful in scoping in Jamf uninstall policies.
118
+
26
119
 
27
- ## Development
120
+ #### listAllInstalledApps_exporttocsv
121
+ ![listAllInstalledApps_exporttocsv](images/listAllInstalledApps_exporttocsv.png)
122
+ Using `JamfReports.listAllInstalledApps_exporttocsv` exports the results to the users desktop as a csv file named `Installed Applications Report.csv`
28
123
 
29
- After checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
30
124
 
31
- To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
32
125
 
33
- ## Contributing
34
126
 
35
- Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/JamfReports.
36
127
 
128
+ ---
37
129
  ## License
38
130
 
39
131
  The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
Binary file
Binary file
Binary file
@@ -1,3 +1,3 @@
1
1
  module JamfReports
2
- VERSION = "0.1.1"
2
+ VERSION = "0.2.2"
3
3
  end
data/lib/JamfReports.rb CHANGED
@@ -1,5 +1,6 @@
1
1
  require "JamfReports/version"
2
2
  require "uri"
3
+ require 'etc'
3
4
  require "json"
4
5
  require "time"
5
6
  require "net/http"
@@ -149,5 +150,17 @@ module JamfReports
149
150
  end
150
151
  end
151
152
  end
153
+
154
+ def self.listAllInstalledApps_exporttocsv
155
+ $currentUser=Etc.getlogin
156
+ reportName="Installed Applications Report"
157
+ $reportPath="/Users/#{$currentUser}/Desktop/#{reportName}.csv"
158
+ File.write("#{$reportPath}", "name,count\n")
159
+
160
+ $applicationHash.sort_by {|_key, value| value}.reverse.each do |k,v|
161
+ open("#{$reportPath}", "a") { |f| f << "#{k},#{v}\n" }
162
+ end
163
+ end
164
+
152
165
 
153
166
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: JamfReports
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - nic scott
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-06-28 00:00:00.000000000 Z
11
+ date: 2023-07-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -53,9 +53,14 @@ files:
53
53
  - Rakefile
54
54
  - bin/console
55
55
  - bin/setup
56
+ - images/listAllInstalledApps.png
57
+ - images/listAllInstalledApps_exporttocsv.png
58
+ - images/listofOneInstallApps.png
59
+ - images/totalNumberOfOneInstalledApps.png
60
+ - images/webBrowserReport.png
56
61
  - lib/JamfReports.rb
57
62
  - lib/JamfReports/version.rb
58
- homepage: https://github.com/nlscott/marshmallow
63
+ homepage: https://github.com/nlscott/JamfReports
59
64
  licenses:
60
65
  - MIT
61
66
  metadata: {}