sujithx 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.
- sujithx-0.1.0/LICENSE.txt +17 -0
- sujithx-0.1.0/PKG-INFO +171 -0
- sujithx-0.1.0/README.md +160 -0
- sujithx-0.1.0/pyproject.toml +21 -0
- sujithx-0.1.0/setup.cfg +4 -0
- sujithx-0.1.0/sujithx/__init__.py +80 -0
- sujithx-0.1.0/sujithx/_init_.py +0 -0
- sujithx-0.1.0/sujithx/automation.py +96 -0
- sujithx-0.1.0/sujithx/cli.py +132 -0
- sujithx-0.1.0/sujithx/colors.py +85 -0
- sujithx-0.1.0/sujithx/files.py +108 -0
- sujithx-0.1.0/sujithx/logger.py +79 -0
- sujithx-0.1.0/sujithx/network.py +42 -0
- sujithx-0.1.0/sujithx/security.py +85 -0
- sujithx-0.1.0/sujithx/system_info.py +57 -0
- sujithx-0.1.0/sujithx.egg-info/PKG-INFO +171 -0
- sujithx-0.1.0/sujithx.egg-info/SOURCES.txt +19 -0
- sujithx-0.1.0/sujithx.egg-info/dependency_links.txt +1 -0
- sujithx-0.1.0/sujithx.egg-info/entry_points.txt +2 -0
- sujithx-0.1.0/sujithx.egg-info/top_level.txt +1 -0
- sujithx-0.1.0/tests/test_basic.py +64 -0
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Sujith
|
|
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.
|
sujithx-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: sujithx
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: A multipurpose Python toolkit for files, security, automation, and system utilities
|
|
5
|
+
Author: Sujith
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Requires-Python: >=3.12
|
|
8
|
+
Description-Content-Type: text/markdown
|
|
9
|
+
License-File: LICENSE.txt
|
|
10
|
+
Dynamic: license-file
|
|
11
|
+
|
|
12
|
+
SUJITHX — The Ultimate Python Toolkit
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
SUJITHX is a modular Python toolkit that combines file management, security utilities, automation, terminal styling, logging, system information, and network checks in one command-line application.
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
Features
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
\- File Intelligence: Search files, analyze folders, identify duplicates, and find large files.
|
|
25
|
+
|
|
26
|
+
\- Security Utilities: Generate random tokens and passwords, calculate SHA-256 hashes, and perform basic password-strength checks.
|
|
27
|
+
|
|
28
|
+
\- Automation: Create directories, inspect files, read text, and copy files safely without overwriting by default.
|
|
29
|
+
|
|
30
|
+
\- Terminal Styling: Colored messages, banners, and progress bars.
|
|
31
|
+
|
|
32
|
+
\- Logging: Write structured log messages to the console and log files.
|
|
33
|
+
|
|
34
|
+
\- System Information: Inspect Python, operating system, and disk usage information.
|
|
35
|
+
|
|
36
|
+
\- Network Utilities: Retrieve hostname and local IP information and check internet connectivity.
|
|
37
|
+
|
|
38
|
+
\- Command Center: Access the tools through an interactive menu.
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
Requirements
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
\- Python 3.12 or newer
|
|
47
|
+
|
|
48
|
+
\- Windows, macOS, or Linux
|
|
49
|
+
|
|
50
|
+
\- No third-party runtime dependencies
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
Installation
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
Clone the repository, enter its folder, and install it in editable mode:
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
git clone YOUR\_GITHUB\_REPOSITORY\_URL
|
|
63
|
+
|
|
64
|
+
cd SUJITHX
|
|
65
|
+
|
|
66
|
+
python -m venv .venv
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
Activate the environment on Windows:
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
.venv\\Scripts\\activate
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
Install SUJITHX:
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
python -m pip install -e .
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
Run
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
Launch the command center:
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
python -m sujithx.cli
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
After installation, you can also run:
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
sujithx
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
Example
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
from sujithx import (
|
|
111
|
+
|
|
112
|
+
  hello,
|
|
113
|
+
|
|
114
|
+
  generate\_token,
|
|
115
|
+
|
|
116
|
+
  analyze\_folder,
|
|
117
|
+
|
|
118
|
+
)
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
print(hello("Developer"))
|
|
123
|
+
|
|
124
|
+
print(generate\_token())
|
|
125
|
+
|
|
126
|
+
print(analyze\_folder("."))
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
|
|
130
|
+
Security Notes
|
|
131
|
+
|
|
132
|
+
|
|
133
|
+
|
|
134
|
+
\- Tokens and passwords are generated using Python's "secrets" module.
|
|
135
|
+
|
|
136
|
+
\- SHA-256 functions calculate file or text hashes; they do not encrypt data.
|
|
137
|
+
|
|
138
|
+
\- The password-strength checker is a basic heuristic, not a complete security assessment.
|
|
139
|
+
|
|
140
|
+
\- Review file paths before running file operations.
|
|
141
|
+
|
|
142
|
+
\- Keep generated passwords and tokens private.
|
|
143
|
+
|
|
144
|
+
|
|
145
|
+
|
|
146
|
+
Project Status
|
|
147
|
+
|
|
148
|
+
|
|
149
|
+
|
|
150
|
+
Version: 0.1.0
|
|
151
|
+
|
|
152
|
+
|
|
153
|
+
|
|
154
|
+
This project is under active development. Contributions, suggestions, and bug reports are welcome.
|
|
155
|
+
|
|
156
|
+
|
|
157
|
+
|
|
158
|
+
Author
|
|
159
|
+
|
|
160
|
+
|
|
161
|
+
|
|
162
|
+
Sujith
|
|
163
|
+
|
|
164
|
+
|
|
165
|
+
|
|
166
|
+
License
|
|
167
|
+
|
|
168
|
+
|
|
169
|
+
|
|
170
|
+
MIT License.
|
|
171
|
+
|
sujithx-0.1.0/README.md
ADDED
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
SUJITHX — The Ultimate Python Toolkit
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
SUJITHX is a modular Python toolkit that combines file management, security utilities, automation, terminal styling, logging, system information, and network checks in one command-line application.
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
Features
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
\- File Intelligence: Search files, analyze folders, identify duplicates, and find large files.
|
|
14
|
+
|
|
15
|
+
\- Security Utilities: Generate random tokens and passwords, calculate SHA-256 hashes, and perform basic password-strength checks.
|
|
16
|
+
|
|
17
|
+
\- Automation: Create directories, inspect files, read text, and copy files safely without overwriting by default.
|
|
18
|
+
|
|
19
|
+
\- Terminal Styling: Colored messages, banners, and progress bars.
|
|
20
|
+
|
|
21
|
+
\- Logging: Write structured log messages to the console and log files.
|
|
22
|
+
|
|
23
|
+
\- System Information: Inspect Python, operating system, and disk usage information.
|
|
24
|
+
|
|
25
|
+
\- Network Utilities: Retrieve hostname and local IP information and check internet connectivity.
|
|
26
|
+
|
|
27
|
+
\- Command Center: Access the tools through an interactive menu.
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
Requirements
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
\- Python 3.12 or newer
|
|
36
|
+
|
|
37
|
+
\- Windows, macOS, or Linux
|
|
38
|
+
|
|
39
|
+
\- No third-party runtime dependencies
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
Installation
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
Clone the repository, enter its folder, and install it in editable mode:
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
git clone YOUR\_GITHUB\_REPOSITORY\_URL
|
|
52
|
+
|
|
53
|
+
cd SUJITHX
|
|
54
|
+
|
|
55
|
+
python -m venv .venv
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
Activate the environment on Windows:
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
.venv\\Scripts\\activate
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
Install SUJITHX:
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
python -m pip install -e .
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
Run
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
Launch the command center:
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
python -m sujithx.cli
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
After installation, you can also run:
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
sujithx
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
Example
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
from sujithx import (
|
|
100
|
+
|
|
101
|
+
  hello,
|
|
102
|
+
|
|
103
|
+
  generate\_token,
|
|
104
|
+
|
|
105
|
+
  analyze\_folder,
|
|
106
|
+
|
|
107
|
+
)
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
print(hello("Developer"))
|
|
112
|
+
|
|
113
|
+
print(generate\_token())
|
|
114
|
+
|
|
115
|
+
print(analyze\_folder("."))
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
Security Notes
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
\- Tokens and passwords are generated using Python's "secrets" module.
|
|
124
|
+
|
|
125
|
+
\- SHA-256 functions calculate file or text hashes; they do not encrypt data.
|
|
126
|
+
|
|
127
|
+
\- The password-strength checker is a basic heuristic, not a complete security assessment.
|
|
128
|
+
|
|
129
|
+
\- Review file paths before running file operations.
|
|
130
|
+
|
|
131
|
+
\- Keep generated passwords and tokens private.
|
|
132
|
+
|
|
133
|
+
|
|
134
|
+
|
|
135
|
+
Project Status
|
|
136
|
+
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
Version: 0.1.0
|
|
140
|
+
|
|
141
|
+
|
|
142
|
+
|
|
143
|
+
This project is under active development. Contributions, suggestions, and bug reports are welcome.
|
|
144
|
+
|
|
145
|
+
|
|
146
|
+
|
|
147
|
+
Author
|
|
148
|
+
|
|
149
|
+
|
|
150
|
+
|
|
151
|
+
Sujith
|
|
152
|
+
|
|
153
|
+
|
|
154
|
+
|
|
155
|
+
License
|
|
156
|
+
|
|
157
|
+
|
|
158
|
+
|
|
159
|
+
MIT License.
|
|
160
|
+
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=68"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "sujithx"
|
|
7
|
+
version = "0.1.0"
|
|
8
|
+
description = "A multipurpose Python toolkit for files, security, automation, and system utilities"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.12"
|
|
11
|
+
license = "MIT"
|
|
12
|
+
authors = [
|
|
13
|
+
{name = "Sujith"}
|
|
14
|
+
]
|
|
15
|
+
dependencies = []
|
|
16
|
+
|
|
17
|
+
[project.scripts]
|
|
18
|
+
sujithx = "sujithx.cli:main"
|
|
19
|
+
|
|
20
|
+
[tool.setuptools.packages.find]
|
|
21
|
+
include = ["sujithx*"]
|
sujithx-0.1.0/setup.cfg
ADDED
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
"""
|
|
2
|
+
SUJITHX - The Ultimate Python Toolkit
|
|
3
|
+
"""
|
|
4
|
+
|
|
5
|
+
_version_ = "0.1.0"
|
|
6
|
+
_author_ = "Sujith"
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
def hello(name="Developer"):
|
|
10
|
+
"""Return a personalized greeting."""
|
|
11
|
+
return f"Hello, {name}! Welcome to SUJITHX."
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
def add(a, b):
|
|
15
|
+
"""Add two numbers."""
|
|
16
|
+
return a + b
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
def multiply(a, b):
|
|
20
|
+
"""Multiply two numbers."""
|
|
21
|
+
return a * b
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
def percentage(value, total):
|
|
25
|
+
"""Calculate a percentage safely."""
|
|
26
|
+
if total == 0:
|
|
27
|
+
raise ValueError("Total cannot be zero.")
|
|
28
|
+
|
|
29
|
+
return (value / total) * 100
|
|
30
|
+
from .files import (
|
|
31
|
+
search_files,
|
|
32
|
+
analyze_folder,
|
|
33
|
+
find_duplicates,
|
|
34
|
+
largest_files,
|
|
35
|
+
format_bytes,
|
|
36
|
+
)
|
|
37
|
+
from .security import (
|
|
38
|
+
sha256_text,
|
|
39
|
+
sha256_file,
|
|
40
|
+
generate_token,
|
|
41
|
+
generate_password,
|
|
42
|
+
check_password_strength,
|
|
43
|
+
)
|
|
44
|
+
from .colors import (
|
|
45
|
+
color_text,
|
|
46
|
+
success,
|
|
47
|
+
error,
|
|
48
|
+
warning,
|
|
49
|
+
info,
|
|
50
|
+
banner,
|
|
51
|
+
progress_bar,
|
|
52
|
+
print_progress,
|
|
53
|
+
)
|
|
54
|
+
from .logger import (
|
|
55
|
+
create_logger,
|
|
56
|
+
log_info,
|
|
57
|
+
log_warning,
|
|
58
|
+
log_error,
|
|
59
|
+
log_debug,
|
|
60
|
+
)
|
|
61
|
+
from .automation import (
|
|
62
|
+
ensure_directory,
|
|
63
|
+
list_files,
|
|
64
|
+
get_file_info,
|
|
65
|
+
copy_file,
|
|
66
|
+
read_text,
|
|
67
|
+
write_text,
|
|
68
|
+
file_exists,
|
|
69
|
+
)
|
|
70
|
+
from .system_info import (
|
|
71
|
+
get_system_info,
|
|
72
|
+
get_disk_info,
|
|
73
|
+
display_system_info,
|
|
74
|
+
)
|
|
75
|
+
from .network import (
|
|
76
|
+
get_hostname,
|
|
77
|
+
get_local_ip,
|
|
78
|
+
check_internet,
|
|
79
|
+
get_network_info,
|
|
80
|
+
)
|
|
File without changes
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
"""Safe file and folder automation utilities for SUJITHX."""
|
|
2
|
+
|
|
3
|
+
from pathlib import Path
|
|
4
|
+
import shutil
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
def ensure_directory(folder):
|
|
8
|
+
"""Create a folder if it does not already exist."""
|
|
9
|
+
path = Path(folder).expanduser()
|
|
10
|
+
path.mkdir(parents=True, exist_ok=True)
|
|
11
|
+
return str(path.resolve())
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
def list_files(folder, pattern="*"):
|
|
15
|
+
"""List files inside a folder and its subfolders."""
|
|
16
|
+
root = Path(folder).expanduser()
|
|
17
|
+
|
|
18
|
+
if not root.is_dir():
|
|
19
|
+
raise NotADirectoryError(f"Folder not found: {root}")
|
|
20
|
+
|
|
21
|
+
return sorted(
|
|
22
|
+
(str(path) for path in root.rglob(pattern) if path.is_file()),
|
|
23
|
+
key=str.lower,
|
|
24
|
+
)
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
def get_file_info(file_path):
|
|
28
|
+
"""Return basic information about a file."""
|
|
29
|
+
path = Path(file_path).expanduser()
|
|
30
|
+
|
|
31
|
+
if not path.is_file():
|
|
32
|
+
raise FileNotFoundError(f"File not found: {path}")
|
|
33
|
+
|
|
34
|
+
details = path.stat()
|
|
35
|
+
|
|
36
|
+
return {
|
|
37
|
+
"name": path.name,
|
|
38
|
+
"path": str(path.resolve()),
|
|
39
|
+
"extension": path.suffix.lower(),
|
|
40
|
+
"size_bytes": details.st_size,
|
|
41
|
+
"size_kb": round(details.st_size / 1024, 2),
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
def copy_file(source, destination, overwrite=False):
|
|
46
|
+
"""Copy a file without overwriting an existing file by default."""
|
|
47
|
+
source_path = Path(source).expanduser()
|
|
48
|
+
destination_path = Path(destination).expanduser()
|
|
49
|
+
|
|
50
|
+
if not source_path.is_file():
|
|
51
|
+
raise FileNotFoundError(f"Source file not found: {source_path}")
|
|
52
|
+
|
|
53
|
+
if destination_path.exists() and not overwrite:
|
|
54
|
+
raise FileExistsError(
|
|
55
|
+
f"Destination already exists: {destination_path}"
|
|
56
|
+
)
|
|
57
|
+
|
|
58
|
+
destination_path.parent.mkdir(parents=True, exist_ok=True)
|
|
59
|
+
shutil.copy2(source_path, destination_path)
|
|
60
|
+
|
|
61
|
+
return str(destination_path.resolve())
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
def read_text(file_path, encoding="utf-8"):
|
|
65
|
+
"""Read a UTF-8 text file."""
|
|
66
|
+
path = Path(file_path).expanduser()
|
|
67
|
+
|
|
68
|
+
if not path.is_file():
|
|
69
|
+
raise FileNotFoundError(f"File not found: {path}")
|
|
70
|
+
|
|
71
|
+
return path.read_text(encoding=encoding)
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
def write_text(file_path, content, overwrite=False, encoding="utf-8"):
|
|
75
|
+
"""Write a text file, refusing to overwrite by default."""
|
|
76
|
+
path = Path(file_path).expanduser()
|
|
77
|
+
|
|
78
|
+
if path.exists() and not overwrite:
|
|
79
|
+
raise FileExistsError(
|
|
80
|
+
f"File already exists: {path}. Set overwrite=True to replace it."
|
|
81
|
+
)
|
|
82
|
+
|
|
83
|
+
path.parent.mkdir(parents=True, exist_ok=True)
|
|
84
|
+
|
|
85
|
+
if overwrite:
|
|
86
|
+
path.write_text(content, encoding=encoding)
|
|
87
|
+
else:
|
|
88
|
+
with path.open("x", encoding=encoding) as file:
|
|
89
|
+
file.write(content)
|
|
90
|
+
|
|
91
|
+
return str(path.resolve())
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
def file_exists(file_path):
|
|
95
|
+
"""Check whether a file exists."""
|
|
96
|
+
return Path(file_path).expanduser().is_file()
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
"""SUJITHX - Unified Python Toolkit Command Center."""
|
|
2
|
+
|
|
3
|
+
from . import (
|
|
4
|
+
hello,
|
|
5
|
+
analyze_folder,
|
|
6
|
+
search_files,
|
|
7
|
+
find_duplicates,
|
|
8
|
+
largest_files,
|
|
9
|
+
format_bytes,
|
|
10
|
+
generate_token,
|
|
11
|
+
generate_password,
|
|
12
|
+
check_password_strength,
|
|
13
|
+
ensure_directory,
|
|
14
|
+
get_file_info,
|
|
15
|
+
banner,
|
|
16
|
+
success,
|
|
17
|
+
error,
|
|
18
|
+
info,
|
|
19
|
+
display_system_info,
|
|
20
|
+
get_network_info,
|
|
21
|
+
create_logger,
|
|
22
|
+
)
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
def show_menu():
|
|
26
|
+
print("\n1. Welcome")
|
|
27
|
+
print("2. Analyze folder")
|
|
28
|
+
print("3. Search files")
|
|
29
|
+
print("4. Find duplicate files")
|
|
30
|
+
print("5. Show largest files")
|
|
31
|
+
print("6. Generate secure token")
|
|
32
|
+
print("7. Generate password")
|
|
33
|
+
print("8. Check password strength")
|
|
34
|
+
print("9. Create folder")
|
|
35
|
+
print("10. Get file information")
|
|
36
|
+
print("11. System information")
|
|
37
|
+
print("12. Network information")
|
|
38
|
+
print("13. Logging demonstration")
|
|
39
|
+
print("0. Exit")
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
def main():
|
|
43
|
+
print(banner("SUJITHX COMMAND CENTER"))
|
|
44
|
+
logger = create_logger("SUJITHX_CLI", "sujithx_cli.log")
|
|
45
|
+
|
|
46
|
+
while True:
|
|
47
|
+
show_menu()
|
|
48
|
+
choice = input("\nChoose an option: ").strip()
|
|
49
|
+
|
|
50
|
+
try:
|
|
51
|
+
if choice == "1":
|
|
52
|
+
name = input("Your name: ").strip() or "Developer"
|
|
53
|
+
print(success(hello(name)))
|
|
54
|
+
|
|
55
|
+
elif choice == "2":
|
|
56
|
+
folder = input("Folder path: ").strip().strip('"')
|
|
57
|
+
result = analyze_folder(folder)
|
|
58
|
+
print("Folder:", result["folder"])
|
|
59
|
+
print("Files:", result["file_count"])
|
|
60
|
+
print("Size:", format_bytes(result["total_bytes"]))
|
|
61
|
+
print("Extensions:", result["extensions"])
|
|
62
|
+
|
|
63
|
+
elif choice == "3":
|
|
64
|
+
folder = input("Folder path: ").strip().strip('"')
|
|
65
|
+
pattern = input("Pattern (default ): ").strip() or ""
|
|
66
|
+
results = search_files(folder, pattern)
|
|
67
|
+
for path in results:
|
|
68
|
+
print(path)
|
|
69
|
+
print(f"Found {len(results)} file(s).")
|
|
70
|
+
|
|
71
|
+
elif choice == "4":
|
|
72
|
+
folder = input("Folder path: ").strip().strip('"')
|
|
73
|
+
groups = find_duplicates(folder)
|
|
74
|
+
if not groups:
|
|
75
|
+
print(success("No duplicates found."))
|
|
76
|
+
else:
|
|
77
|
+
for group in groups:
|
|
78
|
+
print("\nDuplicate group:")
|
|
79
|
+
for path in group:
|
|
80
|
+
print(" ", path)
|
|
81
|
+
|
|
82
|
+
elif choice == "5":
|
|
83
|
+
folder = input("Folder path: ").strip().strip('"')
|
|
84
|
+
for path, size in largest_files(folder, 10):
|
|
85
|
+
print(f"{format_bytes(size):>12} {path}")
|
|
86
|
+
|
|
87
|
+
elif choice == "6":
|
|
88
|
+
print("Generated token:", generate_token())
|
|
89
|
+
|
|
90
|
+
elif choice == "7":
|
|
91
|
+
print("Generated password:", generate_password())
|
|
92
|
+
|
|
93
|
+
elif choice == "8":
|
|
94
|
+
password = input("Password to evaluate: ")
|
|
95
|
+
result = check_password_strength(password)
|
|
96
|
+
print("Rating:", result["rating"])
|
|
97
|
+
print("Checks:", result["checks"])
|
|
98
|
+
|
|
99
|
+
elif choice == "9":
|
|
100
|
+
folder = input("Folder path to create: ").strip().strip('"')
|
|
101
|
+
print(success(ensure_directory(folder)))
|
|
102
|
+
|
|
103
|
+
elif choice == "10":
|
|
104
|
+
path = input("File path: ").strip().strip('"')
|
|
105
|
+
for key, value in get_file_info(path).items():
|
|
106
|
+
print(f"{key}: {value}")
|
|
107
|
+
|
|
108
|
+
elif choice == "11":
|
|
109
|
+
display_system_info()
|
|
110
|
+
|
|
111
|
+
elif choice == "12":
|
|
112
|
+
for key, value in get_network_info().items():
|
|
113
|
+
print(f"{key.replace('_', ' ').title()}: {value}")
|
|
114
|
+
|
|
115
|
+
elif choice == "13":
|
|
116
|
+
logger.info("SUJITHX logging demonstration.")
|
|
117
|
+
logger.warning("This is a sample warning.")
|
|
118
|
+
print(success("Log messages written to sujithx_cli.log"))
|
|
119
|
+
|
|
120
|
+
elif choice == "0":
|
|
121
|
+
print(success("SUJITHX closed. Goodbye!"))
|
|
122
|
+
break
|
|
123
|
+
|
|
124
|
+
else:
|
|
125
|
+
print(error("Choose a number from 0 to 13."))
|
|
126
|
+
|
|
127
|
+
except (OSError, ValueError, TypeError) as exc:
|
|
128
|
+
print(error(str(exc)))
|
|
129
|
+
|
|
130
|
+
|
|
131
|
+
if __name__ == "__main__":
|
|
132
|
+
main()
|