DILSHAD737 commited on
Commit
eda03d3
Β·
1 Parent(s): 4da98f9

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +40 -37
app.py CHANGED
@@ -129,7 +129,7 @@ def generate_phrases_for_words(wordlist, mode):
129
  yield " ".join(combo)
130
 
131
  # ============================================================
132
- # Gradio functions β€” YIELD + Markdown for live updates
133
  # ============================================================
134
 
135
  def generate_random_phrase():
@@ -138,10 +138,6 @@ def generate_random_phrase():
138
 
139
  def run_multi_phrase_scan(my_phrase, num_phrases, addresses_file, phrase_mode,
140
  start_index, end_index, passphrase):
141
- """
142
- Generator β€” har step pe yield, Markdown output, taake UI live update ho
143
- aur Scan Log automatically scroll kare.
144
- """
145
  if not os.path.exists(addresses_file):
146
  yield f"❌ File nahi mili: {addresses_file}", ""
147
  return
@@ -178,14 +174,14 @@ def run_multi_phrase_scan(my_phrase, num_phrases, addresses_file, phrase_mode,
178
  f"πŸ”‘ Index range: {start_index}–{end_index}",
179
  f"πŸ“ Total phrases: {len(phrases)}",
180
  "",
181
- "**Phrases:**",
182
  ]
183
  for i, p in enumerate(phrases, 1):
184
- tag = " **(AAPKI)**" if i == 1 and len(my_words) == 12 else ""
185
- log_lines.append(f"{i}. `{p}`{tag}")
186
  log_lines.append("")
187
 
188
- yield "\n\n".join(log_lines), "Scan shuru ho raha hai..."
189
 
190
  matches = []
191
  start = time.time()
