Új hozzászólás Aktív témák
-
Hege1234
addikt
Sziasztok!
hogyan tudnék kilépni ebből a loopból?
a firefox log fájljában kerestetek 10 token-t
a fájlok nem egyből kerülnek bele a mappába, hanem folyamatosan
és minden 100MB adat után csinál egy új fájlt
log.txt.moz_log.0
log.txt.moz_log.1
log.txt.moz_log.2így elképzelhető, hogy valamelyik token majd csak a 2. vagy 3. fájlban lesz megtalálható..
script:
import re
import time
import glob
log_file_pattern = ".\\firefox-log\\log.txt.moz_log.*"
tokens_to_find = 10
tokens_found = 0
processed_files = set()
while tokens_found < tokens_to_find:
log_files = glob.glob(log_file_pattern)
for file_path in log_files:
cutted_file_path = re.findall(r'\\([^\\]+)$', file_path)[0].strip()
if file_path not in processed_files:
try:
with open(file_path, 'r') as file:
tdata = file.read()
app_key = re.findall(r"header=.app_key..value=.(.*)..merge=0]", tdata)[0].strip()
azukiapp = re.findall(r"E/nsHttp...AzukiApp:.(.*)", tdata)[0].strip()
azukiststoken = re.findall(r"E/nsHttp...AzukiSTSToken:.(.*)", tdata)[0].strip()
natcho = re.findall(r"E/nsHttp.uri=.*natco_key=(.*)&device_type=WEB&channel_number=", tdata)[0].strip()
Device_Id = re.findall(r"header=.Device-Id..value=.(.*)..merge=0]", tdata)[0].strip()
bff_token = re.findall(r"header=.bff_token..value=.(.*)..merge=0]", tdata)[0].strip()
sess_id = re.findall(r"https://.*wv_getlicense.*session_uid=(.*?)&", tdata)[0].strip()
acc_ount = re.findall(r"E/nsHttp.uri=.*user_token=(.*)&session", tdata)[0].strip()
try:
azudrm = re.findall(r'D/n.*?AzukiApp.*?[^.].*?[^.]\"AzukiDRM\" value=\"(.*?)\"', tdata)[0].strip()
except:
azudrm = re.findall(r"E/nsHttp...AzukiApp:..*.*[^?].*[^?.].*[^?.]E/nsHttp...AzukiDRM:.(.*)", tdata)[0].strip()
get_lic = re.findall(r"E/nsHttp uri=(.*wv_getlicense.*token.*)", tdata)[0].strip()
print(f"Token found in {cutted_file_path}: app_key: {app_key}\n")
print(f"Token found in {cutted_file_path}: azukiapp: {azukiapp}\n")
print(f"Token found in {cutted_file_path}: azukiststoken: {azukiststoken}\n")
print(f"Token found in {cutted_file_path}: natcho: {natcho}\n")
print(f"Token found in {cutted_file_path}: Device_Id: {Device_Id}\n")
print(f"Token found in {cutted_file_path}: bff_token: {bff_token}\n")
print(f"Token found in {cutted_file_path}: sess_id: {sess_id}\n")
print(f"Token found in {cutted_file_path}: acc_ount: {acc_ount}\n")
print(f"Token found in {cutted_file_path}: azudrm: {azudrm}\n")
print(f"Token found in {cutted_file_path}: get_lic: {get_lic}\n")
tokens_found += 1
processed_files.add(file_path)
except (IndexError, FileNotFoundError):
print(f"Token not found in {cutted_file_path}. Waiting for the next attempt.")
except Exception as e:
print(f"Error processing {cutted_file_path}: {e}")
time.sleep(2)
print(f"All tokens found! Press Enter to exit.")
stopsdf = input('\stop now!')még a loopban lévő print:
Token not found in log.txt.moz_log.0. Waiting for the next attempt.
Token not found in log.txt.moz_log.0. Waiting for the next attempt.
Token not found in log.txt.moz_log.0. Waiting for the next attempt.
Token found in log.txt.moz_log.0: app_key: ex****k
Token found in log.txt.moz_log.0: azukiapp: 3**
Token found in log.txt.moz_log.0: azukiststoken: AuthTok****
Token found in log.txt.moz_log.0: natcho: T****0P
Token found in log.txt.moz_log.0: Device_Id: 95d6****a4
Token found in log.txt.moz_log.0: bff_token: AuthTok****
Token found in log.txt.moz_log.0: sess_id: e4ab****f91
Token found in log.txt.moz_log.0: acc_ount: 100****001
Token found in log.txt.moz_log.0: azudrm: bd****C0=
Token found in log.txt.moz_log.0: get_lic: htt****lsemajd miután a log.txt.moz_log.0 betelt és létrejön a log.txt.moz_log.1 a mappában
elkezdi azt is csekkolni több száz sort nem teszek be róla, de az így néz ki:Token not found in log.txt.moz_log.1. Waiting for the next attempt.
.
.
Token not found in log.txt.moz_log.1. Waiting for the next attempt.
Token not found in log.txt.moz_log.1. Waiting for the next attempt.
.
.
Token not found in log.txt.moz_log.1. Waiting for the next attempt.
Token not found in log.txt.moz_log.2. Waiting for the next attempt.
Token not found in log.txt.moz_log.3. Waiting for the next attempt.
Token not found in log.txt.moz_log.1. Waiting for the next attempt.azt nem értem, hogy a loop-ból miért nem tud kilépni amikor a mostani helyzetben már az 1. fájlban megtalál minden token-t amit kerestetek és a print jelzi is..

lehet kellene valahova egy break és az, hogy megadom hogy 10 tokent találjon meg az nem elég a kilépéshez?
vagy más ok miatt mehet mégis a következő fájlra?
Új hozzászólás Aktív témák
- OHH! MSI CYBORG 15 Gamer Tervező Laptop 15,6" -30% i7-13620H 10Mag 16/512 RTX 4060 8GB FHD 144Hz
- ELADÓ 4 darab 8GB DDR4 ECC Registered (RDIMM) Szerver RAM modul
- Építőipari csomag (vakológépek, targoncák, építőipari eszközök és kellékek, egyéb, sok más)
- Ubiquiti 10Gbit-es switch eladó (US-XG-6POE)
- KEMP LoadMaster 2200 - 1U magas, rackbe szerelhető alkalmazásvezérlő (ADC) és terheléselosztó -
- 218 - Lenovo ThinkBook 16p (G5 IRX) - Intel Core i9-14900HX, RTX 4060
- ÁRGARANCIA!Épített KomPhone Ryzen 7 5700X 32/64GB RAM RTX 5060 Ti 8GB GAMER PC termékbeszámítással
- Tablet felvásárlás!! Apple iPad, iPad Mini, iPad Air, iPad Pro
- Gyors és kedvező csomagküldés Magyarországon és külföldre!
- Telefon felvásárlás!! Samsung Galaxy A70/Samsung Galaxy A71/Samsung Galaxy A72
Állásajánlatok
Cég: Laptopműhely Bt.
Város: Budapest
Cég: Central PC számítógép és laptop szerviz - Pécs
Város: Pécs


