-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathcombinandocomselenium.py
82 lines (74 loc) · 2.22 KB
/
combinandocomselenium.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
from time import sleep
import psutil
import pymem
import numpy as np
from pdmemedit import Pdmemory
from cythonsequencefinder import np_search_sequence
from seleniumbase import Driver
from exceptdrucker import errwrite
import ujson
driver = Driver(uc=True)
driver.get("https://br.betano.com")
sleep(15)
allprocs = []
for q in psutil.process_iter():
try:
if q.name().lower() == "chrome.exe":
allprocs.append(q)
except Exception:
pass
allmems = []
for q in allprocs:
allmems.append(Pdmemory(pid=q.pid, filename=None))
def search_memory(
string,
encoding="utf-8", # utf-8 / utf-16-le / latin1 / cp1252
outencodingreplace="ignore",
):
seqarra = np.array(list(string.encode(encoding)), dtype=np.uint8)
resultsfound = []
for la in allmems:
try:
la.update_region_df(
limitfunction=lambda x: True,
dtypes=(
"S1",
np.uint8,
),
allowed_protections=(
pymem.ressources.structure.MEMORY_PROTECTION.PAGE_READWRITE,
),
)
for numara in range(len(la.regiondf.aa_dump_numpy_uint8)):
try:
if np.any(
np_search_sequence(
la.regiondf.aa_dump_numpy_uint8.iloc[numara],
seqarra,
distance=1,
)
):
resultsfound.append(
(la.regiondf.aa_dump_S1.iloc[numara]).copy()
)
except Exception:
errwrite()
except Exception:
errwrite()
return resultsfound
resxa = search_memory(
string="displayOrder",
encoding="utf-8",
outencodingreplace="ignore",
)
# 6[{"sports":1
for a in resxa:
# if a.size < 1000000:
print("--------------------------------------------------------")
try:
stri = (b"".join(a)).split(b'[{"sports":', maxsplit=1)[1]
stri = stri.rsplit(b"]", maxsplit=1)[0]
stri = b'[{"sports":' + stri + b"]"
print(ujson.loads(stri))
except Exception:
errwrite()