Move log silencer from release build to system.go
This commit is contained in:
parent
712a51c1de
commit
de4d0a22ea
|
|
@ -78,3 +78,4 @@ Following detections have been tested:
|
|||
* <https://github.com/burrowers/garble?tab=readme-ov-file#mechanism>>
|
||||
* <https://medium.com/@ankyrockstar26/unpacking-a-upx-malware-dca2cdd1a8de>
|
||||
* <https://www.mosse-security.com/2020/09/29/upx-malware-evasion-technique.html?ref=nishtahir.com>
|
||||
* <https://learn.microsoft.com/en-us/windows-server/administration/windows-commands/schtasks-create>
|
||||
|
|
|
|||
|
|
@ -13,17 +13,5 @@ import (
|
|||
var resourceSSHPrivateKey string
|
||||
|
||||
func init() {
|
||||
// Open /dev/null for writing
|
||||
nullFile, err := os.OpenFile(os.DevNull, os.O_WRONLY, 0666)
|
||||
if err != nil {
|
||||
fmt.Println("Error opening /dev/null:", err)
|
||||
return
|
||||
}
|
||||
|
||||
// Redirect stdout and stderr to /dev/null
|
||||
os.Stdout = nullFile
|
||||
os.Stderr = nullFile
|
||||
|
||||
// Redirect log facility to /dev/null
|
||||
log.SetOutput(nullFile)
|
||||
systemSilenceAllLogging()
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,24 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"os"
|
||||
"fmt"
|
||||
"log"
|
||||
)
|
||||
|
||||
// Silence all logging
|
||||
func systemSilenceAllLogging() {
|
||||
// Open /dev/null for writing
|
||||
nullFile, err := os.OpenFile(os.DevNull, os.O_WRONLY, 0666)
|
||||
if err != nil {
|
||||
fmt.Println("Error opening /dev/null:", err)
|
||||
return
|
||||
}
|
||||
|
||||
// Redirect stdout and stderr to /dev/null
|
||||
os.Stdout = nullFile
|
||||
os.Stderr = nullFile
|
||||
|
||||
// Redirect log facility to /dev/null
|
||||
log.SetOutput(nullFile)
|
||||
}
|
||||
Loading…
Reference in New Issue