lanscape 0.0.7__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.
Files changed (55) hide show
  1. lanscape-0.0.7/.gitattributes +2 -0
  2. lanscape-0.0.7/.gitignore +156 -0
  3. lanscape-0.0.7/LICENSE +0 -0
  4. lanscape-0.0.7/PKG-INFO +30 -0
  5. lanscape-0.0.7/README.md +12 -0
  6. lanscape-0.0.7/package.ps1 +6 -0
  7. lanscape-0.0.7/pyproject.toml +26 -0
  8. lanscape-0.0.7/requirements.txt +0 -0
  9. lanscape-0.0.7/src/lanscape/__init__.py +0 -0
  10. lanscape-0.0.7/src/lanscape/__main__.py +4 -0
  11. lanscape-0.0.7/src/lanscape/app.py +21 -0
  12. lanscape-0.0.7/src/lanscape/blueprints/__init__.py +0 -0
  13. lanscape-0.0.7/src/lanscape/blueprints/api/__init__.py +5 -0
  14. lanscape-0.0.7/src/lanscape/blueprints/api/port.py +27 -0
  15. lanscape-0.0.7/src/lanscape/blueprints/api/scan.py +39 -0
  16. lanscape-0.0.7/src/lanscape/blueprints/web/__init__.py +5 -0
  17. lanscape-0.0.7/src/lanscape/blueprints/web/routes.py +31 -0
  18. lanscape-0.0.7/src/lanscape/jobs/472a8172-2150-4167-a90c-d10538d836b6.json +448 -0
  19. lanscape-0.0.7/src/lanscape/libraries/decorators.py +32 -0
  20. lanscape-0.0.7/src/lanscape/libraries/ip_parser.py +50 -0
  21. lanscape-0.0.7/src/lanscape/libraries/mac_lookup.py +14 -0
  22. lanscape-0.0.7/src/lanscape/libraries/net_tools.py +213 -0
  23. lanscape-0.0.7/src/lanscape/libraries/port_manager.py +61 -0
  24. lanscape-0.0.7/src/lanscape/libraries/subnet_scan.py +249 -0
  25. lanscape-0.0.7/src/lanscape/main.py +21 -0
  26. lanscape-0.0.7/src/lanscape/requirements.txt +0 -0
  27. lanscape-0.0.7/src/lanscape/resources/mac_addresses/convert_csv.py +27 -0
  28. lanscape-0.0.7/src/lanscape/resources/mac_addresses/mac-vendors-export.csv +51702 -0
  29. lanscape-0.0.7/src/lanscape/resources/mac_addresses/mac_db.json +51668 -0
  30. lanscape-0.0.7/src/lanscape/resources/ports/convert_csv.py +27 -0
  31. lanscape-0.0.7/src/lanscape/resources/ports/full.json +65537 -0
  32. lanscape-0.0.7/src/lanscape/resources/ports/large.json +6087 -0
  33. lanscape-0.0.7/src/lanscape/resources/ports/medium.json +150 -0
  34. lanscape-0.0.7/src/lanscape/resources/ports/service-names-port-numbers.csv +15097 -0
  35. lanscape-0.0.7/src/lanscape/resources/ports/small.json +22 -0
  36. lanscape-0.0.7/src/lanscape/scanner.py +12 -0
  37. lanscape-0.0.7/src/lanscape/static/css/style.css +373 -0
  38. lanscape-0.0.7/src/lanscape/static/img/favicon.ico +0 -0
  39. lanscape-0.0.7/src/lanscape/static/img/readme1.png +0 -0
  40. lanscape-0.0.7/src/lanscape/static/img/readme2.png +0 -0
  41. lanscape-0.0.7/src/lanscape/static/js/main.js +141 -0
  42. lanscape-0.0.7/src/lanscape/static/js/quietReload.js +21 -0
  43. lanscape-0.0.7/src/lanscape/templates/base.html +12 -0
  44. lanscape-0.0.7/src/lanscape/templates/core/head.html +5 -0
  45. lanscape-0.0.7/src/lanscape/templates/core/scripts.html +3 -0
  46. lanscape-0.0.7/src/lanscape/templates/main.html +60 -0
  47. lanscape-0.0.7/src/lanscape/templates/scan/ip-table-row.html +94 -0
  48. lanscape-0.0.7/src/lanscape/templates/scan/ip-table.html +21 -0
  49. lanscape-0.0.7/src/lanscape/templates/scan/overview.html +26 -0
  50. lanscape-0.0.7/src/lanscape/templates/scan.html +15 -0
  51. lanscape-0.0.7/src/lanscape/tests/_to_parent.py +6 -0
  52. lanscape-0.0.7/src/lanscape/tests/basic.py +28 -0
  53. lanscape-0.0.7/src/lanscape/tests/is_alive_reliability.py +29 -0
  54. lanscape-0.0.7/src/lanscape/tests/test_api.py +88 -0
  55. lanscape-0.0.7/src/lanscape/webviewer.py +19 -0
@@ -0,0 +1,2 @@
1
+ # Auto detect text files and perform LF normalization
2
+ * text=auto
@@ -0,0 +1,156 @@
1
+ # Byte-compiled / optimized / DLL files
2
+ __pycache__/
3
+ *.py[cod]
4
+ *$py.class
5
+
6
+ # C extensions
7
+ *.so
8
+
9
+ # Distribution / packaging
10
+ .Python
11
+ build/
12
+ develop-eggs/
13
+ dist/
14
+ downloads/
15
+ eggs/
16
+ .eggs/
17
+ lib/
18
+ lib64/
19
+ parts/
20
+ sdist/
21
+ var/
22
+ wheels/
23
+ share/python-wheels/
24
+ *.egg-info/
25
+ .installed.cfg
26
+ *.egg
27
+ MANIFEST
28
+
29
+ # PyInstaller
30
+ # Usually these files are written by a python script from a template
31
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
32
+ *.manifest
33
+ *.spec
34
+
35
+ # Installer logs
36
+ pip-log.txt
37
+ pip-delete-this-directory.txt
38
+
39
+ # Unit test / coverage reports
40
+ htmlcov/
41
+ .tox/
42
+ .nox/
43
+ .coverage
44
+ .coverage.*
45
+ .cache
46
+ nosetests.xml
47
+ coverage.xml
48
+ *.cover
49
+ *.py,cover
50
+ .hypothesis/
51
+ .pytest_cache/
52
+ cover/
53
+
54
+ # Translations
55
+ *.mo
56
+ *.pot
57
+
58
+ # Django stuff:
59
+ *.log
60
+ local_settings.py
61
+ db.sqlite3
62
+ db.sqlite3-journal
63
+
64
+ # Flask stuff:
65
+ instance/
66
+ .webassets-cache
67
+
68
+ # Scrapy stuff:
69
+ .scrapy
70
+
71
+ # Sphinx documentation
72
+ docs/_build/
73
+
74
+ # PyBuilder
75
+ .pybuilder/
76
+ target/
77
+
78
+ # Jupyter Notebook
79
+ .ipynb_checkpoints
80
+
81
+ # IPython
82
+ profile_default/
83
+ ipython_config.py
84
+
85
+ # pyenv
86
+ # For a library or package, you might want to ignore these files since the code is
87
+ # intended to run in multiple environments; otherwise, check them in:
88
+ # .python-version
89
+
90
+ # pipenv
91
+ # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
92
+ # However, in case of collaboration, if having platform-specific dependencies or dependencies
93
+ # having no cross-platform support, pipenv may install dependencies that don't work, or not
94
+ # install all needed dependencies.
95
+ #Pipfile.lock
96
+
97
+ # poetry
98
+ # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
99
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
100
+ # commonly ignored for libraries.
101
+ # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
102
+ #poetry.lock
103
+
104
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow
105
+ __pypackages__/
106
+
107
+ # Celery stuff
108
+ celerybeat-schedule
109
+ celerybeat.pid
110
+
111
+ # SageMath parsed files
112
+ *.sage.py
113
+
114
+ # Environments
115
+ .env
116
+ .venv
117
+ env/
118
+ venv/
119
+ ENV/
120
+ env.bak/
121
+ venv.bak/
122
+
123
+ # Spyder project settings
124
+ .spyderproject
125
+ .spyproject
126
+
127
+ # Rope project settings
128
+ .ropeproject
129
+
130
+ # mkdocs documentation
131
+ /site
132
+
133
+ # mypy
134
+ .mypy_cache/
135
+ .dmypy.json
136
+ dmypy.json
137
+
138
+ # Pyre type checker
139
+ .pyre/
140
+
141
+ # pytype static type analyzer
142
+ .pytype/
143
+
144
+ # Cython debug symbols
145
+ cython_debug/
146
+
147
+ # PyCharm
148
+ # JetBrains specific template is maintainted in a separate JetBrains.gitignore that can
149
+ # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
150
+ # and can be added to the global gitignore or merged into this file. For a more nuclear
151
+ # option (not recommended) you can uncomment the following to ignore the entire idea folder.
152
+ #.idea/
153
+
154
+
155
+ # Runtime generated
156
+ jobs/*.json
lanscape-0.0.7/LICENSE ADDED
File without changes
@@ -0,0 +1,30 @@
1
+ Metadata-Version: 2.3
2
+ Name: lanscape
3
+ Version: 0.0.7
4
+ Summary: A python based local network scanner
5
+ Project-URL: Homepage, https://github.com/mdennis281/py-lanscape
6
+ Project-URL: Issues, https://github.com/mdennis281/py-lanscape/issues
7
+ Author-email: Michael Dennis <michael@dipduo.com>
8
+ License-File: LICENSE
9
+ Classifier: License :: OSI Approved :: MIT License
10
+ Classifier: Operating System :: OS Independent
11
+ Classifier: Programming Language :: Python :: 3
12
+ Requires-Python: >=3.10
13
+ Requires-Dist: flask==3.0.3
14
+ Requires-Dist: psutil==6.0.0
15
+ Requires-Dist: pywebview>=4.2
16
+ Requires-Dist: scapy>=2.3.2
17
+ Description-Content-Type: text/markdown
18
+
19
+ # LANscape
20
+ A python based local network scanner.
21
+
22
+ ![screenshot](https://github.com/mdennis281/py-lanscape/raw/main/static/img/readme1.png)
23
+
24
+
25
+ # Local Run
26
+ ```sh
27
+ pip install lanscape
28
+ py -m lanscape
29
+ ```
30
+
@@ -0,0 +1,12 @@
1
+ # LANscape
2
+ A python based local network scanner.
3
+
4
+ ![screenshot](https://github.com/mdennis281/py-lanscape/raw/main/static/img/readme1.png)
5
+
6
+
7
+ # Local Run
8
+ ```sh
9
+ pip install lanscape
10
+ py -m lanscape
11
+ ```
12
+
@@ -0,0 +1,6 @@
1
+ Remove-Item -Path .\dist\ -Recurse -Force
2
+ py -m pip install --upgrade pip
3
+ py -m pip install --upgrade build
4
+ py -m build
5
+ py -m pip install --upgrade twine
6
+ py -m twine upload --repository pypi dist/*
@@ -0,0 +1,26 @@
1
+ [build-system]
2
+ requires = ["hatchling"]
3
+ build-backend = "hatchling.build"
4
+ [project]
5
+ name = "lanscape"
6
+ version = "0.0.7"
7
+ authors = [
8
+ { name="Michael Dennis", email="michael@dipduo.com" },
9
+ ]
10
+ description = "A python based local network scanner"
11
+ readme = "README.md"
12
+ requires-python = ">=3.10"
13
+ classifiers = [
14
+ "Programming Language :: Python :: 3",
15
+ "License :: OSI Approved :: MIT License",
16
+ "Operating System :: OS Independent",
17
+ ]
18
+ dependencies = [
19
+ "Flask==3.0.3",
20
+ "psutil==6.0.0",
21
+ "pywebview>=4.2",
22
+ "scapy>=2.3.2",
23
+ ]
24
+ [project.urls]
25
+ Homepage = "https://github.com/mdennis281/py-lanscape"
26
+ Issues = "https://github.com/mdennis281/py-lanscape/issues"
Binary file
File without changes
@@ -0,0 +1,4 @@
1
+ from main import start_webview
2
+
3
+ if __name__ == "__main__":
4
+ start_webview()
@@ -0,0 +1,21 @@
1
+ from flask import Flask
2
+
3
+ app = Flask(__name__)
4
+
5
+ # Import Blueprints
6
+ from blueprints.api import api_bp
7
+ from blueprints.web import web_bp
8
+
9
+ # Register Blueprints
10
+ app.register_blueprint(api_bp)
11
+ app.register_blueprint(web_bp)
12
+
13
+
14
+ # Custom Jinja filter
15
+ def is_substring_in_values(results: dict, substring: str) -> bool:
16
+ return any(substring.lower() in str(v).lower() for v in results.values()) if substring else True
17
+
18
+ app.jinja_env.filters['is_substring_in_values'] = is_substring_in_values
19
+
20
+ if __name__ == "__main__":
21
+ app.run(host='0.0.0.0', port=5001, debug=True)
File without changes
@@ -0,0 +1,5 @@
1
+ from flask import Blueprint
2
+
3
+ api_bp = Blueprint('api', __name__)
4
+
5
+ from . import port, scan
@@ -0,0 +1,27 @@
1
+ from flask import request, jsonify
2
+ from . import api_bp
3
+ from libraries.port_manager import PortManager
4
+
5
+ # Port Manager API
6
+ ############################################
7
+ @api_bp.route('/api/port/list', methods=['GET'])
8
+ def get_port_lists():
9
+ return jsonify(PortManager().get_port_lists())
10
+
11
+ @api_bp.route('/api/port/list/<port_list>', methods=['GET'])
12
+ def get_port_list(port_list):
13
+ return jsonify(PortManager().get_port_list(port_list))
14
+
15
+ @api_bp.route('/api/port/list/<port_list>', methods=['POST'])
16
+ def create_port_list(port_list):
17
+ data = request.get_json()
18
+ return jsonify(PortManager().create_port_list(port_list, data))
19
+
20
+ @api_bp.route('/api/port/list/<port_list>', methods=['PUT'])
21
+ def update_port_list(port_list):
22
+ data = request.get_json()
23
+ return jsonify(PortManager().update_port_list(port_list, data))
24
+
25
+ @api_bp.route('/api/port/list/<port_list>', methods=['DELETE'])
26
+ def delete_port_list(port_list):
27
+ return jsonify(PortManager().delete_port_list(port_list))
@@ -0,0 +1,39 @@
1
+ from flask import request, jsonify
2
+ from . import api_bp
3
+ from libraries.subnet_scan import SubnetScanner
4
+ import traceback
5
+
6
+ # Subnet Scanner API
7
+ ############################################
8
+ @api_bp.route('/api/scan', methods=['POST'])
9
+ def scan_subnet():
10
+ data = request.get_json()
11
+
12
+ try:
13
+ uid = SubnetScanner.scan_subnet_standalone(
14
+ data['subnet'],
15
+ data['port_list'],
16
+ float(data.get('parallelism', 1.0))
17
+ )
18
+
19
+ return jsonify({'status': 'running', 'scan_id': uid})
20
+ except:
21
+ return jsonify({'status': 'error', 'traceback': traceback.format_exc()}), 500
22
+
23
+
24
+ @api_bp.route('/api/scan/async', methods=['POST'])
25
+ def scan_subnet_async():
26
+ data = request.get_json()
27
+
28
+ scanner = SubnetScanner(
29
+ data['subnet'],
30
+ data['port_list'],
31
+ data.get('parallelism', 1.0)
32
+ )
33
+ scanner.scan_subnet()
34
+ return jsonify({'status': 'complete', 'scan_id': scanner.uid})
35
+
36
+ @api_bp.route('/api/scan/<scan_id>', methods=['GET'])
37
+ def get_scan(scan_id):
38
+ scan = SubnetScanner.get_scan(scan_id)
39
+ return jsonify(scan)
@@ -0,0 +1,5 @@
1
+ from flask import Blueprint
2
+
3
+ web_bp = Blueprint('web', __name__)
4
+
5
+ from . import routes
@@ -0,0 +1,31 @@
1
+ from flask import render_template, request
2
+ from . import web_bp
3
+ from libraries.subnet_scan import SubnetScanner
4
+ from libraries.net_tools import get_primary_network_subnet
5
+
6
+ # Template Renderer
7
+ ############################################
8
+ @web_bp.route('/', methods=['GET'])
9
+ def index():
10
+ subnet = get_primary_network_subnet()
11
+ port_list = 'medium'
12
+ parallelism = 1.0
13
+ if request.args.get('scan_id'):
14
+ scan = SubnetScanner.get_scan(request.args.get('scan_id'))
15
+ subnet = scan['subnet']
16
+ port_list = scan['port_list']
17
+ parallelism = scan['parallelism']
18
+ return render_template(
19
+ 'main.html',
20
+ subnet=subnet,
21
+ port_list=port_list,
22
+ parallelism=parallelism
23
+ )
24
+
25
+ @web_bp.route('/scan/<scan_id>', methods=['GET'])
26
+ @web_bp.route('/scan/<scan_id>/<section>', methods=['GET'])
27
+ def render_scan(scan_id, section='all'):
28
+ data = SubnetScanner.get_scan(scan_id)
29
+ filter = request.args.get('filter')
30
+ return render_template('scan.html', data=data, section=section, filter=filter)
31
+