opensecret 0.0.951 → 0.0.957

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.
Files changed (34) hide show
  1. checksums.yaml +4 -4
  2. data/lib/extension/array.rb +29 -0
  3. data/lib/extension/string.rb +31 -0
  4. data/lib/factbase/facts.opensecret.io.ini +17 -9
  5. data/lib/notepad/blow.rb +108 -5
  6. data/lib/opensecret.rb +32 -6
  7. data/lib/plugins/cipher.rb +7 -7
  8. data/lib/plugins/ciphers/blowfish.rb +63 -157
  9. data/lib/plugins/usecase.rb +1 -1
  10. data/lib/plugins/usecases/init.rb +57 -116
  11. data/lib/plugins/usecases/lock.rb +178 -0
  12. data/lib/plugins/usecases/open.rb +17 -86
  13. data/lib/plugins/usecases/put.rb +137 -0
  14. data/lib/plugins/usecases/safe.rb +8 -10
  15. data/lib/session/attributes.rb +16 -11
  16. data/lib/session/dictionary.rb +191 -0
  17. data/lib/session/session.rb +80 -0
  18. data/lib/session/time.stamp.rb +89 -106
  19. data/lib/using.txt +100 -0
  20. data/lib/version.rb +1 -1
  21. metadata +6 -15
  22. data/lib/opensecret/commons/eco.faculty.rb +0 -364
  23. data/lib/opensecret/commons/eco.system.rb +0 -437
  24. data/lib/opensecret/commons/eco.systems.rb +0 -98
  25. data/lib/opensecret/factbase/hub-runtime.ini +0 -123
  26. data/lib/opensecret/factbase/known-hosts.ini +0 -75
  27. data/lib/opensecret/factbase/published.facts/blobbolicious-facts.ini +0 -553
  28. data/lib/opensecret/factbase/published.facts/credential-facts.ini +0 -40
  29. data/lib/opensecret/factbase/published.facts/infrastructure-facts.ini +0 -63
  30. data/lib/opensecret/factbase/readme.md +0 -24
  31. data/lib/opensecret/factbase/retired.facts/maven.database.ide.facts.ini +0 -127
  32. data/lib/opensecret/factbase/retired.facts/s3-upload-block-facts.ini +0 -17
  33. data/lib/opensecret/plugins.io/file/file.rb +0 -483
  34. data/lib/plugins/usecases/on.rb +0 -33
@@ -0,0 +1,80 @@
1
+ #!/usr/bin/ruby
2
+ # coding: utf-8
3
+
4
+ module OpenSession
5
+
6
+ # Data and session attributes that span or have relevance across the
7
+ # entire runtime software instantiation.
8
+ #
9
+ # The sessiondata includes information on the user, the home directory,
10
+ # the session-wide reference time stamp and the session context.
11
+ class Session
12
+ include Singleton
13
+
14
+ # The session context is derived from the module name of the caller
15
+ # of the {self.set_context} method.
16
+ attr_accessor :context
17
+
18
+
19
+ # Read the software context by looking at the name of the module
20
+ # that is calling this method.
21
+ #
22
+ # @example
23
+ # If the caller is registered as OpenTools::Hammer the session
24
+ # context name is opentools
25
+ #
26
+ # The context name derivation simply pulls out the module name from
27
+ # the stack trace and downcases it.
28
+ ############ def set_context
29
+
30
+ ########### module_name = File.basename caller_locations(1,1).first.absolute_path, ".rb"
31
+ ######## @context = module_name.downcase
32
+
33
+ ########### end
34
+
35
+
36
+ # On non-windows systems the home directory is defined
37
+ # perfectly by Ruby's Dir object.
38
+ #
39
+ # On Windows we sometimes get /AppData/Roaming appended
40
+ # onto the actual home directory. In these cases this
41
+ # method removes it.
42
+ #
43
+ # @return [String] the path to the machine user's home directory
44
+ def home_directory
45
+
46
+ return Dir.home unless Gem.win_platform?
47
+
48
+ extraneous_path = "/AppData/Roaming"
49
+ if Dir.home.end_with? extraneous_path then
50
+ return Dir.home.gsub( extraneous_path, "" )
51
+ end
52
+
53
+ return Dir.home
54
+
55
+ end
56
+
57
+
58
+ #
59
+ # Get the username of the logged in user. This name should
60
+ # not contain spaces (and should be just alphanumeric).
61
+ #
62
+ # The current implementation uses environment variables and
63
+ # crudely states that the username is
64
+ #
65
+ # - ENV['USERNAME'] for the Windows platform
66
+ # - ENV['USER'] for Linux (and everything else)
67
+ #
68
+ # @return [String] the username of the machine user
69
+ def username
70
+
71
+ return ENV['USERNAME'] if Gem.win_platform?
72
+ return ENV['USER']
73
+
74
+ end
75
+
76
+
77
+ end
78
+
79
+
80
+ end
@@ -4,40 +4,17 @@ module OpenSession
4
4
 
5
5
  require 'singleton'
6
6
 
7
- #
8
7
  # This stamp sits at the centre of a fundamental DevOps pattern concerned
9
8
  # with infrastructure provisioning and configuraion management.
10
9
  #
11
10
  # The central idea behind the pattern is to link every infrastructure
12
- # object created for an eco-system with an embedded reference that
13
- # contains time stamps that are accurate to the nearest
14
- #
15
- # - month
16
- # - day
17
- # - hour of day
18
- # - minute
19
- # - second
20
- # - tenth of second
21
- # - hundredth of second
22
- # - thousandth of second
23
- #
24
- # Which newly created or updated infrastructure objects are stamped?
25
- #
26
- # - files and folders
27
- # - database user names
28
- # - Docker containers
29
- # - virtual machines
30
- # - s3 buckets and their contents
31
- # - aws ec2 machines
32
- # - aws acl lists
33
- # - hostnames and urls
34
- #
11
+ # object created during a session with a reference accurate to the nearest
12
+ # centi-second denoting the moment the software runtime (session) began.
35
13
  class Stamp
36
14
  include Singleton
37
15
 
38
16
  attr_reader :time_now
39
17
 
40
- #
41
18
  # Return two digit [mo] month index from 01 to 12.
42
19
  # @example 02 => in February
43
20
  #
@@ -46,7 +23,6 @@ module OpenSession
46
23
  end
47
24
 
48
25
 
49
- #
50
26
  # Return three character abbreviated month name.
51
27
  # @example feb => in February
52
28
  #
@@ -96,9 +72,7 @@ module OpenSession
96
72
  # The final digit is derived from the 1000 sliced
97
73
  # millisecond of second running from 000 to 999.
98
74
  #
99
- # ---------------------------
100
- # Truncation (Not Rounding)
101
- # ---------------------------
75
+ # <tt>Truncation (Not Rounding)</tt>
102
76
  #
103
77
  # The [final] digit is acquired by TRUNCATING
104
78
  # (chopping off) the last 2 of the 3 millisecond
@@ -106,12 +80,11 @@ module OpenSession
106
80
  #
107
81
  # The 3 returned digits comprise of the
108
82
  #
109
- # - second of minute => 2 digits | [00] to [59] (and)
110
- # - tenth of second => 1 digit from [0] to [9]
83
+ # - second of minute => 2 digits | [00] to [59] (and)
84
+ # - tenth of second => 1 digit from [0] to [9]
85
+ #
86
+ # @example
111
87
  #
112
- # ---------
113
- # Example
114
- # ---------
115
88
  # => The time at the 562nd millisecond of the 49th
116
89
  # second of the minute.
117
90
  #
@@ -151,7 +124,6 @@ module OpenSession
151
124
  end
152
125
 
153
126
 
154
- #
155
127
  # [yymo_mmm] returns an amalgam of
156
128
  #
157
129
  # => the two-digit year
@@ -159,11 +131,9 @@ module OpenSession
159
131
  # => a period (separator)
160
132
  # => the abbreviated month name
161
133
  #
162
- # ---------
163
- # Example
164
- # ---------
165
- # => 1908.aug
166
- # => for August 2019
134
+ # @example
135
+ # => 1908.aug
136
+ # => for August 2019
167
137
  #
168
138
  def self.yymo_mmm
169
139
  return "#{yy}#{mo}.#{mmm}"
@@ -237,24 +207,19 @@ module OpenSession
237
207
  end
