fosl 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +7 -0
  2. data/lib/fosl/parser.rb +10 -4
  3. data/lib/fosl/process.rb +3 -1
  4. metadata +20 -44
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 979326cbafca987c5f641c6f2c7a221a7795de16
4
+ data.tar.gz: 98dd5a7fb76bccc40e231e2b38f36af7cb2e2a74
5
+ SHA512:
6
+ metadata.gz: cba361cb6df95a33c113f3850cc828627b7a5d4433191e3909e69e15998e53646b2a73dc1d1e3134bf6c9c1f3b7da53bac6ccd24ff8c5d25f2d87bb6eed04355
7
+ data.tar.gz: 17645a1085581d228abb7088c7005c86049e3956e03915c833f7b32f21cca4ab781094931f8340f493742de1976dff21774d0e2189ac2bd6557b1e1a850a9bd5
@@ -4,7 +4,7 @@ require "fosl/process"
4
4
  class FOSL::Parser
5
5
  # Fields are separated by newlines or null
6
6
  # Fields start with a character followed by the data
7
-
7
+
8
8
  # These are the fields according to the lsof manpage.
9
9
  # If you want to implement one, you should write a 'parse_<field letter>'
10
10
  # method. It should return a hash of key => value you want to save.
@@ -69,7 +69,7 @@ class FOSL::Parser
69
69
  end
70
70
 
71
71
  # the pid
72
- def parse_p(data)
72
+ def parse_p(data)
73
73
  new_pid(data.to_i)
74
74
  return :new_pid
75
75
  end
@@ -80,7 +80,7 @@ class FOSL::Parser
80
80
  end
81
81
 
82
82
  # file descriptor (or 'cwd' etc...)
83
- def parse_f(data)
83
+ def parse_f(data)
84
84
  new_file
85
85
 
86
86
  # Convert to int it looks like a number.
@@ -97,6 +97,12 @@ class FOSL::Parser
97
97
  return nil
98
98
  end
99
99
 
100
+ # The login name
101
+ def parse_L(data)
102
+ @current_process.login = data
103
+ return nil
104
+ end
105
+
100
106
  # state helper, creates a new process
101
107
  def new_pid(pid)
102
108
  new_file # push the last file (if any) onto the last process
@@ -152,7 +158,7 @@ class FOSL::Parser
152
158
  # Example:
153
159
  # lsof("-i :443")
154
160
  def lsof(args="")
155
- output = `lsof -F PcfntT0 #{args}`
161
+ output = `lsof -F PcfntT0L #{args}`
156
162
  # Should we raise an exception, or just return empty results, on failure?
157
163
  if $?.exitstatus != 0
158
164
  raise "lsof exited with status #{$?.exitstatus}"
@@ -4,15 +4,17 @@ class FOSL::Process
4
4
  attr_reader :files
5
5
  attr_reader :pid
6
6
  attr_accessor :command
7
+ attr_accessor :login
7
8
 
8
9
  def initialize(pid)
9
10
  @command = nil
11
+ @login = nil
10
12
  @pid = pid
11
13
  @files = []
12
14
  end
13
15
 
14
16
  # helpers
15
- def listeners
17
+ def listeners
16
18
  @files.find_all { |f| f[:state] == "LISTEN" }
17
19
  end
18
20
  end # class FOSL::Process
metadata CHANGED
@@ -1,70 +1,46 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: fosl
3
- version: !ruby/object:Gem::Version
4
- hash: 29
5
- prerelease:
6
- segments:
7
- - 0
8
- - 0
9
- - 1
10
- version: 0.0.1
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.2
11
5
  platform: ruby
12
- authors:
6
+ authors:
13
7
  - Jordan Sissel
14
8
  autorequire:
15
9
  bindir: bin
16
10
  cert_chain: []
17
-
18
- date: 2011-03-18 00:00:00 -07:00
19
- default_executable:
11
+ date: 2015-07-24 00:00:00.000000000 Z
20
12
  dependencies: []
21
-
22
- description: ""
13
+ description: ''
23
14
  email: jls@semicomplete.com
24
15
  executables: []
25
-
26
16
  extensions: []
27
-
28
17
  extra_rdoc_files: []
29
-
30
- files:
31
- - lib/fosl/parser.rb
18
+ files:
32
19
  - lib/fosl/namespace.rb
20
+ - lib/fosl/parser.rb
33
21
  - lib/fosl/process.rb
34
- has_rdoc: true
35
22
  homepage: https://github.com/jordansissel/ruby-lsof
36
23
  licenses: []
37
-
24
+ metadata: {}
38
25
  post_install_message:
39
26
  rdoc_options: []
40
-
41
- require_paths:
27
+ require_paths:
42
28
  - lib
43
29
  - lib
44
- required_ruby_version: !ruby/object:Gem::Requirement
45
- none: false
46
- requirements:
30
+ required_ruby_version: !ruby/object:Gem::Requirement
31
+ requirements:
47
32
  - - ">="
48
- - !ruby/object:Gem::Version
49
- hash: 3
50
- segments:
51
- - 0
52
- version: "0"
53
- required_rubygems_version: !ruby/object:Gem::Requirement
54
- none: false
55
- requirements:
33
+ - !ruby/object:Gem::Version
34
+ version: '0'
35
+ required_rubygems_version: !ruby/object:Gem::Requirement
36
+ requirements:
56
37
  - - ">="
57
- - !ruby/object:Gem::Version
58
- hash: 3
59
- segments:
60
- - 0
61
- version: "0"
38
+ - !ruby/object:Gem::Version
39
+ version: '0'
62
40
  requirements: []
63
-
64
41
  rubyforge_project:
65
- rubygems_version: 1.5.1
42
+ rubygems_version: 2.4.8
66
43
  signing_key:
67
- specification_version: 3
44
+ specification_version: 4
68
45
  summary: fosl - a ruby api for reading lsof(1) output
69
46
  test_files: []
70
-