pyblock/pybitblock/feed.py
GaltRanch 893aabc85d Security audit round 2: eliminate shell=True, mask secrets, fix race conditions
- Replace all shell=True subprocess calls with Python-native processing
  (nodeconnection.py, SPV/nodeconnection.py, SPV/ppi.py)
- Mask sensitive inputs (private keys, passwords, tokens) with getpass
- Add threading.Lock to block_explorer.py shared state
- Use json.loads() instead of fragile string splitting in apisnd.py
- Add path validation before file open in apisnd.py
- Replace random.randint with secrets.randbelow for mining nonces
- Fix destructive exception handlers in clone.py and feed.py
- Replace bare except clauses with specific exceptions + logging
- Remove unused imports (psutil, xmltodict, block_visualizer, base64, say)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-03 11:15:59 -03:00

31 lines
878 B
Python

#Developer: Curly60e
#PyBLOCK its a clock of the Bitcoin blockchain.
import os
import os.path
import subprocess
import time as t
def readFile():
import glob
import logging
logger = logging.getLogger(__name__)
try:
print("\n\033[1;34;40mWaiting for new data...\n")
downloadsFolder = 'downloads/'
while True:
files = glob.glob(os.path.join(downloadsFolder, '*'))
if not files:
continue
else:
print("\t\t\n\033[1;33;40mNew message from Space just arrived...\033[0;37;40m\n")
for f in files:
with open(f, 'r', errors='replace') as fh:
print(fh.read())
os.remove(f)
except KeyboardInterrupt:
pass
except (OSError, IOError) as e:
logger.debug("readFile error: %s", e)