-
-
Save smallnest/426e0574e118b490adeb389282d77a1a to your computer and use it in GitHub Desktop.
Fast & Furious (And extremely dirty) way to low the priority value of a process for windows and linux
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package components | |
import "syscall" | |
func setpriority() { | |
syscall.Setpriority(syscall.PRIO_PGRP, 0, 9) | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"bytes" | |
"log" | |
"os/exec" | |
"runtime" | |
) | |
func setpriority() { | |
if runtime.GOOS == "windows" { | |
args := "process where name='setpriority' CALL setpriority 32768" //You can also use a Wildcard | |
command1 := "wmic" | |
command := exec.Command(command1, args) | |
// set var to get the output | |
var out bytes.Buffer | |
// set the output to our variable | |
command.Stdout = &out | |
err := command.Run() | |
if err != nil { | |
log.Println(err) | |
} | |
ret := out.String() | |
log.Printf("%s", ret) | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"log" | |
) | |
func main (){ | |
setpriority() | |
log.Println("Low Priority Set for Process") | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment