Skip to content

Instantly share code, notes, and snippets.

@BLTSEC
Created December 7, 2017 12:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save BLTSEC/bc8518cea448c6a6a1ffbb3380230815 to your computer and use it in GitHub Desktop.
Save BLTSEC/bc8518cea448c6a6a1ffbb3380230815 to your computer and use it in GitHub Desktop.
package main
import (
"fmt"
"os/exec"
"path/filepath"
"strings"
)
func main() {
// replaces each '/' with the appropriate path separator
path := filepath.FromSlash("C:/Users/BLTSEC/Desktop/script.sql")
cmd := "cmd /C echo exit | sqlplus USERNAME/PASSWORD@TNS_NAME @" + path
parts := strings.Fields(cmd)
head := parts[0]
parts = parts[1:len(parts)]
c := exec.Command(head, parts...)
if err := c.Run(); err != nil {
fmt.Println("Error: ", err)
}
}
// Cradle to hide cmd window
// save in a vbs file
//
// Set oShell = CreateObject ("Wscript.Shell")
// Dim strArgs
// strArgs = "cmd /c .\GOBINARY.exe"
// oShell.Run strArgs, 0, false
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment