working release
This commit is contained in:
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
|||||||
|
up-six.sh
|
||||||
1
down-six.sh
Normal file
1
down-six.sh
Normal file
@@ -0,0 +1 @@
|
|||||||
|
ip link del he-ipv6
|
||||||
65
main.go
Normal file
65
main.go
Normal file
@@ -0,0 +1,65 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"log"
|
||||||
|
"os/exec"
|
||||||
|
"io/ioutil"
|
||||||
|
"strings"
|
||||||
|
"math/rand"
|
||||||
|
"time"
|
||||||
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
upFile = "up-six.sh"
|
||||||
|
downFile = "down-six.sh"
|
||||||
|
repeatTimer = 120
|
||||||
|
)
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
for true {
|
||||||
|
fileToExec(downFile)
|
||||||
|
fileToExec(upFile)
|
||||||
|
time.Sleep(repeatTimer * time.Second)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func fileToExec(filename string) {
|
||||||
|
doCmds := fileToCmd(filename)
|
||||||
|
for _, currCmd := range doCmds {
|
||||||
|
actualCmd := ""
|
||||||
|
if strings.Count(currCmd, "%x") == 1 {
|
||||||
|
actualCmd = fmt.Sprintf(currCmd, rand.Int() % 65536)
|
||||||
|
} else if strings.Count(currCmd, "%x") == 2 {
|
||||||
|
actualCmd = fmt.Sprintf(currCmd, rand.Int() % 65536, rand.Int() % 65536)
|
||||||
|
} else if strings.Count(currCmd, "%x") == 3 {
|
||||||
|
actualCmd = fmt.Sprintf(currCmd, rand.Int() % 65536, rand.Int() % 65536, rand.Int() % 65536)
|
||||||
|
} else if strings.Count(currCmd, "%x") == 4 {
|
||||||
|
actualCmd = fmt.Sprintf(currCmd, rand.Int() % 65536, rand.Int() % 65536, rand.Int() % 65536, rand.Int() % 65536)
|
||||||
|
} else if strings.Count(currCmd, "%x") == 5 {
|
||||||
|
actualCmd = fmt.Sprintf(currCmd, rand.Int() % 65536, rand.Int() % 65536, rand.Int() % 65536, rand.Int() % 65536, rand.Int() % 65536)
|
||||||
|
} else {
|
||||||
|
actualCmd = currCmd
|
||||||
|
}
|
||||||
|
executeCmd(actualCmd)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func fileToCmd(filename string) []string {
|
||||||
|
fileBody, err := ioutil.ReadFile(filename)
|
||||||
|
if err != nil {
|
||||||
|
log.Printf("Error while reading file %s\n", filename)
|
||||||
|
return []string{}
|
||||||
|
}
|
||||||
|
cmdArr := strings.Split(string(fileBody), "\n")
|
||||||
|
return cmdArr
|
||||||
|
}
|
||||||
|
|
||||||
|
func executeCmd(cmdStr string) {
|
||||||
|
cmd := exec.Command("bash", "-c", cmdStr)
|
||||||
|
log.Println(cmdStr)
|
||||||
|
err := cmd.Run()
|
||||||
|
if err != nil {
|
||||||
|
log.Println(err)
|
||||||
|
}
|
||||||
|
}
|
||||||
BIN
sixes-to-fours
Executable file
BIN
sixes-to-fours
Executable file
Binary file not shown.
8
up-six.sh.example
Normal file
8
up-six.sh.example
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
# use configuration from hurricane electric to modify
|
||||||
|
# up to 5 hex placeholder in ipv6 allowed
|
||||||
|
|
||||||
|
ip tunnel add he-ipv6 mode sit remote 1.2.3.4 local 1.2.3.5 ttl 255
|
||||||
|
ip link set he-ipv6 up
|
||||||
|
ip addr add aaaa:aaa:aa:aaa::%x:%x/64 dev he-ipv6
|
||||||
|
ip route add ::/0 dev he-ipv6
|
||||||
|
ip -f inet6 addr
|
||||||
Reference in New Issue
Block a user