pyxui 0.0.1__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.
- pyxui-0.0.1/LICENSE +21 -0
- pyxui-0.0.1/PKG-INFO +182 -0
- pyxui-0.0.1/README.md +168 -0
- pyxui-0.0.1/pyxui/__init__.py +5 -0
- pyxui-0.0.1/pyxui/xui.py +18 -0
- pyxui-0.0.1/pyxui.egg-info/PKG-INFO +182 -0
- pyxui-0.0.1/pyxui.egg-info/SOURCES.txt +9 -0
- pyxui-0.0.1/pyxui.egg-info/dependency_links.txt +1 -0
- pyxui-0.0.1/pyxui.egg-info/top_level.txt +1 -0
- pyxui-0.0.1/setup.cfg +4 -0
- pyxui-0.0.1/setup.py +29 -0
pyxui-0.0.1/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2023 Arvin Radmehr
|
|
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.
|
pyxui-0.0.1/PKG-INFO
ADDED
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: pyxui
|
|
3
|
+
Version: 0.0.1
|
|
4
|
+
Summary: An application with python that allows you to modify your xui panel
|
|
5
|
+
Home-page: https://github.com/staliox/pyxui
|
|
6
|
+
Author: Staliox
|
|
7
|
+
License: MIT
|
|
8
|
+
Keywords: pyxui,xui,xui python,xui panel
|
|
9
|
+
Classifier: Programming Language :: Python :: 3
|
|
10
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
11
|
+
Requires: requests
|
|
12
|
+
Description-Content-Type: text/markdown
|
|
13
|
+
License-File: LICENSE
|
|
14
|
+
|
|
15
|
+
# PyXUI
|
|
16
|
+
An application with python that allows you to modify your xui panel ([Sanaeii 3x-ui](https://github.com/MHSanaei/3x-ui)) ([alireza0 x-ui](https://github.com/alireza0/x-ui))
|
|
17
|
+
|
|
18
|
+
## How To Install
|
|
19
|
+
```
|
|
20
|
+
pip install pyxui
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## How To Use
|
|
24
|
+
- Import pyxui in your .py file
|
|
25
|
+
```python
|
|
26
|
+
from pyxui import XUI
|
|
27
|
+
|
|
28
|
+
xui = XUI("staliox.com", 54321, True) # Make note if you use https set True else don't set anything
|
|
29
|
+
xui = XUI("staliox.com", 54321, True, "6fo3") # If you set panel path, you can set your panel path string
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
- Login in your panel
|
|
33
|
+
```python
|
|
34
|
+
from pyxui.errors import BadLogin
|
|
35
|
+
|
|
36
|
+
try:
|
|
37
|
+
xui.login(USERNAME, PASSWORD)
|
|
38
|
+
except BadLogin:
|
|
39
|
+
...
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
- Get inbounds list
|
|
43
|
+
```python
|
|
44
|
+
get_inbounds = xui.get_inbounds()
|
|
45
|
+
|
|
46
|
+
# Result
|
|
47
|
+
{
|
|
48
|
+
"success": true,
|
|
49
|
+
"msg": "",
|
|
50
|
+
"obj": [
|
|
51
|
+
{
|
|
52
|
+
"id": 1,
|
|
53
|
+
"up": 552345026,
|
|
54
|
+
"down": 18164200325,
|
|
55
|
+
"total": 0,
|
|
56
|
+
"remark": "Staliox",
|
|
57
|
+
"enable": true,
|
|
58
|
+
"expiryTime": 0,
|
|
59
|
+
"clientStats": [
|
|
60
|
+
{
|
|
61
|
+
"id": 1,
|
|
62
|
+
"inboundId": 1,
|
|
63
|
+
"enable": true,
|
|
64
|
+
"email": "Me",
|
|
65
|
+
"up": 191308877,
|
|
66
|
+
"down": 4945030148,
|
|
67
|
+
"expiryTime": 0,
|
|
68
|
+
"total": 0
|
|
69
|
+
}
|
|
70
|
+
],
|
|
71
|
+
"listen": "",
|
|
72
|
+
"port": 443,
|
|
73
|
+
"protocol": "vless",
|
|
74
|
+
"settings": "{\n \"clients\": [\n {\n \"email\": \"Me\",\n \"enable\": true,\n \"expiryTime\": 0,\n \"flow\": \"\",\n \"id\": \"c6419651-68d7-gfhg-d611-32v5df41g105\",\n \"limitIp\": 0,\n \"subId\": \"\",\n \"tgId\": \"@staliox\",\n \"totalGB\": 0\n }\n ],\n \"decryption\": \"none\",\n \"fallbacks\": []\n}",
|
|
75
|
+
"tag": "inbound-443",
|
|
76
|
+
"sniffing": "{\n \"enabled\": true,\n \"destOverride\": [\n \"http\",\n \"tls\"\n ]\n}"
|
|
77
|
+
}
|
|
78
|
+
]
|
|
79
|
+
}
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
- Add client to exist inbound
|
|
83
|
+
```python
|
|
84
|
+
get = xui.add_client(
|
|
85
|
+
inbound_id=1,
|
|
86
|
+
email="fdsfgf@gmal.com",
|
|
87
|
+
uuid="5d3d1bac-49cd-4b66-8be9-a728efa205fa",
|
|
88
|
+
enable = True,
|
|
89
|
+
flow = "",
|
|
90
|
+
limit_ip = 0,
|
|
91
|
+
total_gb = 5368709120,
|
|
92
|
+
expire_time = 1684948641772,
|
|
93
|
+
telegram_id = "",
|
|
94
|
+
subscription_id = ""
|
|
95
|
+
)
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
- Get client information:
|
|
99
|
+
```python
|
|
100
|
+
get_client = xui.get_client(
|
|
101
|
+
inbound_id=1,
|
|
102
|
+
email="Me",
|
|
103
|
+
uuid="5d3d1bac-49cd-4b66-8be9-a728efa205fa" # Make note you don't have to pass both of them (emaill, uuid), just one is enough
|
|
104
|
+
)
|
|
105
|
+
|
|
106
|
+
# Result
|
|
107
|
+
{
|
|
108
|
+
'id': 1,
|
|
109
|
+
'inboundId': 1,
|
|
110
|
+
'enable': True,
|
|
111
|
+
'email': 'Me',
|
|
112
|
+
'up': 194895832,
|
|
113
|
+
'down': 4959786483,
|
|
114
|
+
'expiryTime': 0,
|
|
115
|
+
'total': 0
|
|
116
|
+
}
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
- Delete client from exist inbound:
|
|
120
|
+
```python
|
|
121
|
+
get_client = xui.delete_client(
|
|
122
|
+
inbound_id=1,
|
|
123
|
+
email="Me",
|
|
124
|
+
uuid="5d3d1bac-49cd-4b66-8be9-a728efa205fa" # Make note you don't have to pass both of them (email, uuid), just one is enough
|
|
125
|
+
)
|
|
126
|
+
|
|
127
|
+
# Create vmess and vless config string
|
|
128
|
+
- Import config_generator
|
|
129
|
+
```python
|
|
130
|
+
from pyxui.config_gen import config_generator
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
- VMESS:
|
|
134
|
+
```python
|
|
135
|
+
config = {
|
|
136
|
+
"v": "2",
|
|
137
|
+
"ps": "Staliox-Me",
|
|
138
|
+
"add": "staliox.com",
|
|
139
|
+
"port": "443",
|
|
140
|
+
"id": "a85def57-0a86-43d1-b15c-0494519067c6",
|
|
141
|
+
"aid": "0",
|
|
142
|
+
"scy": "auto",
|
|
143
|
+
"net": "tcp",
|
|
144
|
+
"type": "ws",
|
|
145
|
+
"host": "staliox.site",
|
|
146
|
+
"path": "/",
|
|
147
|
+
"tls": "tls",
|
|
148
|
+
"sni": "staliox.site",
|
|
149
|
+
"alpn": "h2,http/1.1",
|
|
150
|
+
"fp": "chrome"
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
generate_config = config_generator("vmess", config)
|
|
154
|
+
|
|
155
|
+
# Result
|
|
156
|
+
vmess://eyJ2IjogIjIiLCAicHMiOiAiU3RhbGlveC1NZSIsICJhZGQiOiAic3RhbGlveC5jb20iLCAicG9ydCI6ICI0NDMiLCAiaWQiOiAiYTg1ZGVmNTctMGE4Ni00M2QxLWIxNWMtMDQ5NDUxOTA2N2M2IiwgImFpZCI6ICIwIiwgInNjeSI6ICJhdXRvIiwgIm5ldCI6ICJ0Y3AiLCAidHlwZSI6ICJ3cyIsICJob3N0IjogInN0YWxpb3guc2l0ZSIsICJwYXRoIjogIi8iLCAidGxzIjogInRscyIsICJzbmkiOiAic3RhbGlveC5zaXRlIiwgImFscG4iOiAiaDIsaHR0cC8xLjEiLCAiZnAiOiAiY2hyb21lIn0=
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
- VLESS:
|
|
160
|
+
```python
|
|
161
|
+
config = {
|
|
162
|
+
"ps": "Staliox-Me",
|
|
163
|
+
"add": "staliox.com",
|
|
164
|
+
"port": "443",
|
|
165
|
+
"id": "a85def57-0a86-43d1-b15c-0494519067c6"
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
data = {
|
|
169
|
+
"security": "tls",
|
|
170
|
+
"type": "ws",
|
|
171
|
+
"host": "staliox.site",
|
|
172
|
+
"path": "/",
|
|
173
|
+
"sni": "staliox.site",
|
|
174
|
+
"alpn": "h2,http/1.1",
|
|
175
|
+
"fp": "chrome"
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
generate_config = config_generator("vless", config, data)
|
|
179
|
+
|
|
180
|
+
# Result
|
|
181
|
+
vless://a85def57-0a86-43d1-b15c-0494519067c6@staliox.com:443?security=tls&type=ws&host=staliox.site&path=%2F&tls=tls&sni=staliox.site&alpn=h2%2Chttp%2F1.1&fp=chrome#Staliox-Me
|
|
182
|
+
```
|
pyxui-0.0.1/README.md
ADDED
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
# PyXUI
|
|
2
|
+
An application with python that allows you to modify your xui panel ([Sanaeii 3x-ui](https://github.com/MHSanaei/3x-ui)) ([alireza0 x-ui](https://github.com/alireza0/x-ui))
|
|
3
|
+
|
|
4
|
+
## How To Install
|
|
5
|
+
```
|
|
6
|
+
pip install pyxui
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
## How To Use
|
|
10
|
+
- Import pyxui in your .py file
|
|
11
|
+
```python
|
|
12
|
+
from pyxui import XUI
|
|
13
|
+
|
|
14
|
+
xui = XUI("staliox.com", 54321, True) # Make note if you use https set True else don't set anything
|
|
15
|
+
xui = XUI("staliox.com", 54321, True, "6fo3") # If you set panel path, you can set your panel path string
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
- Login in your panel
|
|
19
|
+
```python
|
|
20
|
+
from pyxui.errors import BadLogin
|
|
21
|
+
|
|
22
|
+
try:
|
|
23
|
+
xui.login(USERNAME, PASSWORD)
|
|
24
|
+
except BadLogin:
|
|
25
|
+
...
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
- Get inbounds list
|
|
29
|
+
```python
|
|
30
|
+
get_inbounds = xui.get_inbounds()
|
|
31
|
+
|
|
32
|
+
# Result
|
|
33
|
+
{
|
|
34
|
+
"success": true,
|
|
35
|
+
"msg": "",
|
|
36
|
+
"obj": [
|
|
37
|
+
{
|
|
38
|
+
"id": 1,
|
|
39
|
+
"up": 552345026,
|
|
40
|
+
"down": 18164200325,
|
|
41
|
+
"total": 0,
|
|
42
|
+
"remark": "Staliox",
|
|
43
|
+
"enable": true,
|
|
44
|
+
"expiryTime": 0,
|
|
45
|
+
"clientStats": [
|
|
46
|
+
{
|
|
47
|
+
"id": 1,
|
|
48
|
+
"inboundId": 1,
|
|
49
|
+
"enable": true,
|
|
50
|
+
"email": "Me",
|
|
51
|
+
"up": 191308877,
|
|
52
|
+
"down": 4945030148,
|
|
53
|
+
"expiryTime": 0,
|
|
54
|
+
"total": 0
|
|
55
|
+
}
|
|
56
|
+
],
|
|
57
|
+
"listen": "",
|
|
58
|
+
"port": 443,
|
|
59
|
+
"protocol": "vless",
|
|
60
|
+
"settings": "{\n \"clients\": [\n {\n \"email\": \"Me\",\n \"enable\": true,\n \"expiryTime\": 0,\n \"flow\": \"\",\n \"id\": \"c6419651-68d7-gfhg-d611-32v5df41g105\",\n \"limitIp\": 0,\n \"subId\": \"\",\n \"tgId\": \"@staliox\",\n \"totalGB\": 0\n }\n ],\n \"decryption\": \"none\",\n \"fallbacks\": []\n}",
|
|
61
|
+
"tag": "inbound-443",
|
|
62
|
+
"sniffing": "{\n \"enabled\": true,\n \"destOverride\": [\n \"http\",\n \"tls\"\n ]\n}"
|
|
63
|
+
}
|
|
64
|
+
]
|
|
65
|
+
}
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
- Add client to exist inbound
|
|
69
|
+
```python
|
|
70
|
+
get = xui.add_client(
|
|
71
|
+
inbound_id=1,
|
|
72
|
+
email="fdsfgf@gmal.com",
|
|
73
|
+
uuid="5d3d1bac-49cd-4b66-8be9-a728efa205fa",
|
|
74
|
+
enable = True,
|
|
75
|
+
flow = "",
|
|
76
|
+
limit_ip = 0,
|
|
77
|
+
total_gb = 5368709120,
|
|
78
|
+
expire_time = 1684948641772,
|
|
79
|
+
telegram_id = "",
|
|
80
|
+
subscription_id = ""
|
|
81
|
+
)
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
- Get client information:
|
|
85
|
+
```python
|
|
86
|
+
get_client = xui.get_client(
|
|
87
|
+
inbound_id=1,
|
|
88
|
+
email="Me",
|
|
89
|
+
uuid="5d3d1bac-49cd-4b66-8be9-a728efa205fa" # Make note you don't have to pass both of them (emaill, uuid), just one is enough
|
|
90
|
+
)
|
|
91
|
+
|
|
92
|
+
# Result
|
|
93
|
+
{
|
|
94
|
+
'id': 1,
|
|
95
|
+
'inboundId': 1,
|
|
96
|
+
'enable': True,
|
|
97
|
+
'email': 'Me',
|
|
98
|
+
'up': 194895832,
|
|
99
|
+
'down': 4959786483,
|
|
100
|
+
'expiryTime': 0,
|
|
101
|
+
'total': 0
|
|
102
|
+
}
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
- Delete client from exist inbound:
|
|
106
|
+
```python
|
|
107
|
+
get_client = xui.delete_client(
|
|
108
|
+
inbound_id=1,
|
|
109
|
+
email="Me",
|
|
110
|
+
uuid="5d3d1bac-49cd-4b66-8be9-a728efa205fa" # Make note you don't have to pass both of them (email, uuid), just one is enough
|
|
111
|
+
)
|
|
112
|
+
|
|
113
|
+
# Create vmess and vless config string
|
|
114
|
+
- Import config_generator
|
|
115
|
+
```python
|
|
116
|
+
from pyxui.config_gen import config_generator
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
- VMESS:
|
|
120
|
+
```python
|
|
121
|
+
config = {
|
|
122
|
+
"v": "2",
|
|
123
|
+
"ps": "Staliox-Me",
|
|
124
|
+
"add": "staliox.com",
|
|
125
|
+
"port": "443",
|
|
126
|
+
"id": "a85def57-0a86-43d1-b15c-0494519067c6",
|
|
127
|
+
"aid": "0",
|
|
128
|
+
"scy": "auto",
|
|
129
|
+
"net": "tcp",
|
|
130
|
+
"type": "ws",
|
|
131
|
+
"host": "staliox.site",
|
|
132
|
+
"path": "/",
|
|
133
|
+
"tls": "tls",
|
|
134
|
+
"sni": "staliox.site",
|
|
135
|
+
"alpn": "h2,http/1.1",
|
|
136
|
+
"fp": "chrome"
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
generate_config = config_generator("vmess", config)
|
|
140
|
+
|
|
141
|
+
# Result
|
|
142
|
+
vmess://eyJ2IjogIjIiLCAicHMiOiAiU3RhbGlveC1NZSIsICJhZGQiOiAic3RhbGlveC5jb20iLCAicG9ydCI6ICI0NDMiLCAiaWQiOiAiYTg1ZGVmNTctMGE4Ni00M2QxLWIxNWMtMDQ5NDUxOTA2N2M2IiwgImFpZCI6ICIwIiwgInNjeSI6ICJhdXRvIiwgIm5ldCI6ICJ0Y3AiLCAidHlwZSI6ICJ3cyIsICJob3N0IjogInN0YWxpb3guc2l0ZSIsICJwYXRoIjogIi8iLCAidGxzIjogInRscyIsICJzbmkiOiAic3RhbGlveC5zaXRlIiwgImFscG4iOiAiaDIsaHR0cC8xLjEiLCAiZnAiOiAiY2hyb21lIn0=
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
- VLESS:
|
|
146
|
+
```python
|
|
147
|
+
config = {
|
|
148
|
+
"ps": "Staliox-Me",
|
|
149
|
+
"add": "staliox.com",
|
|
150
|
+
"port": "443",
|
|
151
|
+
"id": "a85def57-0a86-43d1-b15c-0494519067c6"
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
data = {
|
|
155
|
+
"security": "tls",
|
|
156
|
+
"type": "ws",
|
|
157
|
+
"host": "staliox.site",
|
|
158
|
+
"path": "/",
|
|
159
|
+
"sni": "staliox.site",
|
|
160
|
+
"alpn": "h2,http/1.1",
|
|
161
|
+
"fp": "chrome"
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
generate_config = config_generator("vless", config, data)
|
|
165
|
+
|
|
166
|
+
# Result
|
|
167
|
+
vless://a85def57-0a86-43d1-b15c-0494519067c6@staliox.com:443?security=tls&type=ws&host=staliox.site&path=%2F&tls=tls&sni=staliox.site&alpn=h2%2Chttp%2F1.1&fp=chrome#Staliox-Me
|
|
168
|
+
```
|
pyxui-0.0.1/pyxui/xui.py
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
from pyxui.methods import Methods
|
|
2
|
+
|
|
3
|
+
class XUI(Methods):
|
|
4
|
+
def __init__(
|
|
5
|
+
self,
|
|
6
|
+
address: str,
|
|
7
|
+
port: int,
|
|
8
|
+
https: bool = False,
|
|
9
|
+
path: str = False,
|
|
10
|
+
session_string: str = None
|
|
11
|
+
) -> None:
|
|
12
|
+
super().__init__()
|
|
13
|
+
|
|
14
|
+
self.address = address
|
|
15
|
+
self.port = port
|
|
16
|
+
self.https = "https" if https else "http"
|
|
17
|
+
self.path = "" if not path else f"/{path}"
|
|
18
|
+
self.session_string = session_string
|
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: pyxui
|
|
3
|
+
Version: 0.0.1
|
|
4
|
+
Summary: An application with python that allows you to modify your xui panel
|
|
5
|
+
Home-page: https://github.com/staliox/pyxui
|
|
6
|
+
Author: Staliox
|
|
7
|
+
License: MIT
|
|
8
|
+
Keywords: pyxui,xui,xui python,xui panel
|
|
9
|
+
Classifier: Programming Language :: Python :: 3
|
|
10
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
11
|
+
Requires: requests
|
|
12
|
+
Description-Content-Type: text/markdown
|
|
13
|
+
License-File: LICENSE
|
|
14
|
+
|
|
15
|
+
# PyXUI
|
|
16
|
+
An application with python that allows you to modify your xui panel ([Sanaeii 3x-ui](https://github.com/MHSanaei/3x-ui)) ([alireza0 x-ui](https://github.com/alireza0/x-ui))
|
|
17
|
+
|
|
18
|
+
## How To Install
|
|
19
|
+
```
|
|
20
|
+
pip install pyxui
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## How To Use
|
|
24
|
+
- Import pyxui in your .py file
|
|
25
|
+
```python
|
|
26
|
+
from pyxui import XUI
|
|
27
|
+
|
|
28
|
+
xui = XUI("staliox.com", 54321, True) # Make note if you use https set True else don't set anything
|
|
29
|
+
xui = XUI("staliox.com", 54321, True, "6fo3") # If you set panel path, you can set your panel path string
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
- Login in your panel
|
|
33
|
+
```python
|
|
34
|
+
from pyxui.errors import BadLogin
|
|
35
|
+
|
|
36
|
+
try:
|
|
37
|
+
xui.login(USERNAME, PASSWORD)
|
|
38
|
+
except BadLogin:
|
|
39
|
+
...
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
- Get inbounds list
|
|
43
|
+
```python
|
|
44
|
+
get_inbounds = xui.get_inbounds()
|
|
45
|
+
|
|
46
|
+
# Result
|
|
47
|
+
{
|
|
48
|
+
"success": true,
|
|
49
|
+
"msg": "",
|
|
50
|
+
"obj": [
|
|
51
|
+
{
|
|
52
|
+
"id": 1,
|
|
53
|
+
"up": 552345026,
|
|
54
|
+
"down": 18164200325,
|
|
55
|
+
"total": 0,
|
|
56
|
+
"remark": "Staliox",
|
|
57
|
+
"enable": true,
|
|
58
|
+
"expiryTime": 0,
|
|
59
|
+
"clientStats": [
|
|
60
|
+
{
|
|
61
|
+
"id": 1,
|
|
62
|
+
"inboundId": 1,
|
|
63
|
+
"enable": true,
|
|
64
|
+
"email": "Me",
|
|
65
|
+
"up": 191308877,
|
|
66
|
+
"down": 4945030148,
|
|
67
|
+
"expiryTime": 0,
|
|
68
|
+
"total": 0
|
|
69
|
+
}
|
|
70
|
+
],
|
|
71
|
+
"listen": "",
|
|
72
|
+
"port": 443,
|
|
73
|
+
"protocol": "vless",
|
|
74
|
+
"settings": "{\n \"clients\": [\n {\n \"email\": \"Me\",\n \"enable\": true,\n \"expiryTime\": 0,\n \"flow\": \"\",\n \"id\": \"c6419651-68d7-gfhg-d611-32v5df41g105\",\n \"limitIp\": 0,\n \"subId\": \"\",\n \"tgId\": \"@staliox\",\n \"totalGB\": 0\n }\n ],\n \"decryption\": \"none\",\n \"fallbacks\": []\n}",
|
|
75
|
+
"tag": "inbound-443",
|
|
76
|
+
"sniffing": "{\n \"enabled\": true,\n \"destOverride\": [\n \"http\",\n \"tls\"\n ]\n}"
|
|
77
|
+
}
|
|
78
|
+
]
|
|
79
|
+
}
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
- Add client to exist inbound
|
|
83
|
+
```python
|
|
84
|
+
get = xui.add_client(
|
|
85
|
+
inbound_id=1,
|
|
86
|
+
email="fdsfgf@gmal.com",
|
|
87
|
+
uuid="5d3d1bac-49cd-4b66-8be9-a728efa205fa",
|
|
88
|
+
enable = True,
|
|
89
|
+
flow = "",
|
|
90
|
+
limit_ip = 0,
|
|
91
|
+
total_gb = 5368709120,
|
|
92
|
+
expire_time = 1684948641772,
|
|
93
|
+
telegram_id = "",
|
|
94
|
+
subscription_id = ""
|
|
95
|
+
)
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
- Get client information:
|
|
99
|
+
```python
|
|
100
|
+
get_client = xui.get_client(
|
|
101
|
+
inbound_id=1,
|
|
102
|
+
email="Me",
|
|
103
|
+
uuid="5d3d1bac-49cd-4b66-8be9-a728efa205fa" # Make note you don't have to pass both of them (emaill, uuid), just one is enough
|
|
104
|
+
)
|
|
105
|
+
|
|
106
|
+
# Result
|
|
107
|
+
{
|
|
108
|
+
'id': 1,
|
|
109
|
+
'inboundId': 1,
|
|
110
|
+
'enable': True,
|
|
111
|
+
'email': 'Me',
|
|
112
|
+
'up': 194895832,
|
|
113
|
+
'down': 4959786483,
|
|
114
|
+
'expiryTime': 0,
|
|
115
|
+
'total': 0
|
|
116
|
+
}
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
- Delete client from exist inbound:
|
|
120
|
+
```python
|
|
121
|
+
get_client = xui.delete_client(
|
|
122
|
+
inbound_id=1,
|
|
123
|
+
email="Me",
|
|
124
|
+
uuid="5d3d1bac-49cd-4b66-8be9-a728efa205fa" # Make note you don't have to pass both of them (email, uuid), just one is enough
|
|
125
|
+
)
|
|
126
|
+
|
|
127
|
+
# Create vmess and vless config string
|
|
128
|
+
- Import config_generator
|
|
129
|
+
```python
|
|
130
|
+
from pyxui.config_gen import config_generator
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
- VMESS:
|
|
134
|
+
```python
|
|
135
|
+
config = {
|
|
136
|
+
"v": "2",
|
|
137
|
+
"ps": "Staliox-Me",
|
|
138
|
+
"add": "staliox.com",
|
|
139
|
+
"port": "443",
|
|
140
|
+
"id": "a85def57-0a86-43d1-b15c-0494519067c6",
|
|
141
|
+
"aid": "0",
|
|
142
|
+
"scy": "auto",
|
|
143
|
+
"net": "tcp",
|
|
144
|
+
"type": "ws",
|
|
145
|
+
"host": "staliox.site",
|
|
146
|
+
"path": "/",
|
|
147
|
+
"tls": "tls",
|
|
148
|
+
"sni": "staliox.site",
|
|
149
|
+
"alpn": "h2,http/1.1",
|
|
150
|
+
"fp": "chrome"
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
generate_config = config_generator("vmess", config)
|
|
154
|
+
|
|
155
|
+
# Result
|
|
156
|
+
vmess://eyJ2IjogIjIiLCAicHMiOiAiU3RhbGlveC1NZSIsICJhZGQiOiAic3RhbGlveC5jb20iLCAicG9ydCI6ICI0NDMiLCAiaWQiOiAiYTg1ZGVmNTctMGE4Ni00M2QxLWIxNWMtMDQ5NDUxOTA2N2M2IiwgImFpZCI6ICIwIiwgInNjeSI6ICJhdXRvIiwgIm5ldCI6ICJ0Y3AiLCAidHlwZSI6ICJ3cyIsICJob3N0IjogInN0YWxpb3guc2l0ZSIsICJwYXRoIjogIi8iLCAidGxzIjogInRscyIsICJzbmkiOiAic3RhbGlveC5zaXRlIiwgImFscG4iOiAiaDIsaHR0cC8xLjEiLCAiZnAiOiAiY2hyb21lIn0=
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
- VLESS:
|
|
160
|
+
```python
|
|
161
|
+
config = {
|
|
162
|
+
"ps": "Staliox-Me",
|
|
163
|
+
"add": "staliox.com",
|
|
164
|
+
"port": "443",
|
|
165
|
+
"id": "a85def57-0a86-43d1-b15c-0494519067c6"
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
data = {
|
|
169
|
+
"security": "tls",
|
|
170
|
+
"type": "ws",
|
|
171
|
+
"host": "staliox.site",
|
|
172
|
+
"path": "/",
|
|
173
|
+
"sni": "staliox.site",
|
|
174
|
+
"alpn": "h2,http/1.1",
|
|
175
|
+
"fp": "chrome"
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
generate_config = config_generator("vless", config, data)
|
|
179
|
+
|
|
180
|
+
# Result
|
|
181
|
+
vless://a85def57-0a86-43d1-b15c-0494519067c6@staliox.com:443?security=tls&type=ws&host=staliox.site&path=%2F&tls=tls&sni=staliox.site&alpn=h2%2Chttp%2F1.1&fp=chrome#Staliox-Me
|
|
182
|
+
```
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
pyxui
|
pyxui-0.0.1/setup.cfg
ADDED
pyxui-0.0.1/setup.py
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
from setuptools import setup
|
|
2
|
+
|
|
3
|
+
VERSION = "0.0.1"
|
|
4
|
+
|
|
5
|
+
with open("README.md", "r") as f:
|
|
6
|
+
readme = f.read()
|
|
7
|
+
|
|
8
|
+
setup(
|
|
9
|
+
name="pyxui",
|
|
10
|
+
version=VERSION,
|
|
11
|
+
author="Staliox",
|
|
12
|
+
description="An application with python that allows you to modify your xui panel",
|
|
13
|
+
long_description=readme,
|
|
14
|
+
long_description_content_type="text/markdown",
|
|
15
|
+
url="https://github.com/staliox/pyxui",
|
|
16
|
+
keywords=[
|
|
17
|
+
"pyxui",
|
|
18
|
+
"xui",
|
|
19
|
+
"xui python",
|
|
20
|
+
"xui panel"
|
|
21
|
+
],
|
|
22
|
+
packages=["pyxui"],
|
|
23
|
+
requires=["requests"],
|
|
24
|
+
classifiers=[
|
|
25
|
+
"Programming Language :: Python :: 3",
|
|
26
|
+
"License :: OSI Approved :: MIT License",
|
|
27
|
+
],
|
|
28
|
+
license="MIT"
|
|
29
|
+
)
|