Last updated:
0 purchases
network tools
Network Tools #
Network Tools Supported
Host Scanner
Search all devices on subnet
Get mac address of devices on Linux, macOS and Windows.
Search devices for a specific port open.
Port Scanner
Single Port scan
Range
Custom
Partly Work:
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';
copied to clipboard
Configure network tools in main function #
For dart native #
Future<void> main() async {
await configureNetworkTools('build', enableDebugging: true);
runApp(const MyApp());
}
copied to clipboard
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());
}
copied to clipboard
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.
copied to clipboard
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]);
copied to clipboard
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()}
''');
}
copied to clipboard
Run examples #
Run host scan : dart example/host_scan.dart
Run port scan : dart example/port_scan.dart
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 #
Support this project by becoming stargazer of this project.
Buy me a coffee.
Librepay
Support me on Ko-Fi
Inspired from ping_discover_network
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.