@@ -193,24 +189,24 @@ def run_multi_phrase_scan(my_phrase, num_phrases, addresses_file, phrase_mode,
193
 
194
  for p_idx, phrase in enumerate(phrases, 1):
195
  log_lines.append(f"---")
196
- log_lines.append(f"**πŸ” [{p_idx}/{total_phrases}] Checking:** `{phrase}`")
197
- yield "\n\n".join(log_lines), (
198
- "\n\n".join(f"**Phrase:** `{p}`\n**Index:** {i}\n**Key:** `{k}`\n**Addr:** `{a}`"
199
- for p, i, k, a in matches)
200
  if matches else "Abhi tak koi match nahi"
201
  )
202
 
203
  words = phrase.strip().split()
204
  if len(words) != 12:
205
  log_lines.append(f"⚠️ Skipped (not 12 words)")
206
- yield "\n\n".join(log_lines), "Abhi tak koi match nahi"
207
  continue
208
 
209
  for idx in range(start_index, end_index + 1):
210
  log_lines.append(f" - Index {idx}...")
211
- yield "\n\n".join(log_lines), (
212
- "\n\n".join(f"**Phrase:** `{p}`\n**Index:** {i}\n**Key:** `{k}`\n**Addr:** `{a}`"
213
- for p, i, k, a in matches)
214
  if matches else "Abhi tak koi match nahi"
215
  )
216
 
@@ -226,35 +222,35 @@ def run_multi_phrase_scan(my_phrase, num_phrases, addresses_file, phrase_mode,
226
  continue
227
  if normalize(addr) in known:
228
  match_line = (
229
- f"**πŸŽ‰ MATCH!**\n\n"
230
- f"**Phrase:** `{phrase_str}`\n\n"
231
- f"**Index:** {idx}\n\n"
232
- f"**Key:** `{priv.hex()}`\n\n"
233
- f"**Addr:** `{addr}`"
234
  )
235
  log_lines.append(match_line)
236
  matches.append((phrase_str, idx, priv.hex(), addr))
237
- yield "\n\n".join(log_lines), "\n\n".join(
238
- f"**Phrase:** `{p}`\n**Index:** {i}\n**Key:** `{k}`\n**Addr:** `{a}`"
239
  for p, i, k, a in matches
240
  )
241
 
242
  elapsed = time.time() - start
243
- log_lines.append("---")
244
- log_lines.append(f"**=== DONE ===**")
245
- log_lines.append(f"**Total time:** {elapsed:.1f}s")
246
- log_lines.append(f"**Total matches:** {len(matches)}")
247
 
248
- matches_text = "\n\n".join(
249
- f"**Phrase:** `{p}`\n**Index:** {i}\n**Key:** `{k}`\n**Addr:** `{a}`"
250
  for p, i, k, a in matches
251
  ) if matches else "Koi match nahi mila"
252
 
253
- yield "\n\n".join(log_lines), matches_text
254
 
255
 
256
  # ============================================================
257
- # Build UI β€” gr.Markdown for auto-scroll
258
  # ============================================================
259
  with gr.Blocks(title="Phrase Scanner") as demo:
260
  gr.Markdown("# πŸ” Phrase Scanner")
@@ -299,14 +295,21 @@ with gr.Blocks(title="Phrase Scanner") as demo:
299
 
300
  with gr.Column(scale=2):
301
  gr.Markdown("### Output")
302
- # βœ… gr.Markdown β€” auto-scroll ke liye
303
- log_output = gr.Markdown(
304
  label="Scan Log",
305
- value="",
 
 
 
 
306
  )
307
- matches_output = gr.Markdown(
308
  label="Matches",
309
- value="",
 
 
 
 
310
  )
311
 
312
  run_btn.click(
 
129
  yield " ".join(combo)
130
 
131
  # ============================================================
132
+ # Gradio functions
133
  # ============================================================
134
 
135
  def generate_random_phrase():
 
138
 
139
  def run_multi_phrase_scan(my_phrase, num_phrases, addresses_file, phrase_mode,
140
  start_index, end_index, passphrase):
 
 
 
 
141
  if not os.path.exists(addresses_file):
142
  yield f"❌ File nahi mili: {addresses_file}", ""
143
  return
 
174
  f"πŸ”‘ Index range: {start_index}–{end_index}",
175
  f"πŸ“ Total phrases: {len(phrases)}",
176
  "",
177
+ "Phrases:",
178
  ]
179
  for i, p in enumerate(phrases, 1):
180
+ tag = " (AAPKI)" if i == 1 and len(my_words) == 12 else ""
181
+ log_lines.append(f" {i}. {p}{tag}")
182
  log_lines.append("")
183
 
184
+ yield "\n".join(log_lines), "Scan shuru ho raha hai..."
185
 
186
  matches = []
187
  start = time.time()
 
189
 
190
  for p_idx, phrase in enumerate(phrases, 1):
191
  log_lines.append(f"---")
192
+ log_lines.append(f"πŸ” [{p_idx}/{total_phrases}] Checking: {phrase}")
193
+ yield "\n".join(log_lines), (
194
+ "\n".join(f"Phrase: {p}\nIndex: {i}\nKey: {k}\nAddr: {a}"
195
+ for p, i, k, a in matches)
196
  if matches else "Abhi tak koi match nahi"
197
  )
198
 
199
  words = phrase.strip().split()
200
  if len(words) != 12:
201
  log_lines.append(f"⚠️ Skipped (not 12 words)")
202
+ yield "\n".join(log_lines), "Abhi tak koi match nahi"
203
  continue
204
 
205
  for idx in range(start_index, end_index + 1):
206
  log_lines.append(f" - Index {idx}...")
207
+ yield "\n".join(log_lines), (
208
+ "\n".join(f"Phrase: {p}\nIndex: {i}\nKey: {k}\nAddr: {a}"
209
+ for p, i, k, a in matches)
210
  if matches else "Abhi tak koi match nahi"
211
  )
212
 
 
222
  continue
223
  if normalize(addr) in known:
224
  match_line = (
225
+ f"πŸŽ‰ MATCH!\n"
226
+ f"Phrase: {phrase_str}\n"
227
+ f"Index: {idx}\n"
228
+ f"Key: {priv.hex()}\n"
229
+ f"Addr: {addr}\n"
230
  )
231
  log_lines.append(match_line)
232
  matches.append((phrase_str, idx, priv.hex(), addr))
233
+ yield "\n".join(log_lines), "\n".join(
234
+ f"Phrase: {p}\nIndex: {i}\nKey: {k}\nAddr: {a}"
235
  for p, i, k, a in matches
236
  )
237
 
238
  elapsed = time.time() - start
239
+ log_lines.append(f"---")
240
+ log_lines.append(f"=== DONE ===")
241
+ log_lines.append(f"Total time: {elapsed:.1f}s")
242
+ log_lines.append(f"Total matches: {len(matches)}")
243
 
244
+ matches_text = "\n".join(
245
+ f"Phrase: {p}\nIndex: {i}\nKey: {k}\nAddr: {a}"
246
  for p, i, k, a in matches
247
  ) if matches else "Koi match nahi mila"
248
 
249
+ yield "\n".join(log_lines), matches_text
250
 
251
 
252
  # ============================================================
253
+ # Build UI
254
  # ============================================================
255
  with gr.Blocks(title="Phrase Scanner") as demo:
256
  gr.Markdown("# πŸ” Phrase Scanner")
 
295
 
296
  with gr.Column(scale=2):
297
  gr.Markdown("### Output")
298
+ log_output = gr.Textbox(
 
299
  label="Scan Log",
300
+ lines=20,
301
+ max_lines=30,
302
+ interactive=False,
303
+ autoscroll=True,
304
+ show_copy_button=True,
305
  )
306
+ matches_output = gr.Textbox(
307
  label="Matches",
308
+ lines=10,
309
+ max_lines=20,
310
+ interactive=False,
311
+ autoscroll=True,
312
+ show_copy_button=True,
313
  )
314
 
315
  run_btn.click(