패키지, 저장소 및 앱 카테고리 검색

패키지 상세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 덕분에 네트워킹 기능에 집중하는 개발자에게 통합이 간편합니다.

사용 사례

  • 로컬 네트워크 스캔
  • 서브넷에서 장치 탐지
  • 진단을 위한 포트 스캔
  • 사물인터넷 장치 탐지
  • 네트워크 문제 해결

주요 기능

  • 크로스 플랫폼 지원
  • 서브넷 스캔
  • 열린 포트 탐지
  • 장치 열거
  • 플랫폼 채널 통합

적합한 대상

  • 네트워크 진단 앱
  • 사물인터넷 관리 도구
  • 시스템 모니터링 유틸리티
  • 네트워크 분석을 위한 개발 도구
  • 교육 네트워킹 프로젝트

고려 사항

  • 적절한 시스템 권한이 필요합니다
  • 일부 플랫폼에서는 루트/관리자 액세스가 필요할 수 있습니다
  • 성능은 네트워크 크기에 따라 달라집니다
  • 로컬 네트워크 범위에 제한됨
  • 기반 운영 체제의 네트워크 기능에 따라 달라짐

원본 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 개

소스 저장소

이 패키지를 사용하는 프로젝트