238
208
 
239
209
 
240
- # ---------------------------------------------- -- #
241
- # Return 5 digit amalgam of year and julian day. -- #
242
- # eg [19003] for [January 3rd 2019] -- #
243
- # ---------------------------------------------- -- #
210
+ # Return 5 digit amalgam of year and julian day.
211
+ # eg [19003] for [January 3rd 2019]
244
212
  def self.yyjjj
245
213
  return "#{yy}#{jjj}"
246
214
  end
247
215
 
248
216
 
249
- #
250
217
  # Return the 4 digit amalgam of the hour and minute
251
218
  # using the 24 hour clock.
252
219
  #
253
- # ---------
254
- # Example
255
- # ---------
256
- # => 1525
257
- # => 03:25 pm
220
+ # @example
221
+ # => 1525
222
+ # => 03:25 pm
258
223
  #
259
224
  def self.hhmm
260
225
  return "#{hh}#{mm}"
@@ -274,32 +239,27 @@ module OpenSession
274
239
  # second of minute => 2 digits | [00] to [59]
275
240
  # tenth of second => 1 digit from [0] to [9]
276
241
  #
277
- # ---------
278
- # Example
279
- # ---------
280
- # => The time at the 562nd millisecond of the 49th
281
- # second of the 23rd minute of the 17th hour of
282
- # the day ( 17:23:49.562 )
242
+ # @example
243
+ # => The time at the 562nd millisecond of the 49th
244
+ # second of the 23rd minute of the 17th hour of
245
+ # the day ( 17:23:49.562 )
283
246
  #
284
- # => 8 chars
285
- # => 1723.495
247
+ # => 8 chars
248
+ # => 1723.495
286
249
  #
287
250
  def self.hhmm_sst
288
251
  return "#{hhmm}.#{sst}"
289
252
  end
290
253
 
291
254
 
255
+ # Return a string timestampt that is a period separated
256
+ # amalgam of the 2 digit year, 3 digit julian day, 2 digit
257
+ # hour, 2 digit minute, 2 digit second and 1 digit rounded
258
+ # down tenth of second.
292
259
  #
293
- # Return a period separated amalgam of the
294
- #
295
- # => 2 digit year and 3 digit julian day
296
- # => 4 digit hour/minute
297
- #
298
- # ---------
299
- # Example
300
- # ---------
301
- # => 19003.1025
302
- # => 10:25 am on January 3rd 2019
260
+ # @example
261
+ # => 19003.1025
262
+ # => 10:25 am on January 3rd 2019
303
263
  #
304
264
  #
305
265
  # Return the time of day to a TENTH of a second accuracy.
@@ -311,63 +271,86 @@ module OpenSession
311
271
  #
312
272
  # The 3 digits of the second segment comprise of
313
273
  #
314
- # second of minute => 2 digits | [00] to [59]
315
- # tenth of second => 1 digit from [0] to [9]
274
+ # - second of minute => 2 digits | [00] to [59]
275
+ # - tenth of second => 1 digit from [0] to [9]
316
276
  #
317
- # ---------
318
- # Example
319
- # ---------
320
- # => The time at the 562nd millisecond of the 49th
321
- # second of the 23rd minute of the 17th hour of
322
- # the day ( 17:23:49.562 )
277
+ # @example
278
+ # => The time at the 562nd millisecond of the 49th
279
+ # second of the 23rd minute of the 17th hour of
280
+ # the day ( 17:23:49.562 )
323
281
  #
324
- # => 8 chars
325
- # => 1723.495
282
+ # => 8 chars
283
+ # => 1723.495
326
284
  #
327
285
  def self.yyjjj_hhmm_sst
328
286
  return "#{yyjjj}.#{hhmm}.#{sst}"
329
287
  end
330
288
 
331
289
 
