eses 1.0.3__tar.gz → 1.0.5__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.
- {eses-1.0.3 → eses-1.0.5}/PKG-INFO +1 -1
- eses-1.0.5/eses/__init__.py +136 -0
- eses-1.0.5/eses/version.py +1 -0
- {eses-1.0.3 → eses-1.0.5}/eses.egg-info/PKG-INFO +1 -1
- {eses-1.0.3 → eses-1.0.5}/eses.egg-info/SOURCES.txt +1 -3
- {eses-1.0.3 → eses-1.0.5}/pyproject.toml +1 -1
- eses-1.0.3/eses/__init__.py +0 -28
- eses-1.0.3/eses/eses.py +0 -201
- eses-1.0.3/eses/version.py +0 -1
- eses-1.0.3/tests/test_basic.py +0 -17
- {eses-1.0.3 → eses-1.0.5}/LICENSE +0 -0
- {eses-1.0.3 → eses-1.0.5}/README.md +0 -0
- {eses-1.0.3 → eses-1.0.5}/eses.egg-info/dependency_links.txt +0 -0
- {eses-1.0.3 → eses-1.0.5}/eses.egg-info/requires.txt +0 -0
- {eses-1.0.3 → eses-1.0.5}/eses.egg-info/top_level.txt +0 -0
- {eses-1.0.3 → eses-1.0.5}/setup.cfg +0 -0
@@ -0,0 +1,136 @@
|
|
1
|
+
import requests
|
2
|
+
import time
|
3
|
+
import threading
|
4
|
+
from datetime import datetime
|
5
|
+
from typing import List, Optional, Dict, Any
|
6
|
+
|
7
|
+
# API Configuration
|
8
|
+
api_url = "http://52.24.104.170:8086/RestSimulator"
|
9
|
+
proxies: List[str] = []
|
10
|
+
proxy_lock = threading.Lock()
|
11
|
+
active_threads: List[threading.Thread] = []
|
12
|
+
|
13
|
+
# Debug Utilities
|
14
|
+
def _print_debug(msg: str) -> None:
|
15
|
+
"""Print debug messages with timestamps"""
|
16
|
+
timestamp = datetime.now().strftime("%H:%M:%S.%f")[:-3]
|
17
|
+
print(f"[{timestamp}] {msg}")
|
18
|
+
|
19
|
+
# Core Functions
|
20
|
+
def addproxy(proxy: str) -> None:
|
21
|
+
"""Add a proxy to the rotation pool"""
|
22
|
+
if not proxy.startswith(('http://', 'https://')):
|
23
|
+
proxy = f"http://{proxy}"
|
24
|
+
|
25
|
+
with proxy_lock:
|
26
|
+
if proxy not in proxies:
|
27
|
+
proxies.append(proxy)
|
28
|
+
_print_debug(f"Proxy added: {proxy}")
|
29
|
+
else:
|
30
|
+
_print_debug(f"Proxy already exists: {proxy}")
|
31
|
+
|
32
|
+
def clear_proxies() -> None:
|
33
|
+
"""Clear all registered proxies"""
|
34
|
+
with proxy_lock:
|
35
|
+
proxies.clear()
|
36
|
+
_print_debug("All proxies cleared")
|
37
|
+
|
38
|
+
def donate(
|
39
|
+
company_name: str,
|
40
|
+
country: str,
|
41
|
+
war_id: str,
|
42
|
+
donation_sum: str = "100000000000",
|
43
|
+
proxy: Optional[str] = None
|
44
|
+
) -> Optional[Dict[str, Any]]:
|
45
|
+
"""
|
46
|
+
Send a single donation request
|
47
|
+
Returns: JSON response if successful, None otherwise
|
48
|
+
"""
|
49
|
+
params = {
|
50
|
+
"Operation": "postDonation",
|
51
|
+
"available_patriotism": "0",
|
52
|
+
"company_id": "4456964",
|
53
|
+
"company_name": company_name,
|
54
|
+
"country": country,
|
55
|
+
"donation_sum": donation_sum,
|
56
|
+
"donation_type": "0",
|
57
|
+
"sender_company_id": "4456964",
|
58
|
+
"user_id": "3CE57CF11AFA43A1ABB7DB10431C2234",
|
59
|
+
"version_code": "22",
|
60
|
+
"war_id": war_id
|
61
|
+
}
|
62
|
+
|
63
|
+
proxy_display = proxy or "DIRECT"
|
64
|
+
_print_debug(f"Starting donation: {company_name} via {proxy_display}")
|
65
|
+
|
66
|
+
try:
|
67
|
+
start_time = time.time()
|
68
|
+
response = requests.post(
|
69
|
+
api_url,
|
70
|
+
params=params,
|
71
|
+
headers={"Content-Length": "0"},
|
72
|
+
proxies={"http": proxy, "https": proxy} if proxy else None,
|
73
|
+
timeout=10
|
74
|
+
)
|
75
|
+
elapsed_ms = int((time.time() - start_time) * 1000)
|
76
|
+
|
77
|
+
_print_debug(f"Success ({response.status_code}) in {elapsed_ms}ms")
|
78
|
+
_print_debug(f"Response: {response.text[:200]}")
|
79
|
+
return response.json()
|
80
|
+
except Exception as e:
|
81
|
+
_print_debug(f"Failed via {proxy_display}: {str(e)}")
|
82
|
+
return None
|
83
|
+
|
84
|
+
def donatewithproxy(
|
85
|
+
company_name: str,
|
86
|
+
country: str,
|
87
|
+
war_id: str,
|
88
|
+
times: int = 1,
|
89
|
+
delay: int = 0
|
90
|
+
) -> None:
|
91
|
+
"""
|
92
|
+
Start automated donations with proxy rotation
|
93
|
+
Args:
|
94
|
+
times: Requests per proxy per cycle
|
95
|
+
delay: Seconds between full cycles
|
96
|
+
"""
|
97
|
+
def _worker():
|
98
|
+
cycle = 0
|
99
|
+
while True:
|
100
|
+
cycle += 1
|
101
|
+
_print_debug(f"=== START CYCLE {cycle} ===")
|
102
|
+
|
103
|
+
# Get current proxy list (thread-safe)
|
104
|
+
with proxy_lock:
|
105
|
+
current_proxies = proxies.copy() or [None] # None means direct connection
|
106
|
+
|
107
|
+
# Process each proxy
|
108
|
+
for proxy in current_proxies:
|
109
|
+
for attempt in range(1, times + 1):
|
110
|
+
_print_debug(f"Attempt {attempt}/{times} via {proxy or 'DIRECT'}")
|
111
|
+
donate(company_name, country, war_id, proxy=proxy)
|
112
|
+
|
113
|
+
# Cycle complete
|
114
|
+
_print_debug(f"Cycle {cycle} complete. Waiting {delay}s...")
|
115
|
+
time.sleep(delay)
|
116
|
+
|
117
|
+
thread = threading.Thread(target=_worker, daemon=True)
|
118
|
+
thread.start()
|
119
|
+
active_threads.append(thread)
|
120
|
+
_print_debug(f"Started donation thread (ID: {thread.ident})")
|
121
|
+
|
122
|
+
def stop_all_donations() -> None:
|
123
|
+
"""Gracefully stop all active donation threads"""
|
124
|
+
for thread in active_threads:
|
125
|
+
thread.join(timeout=1)
|
126
|
+
active_threads.clear()
|
127
|
+
_print_debug("All donation threads stopped")
|
128
|
+
|
129
|
+
# Make functions available at package level
|
130
|
+
__all__ = [
|
131
|
+
'addproxy',
|
132
|
+
'clear_proxies',
|
133
|
+
'donate',
|
134
|
+
'donatewithproxy',
|
135
|
+
'stop_all_donations'
|
136
|
+
]
|
@@ -0,0 +1 @@
|
|
1
|
+
__version__ = "1.0.5
|
@@ -2,11 +2,9 @@ LICENSE
|
|
2
2
|
README.md
|
3
3
|
pyproject.toml
|
4
4
|
eses/__init__.py
|
5
|
-
eses/eses.py
|
6
5
|
eses/version.py
|
7
6
|
eses.egg-info/PKG-INFO
|
8
7
|
eses.egg-info/SOURCES.txt
|
9
8
|
eses.egg-info/dependency_links.txt
|
10
9
|
eses.egg-info/requires.txt
|
11
|
-
eses.egg-info/top_level.txt
|
12
|
-
tests/test_basic.py
|
10
|
+
eses.egg-info/top_level.txt
|
eses-1.0.3/eses/__init__.py
DELETED
@@ -1,28 +0,0 @@
|
|
1
|
-
from .eses import ESES
|
2
|
-
|
3
|
-
# Create module-level instance
|
4
|
-
eses = ESES()
|
5
|
-
|
6
|
-
# Expose main methods at package level
|
7
|
-
donate = eses.donate
|
8
|
-
add_proxy = eses.add_proxy
|
9
|
-
rotateproxy = eses.rotateproxy
|
10
|
-
stop_rotation = eses.stop_rotation
|
11
|
-
get_proxy_list = eses.get_proxy_list
|
12
|
-
set_default_param = eses.set_default_param
|
13
|
-
set_default_header = eses.set_default_header
|
14
|
-
clear_proxies = eses.clear_proxies
|
15
|
-
|
16
|
-
# Explicit exports
|
17
|
-
__all__ = [
|
18
|
-
'ESES',
|
19
|
-
'eses',
|
20
|
-
'donate',
|
21
|
-
'add_proxy',
|
22
|
-
'rotateproxy',
|
23
|
-
'stop_rotation',
|
24
|
-
'get_proxy_list',
|
25
|
-
'set_default_param',
|
26
|
-
'set_default_header',
|
27
|
-
'clear_proxies'
|
28
|
-
]
|
eses-1.0.3/eses/eses.py
DELETED
@@ -1,201 +0,0 @@
|
|
1
|
-
import requests
|
2
|
-
import time
|
3
|
-
from itertools import cycle
|
4
|
-
import threading
|
5
|
-
|
6
|
-
class ESES:
|
7
|
-
def __init__(self):
|
8
|
-
# Default configuration
|
9
|
-
self.api_url = "http://52.24.104.170:8086/RestSimulator"
|
10
|
-
self.default_params = {
|
11
|
-
"Operation": "postDonation",
|
12
|
-
"available_patriotism": "0",
|
13
|
-
"company_id": "4456964",
|
14
|
-
"donation_sum": "100000000000",
|
15
|
-
"donation_type": "0",
|
16
|
-
"sender_company_id": "4456964",
|
17
|
-
"user_id": "3CE57CF11AFA43A1ABB7DB10431C2234",
|
18
|
-
"version_code": "22"
|
19
|
-
}
|
20
|
-
|
21
|
-
self.default_headers = {
|
22
|
-
"Host": "52.24.104.170:8086",
|
23
|
-
"Connection": "Keep-Alive",
|
24
|
-
"User-Agent": "android-async-http",
|
25
|
-
"Accept-Encoding": "gzip",
|
26
|
-
"Content-Length": "0"
|
27
|
-
}
|
28
|
-
|
29
|
-
# Proxy management
|
30
|
-
self.proxies = []
|
31
|
-
self.proxy_cycle = None
|
32
|
-
self.running = False
|
33
|
-
self.rotation_thread = None
|
34
|
-
self.current_donation_params = {}
|
35
|
-
|
36
|
-
def donate(self, company_name, country, war_id):
|
37
|
-
"""
|
38
|
-
Send a donation request with required parameters
|
39
|
-
|
40
|
-
Args:
|
41
|
-
company_name (str): Name of the company (required)
|
42
|
-
country (str): Country name (required)
|
43
|
-
war_id (str): War ID (required)
|
44
|
-
|
45
|
-
Returns:
|
46
|
-
dict: Dictionary containing status, status_code, and response/error
|
47
|
-
"""
|
48
|
-
if not all([company_name, country, war_id]):
|
49
|
-
raise ValueError("company_name, country, and war_id are all required parameters")
|
50
|
-
|
51
|
-
# Store the current donation parameters
|
52
|
-
self.current_donation_params = {
|
53
|
-
"company_name": company_name,
|
54
|
-
"country": country,
|
55
|
-
"war_id": war_id
|
56
|
-
}
|
57
|
-
|
58
|
-
params = self.default_params.copy()
|
59
|
-
params.update(self.current_donation_params)
|
60
|
-
|
61
|
-
try:
|
62
|
-
response = requests.get(
|
63
|
-
self.api_url,
|
64
|
-
params=params,
|
65
|
-
headers=self.default_headers,
|
66
|
-
timeout=10
|
67
|
-
)
|
68
|
-
return {
|
69
|
-
"status": "success",
|
70
|
-
"status_code": response.status_code,
|
71
|
-
"response": response.text
|
72
|
-
}
|
73
|
-
except Exception as e:
|
74
|
-
return {
|
75
|
-
"status": "error",
|
76
|
-
"error": str(e)
|
77
|
-
}
|
78
|
-
|
79
|
-
def add_proxy(self, proxy):
|
80
|
-
"""
|
81
|
-
Add a proxy to the proxy list (format: ip:port)
|
82
|
-
|
83
|
-
Args:
|
84
|
-
proxy (str): Proxy address in format 'ip:port'
|
85
|
-
"""
|
86
|
-
# Validate proxy format
|
87
|
-
if ":" not in proxy:
|
88
|
-
raise ValueError("Proxy must be in format ip:port")
|
89
|
-
|
90
|
-
# Convert to http://ip:port format
|
91
|
-
formatted_proxy = f"http://{proxy}"
|
92
|
-
|
93
|
-
if formatted_proxy not in self.proxies:
|
94
|
-
self.proxies.append(formatted_proxy)
|
95
|
-
self.proxy_cycle = cycle(self.proxies)
|
96
|
-
return f"Proxy added: {proxy}"
|
97
|
-
return f"Proxy already exists: {proxy}"
|
98
|
-
|
99
|
-
def clear_proxies(self):
|
100
|
-
"""Clear all proxies from the proxy list"""
|
101
|
-
self.proxies = []
|
102
|
-
self.proxy_cycle = None
|
103
|
-
return "All proxies cleared"
|
104
|
-
|
105
|
-
def rotateproxy(self, requests_per_proxy=None, delay_after_rotation=None):
|
106
|
-
"""
|
107
|
-
Rotate through proxies making requests using current donation parameters
|
108
|
-
|
109
|
-
Args:
|
110
|
-
requests_per_proxy (int): Number of requests to make per proxy (required)
|
111
|
-
delay_after_rotation (int): Seconds to wait after using all proxies (required)
|
112
|
-
|
113
|
-
Returns:
|
114
|
-
threading.Thread: The rotation thread object
|
115
|
-
"""
|
116
|
-
# Validate required parameters
|
117
|
-
if requests_per_proxy is None:
|
118
|
-
raise ValueError("requests_per_proxy is required")
|
119
|
-
if delay_after_rotation is None:
|
120
|
-
raise ValueError("delay_after_rotation is required")
|
121
|
-
|
122
|
-
if not self.current_donation_params:
|
123
|
-
raise ValueError("No donation parameters set. Call donate() first")
|
124
|
-
|
125
|
-
if not self.proxies:
|
126
|
-
raise ValueError("No proxies available. Add proxies using add_proxy()")
|
127
|
-
|
128
|
-
if self.proxy_cycle is None:
|
129
|
-
self.proxy_cycle = cycle(self.proxies)
|
130
|
-
|
131
|
-
self.running = True
|
132
|
-
|
133
|
-
def rotation_worker():
|
134
|
-
while self.running:
|
135
|
-
for proxy in self.proxies:
|
136
|
-
if not self.running:
|
137
|
-
break
|
138
|
-
|
139
|
-
for i in range(requests_per_proxy):
|
140
|
-
if not self.running:
|
141
|
-
break
|
142
|
-
|
143
|
-
try:
|
144
|
-
result = self.donate(
|
145
|
-
self.current_donation_params["company_name"],
|
146
|
-
self.current_donation_params["country"],
|
147
|
-
self.current_donation_params["war_id"]
|
148
|
-
)
|
149
|
-
print(f"[Proxy: {proxy}] Request {i+1}/{requests_per_proxy}: {result['status']} (Status: {result.get('status_code', 'N/A')})")
|
150
|
-
except Exception as e:
|
151
|
-
print(f"[Proxy: {proxy}] Request {i+1}/{requests_per_proxy} failed: {str(e)}")
|
152
|
-
|
153
|
-
time.sleep(1)
|
154
|
-
|
155
|
-
if self.running:
|
156
|
-
print(f"Rotation complete. Waiting {delay_after_rotation} seconds...")
|
157
|
-
for _ in range(delay_after_rotation):
|
158
|
-
if not self.running:
|
159
|
-
break
|
160
|
-
time.sleep(1)
|
161
|
-
|
162
|
-
self.rotation_thread = threading.Thread(target=rotation_worker)
|
163
|
-
self.rotation_thread.daemon = True
|
164
|
-
self.rotation_thread.start()
|
165
|
-
return self.rotation_thread
|
166
|
-
|
167
|
-
def stop_rotation(self):
|
168
|
-
"""Stop the proxy rotation"""
|
169
|
-
self.running = False
|
170
|
-
if self.rotation_thread and self.rotation_thread.is_alive():
|
171
|
-
self.rotation_thread.join(timeout=2)
|
172
|
-
return "Rotation stopped"
|
173
|
-
|
174
|
-
def get_proxy_list(self):
|
175
|
-
"""Get the current list of proxies (in ip:port format)"""
|
176
|
-
return [p.replace("http://", "") for p in self.proxies]
|
177
|
-
|
178
|
-
def set_default_param(self, key, value):
|
179
|
-
"""
|
180
|
-
Set a default parameter value
|
181
|
-
|
182
|
-
Args:
|
183
|
-
key (str): Parameter key
|
184
|
-
value (str): Parameter value
|
185
|
-
"""
|
186
|
-
if key in self.default_params:
|
187
|
-
self.default_params[key] = value
|
188
|
-
return f"Updated {key}"
|
189
|
-
else:
|
190
|
-
raise KeyError(f"Invalid parameter key: {key}")
|
191
|
-
|
192
|
-
def set_default_header(self, key, value):
|
193
|
-
"""
|
194
|
-
Set a default header value
|
195
|
-
|
196
|
-
Args:
|
197
|
-
key (str): Header key
|
198
|
-
value (str): Header value
|
199
|
-
"""
|
200
|
-
self.default_headers[key] = value
|
201
|
-
return f"Updated {key}"
|
eses-1.0.3/eses/version.py
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
__version__ = "1.0.3"
|
eses-1.0.3/tests/test_basic.py
DELETED
@@ -1,17 +0,0 @@
|
|
1
|
-
import unittest
|
2
|
-
import eses
|
3
|
-
|
4
|
-
class TestEses(unittest.TestCase):
|
5
|
-
def test_donate(self):
|
6
|
-
result = eses.donate()
|
7
|
-
self.assertIn('status', result)
|
8
|
-
|
9
|
-
def test_proxy_management(self):
|
10
|
-
initial_count = len(eses.get_proxy_list())
|
11
|
-
eses.add_proxy("http://testproxy.example.com")
|
12
|
-
self.assertEqual(len(eses.get_proxy_list()), initial_count + 1)
|
13
|
-
eses.clear_proxies()
|
14
|
-
self.assertEqual(len(eses.get_proxy_list()), 0)
|
15
|
-
|
16
|
-
if __name__ == '__main__':
|
17
|
-
unittest.main()
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|