JamfReports 0.1.1 → 0.2.1

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: 936b1cd3e821dc76f8187a62bb03c0e339fd0d678aa31a212472d774465276eb
4
+ data.tar.gz: 65406438b5d02ddf0d96c77f9eada5f1ed265e51ab2a292ce9677d10f2e4a904
5
5
  SHA512:
6
- metadata.gz: 07e344536853fca76d8b07ae166cff9dccae9c5d3acca87045569b9244662d878f34d11cbfbde0ce87e363cc1be21a39ea58f73d7cb59507c92da08498f239e2
7
- data.tar.gz: 6d1c9e64d051340b8702bd7e5fb1aae7106fda7f02c349929807a7e92e5c681a10b7540f06ecb30a7401ba7c65f7e1e0189ad1bfebd1396a9a3614ef48f16daf
6
+ metadata.gz: 68d279972dd6b10c469b6938bd4d40551f33ba09769c40125b658e8fe6a25b0b1bc61f199a49b53bdb2476d7668fc711393b185235a0584a8e272be168f08321
7
+ data.tar.gz: a0d2a54ac9b62b844666dbc9e9d9580d9bfeda7c3b2648e17d2a7ba753458d76027e27ff952c3bb32c6e9acf6e816832414f247558c8e752925e3e0d335fa55b
data/CHANGELOG.md CHANGED
@@ -1,3 +1,5 @@
1
+ ## 0.2.0 (2023.06.29)
2
+ - Add: export results to csv
1
3
 
2
4
  ## 0.1.1 (2023.06.28)
3
5
  - Update: update module syntax
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,101 @@ 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.
26
90
 
27
- ## Development
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
28
109
 
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.
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.
30
113
 
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).
114
+ #### listofOneInstallApps
115
+ ![listofOneInstallApps](images/listofOneInstallApps.png)
32
116
 
33
- ## Contributing
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.
34
118
 
35
- Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/JamfReports.
36
119
 
120
+ ---
37
121
  ## License
38
122
 
39
123
  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.1"
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,7 +1,7 @@
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.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - nic scott
@@ -53,6 +53,10 @@ files:
53
53
  - Rakefile
54
54
  - bin/console
55
55
  - bin/setup
56
+ - images/listAllInstalledApps.png
57
+ - images/listofOneInstallApps.png
58
+ - images/totalNumberOfOneInstalledApps.png
59
+ - images/webBrowserReport.png
56
60
  - lib/JamfReports.rb
57
61
  - lib/JamfReports/version.rb
58
62
  homepage: https://github.com/nlscott/marshmallow