3. Custom Sleep function

#AVEvasion #Golang #maldev #malwaredevelopment #sleep

Some times running the sleep function straight after execution begins is detected by AV engines as malicious. Creating a custom sleep function might be a better solution.

There are endless ways of implementing a custom sleep function. A quick example is the following

	var t0, t1 time.Time
	fmt.Println("[+] Sleeping for 10 Seconds")
	t0 = time.Now()
	for {
		t1 = time.Now()
		diff := t1.Sub(t0)

		if diff.Seconds() > 10 {
			break
		}

	}

	fmt.Println("[+] Woke Up ... Execution Continues")

Similar to the previous step. The difference here is that we use an infinite loop as long as the difference of t0 and t1 is less than 10 seconds.

The break command on line 9 allows us to exit the infinite loop.

Complete Code:

Last updated

Was this helpful?