パッケージ、リポジトリ、アプリカテゴリを検索

パッケージ詳細v6.0.18

network_tools

開いているポートやサブネット上のデバイスなどを発見するのに役立つネットワーキングツールライブラリです。

AndroidiOSmacOSWindowsLinux
30日間ダウンロード
1万
いいね数
57
Pub ポイント
160

パッケージをインストール

flutter pub add network_tools

パッケージ概要

公開情報に基づく選定ガイドです。参考としてご利用ください。

network_tools パッケージは、ネットワークの発見と診断を支援するための Flutterユーティリティライブラリです。開発者がサブネットをスキャンし、オープンポートを検出、ローカルネットワーク上のデバイスを特定できるようにします。クロスプラットフォーム対応で、Android、iOS、macOS、Windows、Linuxをサポートしており、低レベルなネットワーク操作が必要なアプリケーションに最適です。プラットフォームチャネルを通じてネイティブプラットフォーム機能を利用することで、あらゆる環境で信頼性の高いパフォーマンスを実現しています。ネットワークモニタリング、IoTデバイス検出、トラブルシューティングツールなどに特に役立ちます。軽量な設計と直感的なAPIにより、ネットワーキング機能に焦点を当てた開発者にとって統合が簡単です。

用途

  • ローカルネットワークスキャン
  • サブネット上のデバイスの発見
  • 診断のためのポートスキャン
  • IoTデバイス検出
  • ネットワークトラブルシューティング

主な機能

  • クロスプラットフォーム対応
  • サブネットスキャン
  • ポートのオープン検出
  • デバイスの列挙
  • プラットフォームチャネル統合

適している対象

  • ネットワーク診断アプリ
  • IoT管理ツール
  • システム監視ユーティリティ
  • ネットワーク分析用の開発ツール
  • 教育ネットワーキングプロジェクト

注意事項

  • 適切なシステム権限が必要です
  • 一部のプラットフォームでは、ルート/管理者アクセスが必要になる場合があります
  • パフォーマンスはネットワークのサイズによって異なります
  • ローカルネットワークの範囲に限定
  • 下位のOSのネットワーク機能に依存する

元の README

関連するソースリポジトリの README 原文のスナップショットです。最新の内容はリポジトリをご覧ください。

Cross Platform Network Tools

pub package Dart Code Coverage codecov

Network Tools Supported

  1. Host Scanner

    1. Search all devices on subnet
    2. Get mac address of devices on Linux, macOS and Windows.
    3. Search devices for a specific port open.
  2. Port Scanner

    1. Single Port scan
    2. Range
    3. Custom

Partly Work:

  1. Mdns Scanner

Network Tools Flutter package

Please check network_tools_flutter package for extensive support to features on different platforms.

Import package in your app

import 'package:network_tools/network_tools.dart';

Configure network tools in main function

For dart native
Future<void> main() async {
  await configureNetworkTools('build', enableDebugging: true);
  runApp(const MyApp());
}
For flutter apps
Future<void> main() async {
  WidgetsFlutterBinding.ensureInitialized();
  // It's necessary to pass correct path to be able to use this library.
  final appDocDirectory = await getApplicationDocumentsDirectory();
  await configureNetworkTools(appDocDirectory.path, enableDebugging: true);
  runApp(const MyApp());
}

Usage

Host Scanner
 String address = '192.168.1.12';
  // or You can also get address using network_info_plus package
  // final String? address = await (NetworkInfo().getWifiIP());
  final String subnet = address.substring(0, address.lastIndexOf('.'));
  final stream = HostScannerService.instance.getAllPingableDevices(subnet, firstHostId: 1, lastHostId: 50,
      progressCallback: (progress) {
    print('Progress for host discovery : $progress');
  });

  stream.listen((host) {
    //Same host can be emitted multiple times
    //Use Set<ActiveHost> instead of List<ActiveHost>
    print('Found device: $host');
  }, onDone: () {
    print('Scan completed');
  }); // Don't forget to cancel the stream when not in use.
Port Scanner
  //1. Range
  String target = '192.168.1.1';
  PortScannerService.instance.scanPortsForSingleDevice(target, startPort: 1, endPort: 1024,
      progressCallback: (progress) {
    print('Progress for port discovery : $progress');
  }).listen((ActiveHost event) {
    if (event.openPorts.isNotEmpty) {
      print('Found open ports : ${event.openPorts}');
    }
  }, onDone: () {
    print('Scan completed');
  });
  //2. Single
  bool isOpen = (await PortScanner.isOpen(target, 80)) == null;
  //3. Custom
  PortScanner.customDiscover(target, portList: const [22, 80, 139]);
Mdns Scanner
  for (final ActiveHost activeHost in await MdnsScannerService.instance.searchMdnsDevices()) {
    final MdnsInfo? mdnsInfo = await activeHost.mdnsInfo;
    print('''
    Address: ${activeHost.address}
    Port: ${mdnsInfo!.mdnsPort}
    ServiceType: ${mdnsInfo.mdnsServiceType}
    MdnsName: ${mdnsInfo.getOnlyTheStartOfMdnsName()}
    ''');
  }
Run examples
  1. Run host scan : dart example/host_scan.dart
  2. Run port scan : dart example/port_scan.dart
  3. Run mdns scan : dart example/mdns_scan.dart

Sample App

Vernet is the open source app built on top of this library. You can check out the code and implementation for more detailed use case of this package.

Support and Donate

  1. Support this project by becoming stargazer of this project.

  2. Buy me a coffee.

    Librepay
    Donate using Liberapay
  3. Support me on Ko-Fi

    ko-fi

Inspired from ping_discover_network

カテゴリー

依存関係

依存関係一覧 12 件

ソースリポジトリ

このパッケージを使用しているプロジェクト