borecli 1.0.0__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.
borecli-1.0.0/LICENSE ADDED
File without changes
borecli-1.0.0/PKG-INFO ADDED
@@ -0,0 +1,231 @@
1
+ Metadata-Version: 2.4
2
+ Name: borecli
3
+ Version: 1.0.0
4
+ Summary: Official BoreHook CLI for securely exposing localhost through BoreHook.
5
+ Author-email: Chinonso Egwuaka <chinonso_patrick@yahoo.com>
6
+ License: MIT
7
+ Project-URL: Homepage, https://borehook.com
8
+ Project-URL: Documentation, https://borehook.com/docs
9
+ Project-URL: Repository, https://github.com/CHI-NONSO1/borecli
10
+ Project-URL: Issues, https://github.com/CHI-NONSO1/borecli/issues
11
+ Keywords: borehook,tunnel,localhost,webhook,cli,proxy
12
+ Classifier: Development Status :: 4 - Beta
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: License :: OSI Approved :: MIT License
15
+ Classifier: Operating System :: OS Independent
16
+ Classifier: Programming Language :: Python :: 3
17
+ Classifier: Programming Language :: Python :: 3.10
18
+ Classifier: Programming Language :: Python :: 3.11
19
+ Classifier: Programming Language :: Python :: 3.12
20
+ Classifier: Topic :: Internet
21
+ Classifier: Topic :: Software Development
22
+ Classifier: Environment :: Console
23
+ Requires-Python: >=3.10
24
+ Description-Content-Type: text/markdown
25
+ License-File: LICENSE
26
+ Requires-Dist: click>=8.1.7
27
+ Requires-Dist: requests>=2.32.0
28
+ Requires-Dist: httpx>=0.28.0
29
+ Requires-Dist: websockets>=15.0
30
+ Dynamic: license-file
31
+
32
+ # BoreHook CLI
33
+
34
+ The official command-line interface for **BoreHook** — securely expose your localhost to the internet, test webhooks, and debug HTTP requests without deploying your application.
35
+
36
+ ## Features
37
+
38
+ * 🚀 Expose localhost over HTTPS
39
+ * 🔐 Secure authenticated tunnels
40
+ * 🔄 Persistent tunnel management
41
+ * 📡 WebSocket-powered request forwarding
42
+ * ⏱️ Configurable login session duration
43
+ * 💻 Cross-platform (Windows, macOS, Linux)
44
+
45
+ ---
46
+
47
+ ## Installation
48
+
49
+ ### Python (PyPI)
50
+
51
+ ```bash
52
+ pip install borecli
53
+ ```
54
+
55
+ ### Node.js (npm)
56
+
57
+ ```bash
58
+ npm install -g borecli
59
+ ```
60
+
61
+ ---
62
+
63
+ ## Login
64
+
65
+ Authenticate your BoreHook account.
66
+
67
+ ```bash
68
+ bore login
69
+ ```
70
+
71
+ Specify a custom session duration:
72
+
73
+ ```bash
74
+ bore login --time 30m
75
+ ```
76
+
77
+ ```bash
78
+ bore login --time 8h
79
+ ```
80
+
81
+ ```bash
82
+ bore login --time 7d
83
+ ```
84
+
85
+ If no duration is specified, the default session length is **1 hour**.
86
+
87
+ Supported time units:
88
+
89
+ | Example | Meaning |
90
+ | ------- | ---------- |
91
+ | `30m` | 30 Minutes |
92
+ | `2h` | 2 Hours |
93
+ | `7d` | 7 Days |
94
+
95
+ ---
96
+
97
+ ## Check Current User
98
+
99
+ ```bash
100
+ bore whoami
101
+ ```
102
+
103
+ Example:
104
+
105
+ ```text
106
+ Logged in as: john@example.com
107
+ ```
108
+
109
+ ---
110
+
111
+ ## Logout
112
+
113
+ ```bash
114
+ bore logout
115
+ ```
116
+
117
+ ---
118
+
119
+ ## Connect a Tunnel
120
+
121
+ Start forwarding traffic to your local application.
122
+
123
+ ```bash
124
+ bore connect
125
+ ```
126
+
127
+ You'll be prompted to select one of your configured tunnels.
128
+
129
+ Example:
130
+
131
+ ```text
132
+ Available Tunnels
133
+
134
+ [1] my-api
135
+ [2] webhook
136
+ [3] development
137
+
138
+ Select tunnel:
139
+ ```
140
+
141
+ After connecting:
142
+
143
+ ```text
144
+ 🚀 Tunnel Connected
145
+
146
+ Tunnel ID: 99c2c16b-e78b-4790-bab8-93865118f91b
147
+ Subdomain: webhook
148
+ Public URL: https://webhook.borehook.com
149
+
150
+ Forwarding → http://127.0.0.1:8000
151
+
152
+ Press Ctrl+C to disconnect.
153
+ ```
154
+
155
+ ---
156
+
157
+ ## Commands
158
+
159
+ | Command | Description |
160
+ | -------------- | ------------------------------------- |
161
+ | `bore login` | Authenticate your account |
162
+ | `bore connect` | Connect to a tunnel |
163
+ | `bore whoami` | Display the current logged-in account |
164
+ | `bore logout` | Remove the local session |
165
+
166
+ ---
167
+
168
+ ## Examples
169
+
170
+ Login for one hour (default):
171
+
172
+ ```bash
173
+ bore login
174
+ ```
175
+
176
+ Login for 15 minutes:
177
+
178
+ ```bash
179
+ bore login --time 15m
180
+ ```
181
+
182
+ Login for 8 hours:
183
+
184
+ ```bash
185
+ bore login --time 8h
186
+ ```
187
+
188
+ Connect to a tunnel:
189
+
190
+ ```bash
191
+ bore connect
192
+ ```
193
+
194
+ Logout:
195
+
196
+ ```bash
197
+ bore logout
198
+ ```
199
+
200
+ ---
201
+
202
+ ## Requirements
203
+
204
+ * Windows
205
+ * macOS
206
+ * Linux
207
+
208
+ Internet connection required.
209
+
210
+ ---
211
+
212
+ ## Documentation
213
+
214
+ Visit **https://borehook.com** for documentation, tutorials, and guides.
215
+
216
+ ---
217
+
218
+ ## Support
219
+
220
+ * Website: https://borehook.com
221
+ * Email: [support@borehook.com](mailto:support@borehook.com)
222
+
223
+ ---
224
+
225
+ ## License
226
+
227
+ MIT License.
228
+
229
+ ---
230
+
231
+ Built with ❤️ by the BoreHook team.
@@ -0,0 +1,200 @@
1
+ # BoreHook CLI
2
+
3
+ The official command-line interface for **BoreHook** — securely expose your localhost to the internet, test webhooks, and debug HTTP requests without deploying your application.
4
+
5
+ ## Features
6
+
7
+ * 🚀 Expose localhost over HTTPS
8
+ * 🔐 Secure authenticated tunnels
9
+ * 🔄 Persistent tunnel management
10
+ * 📡 WebSocket-powered request forwarding
11
+ * ⏱️ Configurable login session duration
12
+ * 💻 Cross-platform (Windows, macOS, Linux)
13
+
14
+ ---
15
+
16
+ ## Installation
17
+
18
+ ### Python (PyPI)
19
+
20
+ ```bash
21
+ pip install borecli
22
+ ```
23
+
24
+ ### Node.js (npm)
25
+
26
+ ```bash
27
+ npm install -g borecli
28
+ ```
29
+
30
+ ---
31
+
32
+ ## Login
33
+
34
+ Authenticate your BoreHook account.
35
+
36
+ ```bash
37
+ bore login
38
+ ```
39
+
40
+ Specify a custom session duration:
41
+
42
+ ```bash
43
+ bore login --time 30m
44
+ ```
45
+
46
+ ```bash
47
+ bore login --time 8h
48
+ ```
49
+
50
+ ```bash
51
+ bore login --time 7d
52
+ ```
53
+
54
+ If no duration is specified, the default session length is **1 hour**.
55
+
56
+ Supported time units:
57
+
58
+ | Example | Meaning |
59
+ | ------- | ---------- |
60
+ | `30m` | 30 Minutes |
61
+ | `2h` | 2 Hours |
62
+ | `7d` | 7 Days |
63
+
64
+ ---
65
+
66
+ ## Check Current User
67
+
68
+ ```bash
69
+ bore whoami
70
+ ```
71
+
72
+ Example:
73
+
74
+ ```text
75
+ Logged in as: john@example.com
76
+ ```
77
+
78
+ ---
79
+
80
+ ## Logout
81
+
82
+ ```bash
83
+ bore logout
84
+ ```
85
+
86
+ ---
87
+
88
+ ## Connect a Tunnel
89
+
90
+ Start forwarding traffic to your local application.
91
+
92
+ ```bash
93
+ bore connect
94
+ ```
95
+
96
+ You'll be prompted to select one of your configured tunnels.
97
+
98
+ Example:
99
+
100
+ ```text
101
+ Available Tunnels
102
+
103
+ [1] my-api
104
+ [2] webhook
105
+ [3] development
106
+
107
+ Select tunnel:
108
+ ```
109
+
110
+ After connecting:
111
+
112
+ ```text
113
+ 🚀 Tunnel Connected
114
+
115
+ Tunnel ID: 99c2c16b-e78b-4790-bab8-93865118f91b
116
+ Subdomain: webhook
117
+ Public URL: https://webhook.borehook.com
118
+
119
+ Forwarding → http://127.0.0.1:8000
120
+
121
+ Press Ctrl+C to disconnect.
122
+ ```
123
+
124
+ ---
125
+
126
+ ## Commands
127
+
128
+ | Command | Description |
129
+ | -------------- | ------------------------------------- |
130
+ | `bore login` | Authenticate your account |
131
+ | `bore connect` | Connect to a tunnel |
132
+ | `bore whoami` | Display the current logged-in account |
133
+ | `bore logout` | Remove the local session |
134
+
135
+ ---
136
+
137
+ ## Examples
138
+
139
+ Login for one hour (default):
140
+
141
+ ```bash
142
+ bore login
143
+ ```
144
+
145
+ Login for 15 minutes:
146
+
147
+ ```bash
148
+ bore login --time 15m
149
+ ```
150
+
151
+ Login for 8 hours:
152
+
153
+ ```bash
154
+ bore login --time 8h
155
+ ```
156
+
157
+ Connect to a tunnel:
158
+
159
+ ```bash
160
+ bore connect
161
+ ```
162
+
163
+ Logout:
164
+
165
+ ```bash
166
+ bore logout
167
+ ```
168
+
169
+ ---
170
+
171
+ ## Requirements
172
+
173
+ * Windows
174
+ * macOS
175
+ * Linux
176
+
177
+ Internet connection required.
178
+
179
+ ---
180
+
181
+ ## Documentation
182
+
183
+ Visit **https://borehook.com** for documentation, tutorials, and guides.
184
+
185
+ ---
186
+
187
+ ## Support
188
+
189
+ * Website: https://borehook.com
190
+ * Email: [support@borehook.com](mailto:support@borehook.com)
191
+
192
+ ---
193
+
194
+ ## License
195
+
196
+ MIT License.
197
+
198
+ ---
199
+
200
+ Built with ❤️ by the BoreHook team.
File without changes
@@ -0,0 +1,104 @@
1
+ #borecli/bore/auth.py
2
+ import requests
3
+
4
+ from .config import (DEFAULT_TOKEN_LIFETIME, clear_credentials, save_credentials,)
5
+
6
+ API_URL = "https://api.borehook.com"
7
+
8
+
9
+
10
+ def login(
11
+ email,
12
+ password,
13
+ lifetime=DEFAULT_TOKEN_LIFETIME,
14
+ ):
15
+ """
16
+ Authenticate a user and save the session locally.
17
+ """
18
+
19
+ response = requests.post(
20
+ f"{API_URL}/api/accounts/login/",
21
+ json={
22
+ "email": email,
23
+ "password": password,
24
+ },
25
+ timeout=30,
26
+ )
27
+
28
+ response.raise_for_status()
29
+
30
+ data = response.json()
31
+
32
+ token = data.get("token")
33
+
34
+ if not token:
35
+ raise Exception(
36
+ "Login succeeded but no token was returned."
37
+ )
38
+
39
+ save_credentials(
40
+ email=email,
41
+ token=token,
42
+ lifetime=lifetime,
43
+ )
44
+
45
+ return {
46
+ "email": email,
47
+ "token": token,
48
+ "lifetime": lifetime,
49
+ }
50
+
51
+
52
+ def verify_token(token):
53
+ """
54
+ Verify token validity against the API.
55
+
56
+ Returns:
57
+ True if valid.
58
+ False if invalid.
59
+ """
60
+
61
+ try:
62
+ response = requests.get(
63
+ f"{API_URL}/api/accounts/me/",
64
+ headers={
65
+ "Authorization": (
66
+ f"Token {token}"
67
+ )
68
+ },
69
+ timeout=30,
70
+ )
71
+
72
+ return response.status_code == 200
73
+
74
+ except Exception:
75
+ return False
76
+
77
+
78
+ def logout():
79
+ """
80
+ Remove locally stored credentials.
81
+ """
82
+
83
+ clear_credentials()
84
+
85
+
86
+ def refresh_session(email, token):
87
+ """
88
+ Refresh the saved session timestamp.
89
+ """
90
+
91
+ save_credentials(
92
+ email=email,
93
+ token=token,
94
+ )
95
+
96
+
97
+ def get_authenticated_headers(token):
98
+ """
99
+ Return authorization headers for API requests.
100
+ """
101
+
102
+ return {
103
+ "Authorization": f"Token {token}",
104
+ }