Commit graph

1029 commits

Author SHA1 Message Date
GaltRanch
458b60fbbc Add status bar with mode, block height, and BTC price to main menus
- PyBlock.py MainMenu(): fetch BTC price from mempool.space API,
  display status_bar() showing mode/block/price before menu header
- SPV/spvblock.py MainMenuCROPPED(): same status_bar integration
- Import shared.ui utilities in both files

The status bar shows at a glance: active mode (Local/Remote/Lite),
current block height, and USD price of Bitcoin.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-01 13:09:21 -03:00
GaltRanch
04c0e33efc Rename 'Cropped' mode to 'Lite Mode' in user-facing text
- PyBlock.py: Update intro screen text and option label
- SPV/spvblock.py: Change all n="CROPPED" display labels to "LITE MODE"
- Internal config value 'cropped' in intro.conf unchanged for backward compat

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-01 13:07:21 -03:00
GaltRanch
915da7a1d5 Add shared/ui.py with status bar, spinner, error display, and input validation
Foundation module for Level 1 frontend improvements:
- status_bar(): persistent header showing mode, block height, BTC price
- show_error/warning/success(): visible user-facing messages
- Spinner: context manager for loading animations on API calls
- prompt_menu(): input validation with back-button support
- ANSI color constants for consistent styling

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-01 13:06:17 -03:00
GaltRanch
42623cfc53 Convert download/install shell chains to list-based subprocess in SPV/spvblock.py
Replace 21 mkdir/cd/wget/tar/unzip/git-clone/chmod shell chains with
os.makedirs() + list-based subprocess.run(cwd=) calls:
- Nostr console 5 platform installers + seed/QR tools
- Mempool-cli x86/ARM installers
- CroppedMiner x86/ARM, Luxor, TinySeed
- Bija, bpytop, Cashu, ColdCore, Warden, Resurrection wallet
- Satellite and terminal_matrix git clones

Replace chmod 777 * with chmod +x on specific binaries.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-01 12:51:48 -03:00
GaltRanch
455cb986ce Convert download/install shell chains to list-based subprocess in PyBlock.py
Replace 27 mkdir/cd/wget/tar/unzip/git-clone/chmod shell chains with
os.makedirs() + list-based subprocess.run(cwd=) calls:
- Mempool-cli x86/ARM installers
- Phoenix wallet 4 platform installers
- Nostr console 5 platform installers + seed tools
- SatSale, Warden, Bija, Coldcore, Cashu, bpytop, Luxor, UTXOracle

4 remaining shell=True are legitimate pipe chains (bitcoincli|xxd, jq).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-01 12:51:41 -03:00
GaltRanch
757b38d3de Convert curl API calls to requests library in SPV/ppi.py
Replace 30 subprocess curl API calls with native Python requests:
- LNBits: invoice create/check/pay, paywall CRUD, LNURL withdraw (11)
- OpenNode: balance, charges, withdrawals, status RSS (7)
- TallyCoin: payment requests (2)
- LNPay: invoice status and decode (2)
- Simple GETs: PGP key, bwt banner, weather, rate.sx (5+)

9 remaining shell=True are pipe chains requiring shell processing.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-01 12:32:55 -03:00
GaltRanch
cf69861dcf Convert LNBits, OpenNode, and TallyCoin curl calls to requests library
Replace 23 subprocess curl API calls with native Python requests:
- LNBits: create/check invoice, pay invoice, paywall CRUD, LNURL withdraw
- OpenNode: create charge, list funds, list payments, initiate withdrawal,
  check status (RSS), decode invoice
- TallyCoin: payment requests (2 functions)

Remaining shell=True in ppi.py are pipe chains (curl|grep|html2text)
that require shell for processing.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-01 12:27:41 -03:00
GaltRanch
c0b40e91f7 Convert simple subprocess shell=True to list format with cwd
Replace cd-and-run shell patterns with list-based subprocess.run()
using cwd parameter for directory context:

- Phoenix macOS ARM installer
- Luxor CLI help
- Mempool CLI (2 instances)
- SatSale, Cashu, Warden, bpytop launchers
- Bija docker-compose
- Both SPV/spvblock.py and PyBlock.py

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-01 12:21:08 -03:00
GaltRanch
935cf809de Eliminate all user-input shell injection vectors in spvblock.py
Convert every remaining subprocess call that interpolates user input
(responseC/D/E, invoice, private keys) from shell=True f-strings to
safe list-based subprocess.run() with cwd parameter:

