From 4b90f7f88f6c367737410694101199c6832300b7 Mon Sep 17 00:00:00 2001 From: Josh Mudge Date: Sat, 9 Nov 2019 17:14:39 -0700 Subject: [PATCH] Location Agnostic Code --- All/Sign Using OV Cert.md | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/All/Sign Using OV Cert.md b/All/Sign Using OV Cert.md index a5e95b2..40aae04 100644 --- a/All/Sign Using OV Cert.md +++ b/All/Sign Using OV Cert.md @@ -49,18 +49,23 @@ This will allow us to set the name of the program, version, etc. and most import go-powershell ``` -# working directory is dir -dir, err := os.Getwd() +import( + "os" + "fmt" + "log" +) +func main() { + dir, err := os.Getwd() if err != nil { log.Fatal(err) } ``` -Might have to create another variable set to the string and add the path. +``` +var dirs string = "New-NetFirewallRule -DisplayName 'Name of Rule' -Direction Inbound -Program '" + dir + "\\server.exe'" +``` + + -``` -# This command will create the firewall rule. -New-NetFirewallRule -DisplayName "Name of Rule" -Direction Inbound -Program "C:\path\to\app\file.exe" -Action Allow -``` You should see something like this: