lab-me-nas 0.2.4__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.
@@ -0,0 +1,4 @@
1
+ __pycache__/
2
+ *.egg-info/
3
+ build/
4
+ .ipynb_checkpoints/
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Your Name
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,176 @@
1
+ Metadata-Version: 2.5
2
+ Name: lab_me_nas
3
+ Version: 0.2.4
4
+ Summary: Access a Synology NAS from Google Colab, Linux or Windows through a NetBird mesh network.
5
+ Project-URL: Homepage, https://github.com/feyhong1112/Lab_nas
6
+ Project-URL: Repository, https://github.com/feyhong1112/Lab_nas
7
+ Project-URL: Issues, https://github.com/feyhong1112/Lab_nas/issues
8
+ Author-email: Suebpong Pruttipattanapong <feyhong44@gmail.com>
9
+ License: MIT
10
+ License-File: LICENSE
11
+ Keywords: colab,filestation,nas,netbird,socks5,synology,wireguard
12
+ Classifier: Development Status :: 4 - Beta
13
+ Classifier: Environment :: Console
14
+ Classifier: Intended Audience :: Developers
15
+ Classifier: License :: OSI Approved :: MIT License
16
+ Classifier: Operating System :: Microsoft :: Windows
17
+ Classifier: Operating System :: POSIX :: Linux
18
+ Classifier: Programming Language :: Python :: 3
19
+ Classifier: Programming Language :: Python :: 3 :: Only
20
+ Classifier: Topic :: System :: Archiving :: Backup
21
+ Classifier: Topic :: System :: Networking
22
+ Requires-Python: >=3.8
23
+ Requires-Dist: alive-progress>=2.0
24
+ Requires-Dist: pysocks>=1.7.1
25
+ Requires-Dist: requests-toolbelt>=0.9
26
+ Requires-Dist: requests>=2.20
27
+ Description-Content-Type: text/markdown
28
+
29
+ # Lab_nas
30
+
31
+ Access a **Synology NAS** from **Google Colab, Linux or Windows** through a
32
+ **NetBird** mesh network, from Python or straight from bash / cmd.
33
+
34
+ `Lab_nas` bundles two small pieces:
35
+
36
+ - **`NetBird`** — starts the [NetBird](https://netbird.io) client in userspace
37
+ (netstack) mode and exposes a local SOCKS5 proxy. It saves the peer identity,
38
+ so later runs reconnect as the same peer **without asking for the setup key**.
39
+ If a NetBird app/service on the machine is already connected, it just uses it.
40
+ - **`Synology`** — a Synology File Station client: browse, search, download
41
+ (files and folders as `.zip`) and upload, with live progress bars.
42
+
43
+ ## Install
44
+
45
+ ```
46
+ pip install Lab_nas
47
+ ```
48
+
49
+ The NetBird binary is downloaded automatically on first start (from the
50
+ official `netbirdio/netbird` GitHub releases) if `netbird` isn't installed.
51
+
52
+ ## How connecting works
53
+
54
+ `NetBird().start()` / `lab_nas start` tries these in order and stops at the
55
+ first that works:
56
+
57
+ 1. NetBird is **already connected** (Lab_nas's own daemon, or a NetBird
58
+ app/service you set up in a terminal) → nothing to do.
59
+ 2. A **saved identity** exists → reconnect with it, no setup key needed.
60
+ 3. A setup key is **already available** (argument, `NETBIRD_SETUP_KEY`
61
+ environment variable, or Colab secret) → used without asking.
62
+ 4. It failed (bad/expired key, peer deleted) or there was **no answer within
63
+ 60 seconds** → you are asked to type the setup key (3 tries).
64
+
65
+ ## Where the identity is saved
66
+
67
+ | Platform | Folder |
68
+ | -------- | ------ |
69
+ | Colab | `/content/drive/MyDrive/netbird` (Google Drive) |
70
+ | Linux | `~/.config/Lab_nas/netbird` (or `$XDG_CONFIG_HOME/Lab_nas/netbird`) |
71
+ | Windows | `Documents\Lab_nas\netbird` |
72
+
73
+ Change it with `NetBird(config_dir=...)`, `--config-dir`, or the
74
+ `LAB_NAS_CONFIG_DIR` environment variable. `config.json` contains the peer's
75
+ private key — keep it private (careful if Documents syncs to OneDrive).
76
+
77
+ ## Command line (bash and cmd)
78
+
79
+ ```
80
+ lab_nas start # connect
81
+ lab_nas status
82
+ lab_nas ls / --host 100.83.14.114
83
+ lab_nas find "*.xlsx" /home/Drive --host 100.83.14.114
84
+ lab_nas download /home/Drive/file.xlsx /home/Drive/MyFolder --dest .
85
+ lab_nas upload report.xlsx --to /home/Drive
86
+ lab_nas stop
87
+ ```
88
+
89
+ If `lab_nas` isn't found, use `python -m Lab_nas ...` (Windows: `py -m Lab_nas ...`).
90
+ Set values once instead of typing them each time:
91
+
92
+ ```bash
93
+ # bash
94
+ export NETBIRD_SETUP_KEY=XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
95
+ export LAB_NAS_HOST=100.83.14.114
96
+ export SYNO_USER=admin
97
+ ```
98
+
99
+ ```bat
100
+ :: cmd
101
+ set NETBIRD_SETUP_KEY=XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
102
+ set LAB_NAS_HOST=100.83.14.114
103
+ set SYNO_USER=admin
104
+ ```
105
+
106
+ Missing values (like `SYNO_PASS`) are asked for. Run `lab_nas <command> -h`
107
+ for all options.
108
+
109
+ ## Quick start (Python / Colab)
110
+
111
+ ```
112
+ from Lab_nas import NetBird, Synology
113
+
114
+ NetBird().start() # connect to your NetBird network
115
+ nas = Synology('100.83.14.114') # your NAS's NetBird IP
116
+ nas.login() # uses SYNO_USER / SYNO_PASS
117
+
118
+ nas.ls('/') # list shared folders
119
+ nas.find('*.xlsx', '/home/Drive') # search by name
120
+ nas.download('/home/Drive/file.xlsx') # Colab: /content, else current folder
121
+ nas.download('/home/Drive/MyFolder') # a folder arrives as MyFolder.zip
122
+ nas.upload('file.xlsx', '/home/Drive') # upload a local file
123
+ ```
124
+
125
+ ### Secrets
126
+
127
+ Looked up as an environment variable first, then a Colab secret (🔑 sidebar
128
+ with *Notebook access* on). If missing, you're asked to type it.
129
+
130
+ | Secret | Meaning |
131
+ | ------------------- | ---------------------------- |
132
+ | `NETBIRD_SETUP_KEY` | a reusable NetBird setup key |
133
+ | `SYNO_USER` | DSM username |
134
+ | `SYNO_PASS` | DSM password |
135
+
136
+ ## Common operations
137
+
138
+ ```
139
+ nb = NetBird(hostname='colab', timeout=60) # peer name, seconds before asking for the key
140
+ nb.start()
141
+ nb.status() # NetBird status + proxy state
142
+ nb.log() # tail the NetBird log
143
+ nb.stop()
144
+
145
+ nas = Synology('100.83.14.114') # proxy used automatically when needed
146
+ nas.login('admin', 'password')
147
+ nas.ls('/home')
148
+ nas.find('report*', '/home', max_depth=3)
149
+ nas.download_more(['/home/a.pdf', '/home/b.pdf'])
150
+ nas.download('/home/Photos', extract=True)
151
+ nas.upload('out.csv', '/home/Drive', overwrite=True)
152
+ nas.logout()
153
+ ```
154
+
155
+ ## Requirements
156
+
157
+ - Colab, Linux (amd64/arm64) or Windows (amd64/arm64).
158
+ - A NetBird network and a **setup key** (needed only the first time).
159
+ - A Synology NAS on your NetBird network, with an account that has File
160
+ Station permission.
161
+
162
+ ## Notes
163
+
164
+ - Runs NetBird in **netstack** (userspace) mode on its own daemon address
165
+ (`127.0.0.1:41799`), so no `tun` device is needed and a NetBird app already
166
+ installed on the machine is never touched.
167
+ - On Windows, if the daemon doesn't start, try cmd **as Administrator**.
168
+ - Synology often serves DSM with a self-signed certificate; TLS verification is
169
+ disabled for the NAS session by design.
170
+ - Synology Office files (`.osheet`, `.odoc`, `.oslides`) can only be opened in
171
+ Synology Office — export to `.xlsx`/`.docx` on the NAS first if you need them
172
+ elsewhere.
173
+
174
+ ## License
175
+
176
+ MIT — see [LICENSE](LICENSE).
@@ -0,0 +1,148 @@
1
+ # Lab_nas
2
+
3
+ Access a **Synology NAS** from **Google Colab, Linux or Windows** through a
4
+ **NetBird** mesh network, from Python or straight from bash / cmd.
5
+
6
+ `Lab_nas` bundles two small pieces:
7
+
8
+ - **`NetBird`** — starts the [NetBird](https://netbird.io) client in userspace
9
+ (netstack) mode and exposes a local SOCKS5 proxy. It saves the peer identity,
10
+ so later runs reconnect as the same peer **without asking for the setup key**.
11
+ If a NetBird app/service on the machine is already connected, it just uses it.
12
+ - **`Synology`** — a Synology File Station client: browse, search, download
13
+ (files and folders as `.zip`) and upload, with live progress bars.
14
+
15
+ ## Install
16
+
17
+ ```
18
+ pip install Lab_nas
19
+ ```
20
+
21
+ The NetBird binary is downloaded automatically on first start (from the
22
+ official `netbirdio/netbird` GitHub releases) if `netbird` isn't installed.
23
+
24
+ ## How connecting works
25
+
26
+ `NetBird().start()` / `lab_nas start` tries these in order and stops at the
27
+ first that works:
28
+
29
+ 1. NetBird is **already connected** (Lab_nas's own daemon, or a NetBird
30
+ app/service you set up in a terminal) → nothing to do.
31
+ 2. A **saved identity** exists → reconnect with it, no setup key needed.
32
+ 3. A setup key is **already available** (argument, `NETBIRD_SETUP_KEY`
33
+ environment variable, or Colab secret) → used without asking.
34
+ 4. It failed (bad/expired key, peer deleted) or there was **no answer within
35
+ 60 seconds** → you are asked to type the setup key (3 tries).
36
+
37
+ ## Where the identity is saved
38
+
39
+ | Platform | Folder |
40
+ | -------- | ------ |
41
+ | Colab | `/content/drive/MyDrive/netbird` (Google Drive) |
42
+ | Linux | `~/.config/Lab_nas/netbird` (or `$XDG_CONFIG_HOME/Lab_nas/netbird`) |
43
+ | Windows | `Documents\Lab_nas\netbird` |
44
+
45
+ Change it with `NetBird(config_dir=...)`, `--config-dir`, or the
46
+ `LAB_NAS_CONFIG_DIR` environment variable. `config.json` contains the peer's
47
+ private key — keep it private (careful if Documents syncs to OneDrive).
48
+
49
+ ## Command line (bash and cmd)
50
+
51
+ ```
52
+ lab_nas start # connect
53
+ lab_nas status
54
+ lab_nas ls / --host 100.83.14.114
55
+ lab_nas find "*.xlsx" /home/Drive --host 100.83.14.114
56
+ lab_nas download /home/Drive/file.xlsx /home/Drive/MyFolder --dest .
57
+ lab_nas upload report.xlsx --to /home/Drive
58
+ lab_nas stop
59
+ ```
60
+
61
+ If `lab_nas` isn't found, use `python -m Lab_nas ...` (Windows: `py -m Lab_nas ...`).
62
+ Set values once instead of typing them each time:
63
+
64
+ ```bash
65
+ # bash
66
+ export NETBIRD_SETUP_KEY=XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
67
+ export LAB_NAS_HOST=100.83.14.114
68
+ export SYNO_USER=admin
69
+ ```
70
+
71
+ ```bat
72
+ :: cmd
73
+ set NETBIRD_SETUP_KEY=XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
74
+ set LAB_NAS_HOST=100.83.14.114
75
+ set SYNO_USER=admin
76
+ ```
77
+
78
+ Missing values (like `SYNO_PASS`) are asked for. Run `lab_nas <command> -h`
79
+ for all options.
80
+
81
+ ## Quick start (Python / Colab)
82
+
83
+ ```
84
+ from Lab_nas import NetBird, Synology
85
+
86
+ NetBird().start() # connect to your NetBird network
87
+ nas = Synology('100.83.14.114') # your NAS's NetBird IP
88
+ nas.login() # uses SYNO_USER / SYNO_PASS
89
+
90
+ nas.ls('/') # list shared folders
91
+ nas.find('*.xlsx', '/home/Drive') # search by name
92
+ nas.download('/home/Drive/file.xlsx') # Colab: /content, else current folder
93
+ nas.download('/home/Drive/MyFolder') # a folder arrives as MyFolder.zip
94
+ nas.upload('file.xlsx', '/home/Drive') # upload a local file
95
+ ```
96
+
97
+ ### Secrets
98
+
99
+ Looked up as an environment variable first, then a Colab secret (🔑 sidebar
100
+ with *Notebook access* on). If missing, you're asked to type it.
101
+
102
+ | Secret | Meaning |
103
+ | ------------------- | ---------------------------- |
104
+ | `NETBIRD_SETUP_KEY` | a reusable NetBird setup key |
105
+ | `SYNO_USER` | DSM username |
106
+ | `SYNO_PASS` | DSM password |
107
+
108
+ ## Common operations
109
+
110
+ ```
111
+ nb = NetBird(hostname='colab', timeout=60) # peer name, seconds before asking for the key
112
+ nb.start()
113
+ nb.status() # NetBird status + proxy state
114
+ nb.log() # tail the NetBird log
115
+ nb.stop()
116
+
117
+ nas = Synology('100.83.14.114') # proxy used automatically when needed
118
+ nas.login('admin', 'password')
119
+ nas.ls('/home')
120
+ nas.find('report*', '/home', max_depth=3)
121
+ nas.download_more(['/home/a.pdf', '/home/b.pdf'])
122
+ nas.download('/home/Photos', extract=True)
123
+ nas.upload('out.csv', '/home/Drive', overwrite=True)
124
+ nas.logout()
125
+ ```
126
+
127
+ ## Requirements
128
+
129
+ - Colab, Linux (amd64/arm64) or Windows (amd64/arm64).
130
+ - A NetBird network and a **setup key** (needed only the first time).
131
+ - A Synology NAS on your NetBird network, with an account that has File
132
+ Station permission.
133
+
134
+ ## Notes
135
+
136
+ - Runs NetBird in **netstack** (userspace) mode on its own daemon address
137
+ (`127.0.0.1:41799`), so no `tun` device is needed and a NetBird app already
138
+ installed on the machine is never touched.
139
+ - On Windows, if the daemon doesn't start, try cmd **as Administrator**.
140
+ - Synology often serves DSM with a self-signed certificate; TLS verification is
141
+ disabled for the NAS session by design.
142
+ - Synology Office files (`.osheet`, `.odoc`, `.oslides`) can only be opened in
143
+ Synology Office — export to `.xlsx`/`.docx` on the NAS first if you need them
144
+ elsewhere.
145
+
146
+ ## License
147
+
148
+ MIT — see [LICENSE](LICENSE).
@@ -0,0 +1,48 @@
1
+ [build-system]
2
+ requires = ["hatchling"]
3
+ build-backend = "hatchling.build"
4
+
5
+ [project]
6
+ name = "lab_me_nas"
7
+ version = "0.2.4"
8
+ description = "Access a Synology NAS from Google Colab, Linux or Windows through a NetBird mesh network."
9
+ readme = "README.md"
10
+ requires-python = ">=3.8"
11
+ license = { text = "MIT" }
12
+
13
+ authors = [{ name = "Suebpong Pruttipattanapong", email = "feyhong44@gmail.com" }]
14
+ keywords = ["synology", "netbird", "colab", "nas", "filestation", "wireguard", "socks5"]
15
+ classifiers = [
16
+ "Development Status :: 4 - Beta",
17
+ "Intended Audience :: Developers",
18
+ "License :: OSI Approved :: MIT License",
19
+ "Operating System :: POSIX :: Linux",
20
+ "Operating System :: Microsoft :: Windows",
21
+ "Environment :: Console",
22
+ "Programming Language :: Python :: 3",
23
+ "Programming Language :: Python :: 3 :: Only",
24
+ "Topic :: System :: Networking",
25
+ "Topic :: System :: Archiving :: Backup",
26
+ ]
27
+ dependencies = [
28
+ "requests>=2.20",
29
+ "PySocks>=1.7.1",
30
+ "requests-toolbelt>=0.9",
31
+ "alive-progress>=2.0",
32
+ ]
33
+
34
+ [project.scripts]
35
+ lab_nas = "Lab_nas.cli:main"
36
+ lab-nas = "Lab_nas.cli:main"
37
+
38
+ [project.urls]
39
+
40
+ Homepage = "https://github.com/feyhong1112/Lab_nas"
41
+ Repository = "https://github.com/feyhong1112/Lab_nas"
42
+ Issues = "https://github.com/feyhong1112/Lab_nas/issues"
43
+
44
+ [tool.hatch.build.targets.wheel]
45
+ packages = ["src/Lab_nas"]
46
+
47
+ [tool.hatch.build.targets.sdist]
48
+ include = ["src/Lab_nas", "README.md", "LICENSE"]