pcczy 1.0.0__py3-none-any.whl

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.
pcczy/__init__.py ADDED
@@ -0,0 +1,101 @@
1
+
2
+ """
3
+ PCCZY - Python Utility Library
4
+
5
+ Terminal styling, animations, security, utilities,
6
+ random generators, Telegram tools and Python analysis.
7
+ """
8
+
9
+ __version__ = "1.0.0"
10
+ __author__ = "PCCZY"
11
+
12
+
13
+ # Terminal
14
+ from .terminal import (
15
+ cprint,
16
+ rgb,
17
+ gradient,
18
+ clear,
19
+ )
20
+
21
+
22
+ # Banners and logo
23
+ from .banners import (
24
+ banner,
25
+ gradient_banner,
26
+ logo,
27
+ )
28
+
29
+
30
+ # Animations
31
+ from .animations import (
32
+ loading,
33
+ progress,
34
+ countdown,
35
+ )
36
+
37
+
38
+ # Utilities
39
+ from .utilities import (
40
+ expire,
41
+ info,
42
+ )
43
+
44
+
45
+ # Security
46
+ from .security import (
47
+ encrypt,
48
+ decrypt,
49
+ generate_key,
50
+ )
51
+
52
+
53
+ # Menus and tables
54
+ from .menus import (
55
+ menu,
56
+ table,
57
+ )
58
+
59
+
60
+ # Random utilities
61
+ from .randoms import (
62
+ random_string,
63
+ random_number,
64
+ random_color,
65
+ random_choice,
66
+ random_shuffle,
67
+ )
68
+
69
+
70
+ # Telegram
71
+ from .telegram import (
72
+ telegram_send,
73
+ )
74
+
75
+
76
+ # Python reverse engineering and analysis
77
+ from .decompiler import (
78
+ inspect_file,
79
+ analyze_file,
80
+ disassemble,
81
+ disassemble_pyc,
82
+ extract_strings,
83
+ get_metadata,
84
+ save_report,
85
+ )
86
+
87
+
88
+ __all__ = [
89
+ "cprint", "rgb", "gradient", "clear",
90
+ "banner", "gradient_banner", "logo",
91
+ "loading", "progress", "countdown",
92
+ "expire", "info",
93
+ "encrypt", "decrypt", "generate_key",
94
+ "menu", "table",
95
+ "random_string", "random_number",
96
+ "random_color", "random_choice", "random_shuffle",
97
+ "telegram_send",
98
+ "inspect_file", "analyze_file",
99
+ "disassemble", "disassemble_pyc",
100
+ "extract_strings", "get_metadata", "save_report",
101
+ ]
pcczy/animations.py ADDED
@@ -0,0 +1,61 @@
1
+
2
+ import sys
3
+ import time
4
+
5
+
6
+ def loading(text="Loading", duration=2, style="dots"):
7
+ frames = {
8
+ "dots": [" ", ". ", ".. ", "..."],
9
+ "line": ["|", "/", "-", "\\"],
10
+ "circle": ["◐", "◓", "◑", "◒"],
11
+ "bar": ["[ ]", "[= ]", "[== ]", "[=== ]", "[====]"]
12
+ }
13
+
14
+ if style not in frames:
15
+ raise ValueError("Style must be dots, line, circle or bar")
16
+
17
+ animation = frames[style]
18
+ end_time = time.time() + max(0, duration)
19
+
20
+ try:
21
+ while time.time() < end_time:
22
+ for frame in animation:
23
+ sys.stdout.write(f"\r{text} {frame}")
24
+ sys.stdout.flush()
25
+ time.sleep(0.12)
26
+
27
+ if time.time() >= end_time:
28
+ break
29
+ finally:
30
+ sys.stdout.write("\r" + " " * (len(text) + 15) + "\r")
31
+ sys.stdout.flush()
32
+
33
+ print(f"{text} Done!")
34
+
35
+
36
+ def progress(current, total, label="Progress", width=30):
37
+ if total <= 0:
38
+ raise ValueError("Total must be greater than zero")
39
+
40
+ current = max(0, min(current, total))
41
+ percentage = (current / total) * 100
42
+ filled = int(width * current / total)
43
+
44
+ bar = "█" * filled + "░" * (width - filled)
45
+
46
+ sys.stdout.write(
47
+ f"\r{label}: [{bar}] {percentage:5.1f}%"
48
+ )
49
+ sys.stdout.flush()
50
+
51
+ if current == total:
52
+ print()
53
+
54
+
55
+ def countdown(seconds, label="Starting in"):
56
+ for remaining in range(seconds, 0, -1):
57
+ sys.stdout.write(f"\r{label}: {remaining} ")
58
+ sys.stdout.flush()
59
+ time.sleep(1)
60
+
61
+ print("\r" + " " * 40 + "\rDone!")
pcczy/banners.py ADDED
@@ -0,0 +1,77 @@
1
+
2
+ from .terminal import cprint, rgb, gradient
3
+
4
+ FONTS = {
5
+ "standard": {
6
+ "A": [" A ", " A A ", "AAAAA", "A A", "A A"],
7
+ "B": ["BBBB ", "B B", "BBBB ", "B B", "BBBB "],
8
+ "C": [" CCC ", "C C", "C ", "C C", " CCC "],
9
+ "D": ["DDD ", "D D ", "D D", "D D ", "DDD "],
10
+ "E": ["EEEEE", "E ", "EEEE ", "E ", "EEEEE"],
11
+ "F": ["FFFFF", "F ", "FFFF ", "F ", "F "],
12
+ "G": [" GGG ", "G ", "G GGG", "G G", " GGG "],
13
+ "H": ["H H", "H H", "HHHHH", "H H", "H H"],
14
+ "I": ["IIIII", " I ", " I ", " I ", "IIIII"],
15
+ "J": ["JJJJJ", " J ", " J ", "J J ", " JJ "],
16
+ "K": ["K K", "K K ", "KKK ", "K K ", "K K"],
17
+ "L": ["L ", "L ", "L ", "L ", "LLLLL"],
18
+ "M": ["M M", "MM MM", "M M M", "M M", "M M"],
19
+ "N": ["N N", "NN N", "N N N", "N NN", "N N"],
20
+ "O": [" OOO ", "O O", "O O", "O O", " OOO "],
21
+ "P": ["PPPP ", "P P", "PPPP ", "P ", "P "],
22
+ "Q": [" QQQ ", "Q Q", "Q Q Q", "Q Q ", " QQ Q"],
23
+ "R": ["RRRR ", "R R", "RRRR ", "R R ", "R R"],
24
+ "S": [" SSSS", "S ", " SSS ", " S", "SSSS "],
25
+ "T": ["TTTTT", " T ", " T ", " T ", " T "],
26
+ "U": ["U U", "U U", "U U", "U U", " UUU "],
27
+ "V": ["V V", "V V", "V V", " V V ", " V "],
28
+ "W": ["W W", "W W", "W W W", "WW WW", "W W"],
29
+ "X": ["X X", " X X ", " X ", " X X ", "X X"],
30
+ "Y": ["Y Y", " Y Y ", " Y ", " Y ", " Y "],
31
+ "Z": ["ZZZZZ", " Z ", " Z ", " Z ", "ZZZZZ"],
32
+ " ": [" ", " ", " ", " ", " "]
33
+ }
34
+ }
35
+
36
+
37
+ def banner(text, font="standard", color=None):
38
+ text = str(text).upper()
39
+
40
+ if font not in FONTS:
41
+ raise ValueError("Font not found")
42
+
43
+ output = [""] * 5
44
+
45
+ for char in text:
46
+ pattern = FONTS[font].get(char, FONTS[font][" "])
47
+
48
+ for i in range(5):
49
+ output[i] += pattern[i] + " "
50
+
51
+ for line in output:
52
+ if color:
53
+ cprint(line, color=color)
54
+ else:
55
+ print(line)
56
+
57
+
58
+ def gradient_banner(text, start="red", end="blue"):
59
+ text = str(text).upper()
60
+ output = [""] * 5
61
+
62
+ for char in text:
63
+ pattern = FONTS["standard"].get(
64
+ char, FONTS["standard"][" "]
65
+ )
66
+
67
+ for i in range(5):
68
+ output[i] += pattern[i] + " "
69
+
70
+ for line in output:
71
+ gradient(line, start, end)
72
+
73
+
74
+ def logo():
75
+ from .logo import main
76
+ main()
77
+
pcczy/decompiler.py ADDED
@@ -0,0 +1,192 @@
1
+
2
+ import ast
3
+ import dis
4
+ import io
5
+ import marshal
6
+ import os
7
+ import re
8
+ import sys
9
+ import types
10
+ import tokenize
11
+ from collections import Counter
12
+
13
+
14
+ def _read_file(path):
15
+ if not os.path.isfile(path):
16
+ raise FileNotFoundError(f"File not found: {path}")
17
+
18
+ with open(path, "rb") as file:
19
+ return file.read()
20
+
21
+
22
+ def inspect_file(path):
23
+ """Inspect Python source and extract its structure."""
24
+
25
+ source = _read_file(path).decode("utf-8-sig")
26
+ tree = ast.parse(source, filename=path)
27
+
28
+ result = {
29
+ "file": os.path.basename(path),
30
+ "lines": len(source.splitlines()),
31
+ "imports": [],
32
+ "functions": [],
33
+ "classes": [],
34
+ "variables": []
35
+ }
36
+
37
+ for node in ast.walk(tree):
38
+ if isinstance(node, ast.Import):
39
+ for name in node.names:
40
+ result["imports"].append(name.name)
41
+
42
+ elif isinstance(node, ast.ImportFrom):
43
+ result["imports"].append(node.module or "")
44
+
45
+ elif isinstance(node, (ast.FunctionDef, ast.AsyncFunctionDef)):
46
+ result["functions"].append(node.name)
47
+
48
+ elif isinstance(node, ast.ClassDef):
49
+ result["classes"].append(node.name)
50
+
51
+ elif isinstance(node, ast.Assign):
52
+ for target in node.targets:
53
+ if isinstance(target, ast.Name):
54
+ result["variables"].append(target.id)
55
+
56
+ return result
57
+
58
+
59
+ def analyze_file(path):
60
+ """Analyze Python source code."""
61
+
62
+ source = _read_file(path).decode("utf-8-sig")
63
+ tree = ast.parse(source, filename=path)
64
+
65
+ functions = []
66
+ classes = []
67
+ imports = []
68
+ strings = []
69
+ constants = Counter()
70
+
71
+ for node in ast.walk(tree):
72
+ if isinstance(node, (ast.FunctionDef, ast.AsyncFunctionDef)):
73
+ functions.append({
74
+ "name": node.name,
75
+ "line": node.lineno,
76
+ "arguments": [
77
+ arg.arg for arg in node.args.args
78
+ ]
79
+ })
80
+
81
+ elif isinstance(node, ast.ClassDef):
82
+ classes.append({
83
+ "name": node.name,
84
+ "line": node.lineno
85
+ })
86
+
87
+ elif isinstance(node, (ast.Import, ast.ImportFrom)):
88
+ imports.append(ast.unparse(node))
89
+
90
+ elif isinstance(node, ast.Constant):
91
+ if isinstance(node.value, str):
92
+ strings.append(node.value)
93
+ elif isinstance(node.value, (int, float, bool, type(None))):
94
+ constants[type(node.value).__name__] += 1
95
+
96
+ return {
97
+ "file": os.path.basename(path),
98
+ "total_lines": len(source.splitlines()),
99
+ "functions": functions,
100
+ "classes": classes,
101
+ "imports": imports,
102
+ "strings": strings,
103
+ "constant_types": dict(constants)
104
+ }
105
+
106
+
107
+ def disassemble(path):
108
+ """Disassemble Python source or compiled Python bytecode."""
109
+
110
+ if path.endswith(".py"):
111
+ source = _read_file(path).decode("utf-8-sig")
112
+ code = compile(source, path, "exec")
113
+ else:
114
+ raise ValueError(
115
+ "This function currently accepts .py files. "
116
+ "Use disassemble_pyc() for .pyc files."
117
+ )
118
+
119
+ output = io.StringIO()
120
+ dis.dis(code, file=output)
121
+
122
+ return output.getvalue()
123
+
124
+
125
+ def disassemble_pyc(path):
126
+ """Read and disassemble a compatible .pyc file."""
127
+
128
+ data = _read_file(path)
129
+
130
+ if len(data) < 16:
131
+ raise ValueError("Invalid or incomplete .pyc file")
132
+
133
+ if data[:4] != __import__("importlib.util").util.MAGIC_NUMBER:
134
+ raise ValueError(
135
+ "This .pyc file was compiled for a different Python version."
136
+ )
137
+
138
+ code = marshal.loads(data[16:])
139
+
140
+ if not isinstance(code, types.CodeType):
141
+ raise ValueError("No valid code object found")
142
+
143
+ output = io.StringIO()
144
+ dis.dis(code, file=output)
145
+
146
+ return output.getvalue()
147
+
148
+
149
+ def extract_strings(path, minimum_length=4):
150
+ """Extract readable strings from a Python file or .pyc file."""
151
+
152
+ data = _read_file(path)
153
+
154
+ found = re.findall(
155
+ rb"[ -~]{%d,}" % minimum_length,
156
+ data
157
+ )
158
+
159
+ return list(dict.fromkeys(
160
+ item.decode("utf-8", errors="replace")
161
+ for item in found
162
+ ))
163
+
164
+
165
+ def get_metadata(path):
166
+ """Get basic file and Python environment metadata."""
167
+
168
+ data = _read_file(path)
169
+
170
+ return {
171
+ "filename": os.path.basename(path),
172
+ "size_bytes": len(data),
173
+ "extension": os.path.splitext(path)[1],
174
+ "python_version": sys.version,
175
+ "is_pyc": path.endswith(".pyc"),
176
+ "pyc_magic": data[:4].hex() if path.endswith(".pyc") else None
177
+ }
178
+
179
+
180
+ def save_report(data, output_path):
181
+ """Save analysis output as a text report."""
182
+
183
+ with open(output_path, "w", encoding="utf-8") as file:
184
+ if isinstance(data, dict):
185
+ for key, value in data.items():
186
+ file.write(f"\n{key.upper()}\n")
187
+ file.write("-" * 35 + "\n")
188
+ file.write(str(value) + "\n")
189
+ else:
190
+ file.write(str(data))
191
+
192
+ return output_path
pcczy/logo.py ADDED
@@ -0,0 +1,290 @@
1
+ #!/usr/bin/env python3
2
+
3
+ import math
4
+ import os
5
+ import random
6
+ import shutil
7
+ import sys
8
+ import time
9
+
10
+ NAME = "@PCCZY"
11
+ TAGLINE = "Dev ; @PCCZY"
12
+ FPS = 20
13
+ MODE_LEN = 110
14
+ INTRO_END = 100
15
+ FONT = {
16
+ "@": ["█████", "█ █ █", "█ ███", "█ ", "█████"],
17
+ "P": ["████ ", "█ █", "████ ", "█ ", "█ "],
18
+ "C": [" ████", "█ ", "█ ", "█ ", " ████"],
19
+ "Z": ["█████", " █ ", " █ ", " █ ", "█████"],
20
+ "Y": ["█ █", " █ █ ", " █ ", " █ ", " █ "],
21
+ }
22
+ GW, GH, GAP = 5, 5, 1
23
+ RAIN = "01<>/\\|=+*"
24
+ EQ = " ▁▂▃▄▅▆▇█"
25
+ SPIN = "|/-\\"
26
+ LOGS = ["loading modules", "syncing colours", "summoning PCCZY"]
27
+
28
+ ESC = "\033["
29
+ HOME, CLRL, HIDE, SHOW, RST = ESC + "H", ESC + "K", ESC + "?25l", ESC + "?25h", ESC + "0m"
30
+
31
+
32
+ def setup():
33
+ try:
34
+ sys.stdout.reconfigure(encoding="utf-8", errors="replace")
35
+ except Exception:
36
+ pass
37
+ if os.name == "nt":
38
+ os.system("")
39
+
40
+
41
+ def term():
42
+ try:
43
+ c, r = shutil.get_terminal_size((40, 24))
44
+ except Exception:
45
+ c, r = 40, 24
46
+ return max(c, 24), max(r, 10)
47
+
48
+
49
+ def c256(r, g, b):
50
+ return 16 + 36 * round(r * 5) + 6 * round(g * 5) + round(b * 5)
51
+
52
+
53
+ def hue(h, v=1.0):
54
+ h %= 1.0
55
+ i = int(h * 6)
56
+ f = h * 6 - i
57
+ r, g, b = [(1, f, 0), (1 - f, 1, 0), (0, 1, f), (0, 1 - f, 1), (f, 0, 1), (1, 0, 1 - f)][i % 6]
58
+ return c256(r * v, g * v, b * v)
59
+
60
+
61
+ def fg(c):
62
+ return f"{ESC}38;5;{c}m"
63
+
64
+
65
+ def layout(width):
66
+ per = max(1, (width + GAP) // (GW + GAP))
67
+ rows = [NAME[i:i + per] for i in range(0, len(NAME), per)]
68
+ pix, idx = [], 0
69
+ for ri, row in enumerate(rows):
70
+ rw = len(row) * (GW + GAP) - GAP
71
+ ox, oy = (width - rw) // 2, ri * (GH + 1)
72
+ for ch in row:
73
+ for y, line in enumerate(FONT[ch]):
74
+ for x, c in enumerate(line):
75
+ if c != " ":
76
+ pix.append((ox + x, oy + y, idx))
77
+ ox += GW + GAP
78
+ idx += 1
79
+ return pix, len(rows) * (GH + 1) - 1
80
+
81
+
82
+ class Show:
83
+ def __init__(self):
84
+ tw, tr = term()
85
+ self.W = min(tw, 60)
86
+ inner = self.W - 4
87
+ self.pix, self.th = layout(inner)
88
+ full = self.th + 11
89
+ self.status = tr - 1 >= full
90
+ self.H = full if self.status else self.th + 6
91
+ self.pix = [(x + 2, y, li) for x, y, li in self.pix]
92
+ self.lock = {(x, y): 6 + (x / self.W) * 45 + random.random() * 20 for x, y, _ in self.pix}
93
+ self.n = max(p[2] for p in self.pix) + 1
94
+ self.cols = [[random.uniform(-14, 0), random.uniform(.5, 1.3), random.randint(4, 9)]
95
+ for _ in range(self.W - 2)]
96
+ bh = self.th + 2
97
+ self.stars = [(random.randint(1, self.W - 2), random.randint(1, bh),
98
+ random.random() * 6, random.uniform(.1, .3)) for _ in range(self.W // 2)]
99
+ self.parts = []
100
+ self.last_mode = -2
101
+
102
+ # ---------- helpers
103
+ def burst(self, n=30):
104
+ cx, cy = self.W / 2, 1 + (self.th + 2) / 2
105
+ for _ in range(n):
106
+ a = random.random() * 6.283
107
+ s = random.uniform(.3, 1.4)
108
+ self.parts.append([cx, cy, math.cos(a) * s * 1.6, math.sin(a) * s * .7,
109
+ random.randint(14, 30), random.random()])
110
+
111
+ def frame(self, t):
112
+ W, H, th = self.W, self.H, self.th
113
+ g = [[(" ", 0)] * W for _ in range(H)]
114
+
115
+ def put(x, y, ch, col):
116
+ if 0 <= x < W and 0 <= y < H:
117
+ g[y][x] = (ch, col)
118
+
119
+ def text(x, y, s, col):
120
+ for i, ch in enumerate(s):
121
+ put(x + i, y, ch, col)
122
+
123
+ mode = -1 if t < INTRO_END else ((t - INTRO_END) // MODE_LEN) % 4
124
+ if mode != self.last_mode:
125
+ if mode >= 0:
126
+ self.burst(34)
127
+ self.last_mode = mode
128
+
129
+ bh = th + 2 # banner area rows 1..bh
130
+ # ---- twinkling stars
131
+ if t > 30:
132
+ for sx, sy, ph, sp in self.stars:
133
+ v = (math.sin(t * sp + ph) + 1) / 2
134
+ if v > .6:
135
+ put(sx, sy, "." if v < .85 else "*", 237 + int(v * 14))
136
+
137
+ # ---- matrix rain (intro, fades out)
138
+ for col_i, c in enumerate(self.cols):
139
+ c[0] += c[1]
140
+ if c[0] - c[2] > bh:
141
+ c[0] = random.uniform(-8, 0) if t < INTRO_END - 15 else 9999
142
+ for k in range(c[2]):
143
+ yy = int(c[0]) - k
144
+ if 1 <= yy <= bh:
145
+ shade = 231 if k == 0 else (46, 40, 34, 28, 22)[min(k - 1, 4)]
146
+ put(col_i + 1, yy, random.choice(RAIN), shade)
147
+
148
+ # ---- banner
149
+ gl_row, gl_shift = -1, 0
150
+ if mode == 3 and random.random() < .45:
151
+ gl_row, gl_shift = random.randint(0, th - 1), random.choice((-2, -1, 1, 2))
152
+ sweep = (t * 1.1) % (W + 24) - 12
153
+ tops = 2
154
+ for x, y, li in self.pix:
155
+ lt = self.lock[(x, y - 0)] if (x, y) in self.lock else 0
156
+ if t < lt:
157
+ continue
158
+ age = t - lt
159
+ dy, ch, col = 0, "█", hue(x * .02 + y * .05 + t * .02)
160
+ px = x
161
+ if age < 3:
162
+ col = 231
163
+ elif mode == 0: # wave
164
+ dy = round(math.sin(x * .33 + t * .22))
165
+ col = hue(x * .03 + t * .03 + dy * .08)
166
+ elif mode == 1: # scanner beam
167
+ d = abs(x - sweep)
168
+ col = 231 if d < 1.5 else (hue(t * .01 + li * .08, .95) if d > 4 else hue(t * .01 + li * .08 + .08))
169
+ elif mode == 2: # pulse + hopping letters
170
+ v = .55 + .45 * math.sin(t * .22 + li * .9)
171
+ col = hue(li * .17 + t * .015, max(.35, v))
172
+ if (t // 5) % self.n == li:
173
+ dy = -1
174
+ elif mode == 3: # glitch / chroma split
175
+ if y == gl_row:
176
+ px = x + gl_shift
177
+ if random.random() < .02:
178
+ ch = random.choice("▓▒░#%")
179
+ put(px - 1, tops + y + dy, "░", 51)
180
+ put(px + 1, tops + y + dy, "░", 201)
181
+ put(px, tops + y + dy, ch, col)
182
+ sx, sy = px + 1, tops + y + dy + 1
183
+ if mode != 3 and 0 <= sx < W and 0 <= sy < H and g[sy][sx][0] == " ":
184
+ put(sx, sy, "▒", 238)
185
+
186
+ # ---- particles
187
+ keep = []
188
+ for p in self.parts:
189
+ p[0] += p[2]
190
+ p[1] += p[3]
191
+ p[3] += .05
192
+ p[4] -= 1
193
+ if p[4] > 0:
194
+ keep.append(p)
195
+ put(int(p[0]), int(p[1]), "*" if p[4] > 10 else ".", hue(p[5] + t * .02, min(1, p[4] / 10)))
196
+ self.parts = keep
197
+
198
+ # ---- frame (rounded, colour-cycling) with title bar + clock
199
+ per = 2 * (W + H)
200
+ for i in range(W):
201
+ put(i, 0, "─", hue(i / per + t * .012, .9))
202
+ put(i, H - 1, "─", hue((W + H + i) / per + t * .012, .9))
203
+ for j in range(H):
204
+ put(0, j, "│", hue((2 * W + H + j) / per + t * .012, .9))
205
+ put(W - 1, j, "│", hue(j / per + .3 + t * .012, .9))
206
+ put(0, 0, "╭", 231); put(W - 1, 0, "╮", 231)
207
+ put(0, H - 1, "╰", 231); put(W - 1, H - 1, "╯", 231)
208
+ put(2, 0, "●", 203); put(4, 0, "●", 221); put(6, 0, "●", 114)
209
+ title = " PCCZY.sh "
210
+ text(W - len(title) - 3, 0, title, 252)
211
+ clock = " " + time.strftime("%H:%M:%S") + " "
212
+ text((W - len(clock)) // 2, H - 1, clock, 252)
213
+
214
+ # ---- divider + status log
215
+ y = bh + 2
216
+ if self.status:
217
+ for i in range(1, W - 1):
218
+ put(i, y, "·", 239)
219
+ for li, label in enumerate(LOGS):
220
+ st = 72 + li * 14
221
+ if t < st:
222
+ break
223
+ ly = y + 1 + li
224
+ text(3, ly, "> " + label, 250)
225
+ if t < st + 12:
226
+ text(W - 8, ly, "[ " + SPIN[t % 4] + " ]", 51)
227
+ else:
228
+ text(W - 8, ly, "[OK]", 46)
229
+ y += 4
230
+ else:
231
+ y += 0
232
+
233
+ # ---- equalizer
234
+ eq_y = H - 3
235
+ if t > 40:
236
+ for i in range(W - 6):
237
+ a = (math.sin(i * .5 + t * .31) + math.sin(i * .21 - t * .17) + 2) / 4
238
+ text(3 + i, eq_y, EQ[int(a * 8) + (1 if a > 0 else 0)] if a > .05 else " ", hue(i / (W - 6) + t * .015, .9))
239
+
240
+ # ---- tagline shimmer
241
+ tag = " ".join(TAGLINE)
242
+ tx = (W - len(tag)) // 2
243
+ shown = min(len(tag), max(0, (t - 85) // 2))
244
+ pos = (t * .6) % (len(tag) + 10) - 3
245
+ for i in range(shown):
246
+ col = 231 if abs(i - pos) < 1.5 else hue(t * .008 + i * .04, .55)
247
+ put(tx + i, H - 2, tag[i], col)
248
+ if shown < len(tag):
249
+ put(tx + shown, H - 2, "_", 46)
250
+
251
+ out = []
252
+ for row in g:
253
+ line, last = [], None
254
+ for ch, col in row:
255
+ if ch == " ":
256
+ line.append(" ")
257
+ continue
258
+ if col != last:
259
+ line.append(fg(col))
260
+ last = col
261
+ line.append(ch)
262
+ out.append("".join(line) + RST + CLRL)
263
+ return "\n".join(out)
264
+
265
+
266
+ def main():
267
+ setup()
268
+ limit = int(os.environ.get("PCCZY_FRAMES", "0")) or None
269
+ show = Show()
270
+ w = sys.stdout.write
271
+ w(ESC + "2J" + HIDE)
272
+ t = 0
273
+ try:
274
+ while True:
275
+ s = time.time()
276
+ w(HOME + show.frame(t))
277
+ sys.stdout.flush()
278
+ t += 1
279
+ if limit and t >= limit:
280
+ break
281
+ time.sleep(max(0, 1 / FPS - (time.time() - s)))
282
+ except KeyboardInterrupt:
283
+ pass
284
+ finally:
285
+ w(RST + SHOW + "\n")
286
+ sys.stdout.flush()
287
+
288
+
289
+ if __name__ == "__main__":
290
+ main()
pcczy/menus.py ADDED
@@ -0,0 +1,77 @@
1
+
2
+ def menu(title, options):
3
+ """
4
+ Display an interactive numbered menu.
5
+ Returns the selected option (1-based).
6
+ """
7
+
8
+ if not options:
9
+ raise ValueError("Menu options cannot be empty")
10
+
11
+ print("\n" + "=" * 35)
12
+ print(f" {title}")
13
+ print("=" * 35)
14
+
15
+ for index, option in enumerate(options, 1):
16
+ print(f" [{index}] {option}")
17
+
18
+ print("=" * 35)
19
+
20
+ while True:
21
+ try:
22
+ choice = int(input(" Select an option: "))
23
+
24
+ if 1 <= choice <= len(options):
25
+ return choice
26
+
27
+ print(" Invalid choice. Try again.")
28
+
29
+ except ValueError:
30
+ print(" Enter a valid number.")
31
+ except (KeyboardInterrupt, EOFError):
32
+ print("\nMenu cancelled.")
33
+ return None
34
+
35
+
36
+ def table(headers, rows):
37
+ """
38
+ Display data in a formatted terminal table.
39
+ """
40
+
41
+ if not headers:
42
+ raise ValueError("Headers cannot be empty")
43
+
44
+ headers = [str(item) for item in headers]
45
+ rows = [[str(item) for item in row] for row in rows]
46
+
47
+ if any(len(row) != len(headers) for row in rows):
48
+ raise ValueError("Every row must match the number of headers")
49
+
50
+ widths = [
51
+ max(
52
+ len(headers[i]),
53
+ max((len(row[i]) for row in rows), default=0)
54
+ )
55
+ for i in range(len(headers))
56
+ ]
57
+
58
+ border = "+" + "+".join("-" * (w + 2) for w in widths) + "+"
59
+
60
+ def print_row(row):
61
+ print(
62
+ "| " +
63
+ " | ".join(
64
+ str(value).ljust(widths[i])
65
+ for i, value in enumerate(row)
66
+ ) +
67
+ " |"
68
+ )
69
+
70
+ print(border)
71
+ print_row(headers)
72
+ print(border)
73
+
74
+ for row in rows:
75
+ print_row(row)
76
+
77
+ print(border)
pcczy/randoms.py ADDED
@@ -0,0 +1,54 @@
1
+
2
+ import random
3
+ import string
4
+
5
+
6
+ def random_string(length=16, uppercase=True, lowercase=True,
7
+ digits=True, symbols=False):
8
+ if not isinstance(length, int) or length < 1:
9
+ raise ValueError("Length must be a positive integer")
10
+
11
+ characters = ""
12
+
13
+ if uppercase:
14
+ characters += string.ascii_uppercase
15
+
16
+ if lowercase:
17
+ characters += string.ascii_lowercase
18
+
19
+ if digits:
20
+ characters += string.digits
21
+
22
+ if symbols:
23
+ characters += "!@#$%^&*()-_=+"
24
+
25
+ if not characters:
26
+ raise ValueError("Select at least one character type")
27
+
28
+ return "".join(
29
+ random.choice(characters) for _ in range(length)
30
+ )
31
+
32
+
33
+ def random_number(minimum=1, maximum=100):
34
+ if minimum > maximum:
35
+ raise ValueError("Minimum cannot exceed maximum")
36
+
37
+ return random.randint(minimum, maximum)
38
+
39
+
40
+ def random_color():
41
+ return "#{:06X}".format(random.randint(0, 0xFFFFFF))
42
+
43
+
44
+ def random_choice(items):
45
+ if not items:
46
+ raise ValueError("Items cannot be empty")
47
+
48
+ return random.choice(items)
49
+
50
+
51
+ def random_shuffle(items):
52
+ result = list(items)
53
+ random.shuffle(result)
54
+ return result
pcczy/security.py ADDED
@@ -0,0 +1,64 @@
1
+
2
+ import os
3
+ import base64
4
+ import hashlib
5
+
6
+ from cryptography.fernet import Fernet, InvalidToken
7
+ from cryptography.hazmat.primitives.kdf.pbkdf2 import PBKDF2HMAC
8
+ from cryptography.hazmat.primitives import hashes
9
+
10
+
11
+ def _derive_key(password, salt):
12
+ if not isinstance(password, str) or not password:
13
+ raise ValueError("Password must be a non-empty string")
14
+
15
+ kdf = PBKDF2HMAC(
16
+ algorithm=hashes.SHA256(),
17
+ length=32,
18
+ salt=salt,
19
+ iterations=600000,
20
+ )
21
+
22
+ key = kdf.derive(password.encode("utf-8"))
23
+ return base64.urlsafe_b64encode(key)
24
+
25
+
26
+ def encrypt(text, password):
27
+ if not isinstance(text, str):
28
+ raise TypeError("Text must be a string")
29
+
30
+ salt = os.urandom(16)
31
+ key = _derive_key(password, salt)
32
+
33
+ encrypted = Fernet(key).encrypt(text.encode("utf-8"))
34
+
35
+ # Store salt and encrypted data together
36
+ return base64.urlsafe_b64encode(
37
+ b"PCCZY1" + salt + encrypted
38
+ ).decode("ascii")
39
+
40
+
41
+ def decrypt(encrypted_text, password):
42
+ try:
43
+ data = base64.urlsafe_b64decode(encrypted_text.encode("ascii"))
44
+
45
+ if not data.startswith(b"PCCZY1"):
46
+ raise ValueError("Invalid PCCZY encrypted data")
47
+
48
+ salt = data[6:22]
49
+ encrypted = data[22:]
50
+
51
+ key = _derive_key(password, salt)
52
+
53
+ return Fernet(key).decrypt(encrypted).decode("utf-8")
54
+
55
+ except (InvalidToken, UnicodeDecodeError):
56
+ raise ValueError("Wrong password or corrupted encrypted data")
57
+ except Exception as error:
58
+ if isinstance(error, ValueError):
59
+ raise
60
+ raise ValueError("Invalid encrypted data") from error
61
+
62
+
63
+ def generate_key():
64
+ return Fernet.generate_key().decode("ascii")
pcczy/telegram.py ADDED
@@ -0,0 +1,49 @@
1
+
2
+ import json
3
+ import urllib.request
4
+ import urllib.parse
5
+ import urllib.error
6
+
7
+
8
+ def telegram_send(token, chat_id, message):
9
+ """
10
+ Send a Telegram message using your own bot.
11
+
12
+ Returns Telegram's response as a dictionary.
13
+ """
14
+
15
+ if not token or not chat_id:
16
+ raise ValueError("Bot token and chat ID are required")
17
+
18
+ if not message:
19
+ raise ValueError("Message cannot be empty")
20
+
21
+ url = f"https://api.telegram.org/bot{token}/sendMessage"
22
+
23
+ data = urllib.parse.urlencode({
24
+ "chat_id": chat_id,
25
+ "text": str(message)
26
+ }).encode("utf-8")
27
+
28
+ request = urllib.request.Request(
29
+ url,
30
+ data=data,
31
+ headers={"Content-Type": "application/x-www-form-urlencoded"},
32
+ method="POST"
33
+ )
34
+
35
+ try:
36
+ with urllib.request.urlopen(request, timeout=15) as response:
37
+ result = json.loads(response.read().decode("utf-8"))
38
+
39
+ if not result.get("ok"):
40
+ raise RuntimeError(result.get("description", "Telegram API error"))
41
+
42
+ return result
43
+
44
+ except urllib.error.HTTPError as error:
45
+ details = error.read().decode("utf-8", errors="replace")
46
+ raise RuntimeError(f"Telegram HTTP error: {details}") from error
47
+
48
+ except urllib.error.URLError as error:
49
+ raise RuntimeError(f"Telegram connection failed: {error}") from error
pcczy/terminal.py ADDED
@@ -0,0 +1,119 @@
1
+
2
+ import os
3
+ import sys
4
+ import time
5
+
6
+ RESET = "\033[0m"
7
+ BOLD = "\033[1m"
8
+
9
+ COLORS = {
10
+ "red": (255, 0, 0),
11
+ "green": (0, 255, 0),
12
+ "blue": (0, 100, 255),
13
+ "yellow": (255, 255, 0),
14
+ "cyan": (0, 255, 255),
15
+ "magenta": (255, 0, 255),
16
+ "white": (255, 255, 255),
17
+ "black": (0, 0, 0),
18
+ "orange": (255, 165, 0),
19
+ "purple": (160, 32, 240),
20
+ "pink": (255, 105, 180)
21
+ }
22
+
23
+
24
+ def _color(value):
25
+ if isinstance(value, str):
26
+ value = value.lower()
27
+
28
+ if value in COLORS:
29
+ return COLORS[value]
30
+
31
+ if value.startswith("#") and len(value) == 7:
32
+ try:
33
+ return tuple(
34
+ int(value[i:i+2], 16)
35
+ for i in (1, 3, 5)
36
+ )
37
+ except ValueError:
38
+ pass
39
+
40
+ if isinstance(value, (tuple, list)) and len(value) == 3:
41
+ if all(isinstance(x, int) and 0 <= x <= 255 for x in value):
42
+ return tuple(value)
43
+
44
+ raise ValueError("Invalid color")
45
+
46
+
47
+ def _rgb_code(r, g, b):
48
+ return f"\033[38;2;{r};{g};{b}m"
49
+
50
+
51
+ def cprint(text, color=None, bold=False):
52
+ text = str(text)
53
+
54
+ if color is None:
55
+ parts = text.split(" ", 1)
56
+
57
+ if len(parts) == 2 and parts[0].lower() in COLORS:
58
+ color = parts[0].lower()
59
+ text = parts[1]
60
+ else:
61
+ print(text)
62
+ return
63
+
64
+ r, g, b = _color(color)
65
+ style = BOLD if bold else ""
66
+
67
+ print(f"{style}{_rgb_code(r,g,b)}{text}{RESET}")
68
+
69
+
70
+ def rgb(text, animate=False, delay=0.03):
71
+ text = str(text)
72
+
73
+ rainbow = [
74
+ (255, 0, 0),
75
+ (255, 127, 0),
76
+ (255, 255, 0),
77
+ (0, 255, 0),
78
+ (0, 127, 255),
79
+ (75, 0, 130),
80
+ (148, 0, 211)
81
+ ]
82
+
83
+ for i, char in enumerate(text):
84
+ r, g, b = rainbow[i % len(rainbow)]
85
+ sys.stdout.write(_rgb_code(r, g, b) + char + RESET)
86
+ sys.stdout.flush()
87
+
88
+ if animate:
89
+ time.sleep(max(0, delay))
90
+
91
+ print()
92
+
93
+
94
+ def gradient(text, start="red", end="blue"):
95
+ text = str(text)
96
+
97
+ if not text:
98
+ print()
99
+ return
100
+
101
+ r1, g1, b1 = _color(start)
102
+ r2, g2, b2 = _color(end)
103
+
104
+ length = max(len(text) - 1, 1)
105
+
106
+ for i, char in enumerate(text):
107
+ ratio = i / length
108
+
109
+ r = int(r1 + (r2 - r1) * ratio)
110
+ g = int(g1 + (g2 - g1) * ratio)
111
+ b = int(b1 + (b2 - b1) * ratio)
112
+
113
+ sys.stdout.write(_rgb_code(r, g, b) + char + RESET)
114
+
115
+ print()
116
+
117
+
118
+ def clear():
119
+ os.system("cls" if os.name == "nt" else "clear")
pcczy/utilities.py ADDED
@@ -0,0 +1,44 @@
1
+
2
+ import platform
3
+ import sys
4
+ from datetime import datetime
5
+
6
+
7
+ def expire(date, message="This script has expired!"):
8
+ """
9
+ Check expiration date.
10
+
11
+ Format: DD/MM/YYYY,HH:MMAM
12
+ Example: 25/12/2026,11:59PM
13
+ """
14
+ try:
15
+ expiry = datetime.strptime(date, "%d/%m/%Y,%I:%M%p")
16
+ except ValueError:
17
+ raise ValueError(
18
+ "Invalid date format. Use DD/MM/YYYY,HH:MMAM"
19
+ )
20
+
21
+ if datetime.now() > expiry:
22
+ print(message)
23
+ raise SystemExit(1)
24
+
25
+ return True
26
+
27
+
28
+ def info(show=True):
29
+ details = {
30
+ "PCCZY": "Python Utility Library",
31
+ "Python": sys.version.split()[0],
32
+ "Platform": platform.platform(),
33
+ "System": platform.system(),
34
+ "Architecture": platform.machine()
35
+ }
36
+
37
+ if show:
38
+ print("\n========== PCCZY INFO ==========")
39
+ for key, value in details.items():
40
+ print(f"{key:<12}: {value}")
41
+ print("================================\n")
42
+
43
+ return details
44
+
@@ -0,0 +1,124 @@
1
+ Metadata-Version: 2.4
2
+ Name: pcczy
3
+ Version: 1.0.0
4
+ Summary: A Python utility library for terminal styling, animations, security and code analysis.
5
+ Author: PCCZY
6
+ License-Expression: MIT
7
+ Keywords: pcczy,python,terminal,colors,animations,utilities,reverse-engineering,bytecode
8
+ Classifier: Programming Language :: Python :: 3
9
+ Classifier: Operating System :: OS Independent
10
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
11
+ Requires-Python: >=3.9
12
+ Description-Content-Type: text/markdown
13
+ Requires-Dist: cryptography>=41.0
14
+
15
+
16
+ # PCCZY 🐍
17
+
18
+ A Python utility library for terminal styling, animations, security, random generators, Telegram integration and Python code analysis.
19
+
20
+ ## Installation
21
+
22
+ ```bash
23
+ pip install pcczy
24
+ ```
25
+
26
+ ## Quick Start
27
+
28
+ ```python
29
+ import pcczy as pc
30
+
31
+ pc.logo()
32
+
33
+ pc.cprint("PCCZY is ready!", color="green")
34
+ pc.rgb("Welcome to PCCZY")
35
+ pc.gradient("Hello World", "red", "blue")
36
+
37
+ pc.loading("Starting", 2)
38
+ pc.info()
39
+ ```
40
+
41
+ ## Features
42
+
43
+ ### Terminal
44
+ - cprint()
45
+ - rgb()
46
+ - gradient()
47
+ - clear()
48
+
49
+ ### Banners
50
+ - banner()
51
+ - gradient_banner()
52
+ - logo()
53
+
54
+ ### Animations
55
+ - loading()
56
+ - progress()
57
+ - countdown()
58
+
59
+ ### Utilities
60
+ - expire()
61
+ - info()
62
+
63
+ ### Security
64
+ - encrypt()
65
+ - decrypt()
66
+ - generate_key()
67
+
68
+ ### Menus
69
+ - menu()
70
+ - table()
71
+
72
+ ### Random Generators
73
+ - random_string()
74
+ - random_number()
75
+ - random_color()
76
+ - random_choice()
77
+ - random_shuffle()
78
+
79
+ ### Telegram
80
+ - telegram_send()
81
+
82
+ ### Python Code Analysis
83
+ - inspect_file()
84
+ - analyze_file()
85
+ - disassemble()
86
+ - disassemble_pyc()
87
+ - extract_strings()
88
+ - get_metadata()
89
+ - save_report()
90
+
91
+ ## Security Example
92
+
93
+ ```python
94
+ import pcczy as pc
95
+
96
+ encrypted = pc.encrypt("Hello PCCZY", "my-password")
97
+ original = pc.decrypt(encrypted, "my-password")
98
+
99
+ print(original)
100
+ ```
101
+
102
+ ## Code Analysis Example
103
+
104
+ ```python
105
+ import pcczy as pc
106
+
107
+ result = pc.analyze_file("example.py")
108
+ print(result)
109
+
110
+ pc.save_report(result, "report.txt")
111
+ ```
112
+
113
+ ## Requirements
114
+
115
+ - Python 3.9+
116
+ - cryptography
117
+
118
+ ## Author
119
+
120
+ PCCZY
121
+
122
+ ## License
123
+
124
+ MIT
@@ -0,0 +1,15 @@
1
+ pcczy/__init__.py,sha256=n3B-cSgZZuSwSyy2n-1x5NmsydzFBLCq4N1s9xvu1CM,1528
2
+ pcczy/animations.py,sha256=I_lm2JnbbVpL5lXdujGz21tNBBrgFmOYXF0QiSe7dMs,1577
3
+ pcczy/banners.py,sha256=qeNVLf__0x1vnbh5zm6GC082SEjlFWelgrfDxKgznqw,2538
4
+ pcczy/decompiler.py,sha256=EvVFmK_jBCgWG-LASJLDCuDQVzyyvXWVvwr3aamrkrE,5025
5
+ pcczy/logo.py,sha256=6LOXhL_6Riib1wEcyBXhzWx47KR0dtiPdRlUZBJloZw,9880
6
+ pcczy/menus.py,sha256=FDpErad86nPaAWwRy19f5kr-trovgf-EHv21C7YCTAc,1752
7
+ pcczy/randoms.py,sha256=NC58vVjCDU1rVHD2vWvSjzndn2jJSqA61OwuIauXods,1160
8
+ pcczy/security.py,sha256=0jxv7VECpH6NOxIX_g2d48y7C0XaVkZjF2PxjKyBsbc,1693
9
+ pcczy/telegram.py,sha256=dYBgx7njsWp-jv_OQ3FeT5G4zi4VFDU0AI1yMuJ4nao,1341
10
+ pcczy/terminal.py,sha256=neQ1RtBk88-XR4OrBeeqzacruQQQIhMCD-UMRUuE20E,2495
11
+ pcczy/utilities.py,sha256=J4_6bKHNiaIWyrx5GoDiw25dusw3Erf8JO9j1jCyCsM,986
12
+ pcczy-1.0.0.dist-info/METADATA,sha256=hSKDDeif8SCDM7CRhSu0ypzebtMyar-Bhvrxfe7GapQ,1947
13
+ pcczy-1.0.0.dist-info/WHEEL,sha256=mOdXR9C3wMVov7cSY8PY-XCzo3SmmWCHvGQr5csJoao,91
14
+ pcczy-1.0.0.dist-info/top_level.txt,sha256=IgMQlZuj3alkzpV1NzRxn-oxOAcgDsisOYbSh8C5Q3Q,6
15
+ pcczy-1.0.0.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (84.2.1)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1 @@
1
+ pcczy