- Miners (CroppedMiner x86/ARM): user address, password, threads
- Foreman Pickaxe: apiKey and clientId
- LND decodepayreq: invoice string (2 instances)
- TinySeed: seed words
- Nostr console (5 platform variants): private key
- Nostr seed/QR seed: hex input

Zero user-input + shell=True patterns remain in the codebase.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-01 12:19:36 -03:00
GaltRanch
0a70a7260a Eliminate all star imports across the entire codebase
Replace every `from X import *` with explicit named imports:
- SPV/spvblock.py: 11 star imports resolved
- SPV/ppi.py: 4 star imports resolved, duplicate import removed
- SPV/nodeconnection.py, SPV/sysinf.py, SPV/apisnd.py, SPV/donation.py
- mempoolclock.py, sysinf.py, apisnd.py, donation.py

Removed unused imports (art, nodeconnection in donation, logos in apisnd).
Zero star imports remain in the project.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-01 12:13:33 -03:00
GaltRanch
273d806d37 Rename shadowed builtin 'list' variable to 'cmd'
Replace all uses of 'list' as a variable name for shell command strings
with 'cmd' to avoid shadowing Python's built-in list type.
Affects ppi.py, PyBlock.py, SPV/ppi.py, and SPV/spvblock.py.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-01 12:10:49 -03:00
GaltRanch
00f39014bd Fix unclosed sockets and add __main__ guard in SHS.py
- Wrap socket operations in try/finally to ensure sock.close() on errors
- Add if __name__ == '__main__' guard to prevent execution on import
- Applied to both pybitblock/SHS.py and pybitblock/SPV/SHS.py

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-01 12:06:00 -03:00
GaltRanch
a746b36420 Replace star imports with explicit imports in core files
- PyBlock.py: Replace 14 star imports with explicit named imports,
  remove unused `from art import *` and `from SPV.spvblock import *`
- ppi.py: Replace star imports, remove unused art/nodeconnection imports,
  remove duplicate `import requests` and dead lnpay_py comments
- nodeconnection.py: Replace star imports, remove unused art import

This improves code clarity, prevents namespace pollution, and makes
dependencies between modules explicit and traceable.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-01 12:03:52 -03:00
GaltRanch
3c7eb44030 Fix mutable default argument bug in all rpc() functions
Replace params=[] with params=None pattern to prevent shared state
between calls. Affects PyBlock.py, nodeconnection.py,
SPV/nodeconnection.py, and clockscriptREMOTE.py.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-01 11:59:22 -03:00
GaltRanch
6304b7a42a Fix shell injection vulnerabilities in spvblock.py
- Replace user input in subprocess f-strings with safe alternatives:
  - Phoenix CLI: use list-based subprocess.run() with cwd parameter
  - PhoenixD API: replace curl shell commands with requests library
  - Bitaxe API: replace curl shell commands with requests library
  - Luxor CLI: use list-based subprocess.run() with cwd parameter
- Convert Phoenix download/install from shell=True to list-based commands
- Add shlex import for safe argument splitting
- Collapse repeated input/subprocess blocks into loops

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-01 11:54:42 -03:00
GaltRanch
cdfb258e95 Harden file handling, exception specificity, and API key management
- Replace open() without context managers with `with` statements across all modified files
- Change bare `except:` to `except Exception:` for safer exception handling
- Move Whale Alert API key from hardcoded to environment variable
- Use raw strings for ASCII art to prevent escape sequence issues
- Simplify image file handling in nodeconnection.py
- Convert unsafe shell subprocess calls to list-based format

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-01 11:52:26 -03:00
GaltRanch
7366e9fe9c Refactor architecture: config singleton, logging, menu system, dependencies
Major improvements across 7 areas:

- Add centralized Config singleton (config.py) replacing ~176 config
  reloads per session with a single cached load
- Add logging framework (log.py) with RotatingFileHandler, replacing
  silent except Exception: pass blocks with structured logging
- Refactor menu system (menu.py) with data-driven color selection,
  eliminating ~1,370 lines of duplicate menu functions
- Create shared/ modules extracting 7 utility functions duplicated
  between PyBlock.py and SPV/spvblock.py
- Clean dependencies: pin all versions, remove stdlib packages
  (asyncio, threading), remove unused imports
- Improve Docker: pin ubuntu:24.04, add non-root user, use venv
- Improve CI: update to actions v4/v5, add test job before publish
- Fix entry point: wrap main loop in def main(), proper module import

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-01 10:58:24 -03:00
GaltRanch
0224cfe230 Fix critical security vulnerabilities across the codebase
Replace insecure patterns that exposed the application to command injection,
arbitrary code execution, and data interception attacks.

- Replace os.popen/os.system with subprocess.run using argument lists
- Migrate pickle config serialization to JSON format
- Replace bare except: blocks with specific exception types
- Fix insecure HTTP URLs to HTTPS (opreturnbot.com, ascii.live)
- Replace shell curl commands with requests library calls
- Add migrate_config.py script for pickle-to-JSON config migration
- Convert existing SPV config files to JSON format

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-01 10:24:47 -03:00
Satoshi Nakamoto
75d0843bfb
Update labels for Bitcoin and Lightning Network 2026-03-21 04:20:00 +01:00
Satoshi Nakamoto
db8a30f584
Update menu options for Bitcoin and Lightning 2026-03-21 04:18:19 +01:00
Satoshi Nakamoto
61e88d049a
Update print statement for Bitcoin Node connection 2026-03-21 04:13:53 +01:00
Satoshi Nakamoto
0ec47b8a92
Update ppi.py 2026-03-21 04:13:11 +01:00
Satoshi Nakamoto
2118b24d22
Update print statement for Bitcoin Node connection 2026-03-21 04:10:09 +01:00
Satoshi Nakamoto
94c91af01f
Change mining pool port from 3333 to 4444 2025-12-12 20:18:43 +01:00
Satoshi Nakamoto
3c09d96531
Change mining pool port from 3333 to 4444 2025-12-12 20:17:20 +01:00
Satoshi Nakamoto
ce6caa6143
Change port number from 3333 to 4444 2025-12-12 20:15:58 +01:00
Satoshi Nakamoto
8960931af9
Remove unused import 'jq' from spvblock.py
Removed unused import statement for 'jq'.
2025-11-28 23:54:12 +01:00
Satoshi Nakamoto
e775426be3
Remove unused import for jq in PyBlock.py 2025-11-28 23:53:34 +01:00
Satoshi Nakamoto
f7da2e7e68
Create WebSocket-Bitaxe-Logs.py 2025-07-09 22:37:12 +02:00
Satoshi Nakamoto
2675d92c52
Update PyBlock.py 2025-06-22 19:03:58 +02:00
Satoshi Nakamoto
98c079e614
Update spvblock.py 2025-06-21 18:13:28 +02:00
curly60e
907a7f7b21
Update spvblock.py 2025-03-16 00:23:24 -03:00
curly60e
9c37b04deb
Update PyBlock.py 2025-03-16 00:23:02 -03:00
Satoshi Nakamoto
cb42f52719
Update spvblock.py 2025-01-09 19:59:52 +01:00
Satoshi Nakamoto
460f428c91
Update spvblock.py 2025-01-09 19:57:18 +01:00
Satoshi Nakamoto
79adc7b5f7
Update spvblock.py 2025-01-09 19:24:37 +01:00
Satoshi Nakamoto
b03a44ad1d
Update spvblock.py 2025-01-08 20:07:50 +01:00
Satoshi Nakamoto
12435172ae
Update spvblock.py 2025-01-08 04:44:37 +01:00
Satoshi Nakamoto
b68b21760d
Update spvblock.py 2025-01-08 04:10:20 +01:00
Satoshi Nakamoto
a54bcbe2c4
Update spvblock.py 2024-12-27 16:36:43 +01:00
Satoshi Nakamoto
9ddd808a3a
Update PyBlock.py 2024-12-27 16:33:54 +01:00
Satoshi Nakamoto
bc9cb18ee6
Update PyVanityGenerator.py 2024-10-29 01:51:14 +01:00
Satoshi Nakamoto
8ea8fba070
Update PyVanityGenerator.py 2024-10-29 00:00:32 +01:00
Satoshi Nakamoto
7c01518977
Update PyVanityGenerator.py 2024-10-28 23:54:05 +01:00
Satoshi Nakamoto
1cf08b49a4
Create PyVanityGenerator.py 2024-10-28 23:45:40 +01:00
Satoshi Nakamoto
40647fee6a
Delete pybitblock/SPV/PyVanityGen.py 2024-10-28 00:18:45 +01:00
Satoshi Nakamoto
9aa15d9e4a
Update spvblock.py 2024-10-28 00:17:49 +01:00
Satoshi Nakamoto
551ab4d2cb
Update PyBlock.py 2024-10-28 00:15:36 +01:00
Satoshi Nakamoto
abf11a1ae2
Update PyVanityGen.py 2024-10-25 00:19:36 +02:00
Satoshi Nakamoto
08fbe97288
Update PyVanityGen.py 2024-10-25 00:07:44 +02:00