allykit 1.2.2__tar.gz → 1.4.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.
- allykit-1.4.0/PKG-INFO +713 -0
- allykit-1.4.0/README.md +655 -0
- {allykit-1.2.2 → allykit-1.4.0}/pyproject.toml +7 -8
- {allykit-1.2.2 → allykit-1.4.0}/src/allykit/Automobile_kit/Automobile/Cmd.py +11 -2
- {allykit-1.2.2 → allykit-1.4.0}/src/allykit/Automobile_kit/ProcessManager/__init__.py +0 -2
- {allykit-1.2.2 → allykit-1.4.0}/src/allykit/Security_kit/file_kit.py +0 -1
- {allykit-1.2.2 → allykit-1.4.0}/src/allykit/Security_kit/password_kit/Time_based_password.py +2 -2
- {allykit-1.2.2 → allykit-1.4.0}/src/allykit/Security_kit/password_kit/__init__.py +2 -1
- allykit-1.4.0/src/allykit/Tools_kit/WorkFileJson.py +554 -0
- allykit-1.4.0/src/allykit/Tools_kit/__init__.py +3 -0
- allykit-1.4.0/src/allykit/__init__.py +632 -0
- allykit-1.4.0/src/allykit/data_kit/IRAN.py +7 -0
- allykit-1.4.0/src/allykit/data_kit/Language.py +1029 -0
- allykit-1.4.0/src/allykit/data_kit/__init__.py +519 -0
- allykit-1.4.0/src/allykit/data_kit/country.py +1850 -0
- {allykit-1.2.2 → allykit-1.4.0}/src/allykit/web_kit/Elastic_bands.py +14 -6
- {allykit-1.2.2 → allykit-1.4.0}/src/allykit/web_kit/Get_Code.py +0 -2
- {allykit-1.2.2 → allykit-1.4.0}/src/allykit/web_kit/__init__.py +4 -1
- allykit-1.4.0/src/allykit/web_kit/scroll_manager.py +1165 -0
- allykit-1.4.0/src/allykit.egg-info/PKG-INFO +713 -0
- {allykit-1.2.2 → allykit-1.4.0}/src/allykit.egg-info/SOURCES.txt +4 -1
- {allykit-1.2.2 → allykit-1.4.0}/src/allykit.egg-info/requires.txt +5 -6
- allykit-1.2.2/PKG-INFO +0 -299
- allykit-1.2.2/README.md +0 -239
- allykit-1.2.2/src/allykit/Tools_kit/__init__.py +0 -2
- allykit-1.2.2/src/allykit/__init__.py +0 -129
- allykit-1.2.2/src/allykit/data_kit/IRAN.py +0 -459
- allykit-1.2.2/src/allykit/data_kit/Language.py +0 -556
- allykit-1.2.2/src/allykit/data_kit/country.py +0 -1095
- allykit-1.2.2/src/allykit.egg-info/PKG-INFO +0 -299
- {allykit-1.2.2 → allykit-1.4.0}/LICENSE +0 -0
- {allykit-1.2.2 → allykit-1.4.0}/setup.cfg +0 -0
- {allykit-1.2.2 → allykit-1.4.0}/src/allykit/Automobile_kit/Automobile/__init__.py +0 -0
- {allykit-1.2.2 → allykit-1.4.0}/src/allykit/Automobile_kit/Automobile/hybrid.py +0 -0
- {allykit-1.2.2 → allykit-1.4.0}/src/allykit/Automobile_kit/Automobile/powerShell.py +0 -0
- {allykit-1.2.2 → allykit-1.4.0}/src/allykit/Automobile_kit/New_automobile/file.py +0 -0
- {allykit-1.2.2 → allykit-1.4.0}/src/allykit/Automobile_kit/New_automobile/git.py +0 -0
- {allykit-1.2.2 → allykit-1.4.0}/src/allykit/Automobile_kit/New_automobile/python.py +0 -0
- {allykit-1.2.2 → allykit-1.4.0}/src/allykit/Automobile_kit/ProcessManager/ProcessManager.py +0 -0
- {allykit-1.2.2 → allykit-1.4.0}/src/allykit/Automobile_kit/__init__.py +0 -0
- {allykit-1.2.2 → allykit-1.4.0}/src/allykit/Security_kit/__init__.py +0 -0
- {allykit-1.2.2 → allykit-1.4.0}/src/allykit/Security_kit/hash_kit.py +0 -0
- {allykit-1.2.2 → allykit-1.4.0}/src/allykit/Security_kit/password_kit/Scoring_password.py +0 -0
- {allykit-1.2.2 → allykit-1.4.0}/src/allykit/Security_kit/password_kit/password.py +0 -0
- {allykit-1.2.2 → allykit-1.4.0}/src/allykit/Tools_kit/file_tools.py +0 -0
- {allykit-1.2.2 → allykit-1.4.0}/src/allykit/Tools_kit/string_tools.py +0 -0
- {allykit-1.2.2 → allykit-1.4.0}/src/allykit/web_kit/CChrome.py +0 -0
- {allykit-1.2.2 → allykit-1.4.0}/src/allykit/web_kit/Communications.py +0 -0
- {allykit-1.2.2 → allykit-1.4.0}/src/allykit/web_kit/Cookie.py +0 -0
- {allykit-1.2.2 → allykit-1.4.0}/src/allykit/web_kit/WebAutomation.py +0 -0
- {allykit-1.2.2 → allykit-1.4.0}/src/allykit/web_kit/Working_with_code.py +0 -0
- {allykit-1.2.2 → allykit-1.4.0}/src/allykit.egg-info/dependency_links.txt +0 -0
- {allykit-1.2.2 → allykit-1.4.0}/src/allykit.egg-info/top_level.txt +0 -0
allykit-1.4.0/PKG-INFO
ADDED
|
@@ -0,0 +1,713 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: allykit
|
|
3
|
+
Version: 1.4.0
|
|
4
|
+
Summary: A comprehensive Python toolkit for security engineering, cryptography, web scraping, filesystem auditing, DFIR, command-line automation, Git, PowerShell, and reusable developer utilities.
|
|
5
|
+
Author-email: allykit Developer <hossein.moradian.ir@outlook.com>
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/hosssein193m-ai/
|
|
8
|
+
Project-URL: Repository, https://github.com/hosssein193m-ai/allykit
|
|
9
|
+
Keywords: security,cryptography,hashing,password,password-generator,password-security,web-scraping,selenium,beautifulsoup,filesystem,filesystem-audit,digital-forensics,dfir,integrity,checksum,metadata,utilities,automation,command-line,cmd,powershell,git,python,pip,terminal,developer-tools,devops,shell,persian,iran,country-data
|
|
10
|
+
Classifier: Development Status :: 4 - Beta
|
|
11
|
+
Classifier: Intended Audience :: Developers
|
|
12
|
+
Classifier: Intended Audience :: Information Technology
|
|
13
|
+
Classifier: Intended Audience :: System Administrators
|
|
14
|
+
Classifier: Intended Audience :: Science/Research
|
|
15
|
+
Classifier: Topic :: Security
|
|
16
|
+
Classifier: Topic :: Security :: Cryptography
|
|
17
|
+
Classifier: Topic :: Internet :: WWW/HTTP
|
|
18
|
+
Classifier: Topic :: Internet :: WWW/HTTP :: Indexing/Search
|
|
19
|
+
Classifier: Topic :: System :: Filesystems
|
|
20
|
+
Classifier: Topic :: System :: Systems Administration
|
|
21
|
+
Classifier: Topic :: System :: Shells
|
|
22
|
+
Classifier: Topic :: Software Development
|
|
23
|
+
Classifier: Topic :: Software Development :: Libraries
|
|
24
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
25
|
+
Classifier: Topic :: Utilities
|
|
26
|
+
Classifier: Operating System :: OS Independent
|
|
27
|
+
Classifier: Programming Language :: Python
|
|
28
|
+
Classifier: Programming Language :: Python :: 3
|
|
29
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
30
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
31
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
32
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
33
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
34
|
+
Classifier: Typing :: Typed
|
|
35
|
+
Requires-Python: >=3.9
|
|
36
|
+
Description-Content-Type: text/markdown
|
|
37
|
+
License-File: LICENSE
|
|
38
|
+
Requires-Dist: psutil>=5.9.0
|
|
39
|
+
Requires-Dist: pyperclip>=0.8.5
|
|
40
|
+
Requires-Dist: selenium>=4.0.0
|
|
41
|
+
Requires-Dist: requests>=2.31.0
|
|
42
|
+
Requires-Dist: tenacity>=8.0.0
|
|
43
|
+
Requires-Dist: beautifulsoup4>=4.12.0
|
|
44
|
+
Provides-Extra: dev
|
|
45
|
+
Requires-Dist: pytest>=8.0; extra == "dev"
|
|
46
|
+
Requires-Dist: pytest-cov>=5.0; extra == "dev"
|
|
47
|
+
Requires-Dist: black>=24.0; extra == "dev"
|
|
48
|
+
Requires-Dist: ruff>=0.6; extra == "dev"
|
|
49
|
+
Requires-Dist: mypy>=1.10; extra == "dev"
|
|
50
|
+
Provides-Extra: docs
|
|
51
|
+
Requires-Dist: mkdocs>=1.6; extra == "docs"
|
|
52
|
+
Requires-Dist: mkdocs-material>=9.5; extra == "docs"
|
|
53
|
+
Provides-Extra: web
|
|
54
|
+
Requires-Dist: selenium>=4.24.0; extra == "web"
|
|
55
|
+
Provides-Extra: all
|
|
56
|
+
Requires-Dist: allykit[dev,docs,web]; extra == "all"
|
|
57
|
+
Dynamic: license-file
|
|
58
|
+
|
|
59
|
+
# 📘 Complete Documentation for allykit Package
|
|
60
|
+
|
|
61
|
+
**allykit** is a versatile and powerful toolkit for Python developers that brings together a collection of essential tools in the fields of security, web interaction, system automation, and data processing, all within a unified and Pythonic interface.
|
|
62
|
+
|
|
63
|
+
---
|
|
64
|
+
|
|
65
|
+
## 🚀 Quick Start
|
|
66
|
+
|
|
67
|
+
### Installation
|
|
68
|
+
|
|
69
|
+
```bash
|
|
70
|
+
pip install allykit
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
**Note:** To use all features of the web module, install the following dependencies:
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
pip install selenium beautifulsoup4 requests tenacity psutil pyperclip
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
### First Example
|
|
80
|
+
|
|
81
|
+
```python
|
|
82
|
+
import allykit as ak
|
|
83
|
+
|
|
84
|
+
# Hashing a password
|
|
85
|
+
hashed = ak.hash_password("my_password", algorithm="sha256")
|
|
86
|
+
|
|
87
|
+
# Getting country information
|
|
88
|
+
iran_code = ak.COUNTRY_TO_CODE.get("Iran") # 98
|
|
89
|
+
|
|
90
|
+
# Fetching web page content
|
|
91
|
+
soup = ak.soup_url("https://example.com")
|
|
92
|
+
print(soup.find_all("div"))
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
---
|
|
96
|
+
|
|
97
|
+
## 🏛️ Architecture & Structure
|
|
98
|
+
|
|
99
|
+
The allykit package consists of 6 main modules, each responsible for a specialized domain:
|
|
100
|
+
|
|
101
|
+
| Module | Path | Responsibility |
|
|
102
|
+
|--------|------|----------------|
|
|
103
|
+
| Security_kit | `allykit.Security_kit` | Cryptography, hashing, password generation, file security |
|
|
104
|
+
| web_kit | `allykit.web_kit` | HTTP requests, JS rendering, browser automation, cookies, caching, scroll management |
|
|
105
|
+
| data_kit | `allykit.data_kit` | Language data, country data, and geographic information |
|
|
106
|
+
| Automobile_kit | `allykit.Automobile_kit` | System automation, command line, Git, Python, filesystem |
|
|
107
|
+
| Tools_kit | `allykit.Tools_kit` | Basic file, JSON, and string utilities |
|
|
108
|
+
| core | `allykit` | Unified entry point and main configuration |
|
|
109
|
+
|
|
110
|
+
---
|
|
111
|
+
|
|
112
|
+
## 📦 Modules & Features
|
|
113
|
+
|
|
114
|
+
### 1. Security Module (`Security_kit`)
|
|
115
|
+
|
|
116
|
+
This module is the specialized core of allykit in the security domain.
|
|
117
|
+
|
|
118
|
+
#### `hash_kit.py` Submodule
|
|
119
|
+
|
|
120
|
+
- Data and file hashing: with algorithms `md5`, `sha1`, `sha224`, `sha256`, `sha384`, `sha512`, `sha3-*`, `blake2b`, `blake2s`
|
|
121
|
+
- Salted hashing: secure salt generation with `generate_salt`, hashing with `hash_with_salt`, and verification with `verify_password`
|
|
122
|
+
- Advanced security: `double_hash` for re-hashing
|
|
123
|
+
- Detection and comparison: automatic hash algorithm detection (`smart_hash_detector`) and hash comparison
|
|
124
|
+
|
|
125
|
+
```python
|
|
126
|
+
from allykit import hash_password, generate_salt, hash_with_salt, verify_password
|
|
127
|
+
|
|
128
|
+
# Simple hashing
|
|
129
|
+
hashed = hash_password("my_password", algorithm="sha256")
|
|
130
|
+
|
|
131
|
+
# Salted hashing
|
|
132
|
+
salt = generate_salt()
|
|
133
|
+
salted_hash = hash_with_salt("my_password", salt)
|
|
134
|
+
is_valid = verify_password("my_password", salted_hash, salt)
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
#### `password_kit` Submodule
|
|
138
|
+
|
|
139
|
+
- Strong password generation: `generate_password` and `generate_strong_password` functions
|
|
140
|
+
- Timed passwords: creating passwords with expiration dates using `generate_timed_password` and `generating_password`
|
|
141
|
+
- Timed password management: `Time_Password` class for validity checking, remaining time, and extracting the main password
|
|
142
|
+
- Security scoring: `Review_Password` class for checking security criteria and calculating entropy scores
|
|
143
|
+
|
|
144
|
+
```python
|
|
145
|
+
from allykit import generate_password, generate_strong_password, generate_timed_password, Time_Password, Review_Password
|
|
146
|
+
|
|
147
|
+
# Generate strong password
|
|
148
|
+
pwd = generate_strong_password(length=16)
|
|
149
|
+
|
|
150
|
+
# Timed password (valid for 24 hours)
|
|
151
|
+
timed_pwd = generate_timed_password(time='hours.24')
|
|
152
|
+
tp = Time_Password(timed_pwd)
|
|
153
|
+
print(f"Valid: {tp.is_valid()}")
|
|
154
|
+
print(f"Remaining: {tp.remaining_time()}")
|
|
155
|
+
|
|
156
|
+
# Check password strength
|
|
157
|
+
reviewer = Review_Password(pwd)
|
|
158
|
+
print(f"Entropy score: {reviewer.Entropy_Score_Password()}")
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
#### `file_kit.py` Submodule
|
|
162
|
+
|
|
163
|
+
- File hashing: `hash_file` with Salt capability for enhanced security
|
|
164
|
+
- Security snapshot: `create_snapshot` for taking a complete image of a folder's status
|
|
165
|
+
- Integrity verification: `verify_snapshot` for detecting changes (additions, deletions, content or permission changes)
|
|
166
|
+
|
|
167
|
+
```python
|
|
168
|
+
from allykit import hash_file, create_snapshot, verify_snapshot
|
|
169
|
+
|
|
170
|
+
# Hash a file
|
|
171
|
+
file_hash = hash_file("document.pdf", algorithm="sha256")
|
|
172
|
+
|
|
173
|
+
# Create a snapshot of a directory
|
|
174
|
+
snapshot = create_snapshot("./important_data")
|
|
175
|
+
|
|
176
|
+
# Later, verify the snapshot
|
|
177
|
+
is_clean = verify_snapshot("./important_data", snapshot)
|
|
178
|
+
if not is_clean:
|
|
179
|
+
print("Changes detected in the directory!")
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
---
|
|
183
|
+
|
|
184
|
+
### 2. Web Module (`web_kit`)
|
|
185
|
+
|
|
186
|
+
This module provides comprehensive tools for web interaction.
|
|
187
|
+
|
|
188
|
+
#### Base Communications (`Communications.py`)
|
|
189
|
+
|
|
190
|
+
- `fetch_url`: GET request with automatic retry (up to 5 times)
|
|
191
|
+
- `execute_request`: GET/POST request with headers, proxy, and authentication
|
|
192
|
+
- `get_rate_limit_info`: Extracting rate limit information from response headers
|
|
193
|
+
|
|
194
|
+
```python
|
|
195
|
+
from allykit import fetch_url, execute_request, get_rate_limit_info
|
|
196
|
+
|
|
197
|
+
# Simple GET request with retry
|
|
198
|
+
response = fetch_url("https://api.example.com/data")
|
|
199
|
+
|
|
200
|
+
# Advanced request with headers and auth
|
|
201
|
+
response = execute_request(
|
|
202
|
+
"https://api.example.com/data",
|
|
203
|
+
method="POST",
|
|
204
|
+
headers={"Content-Type": "application/json"},
|
|
205
|
+
auth=("username", "password"),
|
|
206
|
+
data={"key": "value"}
|
|
207
|
+
)
|
|
208
|
+
|
|
209
|
+
# Get rate limit info
|
|
210
|
+
rate_info = get_rate_limit_info(response)
|
|
211
|
+
print(f"Remaining requests: {rate_info.get('remaining')}")
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
#### Code Retrieval (`Get_Code.py`)
|
|
215
|
+
|
|
216
|
+
- `soup_url`: Fetching and converting a page to BeautifulSoup using requests
|
|
217
|
+
- `javascript`, `javascript_pro`: Fetching pages with full JavaScript rendering (Selenium) with advanced features like scrolling and script execution
|
|
218
|
+
|
|
219
|
+
```python
|
|
220
|
+
from allykit import soup_url, javascript, javascript_pro
|
|
221
|
+
|
|
222
|
+
# Simple BeautifulSoup fetch
|
|
223
|
+
soup = soup_url("https://example.com")
|
|
224
|
+
titles = soup.find_all("h1")
|
|
225
|
+
|
|
226
|
+
# JavaScript rendering with Selenium
|
|
227
|
+
html = javascript("https://example.com", wait_time=5)
|
|
228
|
+
|
|
229
|
+
# Advanced JavaScript rendering with scrolling
|
|
230
|
+
html = javascript_pro(
|
|
231
|
+
"https://example.com",
|
|
232
|
+
scroll_to_bottom=True,
|
|
233
|
+
execute_script="document.querySelector('#load-more').click();"
|
|
234
|
+
)
|
|
235
|
+
```
|
|
236
|
+
|
|
237
|
+
#### Browser Automation (`CChrome.py`, `WebAutomation.py`)
|
|
238
|
+
|
|
239
|
+
- `chrome`: Launching a browser with advanced settings (incognito mode, proxy, User-Agent)
|
|
240
|
+
- `WebAutomation` class: Unified interface for clicking, typing, scrolling, hovering, and interacting with elements
|
|
241
|
+
- Cookie management (`Cookie.py`): Saving, loading, and clearing expired cookies
|
|
242
|
+
|
|
243
|
+
```python
|
|
244
|
+
from allykit import chrome, WebAutomation
|
|
245
|
+
|
|
246
|
+
# Launch browser
|
|
247
|
+
driver = chrome(incognito=True, headless=False)
|
|
248
|
+
|
|
249
|
+
# Create automation instance
|
|
250
|
+
auto = WebAutomation(driver)
|
|
251
|
+
|
|
252
|
+
# Navigate and interact
|
|
253
|
+
auto.goto("https://example.com")
|
|
254
|
+
auto.click("#login-button")
|
|
255
|
+
auto.type("#username", "myuser")
|
|
256
|
+
auto.type("#password", "mypass")
|
|
257
|
+
auto.submit("#login-form")
|
|
258
|
+
|
|
259
|
+
# Cookie management
|
|
260
|
+
from allykit import save_cookies, load_cookies, clear_expired_cookies
|
|
261
|
+
|
|
262
|
+
save_cookies(driver, "cookies.pkl")
|
|
263
|
+
load_cookies(driver, "cookies.pkl")
|
|
264
|
+
clear_expired_cookies(driver)
|
|
265
|
+
```
|
|
266
|
+
|
|
267
|
+
#### Scroll Management (`scroll_manager.py`) 🆕
|
|
268
|
+
|
|
269
|
+
A powerful and comprehensive scroll management system for Selenium WebDriver that handles all scrolling needs:
|
|
270
|
+
|
|
271
|
+
- Basic Scrolling: `window_scrollTo`, `window_scrollTo_bottom`, `window_scrollTo_top`, `window_scrollTo_right`
|
|
272
|
+
- Advanced Scrolling: `scroll_smooth_to`, `scroll_to_element`, `scroll_to_percentage`, `scroll_to_text`
|
|
273
|
+
- Infinite Scroll: `py_scroll` and `scroll_infinite_loader` for dynamic content loading
|
|
274
|
+
- Smart Detection: `get_scroll_info` for comprehensive scroll state information
|
|
275
|
+
- Visual Effects: `scroll_animated_spiral` for creative scrolling animations
|
|
276
|
+
- Element Management: `scroll_until_element_visible`, `highlight_and_scroll`, `get_element_position`
|
|
277
|
+
- `ScrollManager` Class: Unified interface with 20+ methods for all scroll operations
|
|
278
|
+
|
|
279
|
+
```python
|
|
280
|
+
from allykit import chrome, ScrollManager
|
|
281
|
+
|
|
282
|
+
# Launch browser
|
|
283
|
+
driver = chrome()
|
|
284
|
+
scroll = ScrollManager(driver)
|
|
285
|
+
|
|
286
|
+
# Navigate to a page
|
|
287
|
+
driver.get("https://example.com")
|
|
288
|
+
|
|
289
|
+
# Scroll to the bottom
|
|
290
|
+
scroll.to_bottom()
|
|
291
|
+
|
|
292
|
+
# Get scroll information
|
|
293
|
+
info = scroll.get_info()
|
|
294
|
+
print(f"Scrolled: {info['percentageScrolled']}%")
|
|
295
|
+
|
|
296
|
+
# Scroll to a specific element
|
|
297
|
+
scroll.to_element("#my-element", by="css")
|
|
298
|
+
|
|
299
|
+
# Load infinite scroll content
|
|
300
|
+
result = scroll.load_infinite_content(max_scrolls=5)
|
|
301
|
+
print(f"Loaded {result['height_increase']}px of new content")
|
|
302
|
+
|
|
303
|
+
# Highlight an element and scroll to it
|
|
304
|
+
scroll.highlight_and_scroll(".important-section", duration=3)
|
|
305
|
+
|
|
306
|
+
# Smart scroll to bottom with content detection
|
|
307
|
+
if scroll.smart_scroll_to_bottom():
|
|
308
|
+
print("All content loaded successfully")
|
|
309
|
+
|
|
310
|
+
# Scroll smoothly to text
|
|
311
|
+
scroll.to_text("Important News!", smooth=True)
|
|
312
|
+
|
|
313
|
+
# Get element position
|
|
314
|
+
pos = scroll.get_element_position("#post-123")
|
|
315
|
+
print(f"Post at: ({pos['x']}, {pos['y']})")
|
|
316
|
+
|
|
317
|
+
# Reset to top
|
|
318
|
+
scroll.reset()
|
|
319
|
+
|
|
320
|
+
# Print debugging info
|
|
321
|
+
scroll.print_info()
|
|
322
|
+
```
|
|
323
|
+
|
|
324
|
+
#### Caching & Monitoring (`Elastic_bands.py`)
|
|
325
|
+
|
|
326
|
+
- `DiskCache` class: Disk-based caching with automatic expiration (TTL) for web requests
|
|
327
|
+
- `Monitoring` class: Monitoring web page changes and detecting changes in content, headers, and metadata
|
|
328
|
+
|
|
329
|
+
```python
|
|
330
|
+
from allykit import DiskCache, Monitoring
|
|
331
|
+
|
|
332
|
+
# Cache with 1-hour TTL
|
|
333
|
+
cache = DiskCache(ttl_hours=1)
|
|
334
|
+
|
|
335
|
+
# Fetch with caching
|
|
336
|
+
html = cache.fetch("https://example.com")
|
|
337
|
+
cached_html = cache.get("https://example.com")
|
|
338
|
+
|
|
339
|
+
# Monitor a page for changes
|
|
340
|
+
monitor = Monitoring("https://example.com", cache_dir="./cache")
|
|
341
|
+
if monitor.update_all():
|
|
342
|
+
print("Page has been updated!")
|
|
343
|
+
```
|
|
344
|
+
|
|
345
|
+
#### Code Processing (`Working_with_code.py`)
|
|
346
|
+
|
|
347
|
+
- Data extraction: `extract_all_links`, `extract_images`, `extract_text_from_tags` functions
|
|
348
|
+
- `SoupToDict` class: Comparing two HTML pages and detecting line-by-line changes with JSON output
|
|
349
|
+
|
|
350
|
+
```python
|
|
351
|
+
from allykit import extract_all_links, extract_images, extract_text_from_tags, SoupToDict
|
|
352
|
+
|
|
353
|
+
# Extract data from BeautifulSoup
|
|
354
|
+
links = extract_all_links(soup)
|
|
355
|
+
images = extract_images(soup)
|
|
356
|
+
texts = extract_text_from_tags(soup, ["p", "h1", "h2"])
|
|
357
|
+
|
|
358
|
+
# Compare two HTML pages
|
|
359
|
+
comparator = SoupToDict(soup_old, soup_new)
|
|
360
|
+
changes = comparator.get_changes()
|
|
361
|
+
print(f"Found {len(changes)} changes")
|
|
362
|
+
```
|
|
363
|
+
|
|
364
|
+
---
|
|
365
|
+
|
|
366
|
+
### 3. Data Module (`data_kit`)
|
|
367
|
+
|
|
368
|
+
This module provides a rich data source.
|
|
369
|
+
|
|
370
|
+
- `Language.py`: Encyclopedia of characters from various languages (Latin, Cyrillic, Persian, Chinese, etc.) for text detection and processing
|
|
371
|
+
- `country.py`: Complete country information including calling codes (`CALLING_CODES`), ISO codes (`ISO_ALPHA2`), continent (`COUNTRY_CONTINENT`), official language (`COUNTRY_LANGUAGE`), and internet TLD (`COUNTRY_TLD`)
|
|
372
|
+
- `IRAN/`: Comprehensive data on Iranian provinces and cities (including phone codes, license plates, population, and mobile carrier detection)
|
|
373
|
+
|
|
374
|
+
```python
|
|
375
|
+
from allykit import (
|
|
376
|
+
CALLING_CODES, ISO_ALPHA2, COUNTRY_CONTINENT,
|
|
377
|
+
COUNTRY_LANGUAGE, COUNTRY_TLD, COUNTRY_TO_CODE
|
|
378
|
+
)
|
|
379
|
+
|
|
380
|
+
# Get country information
|
|
381
|
+
iran_code = COUNTRY_TO_CODE.get("Iran") # 98
|
|
382
|
+
iran_iso = ISO_ALPHA2.get("Iran") # "IR"
|
|
383
|
+
iran_continent = COUNTRY_CONTINENT.get("Iran") # "Asia"
|
|
384
|
+
iran_language = COUNTRY_LANGUAGE.get("Iran") # "Persian"
|
|
385
|
+
|
|
386
|
+
# Language detection
|
|
387
|
+
from allykit import detect_language_script
|
|
388
|
+
|
|
389
|
+
text = "Hello دنیا 你好"
|
|
390
|
+
script = detect_language_script(text)
|
|
391
|
+
print(f"Scripts detected: {script}")
|
|
392
|
+
```
|
|
393
|
+
|
|
394
|
+
---
|
|
395
|
+
|
|
396
|
+
### 4. System Automation Module (`Automobile_kit`)
|
|
397
|
+
|
|
398
|
+
This module brings command-line power and system management to Python.
|
|
399
|
+
|
|
400
|
+
#### Process Management (`ProcessManager`)
|
|
401
|
+
|
|
402
|
+
- `ProcessManager` class and high-level functions: `kill_process`, `kill_chrome`, `kill_all_browsers`, `suspend_process`, `resume_process`
|
|
403
|
+
- Detailed process information retrieval (`get_process_info`), counting and checking process existence
|
|
404
|
+
|
|
405
|
+
```python
|
|
406
|
+
from allykit import (
|
|
407
|
+
ProcessManager, kill_process, kill_chrome,
|
|
408
|
+
suspend_process, resume_process, get_process_info
|
|
409
|
+
)
|
|
410
|
+
|
|
411
|
+
# Kill a specific process
|
|
412
|
+
kill_process("notepad.exe")
|
|
413
|
+
|
|
414
|
+
# Kill all Chrome processes
|
|
415
|
+
kill_chrome()
|
|
416
|
+
|
|
417
|
+
# Suspend and resume
|
|
418
|
+
suspend_process(1234)
|
|
419
|
+
resume_process(1234)
|
|
420
|
+
|
|
421
|
+
# Get process info
|
|
422
|
+
info = get_process_info(1234)
|
|
423
|
+
print(f"Name: {info['name']}, CPU: {info['cpu']}%")
|
|
424
|
+
|
|
425
|
+
# Process manager class
|
|
426
|
+
pm = ProcessManager()
|
|
427
|
+
processes = pm.list_processes()
|
|
428
|
+
chrome_processes = pm.find_processes("chrome")
|
|
429
|
+
```
|
|
430
|
+
|
|
431
|
+
#### Command Line (`Automobile/Cmd.py`, `powerShell.py`)
|
|
432
|
+
|
|
433
|
+
- `cmd` class: Executing CMD commands, opening windows, auto-typing commands
|
|
434
|
+
- `PowerShell` class: Executing PowerShell commands with Unicode support and special `size_file` function for calculating file/folder size
|
|
435
|
+
|
|
436
|
+
```python
|
|
437
|
+
from allykit import cmd, PowerShell
|
|
438
|
+
|
|
439
|
+
# CMD operations
|
|
440
|
+
cmd.run("dir")
|
|
441
|
+
cmd.open_window()
|
|
442
|
+
cmd.auto_type("echo Hello World")
|
|
443
|
+
|
|
444
|
+
# PowerShell operations
|
|
445
|
+
ps = PowerShell()
|
|
446
|
+
result = ps.run("Get-Process")
|
|
447
|
+
file_size = ps.size_file("C:\\MyFolder")
|
|
448
|
+
```
|
|
449
|
+
|
|
450
|
+
#### Specialized Automation (`New_automobile/`)
|
|
451
|
+
|
|
452
|
+
- `git.py`: `Git` class for full Git automation (clone, init, add, commit, push, pull, branch, log)
|
|
453
|
+
- `python.py`: `Pip` (package management) and `Python` (script execution, venv creation, code execution) classes
|
|
454
|
+
- `file.py`: `File` class for cross-platform filesystem operations (create, delete, copy, move, rename)
|
|
455
|
+
|
|
456
|
+
```python
|
|
457
|
+
from allykit import Git, Pip, Python, File
|
|
458
|
+
|
|
459
|
+
# Git automation
|
|
460
|
+
git = Git()
|
|
461
|
+
git.clone("https://github.com/user/project.git")
|
|
462
|
+
git.add(".")
|
|
463
|
+
git.commit("Initial commit")
|
|
464
|
+
git.push()
|
|
465
|
+
|
|
466
|
+
# Python automation
|
|
467
|
+
py = Python()
|
|
468
|
+
py.create_venv("venv")
|
|
469
|
+
py.run_script("app.py")
|
|
470
|
+
py.install_package("requests")
|
|
471
|
+
|
|
472
|
+
# File operations
|
|
473
|
+
file = File()
|
|
474
|
+
file.copy_file("source.txt", "dest.txt")
|
|
475
|
+
file.move_file("old.txt", "new.txt")
|
|
476
|
+
file.delete_file("temp.txt")
|
|
477
|
+
```
|
|
478
|
+
|
|
479
|
+
---
|
|
480
|
+
|
|
481
|
+
### 5. General Utilities Module (`Tools_kit`)
|
|
482
|
+
|
|
483
|
+
This module provides a reusable foundation layer for other components.
|
|
484
|
+
|
|
485
|
+
- `file_tools.py`: Basic file functions (read, write, delete, get metadata, and permission management)
|
|
486
|
+
- `string_tools.py`: Secure random string generation (`str_choice_string`) and text processing utilities (truncate, format_thousands)
|
|
487
|
+
- `WorkFileJson.py`: `WorkFileJson` class for complete JSON file management with CRUD operations, search, merge, and file management
|
|
488
|
+
|
|
489
|
+
```python
|
|
490
|
+
from allykit import (
|
|
491
|
+
read_file, write_file, delete_file, get_file_metadata,
|
|
492
|
+
str_choice_string, truncate_text, format_thousands,
|
|
493
|
+
WorkFileJson
|
|
494
|
+
)
|
|
495
|
+
|
|
496
|
+
# File operations
|
|
497
|
+
content = read_file("data.txt")
|
|
498
|
+
write_file("output.txt", "Hello World")
|
|
499
|
+
metadata = get_file_metadata("data.txt")
|
|
500
|
+
|
|
501
|
+
# String utilities
|
|
502
|
+
random_string = str_choice_string(length=10)
|
|
503
|
+
formatted = format_thousands(1234567) # "1,234,567"
|
|
504
|
+
|
|
505
|
+
# JSON file management
|
|
506
|
+
json_file = WorkFileJson("data.json")
|
|
507
|
+
json_file.add({"name": "John", "age": 30})
|
|
508
|
+
json_file.update({"name": "Jane"})
|
|
509
|
+
data = json_file.search({"age": 30})
|
|
510
|
+
json_file.save()
|
|
511
|
+
```
|
|
512
|
+
|
|
513
|
+
---
|
|
514
|
+
|
|
515
|
+
## 💡 Advanced Examples
|
|
516
|
+
|
|
517
|
+
### 1. Full Deployment Pipeline Automation
|
|
518
|
+
|
|
519
|
+
```python
|
|
520
|
+
from allykit import Git, Pip, Python, File
|
|
521
|
+
|
|
522
|
+
# 1. Clone repository
|
|
523
|
+
git = Git()
|
|
524
|
+
git.clone("https://github.com/user/project.git")
|
|
525
|
+
|
|
526
|
+
# 2. Install dependencies
|
|
527
|
+
pip = Pip()
|
|
528
|
+
pip.pip_install_requirements("requirements.txt")
|
|
529
|
+
|
|
530
|
+
# 3. Run tests
|
|
531
|
+
py = Python()
|
|
532
|
+
test_output = py.run_script("run_tests.py")
|
|
533
|
+
|
|
534
|
+
# 4. Build package
|
|
535
|
+
py.run_module("build")
|
|
536
|
+
|
|
537
|
+
# 5. Archive results
|
|
538
|
+
file = File()
|
|
539
|
+
file.copy_file("logs/test_results.log", "archive/")
|
|
540
|
+
```
|
|
541
|
+
|
|
542
|
+
### 2. Building a Secure Web Monitoring Bot
|
|
543
|
+
|
|
544
|
+
```python
|
|
545
|
+
from allykit import DiskCache, Monitoring, SoupToDict, create_snapshot, verify_snapshot
|
|
546
|
+
|
|
547
|
+
# Cache with 1-hour TTL
|
|
548
|
+
cache = DiskCache(ttl_hours=1)
|
|
549
|
+
|
|
550
|
+
# Fetch target page
|
|
551
|
+
soup_old = cache.javascript("https://example.com/dashboard")
|
|
552
|
+
|
|
553
|
+
# Create security snapshot
|
|
554
|
+
snapshot = create_snapshot("./data")
|
|
555
|
+
|
|
556
|
+
# ... after some time ...
|
|
557
|
+
# Check for page changes
|
|
558
|
+
monitor = Monitoring("https://example.com/dashboard", "./cache")
|
|
559
|
+
if not monitor.update_all():
|
|
560
|
+
# Fetch new page and perform detailed comparison
|
|
561
|
+
soup_new = cache.javascript("https://example.com/dashboard")
|
|
562
|
+
comparator = SoupToDict(soup_old, soup_new)
|
|
563
|
+
changes = comparator.get_changes()
|
|
564
|
+
|
|
565
|
+
# Verify file integrity
|
|
566
|
+
if verify_snapshot("./data", snapshot):
|
|
567
|
+
print("Website changes detected and file integrity verified.")
|
|
568
|
+
```
|
|
569
|
+
|
|
570
|
+
### 3. Enterprise Password Management
|
|
571
|
+
|
|
572
|
+
```python
|
|
573
|
+
from allykit import generate_timed_password, Time_Password, Review_Password
|
|
574
|
+
|
|
575
|
+
# Generate one-time password for user (24-hour validity)
|
|
576
|
+
temp_pwd = generate_timed_password(time='hours.24')
|
|
577
|
+
tp = Time_Password(temp_pwd)
|
|
578
|
+
|
|
579
|
+
# Check password security
|
|
580
|
+
reviewer = Review_Password(tp.get_password())
|
|
581
|
+
if reviewer.Entropy_Score_Password() < 8:
|
|
582
|
+
print("Password is weak, regenerate!")
|
|
583
|
+
else:
|
|
584
|
+
# Store password hash in database
|
|
585
|
+
hashed_data = tp.to_dict(security=True)
|
|
586
|
+
print(f"Password securely stored: {hashed_data['password']}")
|
|
587
|
+
```
|
|
588
|
+
|
|
589
|
+
### 4. Advanced Scroll Management for Web Automation 🆕
|
|
590
|
+
|
|
591
|
+
```python
|
|
592
|
+
from allykit import chrome, ScrollManager
|
|
593
|
+
|
|
594
|
+
# Launch browser
|
|
595
|
+
driver = chrome()
|
|
596
|
+
|
|
597
|
+
# Create scroll manager
|
|
598
|
+
scroll = ScrollManager(driver)
|
|
599
|
+
|
|
600
|
+
# Navigate to a page
|
|
601
|
+
driver.get("https://example.com")
|
|
602
|
+
|
|
603
|
+
# Scroll to the bottom
|
|
604
|
+
scroll.to_bottom()
|
|
605
|
+
|
|
606
|
+
# Get scroll information
|
|
607
|
+
info = scroll.get_info()
|
|
608
|
+
print(f"Scrolled: {info['percentageScrolled']}%")
|
|
609
|
+
|
|
610
|
+
# Scroll to a specific element
|
|
611
|
+
scroll.to_element("#my-element", by="css")
|
|
612
|
+
|
|
613
|
+
# Load infinite scroll content
|
|
614
|
+
result = scroll.load_infinite_content(max_scrolls=5)
|
|
615
|
+
print(f"Loaded {result['height_increase']}px of new content")
|
|
616
|
+
|
|
617
|
+
# Highlight an element and scroll to it
|
|
618
|
+
scroll.highlight_and_scroll(".important-section", duration=3)
|
|
619
|
+
|
|
620
|
+
# Smart scroll to bottom with content detection
|
|
621
|
+
if scroll.smart_scroll_to_bottom():
|
|
622
|
+
print("All content loaded successfully")
|
|
623
|
+
```
|
|
624
|
+
|
|
625
|
+
### 5. Web Automation with Scroll Management
|
|
626
|
+
|
|
627
|
+
```python
|
|
628
|
+
from allykit import chrome, ScrollManager, WebAutomation
|
|
629
|
+
import time
|
|
630
|
+
|
|
631
|
+
# Setup
|
|
632
|
+
driver = chrome()
|
|
633
|
+
scroll = ScrollManager(driver)
|
|
634
|
+
automation = WebAutomation(driver)
|
|
635
|
+
|
|
636
|
+
# Navigate to social media feed
|
|
637
|
+
driver.get("https://social-media-site.com/feed")
|
|
638
|
+
|
|
639
|
+
# Load content with infinite scroll
|
|
640
|
+
for i in range(3):
|
|
641
|
+
scroll.to_bottom()
|
|
642
|
+
time.sleep(2)
|
|
643
|
+
|
|
644
|
+
# Extract visible posts
|
|
645
|
+
visible_text = scroll.get_visible_elements('div')
|
|
646
|
+
print(f"Visible elements: {len(visible_text)}")
|
|
647
|
+
|
|
648
|
+
# Scroll to a specific post
|
|
649
|
+
scroll.to_text("Exciting news!", smooth=True)
|
|
650
|
+
|
|
651
|
+
# Get element position
|
|
652
|
+
pos = scroll.get_element_position("#post-123")
|
|
653
|
+
print(f"Post at position: ({pos['x']}, {pos['y']})")
|
|
654
|
+
|
|
655
|
+
# Reset to top
|
|
656
|
+
scroll.reset()
|
|
657
|
+
|
|
658
|
+
# Print debugging info
|
|
659
|
+
scroll.print_info()
|
|
660
|
+
```
|
|
661
|
+
|
|
662
|
+
---
|
|
663
|
+
|
|
664
|
+
## ⚙️ Configuration & Dependencies
|
|
665
|
+
|
|
666
|
+
### Core Dependencies (Required)
|
|
667
|
+
|
|
668
|
+
- Python >= 3.9
|
|
669
|
+
- `hashlib`, `os`, `pathlib`, `datetime`, `json`, `shutil`, `string`, `random`, `re`, `typing`, `subprocess`, `time`, `pickle` (all standard)
|
|
670
|
+
- `secrets` (standard)
|
|
671
|
+
|
|
672
|
+
### Optional Dependencies (For Specific Features)
|
|
673
|
+
|
|
674
|
+
- **Web:** `requests`, `beautifulsoup4`, `selenium`, `tenacity`, `deepdiff`
|
|
675
|
+
- **System Automation:** `psutil`, `pyautogui`, `pyperclip`
|
|
676
|
+
|
|
677
|
+
---
|
|
678
|
+
|
|
679
|
+
## 🤝 Contributing
|
|
680
|
+
|
|
681
|
+
The allykit package is developed as Open Source under the MIT license. For contributions, bug reports, or feature suggestions, please visit the main repository on GitHub.
|
|
682
|
+
|
|
683
|
+
---
|
|
684
|
+
|
|
685
|
+
## 📄 License
|
|
686
|
+
|
|
687
|
+
This package is released under the MIT License.
|
|
688
|
+
|
|
689
|
+
**Developed by:** allykit Development Team
|
|
690
|
+
**Last Updated:** As of version 1.4.0
|
|
691
|
+
|
|
692
|
+
---
|
|
693
|
+
|
|
694
|
+
## 🤝 Corporate Sponsorship
|
|
695
|
+
|
|
696
|
+
allykit is a comprehensive toolkit that is already being used by individual developers and small teams. We are looking for corporate partners to help sustain and accelerate its development.
|
|
697
|
+
|
|
698
|
+
### Why Sponsor allykit?
|
|
699
|
+
|
|
700
|
+
- **Reduce Development Time:** Your team can save hundreds of development hours by leveraging allykit's pre-built modules for security, web automation, and system tasks.
|
|
701
|
+
- **Support Open Source:** Help maintain a high-quality, free tool that benefits the entire Python community.
|
|
702
|
+
- **Gain Visibility:** Your company logo and link will be prominently displayed in the project's README and documentation, reaching thousands of developers.
|
|
703
|
+
- **Feature Prioritization:** Sponsors at the corporate level can have a say in the roadmap and prioritization of new features.
|
|
704
|
+
|
|
705
|
+
### Contact Us
|
|
706
|
+
|
|
707
|
+
For corporate sponsorship inquiries, please contact us at:
|
|
708
|
+
📧 **@Hossein_12_mm** (My Telegram ID)
|
|
709
|
+
|
|
710
|
+
---
|
|
711
|
+
|
|
712
|
+
> **One final point:** I am the sole creator of this module—it was built exclusively by me—so please beware of scams. ✔
|
|
713
|
+
> **Thank you for your support.** 🙏💝
|