332
- # ----------------------------------------- -- #
333
- # Return the Rubyfied time zone being used. -- #
334
- # ----------------------------------------- -- #
290
+ # Return a string timestampt that is a period separated
291
+ # amalgam of the 2 digit year, 3 digit julian day, 2 digit
292
+ # hour, 2 digit minute, 2 digit second and <b>9 digit</b>
293
+ # nanosecond.
294
+ #
295
+ # @example
296
+ # return => 19003.1725.42.836592034
297
+ # 4 time => 17:25:42 am on January 3rd 2019
298
+ #
299
+ # As per the above example, the time returned
300
+ #
301
+ # - is the 836592034 <b>nanosecond</b>
302
+ # - of the 42nd <b>second</b>
303
+ # - of the 25th <b>minute</b>
304
+ # - of the 17th <b>hour</b>
305
+ # - of the 3rd <b>day</b>
306
+ # - of the 20th <b>year</b>
307
+ # - of the 21st <b>century</b>
308
+ #
309
+ # @return [String]
310
+ # Return the time of day to nanosecond accuracy.
311
+ # 23 characters are always returned with three (3) period
312
+ # separators at the 6th, 11th and 14th positions.
313
+ def self.yyjjj_hhmm_ss_nanosec
314
+ nanosec_str = Stamp.instance.time_now.strftime "%9N"
315
+ return "#{yyjjj}.#{hhmm}.#{ss}.#{nanosec_str}"
316
+ end
317
+
318
+
319
+ # Return the Rubyfied time zone being used.
335
320
  def self.zone
336
321
  return Stamp.instance.time_now.zone
337
322
  end
338
323
 
339
324
 
340
- # -------------------------------------------------- -- #
341
- # Log segments of time pertaining to the time stamp. -- #
342
- # -------------------------------------------------- -- #
325
+ # Log segments of time pertaining to the time stamp.
326
+ # @todo
327
+ # move method contents into test class
343
328
  def self.log_instance_time
344
329
 
345
- log.info(ere) { "[stamp] -------------- => -------------------------------- #" }
346
- log.info(ere) { "[stamp] eco time stamp => [#{Stamp.instance.time_now.ctime}]" }
347
- log.info(ere) { "[stamp] -------------- => -------------------------------- #" }
348
- log.info(ere) { "[stamp] Univ Time Zone => #{zone}" }
349
- log.info(ere) { "[stamp] Month Index is => #{mo}" }
350
- log.info(ere) { "[stamp] Month Name is => #{mmm}" }
351
- log.info(ere) { "[stamp] Day Of Week is => #{ddd}" }
352
- log.info(ere) { "[stamp] -------------- => -------------------------------- #" }
353
- log.info(ere) { "[stamp] Two Digit Year => #{yy}" }
354
- log.info(ere) { "[stamp] Julian Cal Day => #{jjj}" }
355
- log.info(ere) { "[stamp] Yr and Jul Day => #{yyjjj}" }
356
- log.info(ere) { "[stamp] Hour of Theday => #{hh}" }
357
- log.info(ere) { "[stamp] Minute of Hour => #{mm}" }
358
- log.info(ere) { "[stamp] Hour + Minute => #{hhmm}" }
359
- log.info(ere) { "[stamp] Second of Min => #{ss}" }
360
- log.info(ere) { "[stamp] 600 Min Slices => #{sst}" }
361
- log.info(ere) { "[stamp] -------------- => -------------------------------- #" }
362
- log.info(ere) { "[stamp] The Time Stamp => #{yyjjj_hhmm_sst}" }
363
- log.info(ere) { "[stamp] -------------- => -------------------------------- #" }
330
+ log.info(x) { "[stamp] -------------- => -------------------------------- #" }
331
+ log.info(x) { "[stamp] eco time stamp => [#{Stamp.instance.time_now.ctime}]" }
332
+ log.info(x) { "[stamp] -------------- => -------------------------------- #" }
333
+ log.info(x) { "[stamp] Univ Time Zone => #{zone}" }
334
+ log.info(x) { "[stamp] Month Index is => #{mo}" }
335
+ log.info(x) { "[stamp] Month Name is => #{mmm}" }
336
+ log.info(x) { "[stamp] Day Of Week is => #{ddd}" }
337
+ log.info(x) { "[stamp] -------------- => -------------------------------- #" }
338
+ log.info(x) { "[stamp] Two Digit Year => #{yy}" }
339
+ log.info(x) { "[stamp] Julian Cal Day => #{jjj}" }
340
+ log.info(x) { "[stamp] Yr and Jul Day => #{yyjjj}" }
341
+ log.info(x) { "[stamp] Hour of Theday => #{hh}" }
342
+ log.info(x) { "[stamp] Minute of Hour => #{mm}" }
343
+ log.info(x) { "[stamp] Hour + Minute => #{hhmm}" }
344
+ log.info(x) { "[stamp] Second of Min => #{ss}" }
345
+ log.info(x) { "[stamp] 600 Min Slices => #{sst}" }
346
+ log.info(x) { "[stamp] -------------- => -------------------------------- #" }
347
+ log.info(x) { "[stamp] The Time Stamp => #{yyjjj_hhmm_sst}" }
348
+ log.info(x) { "[stamp] -------------- => -------------------------------- #" }
364
349
 
