lanscape 1.3.2a11__tar.gz → 1.3.3__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {lanscape-1.3.2a11/lanscape.egg-info → lanscape-1.3.3}/PKG-INFO +3 -3
- {lanscape-1.3.2a11 → lanscape-1.3.3}/README.md +2 -2
- {lanscape-1.3.2a11 → lanscape-1.3.3}/lanscape/libraries/logger.py +3 -2
- {lanscape-1.3.2a11 → lanscape-1.3.3}/lanscape/libraries/runtime_args.py +4 -5
- {lanscape-1.3.2a11 → lanscape-1.3.3/lanscape.egg-info}/PKG-INFO +3 -3
- {lanscape-1.3.2a11 → lanscape-1.3.3}/lanscape.egg-info/SOURCES.txt +1 -0
- {lanscape-1.3.2a11 → lanscape-1.3.3}/pyproject.toml +1 -1
- lanscape-1.3.3/tests/test_logging.py +55 -0
- {lanscape-1.3.2a11 → lanscape-1.3.3}/tests/test_utils.py +3 -4
- {lanscape-1.3.2a11 → lanscape-1.3.3}/LICENSE +0 -0
- {lanscape-1.3.2a11 → lanscape-1.3.3}/MANIFEST.in +0 -0
- {lanscape-1.3.2a11 → lanscape-1.3.3}/lanscape/__init__.py +0 -0
- {lanscape-1.3.2a11 → lanscape-1.3.3}/lanscape/__main__.py +0 -0
- {lanscape-1.3.2a11 → lanscape-1.3.3}/lanscape/libraries/__init__.py +0 -0
- {lanscape-1.3.2a11 → lanscape-1.3.3}/lanscape/libraries/app_scope.py +0 -0
- {lanscape-1.3.2a11 → lanscape-1.3.3}/lanscape/libraries/decorators.py +0 -0
- {lanscape-1.3.2a11 → lanscape-1.3.3}/lanscape/libraries/errors.py +0 -0
- {lanscape-1.3.2a11 → lanscape-1.3.3}/lanscape/libraries/ip_parser.py +0 -0
- {lanscape-1.3.2a11 → lanscape-1.3.3}/lanscape/libraries/mac_lookup.py +0 -0
- {lanscape-1.3.2a11 → lanscape-1.3.3}/lanscape/libraries/net_tools.py +0 -0
- {lanscape-1.3.2a11 → lanscape-1.3.3}/lanscape/libraries/port_manager.py +0 -0
- {lanscape-1.3.2a11 → lanscape-1.3.3}/lanscape/libraries/scan_config.py +0 -0
- {lanscape-1.3.2a11 → lanscape-1.3.3}/lanscape/libraries/service_scan.py +0 -0
- {lanscape-1.3.2a11 → lanscape-1.3.3}/lanscape/libraries/subnet_scan.py +0 -0
- {lanscape-1.3.2a11 → lanscape-1.3.3}/lanscape/libraries/version_manager.py +0 -0
- {lanscape-1.3.2a11 → lanscape-1.3.3}/lanscape/libraries/web_browser.py +0 -0
- {lanscape-1.3.2a11 → lanscape-1.3.3}/lanscape/resources/mac_addresses/convert_csv.py +0 -0
- {lanscape-1.3.2a11 → lanscape-1.3.3}/lanscape/resources/mac_addresses/mac_db.json +0 -0
- {lanscape-1.3.2a11 → lanscape-1.3.3}/lanscape/resources/ports/convert_csv.py +0 -0
- {lanscape-1.3.2a11 → lanscape-1.3.3}/lanscape/resources/ports/full.json +0 -0
- {lanscape-1.3.2a11 → lanscape-1.3.3}/lanscape/resources/ports/large.json +0 -0
- {lanscape-1.3.2a11 → lanscape-1.3.3}/lanscape/resources/ports/medium.json +0 -0
- {lanscape-1.3.2a11 → lanscape-1.3.3}/lanscape/resources/ports/small.json +0 -0
- {lanscape-1.3.2a11 → lanscape-1.3.3}/lanscape/resources/services/definitions.jsonc +0 -0
- {lanscape-1.3.2a11 → lanscape-1.3.3}/lanscape/ui/app.py +0 -0
- {lanscape-1.3.2a11 → lanscape-1.3.3}/lanscape/ui/blueprints/__init__.py +0 -0
- {lanscape-1.3.2a11 → lanscape-1.3.3}/lanscape/ui/blueprints/api/__init__.py +0 -0
- {lanscape-1.3.2a11 → lanscape-1.3.3}/lanscape/ui/blueprints/api/port.py +0 -0
- {lanscape-1.3.2a11 → lanscape-1.3.3}/lanscape/ui/blueprints/api/scan.py +0 -0
- {lanscape-1.3.2a11 → lanscape-1.3.3}/lanscape/ui/blueprints/api/tools.py +0 -0
- {lanscape-1.3.2a11 → lanscape-1.3.3}/lanscape/ui/blueprints/web/__init__.py +0 -0
- {lanscape-1.3.2a11 → lanscape-1.3.3}/lanscape/ui/blueprints/web/routes.py +0 -0
- {lanscape-1.3.2a11 → lanscape-1.3.3}/lanscape/ui/main.py +0 -0
- {lanscape-1.3.2a11 → lanscape-1.3.3}/lanscape/ui/static/css/style.css +0 -0
- {lanscape-1.3.2a11 → lanscape-1.3.3}/lanscape/ui/static/img/ico/android-chrome-192x192.png +0 -0
- {lanscape-1.3.2a11 → lanscape-1.3.3}/lanscape/ui/static/img/ico/android-chrome-512x512.png +0 -0
- {lanscape-1.3.2a11 → lanscape-1.3.3}/lanscape/ui/static/img/ico/apple-touch-icon.png +0 -0
- {lanscape-1.3.2a11 → lanscape-1.3.3}/lanscape/ui/static/img/ico/favicon-16x16.png +0 -0
- {lanscape-1.3.2a11 → lanscape-1.3.3}/lanscape/ui/static/img/ico/favicon-32x32.png +0 -0
- {lanscape-1.3.2a11 → lanscape-1.3.3}/lanscape/ui/static/img/ico/favicon.ico +0 -0
- {lanscape-1.3.2a11 → lanscape-1.3.3}/lanscape/ui/static/img/ico/site.webmanifest +0 -0
- {lanscape-1.3.2a11 → lanscape-1.3.3}/lanscape/ui/static/js/core.js +0 -0
- {lanscape-1.3.2a11 → lanscape-1.3.3}/lanscape/ui/static/js/layout-sizing.js +0 -0
- {lanscape-1.3.2a11 → lanscape-1.3.3}/lanscape/ui/static/js/main.js +0 -0
- {lanscape-1.3.2a11 → lanscape-1.3.3}/lanscape/ui/static/js/on-tab-close.js +0 -0
- {lanscape-1.3.2a11 → lanscape-1.3.3}/lanscape/ui/static/js/quietReload.js +0 -0
- {lanscape-1.3.2a11 → lanscape-1.3.3}/lanscape/ui/static/js/shutdown-server.js +0 -0
- {lanscape-1.3.2a11 → lanscape-1.3.3}/lanscape/ui/static/js/subnet-info.js +0 -0
- {lanscape-1.3.2a11 → lanscape-1.3.3}/lanscape/ui/static/js/subnet-selector.js +0 -0
- {lanscape-1.3.2a11 → lanscape-1.3.3}/lanscape/ui/static/lanscape.webmanifest +0 -0
- {lanscape-1.3.2a11 → lanscape-1.3.3}/lanscape/ui/templates/base.html +0 -0
- {lanscape-1.3.2a11 → lanscape-1.3.3}/lanscape/ui/templates/core/head.html +0 -0
- {lanscape-1.3.2a11 → lanscape-1.3.3}/lanscape/ui/templates/core/scripts.html +0 -0
- {lanscape-1.3.2a11 → lanscape-1.3.3}/lanscape/ui/templates/error.html +0 -0
- {lanscape-1.3.2a11 → lanscape-1.3.3}/lanscape/ui/templates/info.html +0 -0
- {lanscape-1.3.2a11 → lanscape-1.3.3}/lanscape/ui/templates/main.html +0 -0
- {lanscape-1.3.2a11 → lanscape-1.3.3}/lanscape/ui/templates/scan/export.html +0 -0
- {lanscape-1.3.2a11 → lanscape-1.3.3}/lanscape/ui/templates/scan/ip-table-row.html +0 -0
- {lanscape-1.3.2a11 → lanscape-1.3.3}/lanscape/ui/templates/scan/ip-table.html +0 -0
- {lanscape-1.3.2a11 → lanscape-1.3.3}/lanscape/ui/templates/scan/overview.html +0 -0
- {lanscape-1.3.2a11 → lanscape-1.3.3}/lanscape/ui/templates/scan/scan-error.html +0 -0
- {lanscape-1.3.2a11 → lanscape-1.3.3}/lanscape/ui/templates/scan.html +0 -0
- {lanscape-1.3.2a11 → lanscape-1.3.3}/lanscape/ui/templates/shutdown.html +0 -0
- {lanscape-1.3.2a11 → lanscape-1.3.3}/lanscape.egg-info/dependency_links.txt +0 -0
- {lanscape-1.3.2a11 → lanscape-1.3.3}/lanscape.egg-info/requires.txt +0 -0
- {lanscape-1.3.2a11 → lanscape-1.3.3}/lanscape.egg-info/top_level.txt +0 -0
- {lanscape-1.3.2a11 → lanscape-1.3.3}/setup.cfg +0 -0
- {lanscape-1.3.2a11 → lanscape-1.3.3}/tests/test_api.py +0 -0
- {lanscape-1.3.2a11 → lanscape-1.3.3}/tests/test_env.py +0 -0
- {lanscape-1.3.2a11 → lanscape-1.3.3}/tests/test_library.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: lanscape
|
|
3
|
-
Version: 1.3.
|
|
3
|
+
Version: 1.3.3
|
|
4
4
|
Summary: A python based local network scanner
|
|
5
5
|
Author-email: Michael Dennis <michael@dipduo.com>
|
|
6
6
|
License-Expression: MIT
|
|
@@ -37,7 +37,7 @@ python -m lanscape
|
|
|
37
37
|
- `--port <port number>` port of the flask app (default: automagic)
|
|
38
38
|
- `--persistent` dont shutdown server when browser tab is closed (default: false)
|
|
39
39
|
- `--reloader` essentially flask debug mode- good for local development (default: false)
|
|
40
|
-
- `--logfile
|
|
40
|
+
- `--logfile <path>` save log output to the given file path
|
|
41
41
|
- `--loglevel <level>` set the logger's log level (default: INFO)
|
|
42
42
|
- `--flask-logging` turn on flask logging (default: false)
|
|
43
43
|
|
|
@@ -45,7 +45,7 @@ Examples:
|
|
|
45
45
|
```shell
|
|
46
46
|
python -m lanscape --reloader
|
|
47
47
|
python -m lanscape --port 5002
|
|
48
|
-
python -m lanscape --logfile --loglevel DEBUG
|
|
48
|
+
python -m lanscape --logfile /tmp/lanscape.log --loglevel DEBUG
|
|
49
49
|
```
|
|
50
50
|
|
|
51
51
|
## Troubleshooting
|
|
@@ -13,7 +13,7 @@ python -m lanscape
|
|
|
13
13
|
- `--port <port number>` port of the flask app (default: automagic)
|
|
14
14
|
- `--persistent` dont shutdown server when browser tab is closed (default: false)
|
|
15
15
|
- `--reloader` essentially flask debug mode- good for local development (default: false)
|
|
16
|
-
- `--logfile
|
|
16
|
+
- `--logfile <path>` save log output to the given file path
|
|
17
17
|
- `--loglevel <level>` set the logger's log level (default: INFO)
|
|
18
18
|
- `--flask-logging` turn on flask logging (default: false)
|
|
19
19
|
|
|
@@ -21,7 +21,7 @@ Examples:
|
|
|
21
21
|
```shell
|
|
22
22
|
python -m lanscape --reloader
|
|
23
23
|
python -m lanscape --port 5002
|
|
24
|
-
python -m lanscape --logfile --loglevel DEBUG
|
|
24
|
+
python -m lanscape --logfile /tmp/lanscape.log --loglevel DEBUG
|
|
25
25
|
```
|
|
26
26
|
|
|
27
27
|
## Troubleshooting
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import logging
|
|
2
2
|
from logging.handlers import RotatingFileHandler
|
|
3
3
|
import click
|
|
4
|
+
from typing import Optional
|
|
4
5
|
|
|
5
6
|
|
|
6
|
-
def configure_logging(loglevel: str, logfile:
|
|
7
|
+
def configure_logging(loglevel: str, logfile: Optional[str], flask_logging: bool = False) -> None:
|
|
7
8
|
numeric_level = getattr(logging, loglevel.upper(), None)
|
|
8
9
|
if not isinstance(numeric_level, int):
|
|
9
10
|
raise ValueError(f'Invalid log level: {loglevel}')
|
|
@@ -17,7 +18,7 @@ def configure_logging(loglevel: str, logfile: bool, flask_logging: bool = False)
|
|
|
17
18
|
|
|
18
19
|
if logfile:
|
|
19
20
|
handler = RotatingFileHandler(
|
|
20
|
-
|
|
21
|
+
logfile, maxBytes=100000, backupCount=3)
|
|
21
22
|
handler.setLevel(numeric_level)
|
|
22
23
|
formatter = logging.Formatter(
|
|
23
24
|
'%(asctime)s - %(name)s - %(levelname)s - %(message)s')
|
|
@@ -1,14 +1,13 @@
|
|
|
1
|
-
import argparse
|
|
2
1
|
from dataclasses import dataclass, fields
|
|
3
2
|
import argparse
|
|
4
|
-
from typing import Any, Dict
|
|
3
|
+
from typing import Any, Dict, Optional
|
|
5
4
|
|
|
6
5
|
|
|
7
6
|
@dataclass
|
|
8
7
|
class RuntimeArgs:
|
|
9
8
|
reloader: bool = False
|
|
10
9
|
port: int = 5001
|
|
11
|
-
logfile:
|
|
10
|
+
logfile: Optional[str] = None
|
|
12
11
|
loglevel: str = 'INFO'
|
|
13
12
|
flask_logging: bool = False
|
|
14
13
|
persistent: bool = False
|
|
@@ -21,8 +20,8 @@ def parse_args() -> RuntimeArgs:
|
|
|
21
20
|
help='Use flask\'s reloader (helpful for local development)')
|
|
22
21
|
parser.add_argument('--port', type=int, default=5001,
|
|
23
22
|
help='Port to run the webserver on')
|
|
24
|
-
parser.add_argument('--logfile',
|
|
25
|
-
help='Log output to
|
|
23
|
+
parser.add_argument('--logfile', type=str, default=None,
|
|
24
|
+
help='Log output to the specified file path')
|
|
26
25
|
parser.add_argument('--loglevel', default='INFO', help='Set the log level')
|
|
27
26
|
parser.add_argument('--flask-logging', action='store_true',
|
|
28
27
|
help='Enable flask logging (disables click output)')
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: lanscape
|
|
3
|
-
Version: 1.3.
|
|
3
|
+
Version: 1.3.3
|
|
4
4
|
Summary: A python based local network scanner
|
|
5
5
|
Author-email: Michael Dennis <michael@dipduo.com>
|
|
6
6
|
License-Expression: MIT
|
|
@@ -37,7 +37,7 @@ python -m lanscape
|
|
|
37
37
|
- `--port <port number>` port of the flask app (default: automagic)
|
|
38
38
|
- `--persistent` dont shutdown server when browser tab is closed (default: false)
|
|
39
39
|
- `--reloader` essentially flask debug mode- good for local development (default: false)
|
|
40
|
-
- `--logfile
|
|
40
|
+
- `--logfile <path>` save log output to the given file path
|
|
41
41
|
- `--loglevel <level>` set the logger's log level (default: INFO)
|
|
42
42
|
- `--flask-logging` turn on flask logging (default: false)
|
|
43
43
|
|
|
@@ -45,7 +45,7 @@ Examples:
|
|
|
45
45
|
```shell
|
|
46
46
|
python -m lanscape --reloader
|
|
47
47
|
python -m lanscape --port 5002
|
|
48
|
-
python -m lanscape --logfile --loglevel DEBUG
|
|
48
|
+
python -m lanscape --logfile /tmp/lanscape.log --loglevel DEBUG
|
|
49
49
|
```
|
|
50
50
|
|
|
51
51
|
## Troubleshooting
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import unittest
|
|
2
|
+
import logging
|
|
3
|
+
import os
|
|
4
|
+
import tempfile
|
|
5
|
+
from unittest.mock import patch
|
|
6
|
+
|
|
7
|
+
import click
|
|
8
|
+
from logging.handlers import RotatingFileHandler
|
|
9
|
+
|
|
10
|
+
from lanscape.libraries.logger import configure_logging
|
|
11
|
+
from lanscape.libraries.runtime_args import parse_args
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
class LoggingConfigTests(unittest.TestCase):
|
|
15
|
+
def setUp(self):
|
|
16
|
+
self.root = logging.getLogger()
|
|
17
|
+
self.root.handlers.clear()
|
|
18
|
+
self.original_click_echo = click.echo
|
|
19
|
+
self.original_click_secho = click.secho
|
|
20
|
+
|
|
21
|
+
def tearDown(self):
|
|
22
|
+
self.root.handlers.clear()
|
|
23
|
+
logging.shutdown()
|
|
24
|
+
click.echo = self.original_click_echo
|
|
25
|
+
click.secho = self.original_click_secho
|
|
26
|
+
|
|
27
|
+
def test_configure_logging_writes_file(self):
|
|
28
|
+
with tempfile.TemporaryDirectory() as tmpdir:
|
|
29
|
+
logfile = os.path.join(tmpdir, 'test.log')
|
|
30
|
+
configure_logging('INFO', logfile, flask_logging=True)
|
|
31
|
+
logging.getLogger('test').info('hello file')
|
|
32
|
+
for handler in logging.getLogger().handlers:
|
|
33
|
+
handler.flush()
|
|
34
|
+
with open(logfile, 'r') as fh:
|
|
35
|
+
contents = fh.read()
|
|
36
|
+
self.assertIn('hello file', contents)
|
|
37
|
+
self.tearDown()
|
|
38
|
+
|
|
39
|
+
def test_configure_logging_without_file(self):
|
|
40
|
+
configure_logging('INFO', None, flask_logging=True)
|
|
41
|
+
root_handlers = logging.getLogger().handlers
|
|
42
|
+
self.assertTrue(all(not isinstance(h, RotatingFileHandler) for h in root_handlers))
|
|
43
|
+
|
|
44
|
+
def test_disable_flask_logging_overrides_click(self):
|
|
45
|
+
configure_logging('INFO', None, flask_logging=False)
|
|
46
|
+
self.assertNotEqual(click.echo, self.original_click_echo)
|
|
47
|
+
self.assertNotEqual(click.secho, self.original_click_secho)
|
|
48
|
+
self.assertEqual(logging.getLogger('werkzeug').level, logging.ERROR)
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
class RuntimeArgsLoggingTests(unittest.TestCase):
|
|
52
|
+
def test_parse_args_logfile_path(self):
|
|
53
|
+
with patch('sys.argv', ['prog', '--logfile', '/tmp/custom.log']):
|
|
54
|
+
args = parse_args()
|
|
55
|
+
self.assertEqual(args.logfile, '/tmp/custom.log')
|
|
@@ -3,7 +3,6 @@ from lanscape.libraries.ip_parser import parse_ip_input
|
|
|
3
3
|
from lanscape.libraries.errors import SubnetTooLargeError
|
|
4
4
|
import ipaddress
|
|
5
5
|
from lanscape.libraries import ip_parser
|
|
6
|
-
from lanscape.libraries.errors import SubnetTooLargeError
|
|
7
6
|
from lanscape.libraries.port_manager import PortManager
|
|
8
7
|
from lanscape.libraries.decorators import timeout_enforcer
|
|
9
8
|
import time
|
|
@@ -54,7 +53,7 @@ class PortManagerValidateTests(unittest.TestCase):
|
|
|
54
53
|
|
|
55
54
|
def test_validate_port_data_valid(self):
|
|
56
55
|
valid = {"80": "http", "443": "https"}
|
|
57
|
-
self.assertTrue(
|
|
56
|
+
self.assertTrue(self.pm.validate_port_data(valid))
|
|
58
57
|
|
|
59
58
|
def test_validate_port_data_invalid(self):
|
|
60
59
|
invalid_cases = [
|
|
@@ -65,14 +64,14 @@ class PortManagerValidateTests(unittest.TestCase):
|
|
|
65
64
|
]
|
|
66
65
|
for case in invalid_cases:
|
|
67
66
|
with self.subTest(case=case):
|
|
68
|
-
self.assertFalse(
|
|
67
|
+
self.assertFalse(self.pm.validate_port_data(case))
|
|
69
68
|
|
|
70
69
|
|
|
71
70
|
class DecoratorTimeoutTests(unittest.TestCase):
|
|
72
71
|
def test_timeout_enforcer(self):
|
|
73
72
|
@timeout_enforcer(0.1, raise_on_timeout=False)
|
|
74
73
|
def slow_return():
|
|
75
|
-
time.sleep(0.
|
|
74
|
+
time.sleep(0.5)
|
|
76
75
|
return "done"
|
|
77
76
|
|
|
78
77
|
self.assertIsNone(slow_return())
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|