fix bug loader fw SSH, update doc, update scan ip ( scan nhanh hơn )
This commit is contained in:
33
main.py
33
main.py
@@ -55,7 +55,7 @@ class App(QWidget):
|
||||
self.firmware = None
|
||||
self.all_devices = [] # raw list from scanner
|
||||
self.devices = [] # filtered list for table
|
||||
self.flashed_macs = set() # MAC addresses flashed successfully in session
|
||||
self.flashed_macs = {} # MAC addresses flashed successfully in session (MAC -> timestamp)
|
||||
self.scan_thread = None
|
||||
|
||||
info = get_machine_info()
|
||||
@@ -300,19 +300,6 @@ class App(QWidget):
|
||||
ssh_row1.addStretch()
|
||||
ssh_creds_layout.addLayout(ssh_row1)
|
||||
|
||||
ssh_row2 = QHBoxLayout()
|
||||
ssh_lbl3 = QLabel("Backup Pass:")
|
||||
ssh_lbl3.setStyleSheet("font-size: 12px; font-weight: bold;")
|
||||
ssh_row2.addWidget(ssh_lbl3)
|
||||
self.ssh_backup_pass_input = QLineEdit("admin")
|
||||
self.ssh_backup_pass_input.setEchoMode(QLineEdit.EchoMode.Password)
|
||||
self.ssh_backup_pass_input.setFixedWidth(130)
|
||||
self.ssh_backup_pass_input.setStyleSheet(str_qlineedit)
|
||||
self.ssh_backup_pass_input.setToolTip("Password to try if device already has a password (fallback)")
|
||||
ssh_row2.addWidget(self.ssh_backup_pass_input)
|
||||
ssh_row2.addStretch()
|
||||
ssh_creds_layout.addLayout(ssh_row2)
|
||||
|
||||
self.set_passwd_cb = QCheckBox("Set password before flash (passwd → admin123a)")
|
||||
self.set_passwd_cb.setChecked(True)
|
||||
self.set_passwd_cb.setStyleSheet("color: #94a3b8; font-size: 12px; font-weight: bold;")
|
||||
@@ -461,8 +448,14 @@ class App(QWidget):
|
||||
if not self.flashed_macs:
|
||||
QMessageBox.information(self, "Flash History", "No successful flashes during this session.")
|
||||
else:
|
||||
macs = "\n".join(sorted(list(self.flashed_macs)))
|
||||
msg = f"Successfully flashed devices in this session ({len(self.flashed_macs)}):\n\n{macs}"
|
||||
# Sort by MAC and format with timestamp
|
||||
history_lines = []
|
||||
for mac in sorted(self.flashed_macs.keys()):
|
||||
time_str = self.flashed_macs[mac]
|
||||
history_lines.append(f"[{time_str}] {mac}")
|
||||
|
||||
macs_str = "\n".join(history_lines)
|
||||
msg = f"Successfully flashed devices in this session ({len(self.flashed_macs)}):\n\n{macs_str}"
|
||||
QMessageBox.information(self, "Flash History", msg)
|
||||
|
||||
# ── Actions ──
|
||||
@@ -648,7 +641,7 @@ class App(QWidget):
|
||||
method = self.method_combo.currentData()
|
||||
ssh_user = self.ssh_user_input.text().strip() or "root"
|
||||
ssh_password = self.ssh_pass_input.text() or "admin123a"
|
||||
ssh_backup_password = self.ssh_backup_pass_input.text()
|
||||
ssh_backup_password = "admin123a"
|
||||
set_passwd = self.set_passwd_cb.isChecked() if method == "ssh" else False
|
||||
|
||||
# Run flashing in background thread so UI doesn't freeze
|
||||
@@ -678,10 +671,12 @@ class App(QWidget):
|
||||
item = QTableWidgetItem(f"✅ {result}")
|
||||
item.setForeground(QColor("#a6e3a1"))
|
||||
|
||||
# Save MAC to history
|
||||
# Save MAC to history with current timestamp
|
||||
mac_item = self.table.item(row, 2)
|
||||
if mac_item:
|
||||
self.flashed_macs.add(mac_item.text().strip())
|
||||
import datetime
|
||||
now_str = datetime.datetime.now().strftime("%H:%M:%S")
|
||||
self.flashed_macs[mac_item.text().strip()] = now_str
|
||||
|
||||
# Auto-uncheck so it won't be flashed again
|
||||
cb = self.table.item(row, 0)
|
||||
|
||||
Reference in New Issue
Block a user