Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

lan_scanner

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

lan_scanner

  • 0.0.5
  • Rubygems
  • Socket score

Version published
Maintainers
1
Created
Source

lan_scanner

Gem downloads License: MIT

The very basic ruby gem to scan your LAN for devices

Based on nmap.

Contents

Usage

Find online devices in LAN

require 'lan_scanner'

# examples with explicit default parameters
devices = LanScanner.scan_devices network: '192.168.178.0/24'
# => [LanScanner::Device, LanScanner::Device, ...]

devices.each do |d|
  puts "=================================================="
  puts "Found device on #{d.remote_address}"
  puts
  puts "Hostname: #{d.host_name}"
  puts
  # =================================================="
  # Found device on 192.168.178.20
  # 
  # Hostname: Windows-PC
  # 
end

Get state of devices in LAN

require 'lan_scanner'

devices = LanScanner.scan_device_states %w[192.168.178.1 192.168.178.22 192.168.178.44], expensive: true
# => [LanScanner::Device, LanScanner::Device, ...]

devices.each do |d|
  puts "#{d.remote_address} -> #{d.host_name} (#{d.state})"
end
# 192.168.178.1 -> server.domain (up)
# 192.168.178.22 -> mycomputer.domain (up)
# 192.168.178.44 -> (down)

Installation

NMAP

This gem is based on nmap. So you need to install nmap before and ensure it is available via command line (added to PATH environment variable).

To check if you have installed nmap correctly, run the following command on a terminal

nmap --version

and you should get some version information. After, you are ready to install the ruby gem.

Gem

Add this line to your application's Gemfile:

gem 'lan_scanner'

And then execute:

$ bundle install

Or install it yourself by:

$ gem install lan_scanner

Documentation

Check out the doc at RubyDoc https://www.rubydoc.info/gems/lan_scanner

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/magynhard/lan_scanner. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.

FAQs

Package last updated on 01 Jan 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc