lanscape 1.3.1a8__py3-none-any.whl → 1.3.2a6__py3-none-any.whl
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.
Potentially problematic release.
This version of lanscape might be problematic. Click here for more details.
- lanscape/__init__.py +4 -1
- lanscape/__main__.py +4 -1
- lanscape/ui/static/css/style.css +1 -1
- lanscape/ui/templates/core/scripts.html +1 -1
- lanscape/ui/templates/info.html +1 -1
- lanscape/ui/templates/main.html +6 -4
- {lanscape-1.3.1a8.dist-info → lanscape-1.3.2a6.dist-info}/METADATA +4 -3
- lanscape-1.3.2a6.dist-info/RECORD +43 -0
- lanscape/libraries/app_scope.py +0 -70
- lanscape/libraries/decorators.py +0 -75
- lanscape/libraries/errors.py +0 -29
- lanscape/libraries/ip_parser.py +0 -65
- lanscape/libraries/logger.py +0 -42
- lanscape/libraries/mac_lookup.py +0 -69
- lanscape/libraries/net_tools.py +0 -480
- lanscape/libraries/port_manager.py +0 -59
- lanscape/libraries/runtime_args.py +0 -44
- lanscape/libraries/service_scan.py +0 -51
- lanscape/libraries/subnet_scan.py +0 -373
- lanscape/libraries/version_manager.py +0 -54
- lanscape/libraries/web_browser.py +0 -141
- lanscape/resources/mac_addresses/convert_csv.py +0 -27
- lanscape/resources/ports/convert_csv.py +0 -27
- lanscape/tests/__init__.py +0 -3
- lanscape/tests/_helpers.py +0 -15
- lanscape/tests/test_api.py +0 -194
- lanscape/tests/test_env.py +0 -30
- lanscape/tests/test_library.py +0 -53
- lanscape/ui/app.py +0 -122
- lanscape/ui/blueprints/__init__.py +0 -7
- lanscape/ui/blueprints/api/__init__.py +0 -5
- lanscape/ui/blueprints/api/port.py +0 -27
- lanscape/ui/blueprints/api/scan.py +0 -69
- lanscape/ui/blueprints/api/tools.py +0 -30
- lanscape/ui/blueprints/web/__init__.py +0 -5
- lanscape/ui/blueprints/web/routes.py +0 -74
- lanscape/ui/main.py +0 -138
- lanscape-1.3.1a8.dist-info/RECORD +0 -72
- {lanscape-1.3.1a8.dist-info → lanscape-1.3.2a6.dist-info}/WHEEL +0 -0
- {lanscape-1.3.1a8.dist-info → lanscape-1.3.2a6.dist-info}/licenses/LICENSE +0 -0
- {lanscape-1.3.1a8.dist-info → lanscape-1.3.2a6.dist-info}/top_level.txt +0 -0
lanscape/ui/main.py
DELETED
|
@@ -1,138 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
import threading
|
|
3
|
-
import time
|
|
4
|
-
import logging
|
|
5
|
-
import traceback
|
|
6
|
-
import os
|
|
7
|
-
from ..libraries.logger import configure_logging
|
|
8
|
-
from ..libraries.runtime_args import parse_args, RuntimeArgs
|
|
9
|
-
from ..libraries.web_browser import open_webapp
|
|
10
|
-
from ..libraries.net_tools import is_arp_supported
|
|
11
|
-
# do this so any logs generated on import are displayed
|
|
12
|
-
args = parse_args()
|
|
13
|
-
configure_logging(args.loglevel, args.logfile, args.flask_logging)
|
|
14
|
-
|
|
15
|
-
from ..libraries.version_manager import get_installed_version, is_update_available
|
|
16
|
-
from .app import start_webserver_daemon, start_webserver
|
|
17
|
-
import socket
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
log = logging.getLogger('core')
|
|
21
|
-
# determine if the execution is an instance of a flask reload
|
|
22
|
-
# happens on file change with reloader enabled
|
|
23
|
-
IS_FLASK_RELOAD = os.environ.get("WERKZEUG_RUN_MAIN")
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
def main():
|
|
27
|
-
try:
|
|
28
|
-
_main()
|
|
29
|
-
except KeyboardInterrupt:
|
|
30
|
-
log.info('Keyboard interrupt received, terminating...')
|
|
31
|
-
terminate()
|
|
32
|
-
except Exception as e:
|
|
33
|
-
log.critical(f'Unexpected error: {e}')
|
|
34
|
-
log.debug(traceback.format_exc())
|
|
35
|
-
terminate()
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
def _main():
|
|
39
|
-
if not IS_FLASK_RELOAD:
|
|
40
|
-
log.info(f'LANscape v{get_installed_version()}')
|
|
41
|
-
try_check_update()
|
|
42
|
-
|
|
43
|
-
else:
|
|
44
|
-
log.info('Flask reloaded app.')
|
|
45
|
-
|
|
46
|
-
args.port = get_valid_port(args.port)
|
|
47
|
-
|
|
48
|
-
if not is_arp_supported():
|
|
49
|
-
log.warning('ARP is not supported, device discovery is degraded.')
|
|
50
|
-
log.warning('Help guide: https://github.com/mdennis281/LANscape/blob/main/support/arp-issues.md')
|
|
51
|
-
|
|
52
|
-
try:
|
|
53
|
-
start_webserver_ui(args)
|
|
54
|
-
log.info('Exiting...')
|
|
55
|
-
except Exception as e:
|
|
56
|
-
# showing error in debug only because this is handled gracefully
|
|
57
|
-
log.critical(f'Failed to start app. Error: {e}')
|
|
58
|
-
log.debug('Failed to start. Traceback below')
|
|
59
|
-
log.debug(traceback.format_exc())
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
def try_check_update():
|
|
64
|
-
try:
|
|
65
|
-
if is_update_available():
|
|
66
|
-
log.info('An update is available!')
|
|
67
|
-
log.info('Run "pip install --upgrade lanscape --no-cache" to supress this message.')
|
|
68
|
-
except:
|
|
69
|
-
log.debug(traceback.format_exc())
|
|
70
|
-
log.warning('Unable to check for updates.')
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
def open_browser(url: str, wait=2) -> bool:
|
|
74
|
-
"""
|
|
75
|
-
Open a browser window to the specified
|
|
76
|
-
url after waiting for the server to start
|
|
77
|
-
"""
|
|
78
|
-
try:
|
|
79
|
-
time.sleep(wait)
|
|
80
|
-
log.info(f'Starting UI - http://127.0.0.1:{args.port}')
|
|
81
|
-
return open_webapp(url)
|
|
82
|
-
|
|
83
|
-
except:
|
|
84
|
-
log.debug(traceback.format_exc())
|
|
85
|
-
log.info(f'Unable to open web browser, server running on {url}')
|
|
86
|
-
return False
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
def start_webserver_ui(args: RuntimeArgs):
|
|
91
|
-
uri = f'http://127.0.0.1:{args.port}'
|
|
92
|
-
|
|
93
|
-
# running reloader requires flask to run in main thread
|
|
94
|
-
# this decouples UI from main process
|
|
95
|
-
if args.reloader:
|
|
96
|
-
# determine if it was reloaded by flask debug reloader
|
|
97
|
-
# if it was, dont open the browser again
|
|
98
|
-
log.info('Opening UI as daemon')
|
|
99
|
-
if not IS_FLASK_RELOAD:
|
|
100
|
-
threading.Thread(
|
|
101
|
-
target=open_browser,
|
|
102
|
-
args=(uri,),
|
|
103
|
-
daemon=True
|
|
104
|
-
).start()
|
|
105
|
-
start_webserver(args)
|
|
106
|
-
else:
|
|
107
|
-
flask_thread = start_webserver_daemon(args)
|
|
108
|
-
app_closed = open_browser(uri)
|
|
109
|
-
|
|
110
|
-
# depending on env, open_browser may or
|
|
111
|
-
# may not be coupled with the closure of UI
|
|
112
|
-
# (if in browser tab, it's uncoupled)
|
|
113
|
-
if not app_closed or args.persistent:
|
|
114
|
-
# not doing a direct join so i can still
|
|
115
|
-
# terminate the app with ctrl+c
|
|
116
|
-
while flask_thread.is_alive():
|
|
117
|
-
time.sleep(1)
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
def get_valid_port(port: int):
|
|
121
|
-
"""
|
|
122
|
-
Get the first available port starting from the specified port
|
|
123
|
-
"""
|
|
124
|
-
while True:
|
|
125
|
-
with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s:
|
|
126
|
-
if s.connect_ex(('localhost', port)) != 0:
|
|
127
|
-
return port
|
|
128
|
-
port += 1
|
|
129
|
-
|
|
130
|
-
def terminate():
|
|
131
|
-
import requests
|
|
132
|
-
log.info('Attempting flask shutdown')
|
|
133
|
-
requests.get(f'http://127.0.0.1:{args.port}/shutdown?type=core')
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
if __name__ == "__main__":
|
|
138
|
-
main()
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
lanscape/__init__.py,sha256=_8FoHQKR0s9B_stjs5e5CnytwbSK1JgNvE2kZBDrWbw,180
|
|
2
|
-
lanscape/__main__.py,sha256=Im2Qc9AIScEvjRik_X4x63n0Rie67-myQbuIEU7I-Ac,129
|
|
3
|
-
lanscape/libraries/app_scope.py,sha256=oPRrYIXOn914gF1DTVCDcy1d97hjReFlAxJNBjseBIo,2447
|
|
4
|
-
lanscape/libraries/decorators.py,sha256=Birxor-ae-CQRlBVOyB5DggHnuMQR98IYZ1FVHdGZzE,2448
|
|
5
|
-
lanscape/libraries/errors.py,sha256=DaercNEZD_tUuXF7KsNk3SD6AqAwT-S7fvzpEybVn08,964
|
|
6
|
-
lanscape/libraries/ip_parser.py,sha256=ElXz3LU5CUYWqKOHEyrj5Y4Iv6OBtoSlbCcxhCsibfQ,2226
|
|
7
|
-
lanscape/libraries/logger.py,sha256=doD8KKb4TNWDwVXc1VR7NK4UdharrAoRHl8vZnSAupI,1407
|
|
8
|
-
lanscape/libraries/mac_lookup.py,sha256=-dRV0ygtjjh3JkgL3GTi_5-w7pcZ1oj4XVH4chjsmRs,2121
|
|
9
|
-
lanscape/libraries/net_tools.py,sha256=dUGPwiOudr6I3flMrTyUumpve4pJrt_lST3l8fOOFxs,17117
|
|
10
|
-
lanscape/libraries/port_manager.py,sha256=fNext3FNfGnGYRZK9RhTEwQ2K0e0YmmMlhK4zVAvoCw,1977
|
|
11
|
-
lanscape/libraries/runtime_args.py,sha256=ICX_JkOmqDQdewZNfRxJb9jMggDw1XqF5CxM9zXZE_Q,1947
|
|
12
|
-
lanscape/libraries/service_scan.py,sha256=jLU84ZoJnqSQbE30Zly2lm2zHrCGutNXjla1sEvp1hE,1949
|
|
13
|
-
lanscape/libraries/subnet_scan.py,sha256=nT1-P9UkIneRcgfPNwZveiYYB4T-qnS6fv21tYRhCGQ,13313
|
|
14
|
-
lanscape/libraries/version_manager.py,sha256=3n0PV_EdW9Fgg2yxD2uzA4WYvzk6H6hMf_1gfvtZbp0,1730
|
|
15
|
-
lanscape/libraries/web_browser.py,sha256=EuKJG3bmBZUochDGm9a0qrB6JkIkOkvx4njZBe4eLIQ,5028
|
|
16
|
-
lanscape/resources/mac_addresses/convert_csv.py,sha256=w3Heed5z2mHYDEZNBep3_hNg4dbrp_N6J54MGxnrq4s,721
|
|
17
|
-
lanscape/resources/mac_addresses/mac_db.json,sha256=ygtFSwNwJzDlg6hmAujdgCyzUjxt9Di75J8SO4xYIs8,2187804
|
|
18
|
-
lanscape/resources/ports/convert_csv.py,sha256=mWe8zucWVfnlNEx_ZzH5Vc3tJJbdi-Ih4nm2yKNrRN0,720
|
|
19
|
-
lanscape/resources/ports/full.json,sha256=Abfbi-b5yZF4jR5NS6CT6QpIDfx4Vk04gIC1fKH2ws0,1506980
|
|
20
|
-
lanscape/resources/ports/large.json,sha256=jK4gkzlPT74uv4y0TvFjsaOaUcX7Cy8Zxe2bh5FYcc0,144496
|
|
21
|
-
lanscape/resources/ports/medium.json,sha256=3yHAca0_pEWXK4k1wmda1eNVM6ftzcpKn5VspVwmkRs,3667
|
|
22
|
-
lanscape/resources/ports/small.json,sha256=Mj3zGVG1F2eqZx2YkrLpTL8STeLcqB8_65IR67MS1Tg,397
|
|
23
|
-
lanscape/resources/services/definitions.jsonc,sha256=71w9Q7r4RoBYiIMkzzO2KdEJXaSIchNccYQueqAhD4E,8842
|
|
24
|
-
lanscape/tests/__init__.py,sha256=xYPeceOF-ppTS0wnq7CkVYQMwupmeSHxbYLbGj_imZ0,113
|
|
25
|
-
lanscape/tests/_helpers.py,sha256=wXJfUwzL3Fq4XBsC3dValCbXsf0U8FisuM_yo1de4QQ,371
|
|
26
|
-
lanscape/tests/test_api.py,sha256=sjcjt3b1ZwvQiALOSfXoQxTlN1Z1_TRPC0EEy-bRIgE,7313
|
|
27
|
-
lanscape/tests/test_env.py,sha256=7gfekAAfzlQxHmYG3MwDQpABDDkRomKWBhmIHFPq0jw,946
|
|
28
|
-
lanscape/tests/test_library.py,sha256=OPcTsUoR5IureSNDbePxid2BG98mfNNIJmCIY0BVz3w,1553
|
|
29
|
-
lanscape/ui/app.py,sha256=WfoWmNMkt9_58Dn8rX4vs59rchQ8E2d_6vGOvaINYbg,3701
|
|
30
|
-
lanscape/ui/main.py,sha256=h-iV9gvMmMyXDtB_w5HdWEEuL68nmJavZNshDKqXpBQ,4278
|
|
31
|
-
lanscape/ui/blueprints/__init__.py,sha256=agvgPOSVbrxddaw6EY64ZZr1CQi1Qzwcs1t0lZMv5oY,206
|
|
32
|
-
lanscape/ui/blueprints/api/__init__.py,sha256=t0QOq3vHFWmlZm_3YFPQbQzCn1a_a5cmRchtIxwy4eY,103
|
|
33
|
-
lanscape/ui/blueprints/api/port.py,sha256=2UA38umzXE8pMitx1E-_wJHyL1dYYbtM6Kg5zVtfj6A,1019
|
|
34
|
-
lanscape/ui/blueprints/api/scan.py,sha256=vNHH5XIVM8hWsHpkBX2okNFXWSFWz0E1RQuom8D-9TI,2229
|
|
35
|
-
lanscape/ui/blueprints/api/tools.py,sha256=CD0NDSX8kN6_lpl0jEw-ULLsDx7pKODCMFQiaK4GCzM,1153
|
|
36
|
-
lanscape/ui/blueprints/web/__init__.py,sha256=-WRjENG8D99NfaiSDk9uAa8OX6XJq9Zmq1ck29ARL-w,92
|
|
37
|
-
lanscape/ui/blueprints/web/routes.py,sha256=hl89T5_oRbTlA9Cde_xh9zAQDGRRH-Dpwm74B1_NM1Y,2511
|
|
38
|
-
lanscape/ui/static/lanscape.webmanifest,sha256=0aauJk_Bybd0B2iwzJfvPcs7AX43kVHs0dtpV6_jSWk,459
|
|
39
|
-
lanscape/ui/static/css/style.css,sha256=DJKGnsv7jpjXemVQRPNIWE_THTqNfjzPVs49ysRbBGM,16372
|
|
40
|
-
lanscape/ui/static/img/ico/android-chrome-192x192.png,sha256=JmFT6KBCCuoyxMV-mLNtF9_QJbVBvfWPUizKN700fi8,18255
|
|
41
|
-
lanscape/ui/static/img/ico/android-chrome-512x512.png,sha256=88Jjx_1-4XAnZYz64KP6FdTl_kYkNG2_kQIKteQwSh4,138055
|
|
42
|
-
lanscape/ui/static/img/ico/apple-touch-icon.png,sha256=tEJlLwBZtF4v-NC90YCfRJQ2prTsF4i3VQLK_hnv2Mw,16523
|
|
43
|
-
lanscape/ui/static/img/ico/favicon-16x16.png,sha256=HpQOZk3rziZjT1xQxKuy5WourXsfrdwuzQY1hChzBJQ,573
|
|
44
|
-
lanscape/ui/static/img/ico/favicon-32x32.png,sha256=UpgiDPIHckK19udHtACiaI3ZPbmImUUcN1GcrjpEg9s,1302
|
|
45
|
-
lanscape/ui/static/img/ico/favicon.ico,sha256=rs5vq0MPJ1LzzioOzOz5aQLVfrtS2nLRc920dOeReTw,15406
|
|
46
|
-
lanscape/ui/static/img/ico/site.webmanifest,sha256=ep4Hzh9zhmiZF2At3Fp1dQrYQuYF_3ZPZxc1KcGBvwQ,263
|
|
47
|
-
lanscape/ui/static/js/core.js,sha256=y-f8iQPIetllUY0lSCwnGbPCk5fTJbbU6Pxm3rw1EBU,1111
|
|
48
|
-
lanscape/ui/static/js/layout-sizing.js,sha256=23UuKdEmRChg6fyqj3DRvcsNfMoa6MRt6dkaT0k7_UY,841
|
|
49
|
-
lanscape/ui/static/js/main.js,sha256=s0ipGqmuuFHnH9KKoUVaDRJ10_YqYoJ-9r_YnbsH8Mw,7676
|
|
50
|
-
lanscape/ui/static/js/on-tab-close.js,sha256=YYzNd1KMrLWW4-rFcC8EXckTRfG-pKRLA6xpdVTDt04,1417
|
|
51
|
-
lanscape/ui/static/js/quietReload.js,sha256=_mHzpUsGL4Lm1hNsr3VYSOGVcgGA2y1-eZHacssTXGs,724
|
|
52
|
-
lanscape/ui/static/js/shutdown-server.js,sha256=WkO7_SNSHM_6kReUoCoExIdCf7Sl7IPiSiNxpbI-r0s,469
|
|
53
|
-
lanscape/ui/static/js/subnet-info.js,sha256=aytt0LkBx4FVq36TxiMEw3aM7XQLHg_ng1U2WDwZVF4,577
|
|
54
|
-
lanscape/ui/static/js/subnet-selector.js,sha256=OG01pDaSOPLq3Ial0aO0CqPcob9tPZA1MZKGmQG0W7Q,366
|
|
55
|
-
lanscape/ui/templates/base.html,sha256=P5xnMlvDXYkYSXdSZUWaRfhsszNuZPP7A56hemBrAFs,1498
|
|
56
|
-
lanscape/ui/templates/error.html,sha256=zXFO0zPIfQORWq1ZMiSZ8G7FjfhVVr-aaYC0HeBl4Rs,1068
|
|
57
|
-
lanscape/ui/templates/info.html,sha256=ZRx0Q92viaIsD0H8Rd1oGMdFIsZtBal7-tcKvt9WJIY,2586
|
|
58
|
-
lanscape/ui/templates/main.html,sha256=Xu3SDFXlnW6qkH-nqzt4b4Wq9Q6LG5FT5zeKiYXmpks,4143
|
|
59
|
-
lanscape/ui/templates/scan.html,sha256=Fz1Q4CzRq5qpKgszTAQLhaLVV0A6gBraT33mNDmpYRE,390
|
|
60
|
-
lanscape/ui/templates/shutdown.html,sha256=v0cGT5CJWi-V8b5sUN3l-QIDNUmHTvKGi2gDlhmRlrs,724
|
|
61
|
-
lanscape/ui/templates/core/head.html,sha256=6XyoDIz-IMPIRG-ti2LFY9FFX39UTIf_K6-6USni_ek,788
|
|
62
|
-
lanscape/ui/templates/core/scripts.html,sha256=31e62wrNUs8pQLp9unx3iSLT4YuPXgZoHUrGYTdt-8w,649
|
|
63
|
-
lanscape/ui/templates/scan/export.html,sha256=Qi0m2xJPbC5I2rxzekXjvQ6q9gm2Lr4VJW6riLhIaU0,776
|
|
64
|
-
lanscape/ui/templates/scan/ip-table-row.html,sha256=ptY24rxJRaA4PEEQRDncaq6Q0ql5RJ87Kn0zKRCzOHw,4842
|
|
65
|
-
lanscape/ui/templates/scan/ip-table.html,sha256=ds__UP9JiTKf5IxCmTMzw--eN_yg1Pvn3Nj1KvQxeZg,940
|
|
66
|
-
lanscape/ui/templates/scan/overview.html,sha256=FsX-jSFhGKwCxZGKE8AMKk328UuawN6O9RNTzYvIOts,1205
|
|
67
|
-
lanscape/ui/templates/scan/scan-error.html,sha256=Q4eZM5ThrxnFaWOSTUpK8hA2ksHwhxOBTaVUCLALhyA,1032
|
|
68
|
-
lanscape-1.3.1a8.dist-info/licenses/LICENSE,sha256=cCO-NbS01Ilwc6djHjZ7LIgPFRkRmWdr0fH2ysXKioA,1090
|
|
69
|
-
lanscape-1.3.1a8.dist-info/METADATA,sha256=TbyhZCx4ZrzNChJDFmmF05B5smHwT1QripthSE5lPqA,2567
|
|
70
|
-
lanscape-1.3.1a8.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
71
|
-
lanscape-1.3.1a8.dist-info/top_level.txt,sha256=E9D4sjPz_6H7c85Ycy_pOS2xuv1Wm-ilKhxEprln2ps,9
|
|
72
|
-
lanscape-1.3.1a8.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|