-
-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #186 from osociety/dev
Dev -> Main
- Loading branch information
Showing
24 changed files
with
478 additions
and
227 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
{ | ||
"version": "0.2.0", | ||
"configurations": [ | ||
{ | ||
"name": "host scan", | ||
"program": "${workspaceFolder}/example/lib/scan/host_scan.dart", | ||
"request": "launch", | ||
"type": "dart" | ||
}, | ||
{ | ||
"name": "mdns scan", | ||
"program": "${workspaceFolder}/example/lib/scan/mdns_scan.dart", | ||
"request": "launch", | ||
"type": "dart" | ||
}, | ||
{ | ||
"name": "port scan", | ||
"program": "${workspaceFolder}/example/lib/scan/port_scan.dart", | ||
"request": "launch", | ||
"type": "dart" | ||
}, | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,7 +22,6 @@ analyzer: | |
- "**/*.pbjson.dart" | ||
- "**/*.gr.dart" | ||
- "**/*.md" | ||
- "example/**" | ||
|
||
linter: | ||
rules: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,8 @@ | ||
void main() { | ||
// ignore: avoid_print | ||
print("Run host scan : 'dart example/lib/scan/host_scan.dart'"); | ||
// ignore: avoid_print | ||
print("Run port scan : 'dart example/lib/scan/port_scan.dart'"); | ||
// ignore: avoid_print | ||
print("Run mdns scan : 'dart example/lib/scan/mdns_scan.dart'"); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,54 +1,21 @@ | ||
/// Network tools base library | ||
library network_tools; | ||
|
||
import 'package:get_it/get_it.dart'; | ||
import 'package:logging/logging.dart'; | ||
import 'package:network_tools/injectable.dart'; | ||
import 'package:network_tools/src/device_info/vendor_table.dart'; | ||
import 'package:network_tools/src/network_tools_utils.dart'; | ||
import 'package:network_tools/src/services/arp_service.dart'; | ||
|
||
export 'src/configure_dart_native.dart'; | ||
export 'src/device_info/net_interface.dart'; | ||
export 'src/device_info/vendor_table.dart'; | ||
export 'src/host_scanner.dart'; | ||
export 'src/mdns_scanner/list_of_srv_records.dart'; | ||
export 'src/mdns_scanner/mdns_scanner.dart'; | ||
export 'src/models/active_host.dart'; | ||
export 'src/models/arp_data.dart'; | ||
export 'src/models/callbacks.dart'; | ||
export 'src/models/mdns_info.dart'; | ||
export 'src/models/open_port.dart'; | ||
export 'src/models/sendable_active_host.dart'; | ||
export 'src/models/vendor.dart'; | ||
export 'src/port_scanner.dart'; | ||
|
||
final _getIt = GetIt.instance; | ||
late bool _enableDebugging; | ||
|
||
late String _dbDirectory; | ||
export 'src/services/host_scanner_service.dart'; | ||
export 'src/services/mdns_scanner_service.dart'; | ||
export 'src/services/port_scanner_service.dart'; | ||
|
||
String get dbDirectory => _dbDirectory; | ||
bool get enableDebugging => _enableDebugging; | ||
late bool enableDebugging; | ||
|
||
Future<void> configureNetworkTools( | ||
String dbDirectory, { | ||
bool enableDebugging = false, | ||
}) async { | ||
_enableDebugging = enableDebugging; | ||
_dbDirectory = dbDirectory; | ||
if (enableDebugging) { | ||
Logger.root.level = Level.FINE; | ||
Logger.root.onRecord.listen((record) { | ||
if (record.loggerName == log.name) { | ||
// ignore: avoid_print | ||
print( | ||
'${record.time.toLocal()}: ${record.level.name}: ${record.loggerName}: ${record.message}', | ||
); | ||
} | ||
}); | ||
} | ||
configureDependencies(); | ||
final arpService = await _getIt<ARPService>().open(); | ||
await arpService.buildTable(); | ||
await VendorTable.createVendorTableMap(); | ||
} | ||
late String dbDirectory; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import 'package:logging/logging.dart'; | ||
import 'package:network_tools/network_tools.dart' as pacakges_page; | ||
import 'package:network_tools/src/network_tools_utils.dart'; | ||
import 'package:network_tools/src/services/arp_service.dart'; | ||
import 'package:network_tools/src/services/impls/arp_service_sembast_impl.dart'; | ||
import 'package:network_tools/src/services/impls/host_scanner_service_impl.dart'; | ||
import 'package:network_tools/src/services/impls/mdns_scanner_service_impl.dart'; | ||
import 'package:network_tools/src/services/impls/port_scanner_service_impl.dart'; | ||
|
||
Future<void> configureNetworkTools( | ||
String dbDirectory, { | ||
bool enableDebugging = false, | ||
}) async { | ||
pacakges_page.enableDebugging = enableDebugging; | ||
pacakges_page.dbDirectory = dbDirectory; | ||
|
||
if (pacakges_page.enableDebugging) { | ||
Logger.root.level = Level.FINE; | ||
Logger.root.onRecord.listen((record) { | ||
if (record.loggerName == log.name) { | ||
// ignore: avoid_print | ||
print( | ||
'${record.time.toLocal()}: ${record.level.name}: ${record.loggerName}: ${record.message}', | ||
); | ||
} | ||
}); | ||
} | ||
|
||
/// Setting dart native classes implementations | ||
ARPServiceSembastImpl(); | ||
HostScannerServiceImpl(); | ||
PortScannerServiceImpl(); | ||
MdnsScannerServiceImpl(); | ||
|
||
final arpService = await ARPService.instance.open(); | ||
await arpService.buildTable(); | ||
await pacakges_page.VendorTable.createVendorTableMap(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.