console1984 0.1.25 → 0.1.27
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a951f175fb207d36a6168d764028fb24da119f989f041499b9633a6aed25890b
|
4
|
+
data.tar.gz: 663a88ab790f14e519f6aa0c9ee7ef783d95103172d155e18ef1ac2dfb7f2964
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e21283bde2bf50f13440a9ee3cb122b99df2a300df100286f6fc4fccfc47dd43a4e40a1aadc39ec39375abb3f07b33beeaa42262fb65721156eb433eabaf7d95
|
7
|
+
data.tar.gz: 46320a782db2126241c5bd6d9e30b7f241f53deac33546484a62ded0276abd01fafc3f6618d732e6743ee274ea9f664a9b7ed87829a0e07986563f57f9742ca1
|
data/config/protections.yml
CHANGED
@@ -20,17 +20,17 @@ module Console1984::InputOutput
|
|
20
20
|
|
21
21
|
Commands:
|
22
22
|
|
23
|
-
#{COMMANDS.collect { |command, help_line| "* #{
|
23
|
+
#{COMMANDS.collect { |command, help_line| "* #{Rainbow(command.to_s).blue}: #{help_line}" }.join("\n")}
|
24
24
|
|
25
25
|
TXT
|
26
26
|
end
|
27
27
|
|
28
28
|
def show_warning(message)
|
29
|
-
puts
|
29
|
+
puts Rainbow("\n#{message}\n").yellow
|
30
30
|
end
|
31
31
|
|
32
32
|
def ask_for_value(message)
|
33
|
-
puts
|
33
|
+
puts Rainbow("#{message}").green
|
34
34
|
reason = $stdin.gets.strip until reason.present?
|
35
35
|
reason
|
36
36
|
end
|
@@ -5,7 +5,7 @@ class Console1984::SessionsLogger::Database
|
|
5
5
|
attr_reader :current_session, :current_sensitive_access
|
6
6
|
|
7
7
|
def start_session(username, reason)
|
8
|
-
|
8
|
+
silence_logging_and_ensure_connected do
|
9
9
|
user = Console1984::User.find_or_create_by!(username: username)
|
10
10
|
@current_session = user.sessions.create!(reason: reason)
|
11
11
|
end
|
@@ -17,7 +17,7 @@ class Console1984::SessionsLogger::Database
|
|
17
17
|
end
|
18
18
|
|
19
19
|
def start_sensitive_access(justification)
|
20
|
-
|
20
|
+
silence_logging_and_ensure_connected do
|
21
21
|
@current_sensitive_access = current_session.sensitive_accesses.create! justification: justification
|
22
22
|
end
|
23
23
|
end
|
@@ -27,7 +27,7 @@ class Console1984::SessionsLogger::Database
|
|
27
27
|
end
|
28
28
|
|
29
29
|
def before_executing(statements)
|
30
|
-
|
30
|
+
silence_logging_and_ensure_connected do
|
31
31
|
@before_commands_count = @current_session.commands.count
|
32
32
|
record_statements statements
|
33
33
|
end
|
@@ -37,7 +37,7 @@ class Console1984::SessionsLogger::Database
|
|
37
37
|
end
|
38
38
|
|
39
39
|
def suspicious_commands_attempted(statements)
|
40
|
-
|
40
|
+
silence_logging_and_ensure_connected do
|
41
41
|
sensitive_access = start_sensitive_access "Suspicious commands attempted"
|
42
42
|
Console1984::Command.last.update! sensitive_access: sensitive_access
|
43
43
|
end
|
@@ -48,13 +48,20 @@ class Console1984::SessionsLogger::Database
|
|
48
48
|
@current_session.commands.create! statements: Array(statements).join("\n"), sensitive_access: current_sensitive_access
|
49
49
|
end
|
50
50
|
|
51
|
-
def
|
51
|
+
def silence_logging_and_ensure_connected(&block)
|
52
52
|
if Console1984.debug
|
53
|
-
block
|
53
|
+
ensure_connected(&block)
|
54
54
|
else
|
55
55
|
Console1984::IncinerationJob.logger.silence do
|
56
|
-
Console1984::Base.logger.silence
|
56
|
+
Console1984::Base.logger.silence do
|
57
|
+
ensure_connected(&block)
|
58
|
+
end
|
57
59
|
end
|
58
60
|
end
|
59
61
|
end
|
62
|
+
|
63
|
+
def ensure_connected(&block)
|
64
|
+
Console1984::Command.connection.reconnect! unless Console1984::Command.connection.active?
|
65
|
+
block.call
|
66
|
+
end
|
60
67
|
end
|
@@ -44,7 +44,7 @@ class Console1984::Supervisor
|
|
44
44
|
Kernel.silence_warnings do
|
45
45
|
require 'parser/current'
|
46
46
|
end
|
47
|
-
require '
|
47
|
+
require 'rainbow'
|
48
48
|
|
49
49
|
# Explicit lazy loading because it depends on +parser+, which we want to only load
|
50
50
|
# in console sessions.
|
data/lib/console1984/version.rb
CHANGED
metadata
CHANGED
@@ -1,17 +1,17 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: console1984
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.27
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jorge Manrubia
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-06-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name:
|
14
|
+
name: rainbow
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
17
|
- - ">="
|