usys 0.1.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.
usys-0.1.0/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Wattox
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.
usys-0.1.0/PKG-INFO ADDED
@@ -0,0 +1,61 @@
1
+ Metadata-Version: 2.4
2
+ Name: usys
3
+ Version: 0.1.0
4
+ Summary: Linux user manager
5
+ Author: Wattox00
6
+ License: MIT
7
+ Requires-Python: >=3.8
8
+ Description-Content-Type: text/markdown
9
+ License-File: LICENSE
10
+ Dynamic: license-file
11
+
12
+ # USYS – Linux User Manager
13
+
14
+ USYS is a simple command-line Linux user and group management tool.
15
+ It provides an interactive interface to manage users and groups using
16
+ clear commands and short aliases.
17
+
18
+ ## Features
19
+
20
+ - Create, modify, and delete users
21
+ - Create and manage groups
22
+ - Add users to groups
23
+ - View user and group information
24
+ - Simple command aliases for faster usage
25
+
26
+ ## Main Menu
27
+ ```
28
+ Command Alias Description
29
+
30
+ user (u) User management
31
+ group (g) Group management
32
+ help (h) Show help menu
33
+ exit (q) Exit the program
34
+ ```
35
+
36
+
37
+ ## User Commands
38
+ ```
39
+ Command Alias Description
40
+
41
+ adduser (au) Create a new user account
42
+ deluser (du) Delete an existing user
43
+ passwd (pw) Change user password
44
+ chname (cn) Change username
45
+ chshell (cs) Change user shell
46
+ listuser (lu) List all users
47
+ homedir (hd) View user's home directory
48
+ quit (q) Quit user menu
49
+ ```
50
+
51
+ ## Group Commands
52
+ ```
53
+ Command Alias Description
54
+
55
+ addgroup (ga) Create a new group
56
+ delgroup (gd) Delete an existing group
57
+ appendgroup (ag) Add user to an existing group
58
+ listgroups (lg) List all groups
59
+ groupinfo (gi) Show detailed group information
60
+ quit (q) Quit group menu
61
+ ```
usys-0.1.0/README.md ADDED
@@ -0,0 +1,50 @@
1
+ # USYS – Linux User Manager
2
+
3
+ USYS is a simple command-line Linux user and group management tool.
4
+ It provides an interactive interface to manage users and groups using
5
+ clear commands and short aliases.
6
+
7
+ ## Features
8
+
9
+ - Create, modify, and delete users
10
+ - Create and manage groups
11
+ - Add users to groups
12
+ - View user and group information
13
+ - Simple command aliases for faster usage
14
+
15
+ ## Main Menu
16
+ ```
17
+ Command Alias Description
18
+
19
+ user (u) User management
20
+ group (g) Group management
21
+ help (h) Show help menu
22
+ exit (q) Exit the program
23
+ ```
24
+
25
+
26
+ ## User Commands
27
+ ```
28
+ Command Alias Description
29
+
30
+ adduser (au) Create a new user account
31
+ deluser (du) Delete an existing user
32
+ passwd (pw) Change user password
33
+ chname (cn) Change username
34
+ chshell (cs) Change user shell
35
+ listuser (lu) List all users
36
+ homedir (hd) View user's home directory
37
+ quit (q) Quit user menu
38
+ ```
39
+
40
+ ## Group Commands
41
+ ```
42
+ Command Alias Description
43
+
44
+ addgroup (ga) Create a new group
45
+ delgroup (gd) Delete an existing group
46
+ appendgroup (ag) Add user to an existing group
47
+ listgroups (lg) List all groups
48
+ groupinfo (gi) Show detailed group information
49
+ quit (q) Quit group menu
50
+ ```
@@ -0,0 +1,16 @@
1
+ [build-system]
2
+ requires = ["setuptools>=61.0"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "usys"
7
+ version = "0.1.0"
8
+ description = "Linux user manager"
9
+ readme = "README.md"
10
+ authors = [{ name="Wattox00"}]
11
+ license = { text = "MIT" }
12
+ requires-python = ">=3.8"
13
+ dependencies = []
14
+
15
+ [project.scripts]
16
+ usys = "usys.main:main"
usys-0.1.0/setup.cfg ADDED
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
File without changes
@@ -0,0 +1,113 @@
1
+ from functions.group_cfg import GroupFunctions
2
+ from functions.user_cfg import UserFunctions
3
+ from functions.functions import HelpFunctions
4
+
5
+ USER_COMMANDS = {
6
+ "adduser": UserFunctions.userAdd,
7
+ "deluser": UserFunctions.deleteUser,
8
+ "passwd": UserFunctions.userPassword,
9
+ "appendgroup": UserFunctions.appendToGroup,
10
+ "chname": UserFunctions.changeName,
11
+ "chshell": UserFunctions.changeShell,
12
+ "listusers": HelpFunctions.listUsers,
13
+ "listusergroups": HelpFunctions.listUserGroups,
14
+ "homedir": HelpFunctions.getHomeDir,
15
+ "help": UserFunctions.helpText,
16
+ "quit": quit,
17
+ }
18
+
19
+ USER_ALIASES = {
20
+ "au": "adduser",
21
+ "du": "deluser",
22
+ "pw": "passwd",
23
+ "ag": "appendgroup",
24
+ "cn": "chname",
25
+ "cs": "chshell",
26
+ "lu": "listusers",
27
+ "lug": "listusergroups",
28
+ "hd": "homedir",
29
+ "h": "help",
30
+ "q": "quit",
31
+ }
32
+
33
+ GROUP_COMMANDS = {
34
+ "addgroup": GroupFunctions.groupAdd,
35
+ "rmgroup": GroupFunctions.groupRemove,
36
+ "chgroup": GroupFunctions.chGroupName,
37
+ "delgroup": GroupFunctions.groupDel,
38
+ "listgroups": HelpFunctions.listGroups,
39
+ "groupinfo": HelpFunctions.listGroupInfo,
40
+ "help": GroupFunctions.helpText,
41
+ "quit": quit,
42
+ }
43
+
44
+ GROUP_ALIASES = {
45
+ "ga": "addgroup",
46
+ "gr": "rmgroup",
47
+ "cg": "chgroup",
48
+ "gd": "delgroup",
49
+ "lg": "listgroups",
50
+ "gi": "groupinfo",
51
+ "h": "help",
52
+ "q": "quit",
53
+ }
54
+
55
+ def root_help():
56
+ print("""
57
+ Command Alias Description
58
+
59
+ user (u) User management
60
+ group (g) Group management
61
+ help (h) Show this help menu
62
+ exit (q) Exit the program
63
+ """)
64
+
65
+ def helpFull():
66
+ print("""
67
+ USYS - linux user manager :)
68
+
69
+
70
+ USER COMMANDS
71
+
72
+ adduser (au) - Create a new user account
73
+ deluser (du) - Remove an existing user account
74
+ passwd (pw) - Change a user's password
75
+ chname (cn) - Modify an existing username
76
+ chshell (cs) - Change the user's default shell
77
+ listuser (lu) - Display all registered users
78
+ homedir (hd) - Show the user's home directory path
79
+
80
+ GROUP COMMANDS
81
+
82
+ addgroup (ga) - Create a new group
83
+ delgroup (gd) - Delete an existing group
84
+ appendgroup (ag) - Add a user to an existing group
85
+ listgroups (lg) - Display all groups
86
+ groupinfo (gi) - Show detailed information about a group
87
+
88
+ GENERAL
89
+
90
+ quit (q) - Exit the program
91
+ """)
92
+
93
+ # todo :
94
+
95
+ # lock/unlock user: usermod -L username ; usermod -U username
96
+
97
+ # set expire: expireuser (eu) ; setexpiry (se)
98
+
99
+ # passinfo (pi) ; setpasspolicy (sp)
100
+
101
+ # addusertogroup (aug) ; removeusergroup (rug) ; setgroups (sg)
102
+
103
+ # chuid (cuid) ; chgid (cgid)
104
+
105
+ # cloneuser (cu)
106
+
107
+ # add flags
108
+
109
+ # add ssh
110
+ # add samba
111
+ # add github ssh setup
112
+ # add apache setup
113
+ # add errorhandling ; user permission managment ; foldere permissions
@@ -0,0 +1,52 @@
1
+ class Functions():
2
+
3
+ def userName():
4
+ HelpFunctions.listUsers()
5
+ username = str(input('User name: ')).lower().strip()
6
+ return username
7
+
8
+ def groupName():
9
+ HelpFunctions.listGroups()
10
+ groupname = str(input('Group name: ')).lower().strip()
11
+ return groupname
12
+
13
+ def executeCmd(cmd, check=True, capture=False):
14
+ import subprocess
15
+ return subprocess.run(cmd, check=check, capture_output=capture, text=True)
16
+
17
+ class HelpFunctions():
18
+
19
+ #listings
20
+ def listUsers():
21
+ result = Functions.executeCmd(["bash", "-c", "getent passwd | awk -F: '$3 >= 1000 {print $1}'"], capture=True)
22
+ print(result.stdout)
23
+
24
+ def listGroups():
25
+ result = Functions.executeCmd(["bash", "-c", "getent group | awk -F: '$3 >= 1000 || $1 ~ /^(sudo|wheel|docker)$/ {print $1}'"], capture=True)
26
+ print(result.stdout)
27
+
28
+ def getHomeDir():
29
+ username = Functions.userName()
30
+ result = Functions.executeCmd(["getent", "passwd", username], capture=True)
31
+
32
+ home = result.stdout.split(":")[5]
33
+ print(home)
34
+
35
+ def listGroupInfo():
36
+ groupname = Functions.groupName()
37
+ cmd = ["getent", "group", groupname]
38
+
39
+ print(Functions.executeCmd(cmd, capture=True).stdout)
40
+
41
+ def listUserGroups():
42
+ username = Functions.userName()
43
+ cmd = ["groups", username]
44
+
45
+ print(Functions.executeCmd(cmd, capture=True).stdout)
46
+
47
+ # Helpers
48
+ def groupName():
49
+ Functions.listGroups()
50
+ groupname = str(input('Group name separated by space: ')).lower().strip()
51
+ return groupname.split(' ')
52
+
@@ -0,0 +1,45 @@
1
+ from functions.functions import Functions
2
+
3
+ class GroupFunctions():
4
+ # GROUPS
5
+
6
+ def groupAdd():
7
+ groupname = Functions.groupName()
8
+ cmd = ["sudo", "groupadd", groupname]
9
+
10
+ Functions.executeCmd(cmd)
11
+
12
+ def groupRemove():
13
+ username = Functions.userName()
14
+ groupName = Functions.groupName()
15
+
16
+ groups = ','.join(groupName)
17
+ cmd = ["sudo", "usermod", "-rG", groups, username]
18
+
19
+ Functions.executeCmd(cmd)
20
+
21
+ def chGroupName():
22
+ groupname = Functions.groupName()
23
+ newgroup = str(input('New name of the group: '))
24
+ cmd = ["sudo", "groupmod", "-n", newgroup, groupname]
25
+
26
+ Functions.executeCmd(cmd)
27
+
28
+ def groupDel():
29
+ groupname = Functions.groupName()
30
+ cmd = ["sudo", "groupdel", groupname]
31
+
32
+ Functions.executeCmd(cmd)
33
+
34
+ # Help text
35
+ def helpText():
36
+ print("""
37
+ Command Alias Description
38
+
39
+ appendgroup (ag) Add user to an existing group
40
+ addgroup (ga) Create a new group
41
+ delgroup (gd) Delete an existing group
42
+ listgroups (lg) List all groups
43
+ groupinfo (gi) Show detailed group information
44
+ quit (q) Quit the program
45
+ """)
File without changes
@@ -0,0 +1,84 @@
1
+ from functions.functions import Functions, HelpFunctions
2
+ class UserFunctions():
3
+
4
+ # add a user
5
+ def userAdd():
6
+ newUserName = Functions.userName()
7
+
8
+ cmd = ["sudo", "useradd"]
9
+
10
+ # Home directory
11
+ homeQ = input(f'Do you want to add home directory [home/{newUserName}] (Y/n) ').lower()
12
+ if homeQ in ("y", "yes", ""):
13
+ cmd.append("-m")
14
+
15
+ # Groups
16
+ groupQ = input(f'Do you want to add ({newUserName}) to a group (Y/n) ').lower()
17
+ if groupQ in ("y", "yes", ""):
18
+ HelpFunctions.listGroups()
19
+ groups = Functions.groupName()
20
+
21
+ if len(groups) == 1:
22
+ cmd += ["-g", groups[0]]
23
+
24
+ if len(groups) > 1:
25
+ cmd += ["-G", ",".join(groups[1:])]
26
+
27
+ cmd.append(newUserName)
28
+
29
+ Functions.executeCmd(cmd)
30
+
31
+ # remove user
32
+ def deleteUser():
33
+ username = Functions.userName()
34
+
35
+ cmd = ["sudo", "userdel", "-r", username]
36
+
37
+ Functions.executeCmd(cmd)
38
+
39
+ # Add/change password
40
+ def userPassword():
41
+ username = Functions.userName()
42
+ cmd = ["sudo", "passwd", username]
43
+ Functions.executeCmd(cmd)
44
+
45
+ # Append to Groups
46
+ def appendToGroup():
47
+ username = Functions.userName()
48
+ groupName = Functions.groupName()
49
+
50
+ groups = ','.join(groupName)
51
+ cmd = ["sudo", "usermod", "-aG", groups, username]
52
+
53
+ Functions.executeCmd(cmd)
54
+
55
+ # Change name
56
+ def changeName():
57
+ old = Functions.userName()
58
+ new = str(input('New name: '))
59
+ cmd = ["sudo", "usermod", "-l", new, old]
60
+
61
+ Functions.executeCmd(cmd)
62
+
63
+ # Change shell
64
+ def changeShell():
65
+ username = Functions.userName()
66
+ shellname = str(input('Change shell full path (/bin/bash): '))
67
+ cmd = ["sudo", "usermod", "-s", shellname, username]
68
+
69
+ Functions.executeCmd(cmd)
70
+
71
+ # help text
72
+ def helpText():
73
+ print("""
74
+ Command Alias Description
75
+
76
+ adduser (au) Create a new user
77
+ deluser (du) Delete an existing user
78
+ passwd (pw) Change user password
79
+ chname (cn) Change username
80
+ chshell (cs) Change user shell
81
+ listuser (lu) List all users
82
+ homedir (hd) View home directory
83
+ quit (q) Quit the program
84
+ """)
@@ -0,0 +1,34 @@
1
+ from shell import run_shell
2
+ from functions.commands import USER_COMMANDS, USER_ALIASES, GROUP_COMMANDS, GROUP_ALIASES, root_help, helpFull
3
+
4
+ def main():
5
+ while True:
6
+ try:
7
+ raw = input("usys ~ $ ").strip().lower()
8
+ except KeyboardInterrupt:
9
+ print()
10
+ break
11
+
12
+ if not raw:
13
+ continue
14
+
15
+ if raw == 'exit' or raw == 'q' or raw == 'e':
16
+ break
17
+
18
+ if raw == 'help' or raw == 'h':
19
+ root_help()
20
+ continue
21
+
22
+ if raw == 'helpf' or raw == 'hf':
23
+ helpFull()
24
+ continue
25
+
26
+ if raw == 'user' or raw == 'u':
27
+ run_shell('usys user ~ $ ', USER_COMMANDS, USER_ALIASES)
28
+ continue
29
+
30
+ if raw == 'group' or raw == 'g':
31
+ run_shell('usys group ~ $ ', GROUP_COMMANDS, GROUP_ALIASES)
32
+ continue
33
+
34
+ print(f"{raw}: command not found")
@@ -0,0 +1,25 @@
1
+ def run_shell(prompt, commands, aliases):
2
+
3
+ while True:
4
+ try:
5
+ raw = input(prompt).strip().lower()
6
+ except KeyboardInterrupt:
7
+ print()
8
+ return
9
+
10
+ if not raw:
11
+ continue
12
+
13
+ if raw == 'exit' or raw == 'e':
14
+ return
15
+
16
+ command = aliases.get(raw, raw)
17
+ func = commands.get(command)
18
+
19
+
20
+
21
+ if not func:
22
+ print(f"{command}: command not found")
23
+ continue
24
+
25
+ func()
@@ -0,0 +1,61 @@
1
+ Metadata-Version: 2.4
2
+ Name: usys
3
+ Version: 0.1.0
4
+ Summary: Linux user manager
5
+ Author: Wattox00
6
+ License: MIT
7
+ Requires-Python: >=3.8
8
+ Description-Content-Type: text/markdown
9
+ License-File: LICENSE
10
+ Dynamic: license-file
11
+
12
+ # USYS – Linux User Manager
13
+
14
+ USYS is a simple command-line Linux user and group management tool.
15
+ It provides an interactive interface to manage users and groups using
16
+ clear commands and short aliases.
17
+
18
+ ## Features
19
+
20
+ - Create, modify, and delete users
21
+ - Create and manage groups
22
+ - Add users to groups
23
+ - View user and group information
24
+ - Simple command aliases for faster usage
25
+
26
+ ## Main Menu
27
+ ```
28
+ Command Alias Description
29
+
30
+ user (u) User management
31
+ group (g) Group management
32
+ help (h) Show help menu
33
+ exit (q) Exit the program
34
+ ```
35
+
36
+
37
+ ## User Commands
38
+ ```
39
+ Command Alias Description
40
+
41
+ adduser (au) Create a new user account
42
+ deluser (du) Delete an existing user
43
+ passwd (pw) Change user password
44
+ chname (cn) Change username
45
+ chshell (cs) Change user shell
46
+ listuser (lu) List all users
47
+ homedir (hd) View user's home directory
48
+ quit (q) Quit user menu
49
+ ```
50
+
51
+ ## Group Commands
52
+ ```
53
+ Command Alias Description
54
+
55
+ addgroup (ga) Create a new group
56
+ delgroup (gd) Delete an existing group
57
+ appendgroup (ag) Add user to an existing group
58
+ listgroups (lg) List all groups
59
+ groupinfo (gi) Show detailed group information
60
+ quit (q) Quit group menu
61
+ ```
@@ -0,0 +1,16 @@
1
+ LICENSE
2
+ README.md
3
+ pyproject.toml
4
+ usys/__init__.py
5
+ usys/main.py
6
+ usys/shell.py
7
+ usys.egg-info/PKG-INFO
8
+ usys.egg-info/SOURCES.txt
9
+ usys.egg-info/dependency_links.txt
10
+ usys.egg-info/entry_points.txt
11
+ usys.egg-info/top_level.txt
12
+ usys/functions/commands.py
13
+ usys/functions/functions.py
14
+ usys/functions/group_cfg.py
15
+ usys/functions/permission_cfg.py
16
+ usys/functions/user_cfg.py
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ usys = usys.main:main
@@ -0,0 +1 @@
1
+ usys