Commit graph

56 commits

Author SHA1 Message Date
Michał Sochoń
3c106096b9 Update port.rb 2016-08-25 19:57:41 +02:00
Michał Sochoń
8b6107c5b9 Update port.rb
fix comment section, expand example section
2016-08-25 17:03:41 +02:00
Alex Pop
353dcf10ec make netstat default for getting ports and get only listening ones 2016-08-12 16:02:56 +01:00
Steven Danna
13ebea48e1 Allow port to be specified as a string
This allows the user to write:

   describe port(22) do
     it { should be_listening }
   end

as well as

   describe port('22') do
     it { should be_listening }
   end

without hitting an error.

Fixes #867

Signed-off-by: Steven Danna <steve@chef.io>
2016-08-05 14:01:08 +02:00
Dominik Richter
c2f34932ad add port resource for windows 2008
using `netstat -an`
2016-07-21 14:58:43 +02:00
Dominik Richter
302a718b48 list arbitrary ports and query it
utilizing filter table to make port more flexible and useful.
2016-05-31 03:14:07 +02:00
Alex Pop
2a9d9b5481 return empty array instead of nil to be .each friendly 2016-05-11 22:21:22 +01:00
Anirudh Gupta
738ef69bcf prefixed hpux to cmd file name 2016-05-03 21:38:39 +05:30
Anirudh Gupta
d839f218bf hpux support for basic port properties 2016-05-03 14:30:59 +05:30
Christoph Hartmann
f50255486b add support for addresses in port resource 2016-03-19 11:48:14 +01:00
Adam Leff
577688a3a0 Placing all resources in the Inspec::Resources namespace
Many of the resources are named as a top-level class with a fairly generic class name, such as "OS". This causes an issue specifically with kitchen-google which depends on a gem which depends on the "os" gem which itself defines an OS class with a different superclass. This prevents users from using TK, Google Compute, and Inspec without this fix.

Some mocked commands had their digest changed as well due to the new indentation, specifically in the User and RegistryKey classes.

I strongly recommend viewing this diff with `git diff --ignore-space-change`
to see the *real* changes. :)
2016-03-08 13:40:16 -05:00
Christoph Hartmann
6ccfbe5e95 bugfix: use freebsd netstat parser instead of linux netstat parser for solaris 2016-01-28 21:08:52 +01:00
Christoph Hartmann
ef3dbbb35c improvement: make port parsing on solaris more reliable 2016-01-28 18:30:38 +01:00
Christoph Hartmann
678ee2b473 parse port information on solaris 10 and 11 via netstat 2016-01-28 18:30:38 +01:00
Christoph Hartmann
dd59dd9a5a use os.linux and os.windows where possible 2016-01-28 18:30:38 +01:00
Christoph Hartmann
b9978b5606 new rubocop fixes 2016-01-14 23:15:10 -05:00
Christoph Hartmann
46d85c2cbc fail test if lsof is not available 2016-01-14 23:03:51 -05:00
Jeremy W. Chalfant
98a7e6303e fix remaining rubocop complaints 2016-01-14 23:03:26 -05:00
Jeremy W. Chalfant
2d8c892298 use formmated lsof output to ensure accuracy and consistency across platforms 2016-01-14 23:03:26 -05:00
Jeremy W. Chalfant
94a286929f fix remaining rubocop complaints 2016-01-14 23:03:25 -05:00
Jeremy W. Chalfant
c8c676e1d6 use formmated lsof output to ensure accuracy and consistency across platforms 2016-01-14 23:03:25 -05:00
Jeremy W. Chalfant
88656c9ea8 fix remaining rubocop complaints 2016-01-14 23:03:25 -05:00
Jeremy W. Chalfant
b6649dd581 use formmated lsof output to ensure accuracy and consistency across platforms 2016-01-14 23:03:24 -05:00
Jeremy W. Chalfant
d51d86e6d8 disable cops 2016-01-14 23:03:24 -05:00
Jeremy W. Chalfant
6bdb06fbe9 move lsof parsing to seperate method 2016-01-14 23:03:24 -05:00
Jeremy W. Chalfant
3211071b9f simplify lsof call 2016-01-14 23:03:24 -05:00
Jeremy W. Chalfant
f817840d38 fix remaining rubocop complaints 2016-01-14 23:03:24 -05:00
Jeremy W. Chalfant
d855602efe use formmated lsof output to ensure accuracy and consistency across platforms 2016-01-14 23:03:23 -05:00
Mark Harrison
f5780b69a4 Correctly detect UDP ports on linux
netstat on UDP lines doesn't display a port state (e.g. LISTEN), so make this
field optional when parsing the netstat line.
2016-01-14 22:53:38 -05:00
Dominik Richter
4092691a78 lint 2016-01-15 04:07:25 +01:00
Stephan Renatus
652d51e9dc [resource/port] add port(addr, port) variant 2015-12-08 20:33:36 +01:00
Stephan Renatus
8532dd7034 [resource/port] change attribute names to plural, indicating arrays
see discussion in #256
2015-12-08 20:33:36 +01:00
Adam Leff
e0c356dae7 Adding support for Wind River Linux
WRL is used as the OS on Cisco Nexus devices and acts like a Red
Hat variant. These changes add support for WRL.
2015-12-03 17:41:11 -05:00
Christoph Hartmann
766fe47b87 add inline documentation 2015-12-01 10:56:47 +01:00
Christoph Hartmann
c6166e335b lint: fix lint error 2015-11-17 12:29:33 +01:00
Christoph Hartmann
850af710b0 improvement: add v6 protocol detection, it netstat does not deliver the information 2015-11-17 12:15:49 +01:00
Christoph Hartmann
9e3dccbfa3 improvement: restrice rescue to URI parse error 2015-11-17 12:14:05 +01:00
Christoph Hartmann
a4c47e1cd7 bugfix: fix regular expression to leave port colon 2015-11-17 12:12:59 +01:00
Christoph Hartmann
0de7549a64 lint: remove trailing whitespace 2015-11-16 21:44:12 +01:00
Christoph Hartmann
7898c1d29c improvement: optimize regular expression, catch parse errors and ignore header lines 2015-11-16 20:33:49 +01:00
Christoph Hartmann
83e6f46724 add centos support for port 2015-11-16 20:32:43 +01:00
Dominik Richter
b58a4b3f43 rename vulcanosec -> inspec 2015-10-26 12:34:15 +01:00
Christoph Hartmann
03f07e1a3e add to_s methods to resources, fixes #98 2015-10-12 13:01:58 +02:00
Christoph Hartmann
8fff2ee989 add author header 2015-10-06 18:55:44 +02:00
Dominik Richter
56d8379fc9 move all resources to use the command resource
Signed-off-by: Dominik Richter <dominik.richter@gmail.com>
2015-10-05 18:54:47 +02:00
Dominik Richter
ae10fefd15 fix warnings 2015-10-01 16:43:36 +02:00
Dominik Richter
9885e7683b lint port resource
Signed-off-by: Dominik Richter <dominik.richter@gmail.com>
2015-09-26 12:25:02 +02:00
Christoph Hartmann
968ed7a576 add todos for windows 2015-09-23 23:15:40 +02:00
Christoph Hartmann
476ac63036 return more detailed protocol information: tcp, udp, tcp6, udp6 2015-09-23 23:15:40 +02:00
Christoph Hartmann
563785d8a6 return arrays, since a port may run on multiple interfaces 2015-09-23 23:15:40 +02:00