mind_control 0.1.1 → 0.1.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 +4 -4
- data/bin/mind_control +16 -10
- data/lib/mind_control/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 696fd9a85294fbb472b51831c64e131ab2621f64
|
4
|
+
data.tar.gz: 71b19e9b4161993cef4dbe9961ff5cf847ce2c7b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bec3f47e955feeedf129024eb9f6024e3f6d070c92d989cf8514ccc299fcb1ea04cd5601fab483d49273c5f9a6449c97a2fd33cbf9c8acef9073134a2b030344
|
7
|
+
data.tar.gz: 0db81ab0f37875f0be3bcd3a186eea69d6a077a76bdbc32961ce2bb4a3408d5544c3fd502c40f0442fd9015c6e5ba7a15f9be7fd3e084ac0ccc5df3743b0629b
|
data/bin/mind_control
CHANGED
@@ -29,22 +29,28 @@ unless running_processes.any?
|
|
29
29
|
exit
|
30
30
|
end
|
31
31
|
|
32
|
-
|
32
|
+
filtered_processes =
|
33
33
|
# If filter given
|
34
34
|
if filter = ARGV[ 0 ]
|
35
|
-
# Filter processes by substring
|
36
|
-
|
37
|
-
|
38
|
-
# If filter matches 1 process -- connect to it, otherwise ask user to select process from filtered list
|
39
|
-
filtered_processes.size == 1 ? filtered_processes[ 0 ] : cui.select_process( filtered_processes )
|
35
|
+
# Filter processes by name substring and pid equality
|
36
|
+
running_processes.select { |p| p.name.include?( filter ) || p.pid.to_i == filter.to_i }
|
40
37
|
else
|
41
|
-
|
42
|
-
|
38
|
+
[]
|
39
|
+
end
|
40
|
+
|
41
|
+
# If filter matches 1 process -- connect to it,
|
42
|
+
# if filter matches > 1 processes -- ask user to select process from filtered processes,
|
43
|
+
# if filter matches no processes -- ask user to select process from all running processes.
|
44
|
+
selected_process =
|
45
|
+
case filtered_processes.size
|
46
|
+
when 1 then filtered_processes[ 0 ]
|
47
|
+
when 0 then cui.select_process( running_processes )
|
48
|
+
else cui.select_process( filtered_processes )
|
43
49
|
end
|
44
50
|
|
45
51
|
begin
|
46
|
-
cui.show_debug "Connecting to #{
|
47
|
-
MindControl::Client.connect(
|
52
|
+
cui.show_debug "Connecting to #{selected_process.name} via #{selected_process.socket} ..."
|
53
|
+
MindControl::Client.connect( selected_process )
|
48
54
|
rescue Exception => e
|
49
55
|
cui.show_error e.message
|
50
56
|
end
|
data/lib/mind_control/version.rb
CHANGED