Quiet quarantine scans
All checks were successful
release / create-release (push) Successful in 7s
release / build-and-upload (pia-qbt-autoport-linux-amd64, amd64, linux, pia-qbt-autoport-linux-amd64) (push) Successful in 53s
release / build-and-upload (pia-qbt-autoport-macos-amd64, amd64, darwin, pia-qbt-autoport-macos-amd64) (push) Successful in 58s
release / build-and-upload (pia-qbt-autoport-macos-arm64, arm64, darwin, pia-qbt-autoport-macos-arm64) (push) Successful in 49s
release / build-and-upload (pia-qbt-autoport-windows-amd64.exe, amd64, windows, pia-qbt-autoport-windows-amd64.exe) (push) Successful in 48s
All checks were successful
release / create-release (push) Successful in 7s
release / build-and-upload (pia-qbt-autoport-linux-amd64, amd64, linux, pia-qbt-autoport-linux-amd64) (push) Successful in 53s
release / build-and-upload (pia-qbt-autoport-macos-amd64, amd64, darwin, pia-qbt-autoport-macos-amd64) (push) Successful in 58s
release / build-and-upload (pia-qbt-autoport-macos-arm64, arm64, darwin, pia-qbt-autoport-macos-arm64) (push) Successful in 49s
release / build-and-upload (pia-qbt-autoport-windows-amd64.exe, amd64, windows, pia-qbt-autoport-windows-amd64.exe) (push) Successful in 48s
This commit is contained in:
@@ -44,7 +44,7 @@ The app checks qBittorrent every 30 seconds in the background and reapplies the
|
||||
|
||||
`quarantine_suspicious_downloads` defaults to `true`.
|
||||
|
||||
When `quarantine_suspicious_downloads` is enabled, the app runs a scan at startup and then every minute across every file in each torrent, including nested paths, using a safe allowlist of text, audio, video, and image formats. If it finds a suspicious file, it logs the torrent hash and file name, then deletes the torrent and its downloaded data after the full file list has been enumerated.
|
||||
When `quarantine_suspicious_downloads` is enabled, the app runs a scan at startup and then every minute across every file in each torrent, including nested paths, using a safe allowlist of text, audio, video, and image formats. It stays quiet unless it deletes a torrent for a suspicious file.
|
||||
|
||||
The process now shuts down cleanly on SIGINT and SIGTERM.
|
||||
|
||||
|
||||
@@ -69,7 +69,6 @@ func (a *App) StartQuarantineChecks(ctx context.Context) {
|
||||
a.bgWG.Add(1)
|
||||
go func() {
|
||||
defer a.bgWG.Done()
|
||||
log.Printf("qBittorrent quarantine scan enabled; running now and every %s", quarantineInterval)
|
||||
a.runQuarantineOnce()
|
||||
|
||||
ticker := time.NewTicker(quarantineInterval)
|
||||
@@ -104,19 +103,15 @@ func (a *App) syncOnce() {
|
||||
}
|
||||
|
||||
func (a *App) runQuarantineOnce() {
|
||||
log.Printf("qBittorrent quarantine scan started")
|
||||
deleted, err := a.quarantineQBittorrentDownloads()
|
||||
if err != nil {
|
||||
log.Printf("qBittorrent quarantine scan failed: %v", err)
|
||||
return
|
||||
}
|
||||
|
||||
if deleted == 0 {
|
||||
log.Printf("qBittorrent quarantine scan finished: no suspicious torrents found")
|
||||
return
|
||||
if deleted > 0 {
|
||||
log.Printf("qBittorrent quarantine deleted %d malicious torrent(s)", deleted)
|
||||
}
|
||||
|
||||
log.Printf("qBittorrent quarantine scan finished: deleted %d malicious torrent(s)", deleted)
|
||||
}
|
||||
|
||||
func (a *App) syncQBittorrent(info *PIAInfo) error {
|
||||
|
||||
@@ -122,13 +122,10 @@ func (c *qBittorrentClient) quarantineSuspiciousDownloads() (int, error) {
|
||||
continue
|
||||
}
|
||||
|
||||
log.Printf("qBittorrent quarantine: scanning torrent=%s name=%q files=%d", torrent.Hash, torrent.Name, len(files))
|
||||
|
||||
var suspicious []qBittorrentFile
|
||||
for _, file := range files {
|
||||
if isSuspiciousDownload(file.Name) {
|
||||
suspicious = append(suspicious, file)
|
||||
log.Printf("qBittorrent quarantine: suspicious file torrent=%s file=%q", torrent.Hash, file.Name)
|
||||
}
|
||||
}
|
||||
if len(suspicious) == 0 {
|
||||
|
||||
Reference in New Issue
Block a user