cashit 1.2.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.
- cashit-1.2.0/LICENSE +21 -0
- cashit-1.2.0/MANIFEST.in +1 -0
- cashit-1.2.0/PKG-INFO +23 -0
- cashit-1.2.0/cashit/__init__.py +0 -0
- cashit-1.2.0/cashit/cashit.py +171 -0
- cashit-1.2.0/cashit.egg-info/PKG-INFO +23 -0
- cashit-1.2.0/cashit.egg-info/SOURCES.txt +10 -0
- cashit-1.2.0/cashit.egg-info/dependency_links.txt +1 -0
- cashit-1.2.0/cashit.egg-info/requires.txt +1 -0
- cashit-1.2.0/cashit.egg-info/top_level.txt +1 -0
- cashit-1.2.0/setup.cfg +4 -0
- cashit-1.2.0/setup.py +21 -0
cashit-1.2.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 Cleo
|
|
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.
|
cashit-1.2.0/MANIFEST.in
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
include LICENSE
|
cashit-1.2.0/PKG-INFO
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: cashit
|
|
3
|
+
Version: 1.2.0
|
|
4
|
+
Summary: wordlist generator and manager for creating categorized word collections by ur god cleo :P
|
|
5
|
+
Author: cleo
|
|
6
|
+
Author-email: thisisntmymail@gmail.com
|
|
7
|
+
Classifier: Programming Language :: Python :: 3
|
|
8
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
9
|
+
Classifier: Operating System :: OS Independent
|
|
10
|
+
Classifier: Development Status :: 4 - Beta
|
|
11
|
+
Classifier: Intended Audience :: Developers
|
|
12
|
+
Classifier: Topic :: Text Processing
|
|
13
|
+
Classifier: Topic :: Utilities
|
|
14
|
+
Requires-Python: >=3.7
|
|
15
|
+
License-File: LICENSE
|
|
16
|
+
Requires-Dist: carcent==2.1.0
|
|
17
|
+
Dynamic: author
|
|
18
|
+
Dynamic: author-email
|
|
19
|
+
Dynamic: classifier
|
|
20
|
+
Dynamic: license-file
|
|
21
|
+
Dynamic: requires-dist
|
|
22
|
+
Dynamic: requires-python
|
|
23
|
+
Dynamic: summary
|
|
File without changes
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
import os
|
|
2
|
+
import re
|
|
3
|
+
import string
|
|
4
|
+
import logging
|
|
5
|
+
import random
|
|
6
|
+
import carcent
|
|
7
|
+
from typing import List, Optional, Callable
|
|
8
|
+
|
|
9
|
+
logger = logging.getLogger("cashit")
|
|
10
|
+
logging.basicConfig(
|
|
11
|
+
level=logging.INFO,
|
|
12
|
+
format="%(asctime)s %(levelname)-7s %(message)s",
|
|
13
|
+
datefmt="%Y-%m-%d %H:%M:%S"
|
|
14
|
+
)
|
|
15
|
+
|
|
16
|
+
class Cashit:
|
|
17
|
+
DEFAULT_DIR = "wordlists"
|
|
18
|
+
FILE_PREFIX = "wl"
|
|
19
|
+
FILE_EXT = ".txt"
|
|
20
|
+
HASH_PROBABILITY = 0.4
|
|
21
|
+
|
|
22
|
+
@staticmethod
|
|
23
|
+
def _normalize(text: str) -> str:
|
|
24
|
+
cleaned = re.sub(r'[' + re.escape(string.punctuation) + r']', '', text)
|
|
25
|
+
cleaned = ' '.join(cleaned.split())
|
|
26
|
+
return cleaned.upper() if cleaned else ''
|
|
27
|
+
|
|
28
|
+
@staticmethod
|
|
29
|
+
def _has_multiple_words(cleaned: str) -> bool:
|
|
30
|
+
return len(cleaned.split()) > 1
|
|
31
|
+
|
|
32
|
+
@classmethod
|
|
33
|
+
def next_filepath(cls, directory: str = DEFAULT_DIR) -> str:
|
|
34
|
+
try:
|
|
35
|
+
os.makedirs(directory, exist_ok=True)
|
|
36
|
+
except OSError as e:
|
|
37
|
+
logger.error("Failed to create directory %s: %s", directory, e)
|
|
38
|
+
raise
|
|
39
|
+
|
|
40
|
+
n = 1
|
|
41
|
+
while True:
|
|
42
|
+
path = os.path.join(directory, f"{cls.FILE_PREFIX}{n}{cls.FILE_EXT}")
|
|
43
|
+
if not os.path.exists(path):
|
|
44
|
+
return path
|
|
45
|
+
n += 1
|
|
46
|
+
|
|
47
|
+
@classmethod
|
|
48
|
+
def save(
|
|
49
|
+
cls,
|
|
50
|
+
fetch_func: Callable[[], str],
|
|
51
|
+
prompt_fetch: bool = True,
|
|
52
|
+
prompt_save: bool = True,
|
|
53
|
+
target_dir: str = DEFAULT_DIR
|
|
54
|
+
) -> Optional[str]:
|
|
55
|
+
if prompt_fetch:
|
|
56
|
+
while True:
|
|
57
|
+
try:
|
|
58
|
+
inp = input("How many entries to fetch? ").strip()
|
|
59
|
+
if not inp:
|
|
60
|
+
target = 100
|
|
61
|
+
break
|
|
62
|
+
val = int(inp)
|
|
63
|
+
if val <= 0:
|
|
64
|
+
print("Enter positive number.")
|
|
65
|
+
continue
|
|
66
|
+
target = val
|
|
67
|
+
break
|
|
68
|
+
except ValueError:
|
|
69
|
+
print("Invalid number.")
|
|
70
|
+
except KeyboardInterrupt:
|
|
71
|
+
logger.info("Interrupted during fetch prompt → aborting")
|
|
72
|
+
return None
|
|
73
|
+
else:
|
|
74
|
+
target = 100
|
|
75
|
+
|
|
76
|
+
logger.info("Will attempt to fetch up to %d entries", target)
|
|
77
|
+
|
|
78
|
+
raw_entries = []
|
|
79
|
+
count = 0
|
|
80
|
+
|
|
81
|
+
while count < target:
|
|
82
|
+
try:
|
|
83
|
+
item = fetch_func()
|
|
84
|
+
if not item:
|
|
85
|
+
break
|
|
86
|
+
raw_entries.append(item)
|
|
87
|
+
count += 1
|
|
88
|
+
if count % 10 == 0:
|
|
89
|
+
logger.info("Fetched %d so far...", count)
|
|
90
|
+
except Exception as e:
|
|
91
|
+
logger.warning("Fetch failed (continuing): %s", e)
|
|
92
|
+
break
|
|
93
|
+
|
|
94
|
+
fetched = len(raw_entries)
|
|
95
|
+
logger.info("Fetch finished → got %d / %d requested", fetched, target)
|
|
96
|
+
|
|
97
|
+
if fetched == 0:
|
|
98
|
+
logger.warning("Nothing was fetched → exiting")
|
|
99
|
+
return None
|
|
100
|
+
|
|
101
|
+
processed = []
|
|
102
|
+
for line in raw_entries:
|
|
103
|
+
norm = cls._normalize(line)
|
|
104
|
+
if norm and cls._has_multiple_words(norm):
|
|
105
|
+
if random.random() < cls.HASH_PROBABILITY:
|
|
106
|
+
norm = f"# {norm}"
|
|
107
|
+
processed.append(norm)
|
|
108
|
+
|
|
109
|
+
valid_count = len(processed)
|
|
110
|
+
logger.info("After filtering → %d valid multi-word entries", valid_count)
|
|
111
|
+
|
|
112
|
+
if valid_count == 0:
|
|
113
|
+
logger.warning("No valid entries after normalization → nothing to save")
|
|
114
|
+
return None
|
|
115
|
+
|
|
116
|
+
save_count = valid_count
|
|
117
|
+
|
|
118
|
+
if prompt_save:
|
|
119
|
+
while True:
|
|
120
|
+
try:
|
|
121
|
+
inp = input("How many lines to save? ").strip()
|
|
122
|
+
if not inp:
|
|
123
|
+
save_count = valid_count
|
|
124
|
+
break
|
|
125
|
+
val = int(inp)
|
|
126
|
+
if val <= 0:
|
|
127
|
+
print("Enter positive number.")
|
|
128
|
+
continue
|
|
129
|
+
save_count = min(val, valid_count)
|
|
130
|
+
break
|
|
131
|
+
except ValueError:
|
|
132
|
+
print("Invalid number.")
|
|
133
|
+
except KeyboardInterrupt:
|
|
134
|
+
logger.info("Interrupted during save prompt → aborting")
|
|
135
|
+
return None
|
|
136
|
+
|
|
137
|
+
if save_count == 0:
|
|
138
|
+
logger.info("save_count is 0 → skipping write")
|
|
139
|
+
return None
|
|
140
|
+
|
|
141
|
+
to_save = processed[:save_count]
|
|
142
|
+
|
|
143
|
+
try:
|
|
144
|
+
path = cls.next_filepath(target_dir)
|
|
145
|
+
with open(path, "w", encoding="utf-8") as f:
|
|
146
|
+
for item in to_save:
|
|
147
|
+
f.write(item + "\n")
|
|
148
|
+
logger.info("Saved %d lines → %s", len(to_save), path)
|
|
149
|
+
return path
|
|
150
|
+
except Exception as e:
|
|
151
|
+
logger.exception("Failed to save wordlist: %s", e)
|
|
152
|
+
return None
|
|
153
|
+
|
|
154
|
+
|
|
155
|
+
def cashit(
|
|
156
|
+
fetch_func: Callable[[], str],
|
|
157
|
+
ask_fetch: bool = True,
|
|
158
|
+
ask_save: bool = True,
|
|
159
|
+
directory: str = Cashit.DEFAULT_DIR
|
|
160
|
+
) -> Optional[str]:
|
|
161
|
+
result = Cashit.save(
|
|
162
|
+
fetch_func=fetch_func,
|
|
163
|
+
prompt_fetch=ask_fetch,
|
|
164
|
+
prompt_save=ask_save,
|
|
165
|
+
target_dir=directory
|
|
166
|
+
)
|
|
167
|
+
if result:
|
|
168
|
+
logger.info("Generation & save completed")
|
|
169
|
+
else:
|
|
170
|
+
logger.warning("Process finished without saving file")
|
|
171
|
+
return result
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: cashit
|
|
3
|
+
Version: 1.2.0
|
|
4
|
+
Summary: wordlist generator and manager for creating categorized word collections by ur god cleo :P
|
|
5
|
+
Author: cleo
|
|
6
|
+
Author-email: thisisntmymail@gmail.com
|
|
7
|
+
Classifier: Programming Language :: Python :: 3
|
|
8
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
9
|
+
Classifier: Operating System :: OS Independent
|
|
10
|
+
Classifier: Development Status :: 4 - Beta
|
|
11
|
+
Classifier: Intended Audience :: Developers
|
|
12
|
+
Classifier: Topic :: Text Processing
|
|
13
|
+
Classifier: Topic :: Utilities
|
|
14
|
+
Requires-Python: >=3.7
|
|
15
|
+
License-File: LICENSE
|
|
16
|
+
Requires-Dist: carcent==2.1.0
|
|
17
|
+
Dynamic: author
|
|
18
|
+
Dynamic: author-email
|
|
19
|
+
Dynamic: classifier
|
|
20
|
+
Dynamic: license-file
|
|
21
|
+
Dynamic: requires-dist
|
|
22
|
+
Dynamic: requires-python
|
|
23
|
+
Dynamic: summary
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
carcent==2.1.0
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
cashit
|
cashit-1.2.0/setup.cfg
ADDED
cashit-1.2.0/setup.py
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
from setuptools import setup, find_packages
|
|
2
|
+
|
|
3
|
+
setup(
|
|
4
|
+
name="cashit",
|
|
5
|
+
version="1.2.0",
|
|
6
|
+
author="cleo",
|
|
7
|
+
author_email="thisisntmymail@gmail.com",
|
|
8
|
+
description="wordlist generator and manager for creating categorized word collections by ur god cleo :P",
|
|
9
|
+
packages=find_packages(),
|
|
10
|
+
classifiers=[
|
|
11
|
+
"Programming Language :: Python :: 3",
|
|
12
|
+
"License :: OSI Approved :: MIT License",
|
|
13
|
+
"Operating System :: OS Independent",
|
|
14
|
+
"Development Status :: 4 - Beta",
|
|
15
|
+
"Intended Audience :: Developers",
|
|
16
|
+
"Topic :: Text Processing",
|
|
17
|
+
"Topic :: Utilities",
|
|
18
|
+
],
|
|
19
|
+
python_requires=">=3.7",
|
|
20
|
+
install_requires=["carcent==2.1.0"],
|
|
21
|
+
)
|