365
350
  end
366
351
 
367
352
 
368
- # ------------------------------------------------------------ -- #
369
- # This singleton (one instance) class sets the time just once. -- #
370
- # ------------------------------------------------------------ -- #
353
+ # This singleton (one instance) class sets the time just once.
371
354
  def initialize
372
355
 
373
356
  @time_now = Time.now;
data/lib/using.txt CHANGED
@@ -13,6 +13,106 @@ swap disk/password=bettersecret
13
13
  lock
14
14
  (or push)
15
15
  ==============================================================================================
16
+ ==============================================================================================
17
+
18
+ On Curent Workstation
19
+ --------------------------
20
+ os copy config
21
+
22
+
23
+ Go to new Workstation
24
+ --------------------------
25
+ enter usb key/phone dir (wherever safe is)
26
+ sudo gem install opensecret
27
+ os safe /path/to/safe
28
+ os store /path/to/store (if different)
29
+ os paste config
30
+ (Now carry on as normal - no need for os init)
31
+
32
+
33
+ ==============================================================================================
34
+ ==============================================================================================
35
+
36
+ To Decommission from Workstation
37
+ ------------------------------------
38
+ os delete config
39
+
40
+ If necessary you can do
41
+ gem uninstall opensecret
42
+
43
+
44
+ ==============================================================================================
45
+ ==============================================================================================
46
+
47
+ To Backup
48
+ ------------------------------------
49
+ Create single backup reference number
50
+ Create huge symmetric key
51
+ Baseline each file with signature and date / time
52
+ os rekeys and takes direction on where to send crypted + amalgamated keystore and cryptstore
53
+ That goes to one backup location (even tape drive)
54
+
55
+ Then the machine config and othe sensitive items can be emailed - saved on phone - use os's rest services.
56
+
57
+ It emails you with a key wealth report.
58
+ If you bring them back together it will rebuild (restore) everything for you.
59
+
60
+ ==============================================================================================
61
+ ==============================================================================================
62
+
63
+
64
+
65
+
66
+
67
+ You can output in the key EAI data formats - the default is INI.
68
+
69
+ os read office/laptop # outputs all groups and key/value pairs (INI format)
70
+ os read office/laptop/login # outputs the login group and its key/value pairs (INI)
71
+ os read office/laptop/login/username # outputs only the secret value
72
+
73
+ os peek office/laptop # (secrets redacted) outputs groups and key/value pairs
74
+ os peek office/laptop/login # (secrets redacted) outputs login group and its keys
75
+ os peek office/laptop/login/username # exact mirror of full read command
76
+
77
+ Kiss and Tell
78
+ ==================
79
+ os kiss # taints the secret (and/or secret tree) prepping it for a tell (share)
80
+ os tell # send secret by sending keys os tell london/safe-houses
81
+
82
+ os put
83
+
84
+ os remove
85
+ os wipe
86
+ os open x/y (when packet exists)
87
+
88
+ os lock
89
+
90
+ os unlock (a file)
91
+ os undo
92
+ os zip
93
+ os push (after a zip or file locking operation)
94
+
95
+
96
+
97
+
98
+
99
+ ==============================================================================================
100
+ ==============================================================================================
101
+
102
+ Input
103
+ ======
104
+
105
+ file
106
+ use bash pipes
107
+ cli string
108
+ sensitive collection
109
+ zip files in folder
110
+ recursive zip with all lower folders
111
+
112
+
113
+
114
+ ==============================================================================================
115
+ ==============================================================================================
16
116
 
17
117
 
18
118
  open office/laptop --with=asdfasdflkhlkh