mirror of
https://github.com/moonD4rk/HackBrowserData.git
synced 2026-05-23 19:14:01 +02:00
fix(windows): silent default dump on double-click (#591)
This commit is contained in:
@@ -49,6 +49,7 @@ GitHub: https://github.com/moonD4rk/HackBrowserData`,
|
|||||||
}
|
}
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
configureDoubleClickMode()
|
||||||
if err := rootCmd().Execute(); err != nil {
|
if err := rootCmd().Execute(); err != nil {
|
||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,5 @@
|
|||||||
|
//go:build !windows
|
||||||
|
|
||||||
|
package main
|
||||||
|
|
||||||
|
func configureDoubleClickMode() {}
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
//go:build windows
|
||||||
|
|
||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/inconshreveable/mousetrap"
|
||||||
|
"github.com/spf13/cobra"
|
||||||
|
|
||||||
|
"github.com/moond4rk/hackbrowserdata/utils/winapi"
|
||||||
|
)
|
||||||
|
|
||||||
|
// configureDoubleClickMode hides the console and bypasses cobra's
|
||||||
|
// double-click guard when launched from Explorer (issue #344).
|
||||||
|
func configureDoubleClickMode() {
|
||||||
|
if !mousetrap.StartedByExplorer() {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
cobra.MousetrapHelpText = ""
|
||||||
|
winapi.HideConsoleWindow()
|
||||||
|
}
|
||||||
@@ -4,6 +4,7 @@ go 1.20
|
|||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/godbus/dbus/v5 v5.2.2
|
github.com/godbus/dbus/v5 v5.2.2
|
||||||
|
github.com/inconshreveable/mousetrap v1.1.0
|
||||||
github.com/moond4rk/binarycookies v1.0.2
|
github.com/moond4rk/binarycookies v1.0.2
|
||||||
github.com/moond4rk/keychainbreaker v0.2.5
|
github.com/moond4rk/keychainbreaker v0.2.5
|
||||||
github.com/moond4rk/plist v1.2.0
|
github.com/moond4rk/plist v1.2.0
|
||||||
@@ -25,7 +26,6 @@ require (
|
|||||||
github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db // indirect
|
github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db // indirect
|
||||||
github.com/google/uuid v1.6.0 // indirect
|
github.com/google/uuid v1.6.0 // indirect
|
||||||
github.com/hashicorp/golang-lru/v2 v2.0.7 // indirect
|
github.com/hashicorp/golang-lru/v2 v2.0.7 // indirect
|
||||||
github.com/inconshreveable/mousetrap v1.1.0 // indirect
|
|
||||||
github.com/mattn/go-isatty v0.0.20 // indirect
|
github.com/mattn/go-isatty v0.0.20 // indirect
|
||||||
github.com/ncruces/go-strftime v0.1.9 // indirect
|
github.com/ncruces/go-strftime v0.1.9 // indirect
|
||||||
github.com/otiai10/mint v1.6.3 // indirect
|
github.com/otiai10/mint v1.6.3 // indirect
|
||||||
|
|||||||
@@ -0,0 +1,21 @@
|
|||||||
|
//go:build windows
|
||||||
|
|
||||||
|
package winapi
|
||||||
|
|
||||||
|
var (
|
||||||
|
procGetConsoleWindow = Kernel32.NewProc("GetConsoleWindow")
|
||||||
|
procShowWindow = User32.NewProc("ShowWindow")
|
||||||
|
)
|
||||||
|
|
||||||
|
const swHide = 0
|
||||||
|
|
||||||
|
// HideConsoleWindow hides the console window attached to the current
|
||||||
|
// process. Returns true if the window was previously visible.
|
||||||
|
func HideConsoleWindow() bool {
|
||||||
|
hwnd, _, _ := procGetConsoleWindow.Call()
|
||||||
|
if hwnd == 0 {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
prev, _, _ := procShowWindow.Call(hwnd, swHide)
|
||||||
|
return prev != 0
|
||||||
|
}
|
||||||
@@ -24,6 +24,7 @@ var (
|
|||||||
Kernel32 = windows.NewLazySystemDLL("kernel32.dll")
|
Kernel32 = windows.NewLazySystemDLL("kernel32.dll")
|
||||||
Ntdll = windows.NewLazySystemDLL("ntdll.dll")
|
Ntdll = windows.NewLazySystemDLL("ntdll.dll")
|
||||||
Crypt32 = windows.NewLazySystemDLL("crypt32.dll")
|
Crypt32 = windows.NewLazySystemDLL("crypt32.dll")
|
||||||
|
User32 = windows.NewLazySystemDLL("user32.dll")
|
||||||
)
|
)
|
||||||
|
|
||||||
// CallBoolErr wraps the common "r1 == 0 means failure" Win32 convention.
|
// CallBoolErr wraps the common "r1 == 0 means failure" Win32 convention.
|
||||||
|
|||||||
Reference in New Issue
Block a user