├── conf.ini ├── .gitignore ├── html ├── css │ ├── vcode.png │ └── login.css ├── index.html ├── panel.html └── login.html ├── tuuz ├── Redis │ ├── config.go │ ├── redigo.go │ └── Redis.go ├── Calc │ ├── Token.go │ ├── Convert.go │ ├── Str.go │ └── Calc.go ├── Jsong │ ├── SimpleJson.go │ ├── Parse.go │ └── Jsong.go ├── Net │ ├── netConfig.go │ ├── HttpClient.go │ └── Net.go ├── Sort │ └── Sort.go ├── common.go ├── Log │ └── Log.go ├── Preg │ └── Preg.go ├── RSA │ └── RSA.go ├── RET │ └── RET.go └── Array │ └── Array.go ├── go.mod ├── Action └── ActionRoute │ ├── PCRoute.go │ ├── SuperCurl.go │ └── ActionRoute.go ├── Conf └── Conf.go ├── Common └── update │ └── update.go ├── go.sum ├── Tcp ├── Tcp.go └── Function.go ├── Readme.md ├── main.go └── LICENSE /conf.ini: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /config.ini 2 | /.idea/ 3 | /BiliHP-Local.iml 4 | /conf.ini -------------------------------------------------------------------------------- /html/css/vcode.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tobycroft/BiliHP-Local/HEAD/html/css/vcode.png -------------------------------------------------------------------------------- /tuuz/Redis/config.go: -------------------------------------------------------------------------------- 1 | package Redis 2 | 3 | const address = "127.0.0.1" 4 | const port = "6379" 5 | const proto = "tcp" 6 | const username = "" 7 | const password = "" 8 | -------------------------------------------------------------------------------- /html/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Title 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /tuuz/Calc/Token.go: -------------------------------------------------------------------------------- 1 | package Calc 2 | 3 | import ( 4 | "strconv" 5 | "time" 6 | ) 7 | 8 | func GenerateToken() string { 9 | unix := time.Now().UnixNano() 10 | rand := Rand(0, 99999999) 11 | str := strconv.FormatInt(unix, 10) + strconv.FormatInt(int64(rand), 10) 12 | return Md5(str) 13 | } 14 | -------------------------------------------------------------------------------- /tuuz/Calc/Convert.go: -------------------------------------------------------------------------------- 1 | package Calc 2 | 3 | import "strconv" 4 | 5 | func Int2String(num int) string { 6 | return strconv.Itoa(num) 7 | } 8 | 9 | func Int642String(num int64) string { 10 | return strconv.FormatInt(num, 10) 11 | } 12 | 13 | func Float642String(f64 float64) string { 14 | return strconv.FormatFloat(f64, 'f', -1, 64) 15 | } 16 | -------------------------------------------------------------------------------- /tuuz/Jsong/SimpleJson.go: -------------------------------------------------------------------------------- 1 | package Jsong 2 | 3 | import ( 4 | "fmt" 5 | "github.com/bitly/go-simplejson" 6 | ) 7 | 8 | func Simple(json string) (*simplejson.Json, error) { 9 | res, err := simplejson.NewJson([]byte(json)) 10 | if err != nil { 11 | fmt.Printf("%v\n", err) 12 | return nil, err 13 | } 14 | return res, err 15 | } 16 | 17 | func SimpleDecode(json string) *simplejson.Json { 18 | ret, _ := Simple(json) 19 | return ret 20 | } 21 | -------------------------------------------------------------------------------- /tuuz/Net/netConfig.go: -------------------------------------------------------------------------------- 1 | package Net 2 | 3 | import "strings" 4 | 5 | const cookie_tag = "sid,JSESSIONID,DedeUserID,DedeUserID__ckMd5,SESSDATA,bili_jct,sid" 6 | 7 | func CookieTagChecker(cookie_key string) bool { 8 | if cookie_tag == "" { 9 | return true 10 | } else { 11 | arr := strings.Split(cookie_tag, ",") 12 | for _, v := range arr { 13 | if v == cookie_key { 14 | return true 15 | } 16 | } 17 | return false 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /tuuz/Sort/Sort.go: -------------------------------------------------------------------------------- 1 | package Sort 2 | 3 | import ( 4 | "sort" 5 | ) 6 | 7 | func Ksort(arr map[string]interface{}) map[string]interface{} { 8 | 9 | // To store the keys in slice in sorted order 10 | var strs []string 11 | for k := range arr { 12 | strs = append(strs, k) 13 | } 14 | sort.Strings(strs) 15 | // To perform the opertion you want 16 | //for _, k := range strs { 17 | // fmt.Printf("%s\t%d\n", k, arr[k]) 18 | //} 19 | return arr 20 | } 21 | -------------------------------------------------------------------------------- /go.mod: -------------------------------------------------------------------------------- 1 | module main.go 2 | 3 | go 1.13 4 | 5 | require ( 6 | github.com/Unknwon/goconfig v0.0.0-20191126170842-860a72fb44fd 7 | github.com/bitly/go-simplejson v0.5.0 8 | github.com/garyburd/redigo v1.6.0 9 | github.com/inconshreveable/go-update v0.0.0-20160112193335-8152e7eb6ccf 10 | github.com/json-iterator/go v1.1.9 11 | github.com/kirinlabs/HttpRequest v1.0.5 12 | github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect 13 | github.com/modern-go/reflect2 v1.0.1 // indirect 14 | ) 15 | -------------------------------------------------------------------------------- /tuuz/common.go: -------------------------------------------------------------------------------- 1 | package tuuz 2 | 3 | import ( 4 | "github.com/gohouse/gorose/v2" 5 | "main.go/tuuz/Preg" 6 | "main.go/tuuz/database" 7 | "runtime" 8 | ) 9 | 10 | func Db() gorose.IOrm { 11 | return database.Database.NewOrm() 12 | } 13 | 14 | func FUNCTION() string { 15 | pc, _, _, _ := runtime.Caller(1) 16 | name := runtime.FuncForPC(pc).Name() 17 | Preg.MatchOwn("[A-z]+$", &name) 18 | return name 19 | } 20 | 21 | func FUNCTION_ALL() string { 22 | pc, _, _, _ := runtime.Caller(1) 23 | name := runtime.FuncForPC(pc).Name() 24 | return name 25 | } 26 | -------------------------------------------------------------------------------- /tuuz/Redis/redigo.go: -------------------------------------------------------------------------------- 1 | package Redis 2 | 3 | import ( 4 | "fmt" 5 | redigo "github.com/garyburd/redigo/redis" 6 | "log" 7 | ) 8 | 9 | var pool *redigo.Pool 10 | 11 | func init() { 12 | redis_host := address 13 | redis_port := port 14 | pool_size := 10 15 | pool = redigo.NewPool(func() (redigo.Conn, error) { 16 | c, err := redigo.Dial("tcp", fmt.Sprintf("%s:%s", redis_host, redis_port)) 17 | if err != nil { 18 | log.Panic(err) 19 | return nil, err 20 | } 21 | return c, nil 22 | }, pool_size) 23 | } 24 | 25 | func Conn() redigo.Conn { 26 | return pool.Get() 27 | } 28 | -------------------------------------------------------------------------------- /tuuz/Jsong/Parse.go: -------------------------------------------------------------------------------- 1 | package Jsong 2 | 3 | import jsoniter "github.com/json-iterator/go" 4 | 5 | func ParseObject(data interface{}) (map[string]interface{}, error) { 6 | ret, err := Encode(data) 7 | if err != nil { 8 | return nil, err 9 | } 10 | return JObject(ret) 11 | } 12 | func ParseObject2(data interface{}) (map[string]string, error) { 13 | ret, err := Encode(data) 14 | if err != nil { 15 | return nil, err 16 | } 17 | var arr map[string]string 18 | var json = jsoniter.ConfigCompatibleWithStandardLibrary 19 | err2 := json.Unmarshal([]byte(ret), &arr) 20 | if err2 != nil { 21 | return nil, err 22 | } 23 | return arr, err 24 | } 25 | func ParseSlice(data interface{}) ([]interface{}, error) { 26 | ret, err := Encode(data) 27 | if err != nil { 28 | return nil, err 29 | } 30 | return JArray(ret) 31 | } 32 | -------------------------------------------------------------------------------- /Action/ActionRoute/PCRoute.go: -------------------------------------------------------------------------------- 1 | package ActionRoute 2 | 3 | import ( 4 | "fmt" 5 | "main.go/Conf" 6 | "main.go/tuuz/Calc" 7 | "main.go/tuuz/Jsong" 8 | "net" 9 | ) 10 | 11 | func PCRoute(jobject map[string]interface{}, username string, conn *net.TCPConn) { 12 | route := jobject["route"] 13 | data := jobject["data"] 14 | echo := jobject["echo"] 15 | switch route { 16 | 17 | case "update_config": 18 | //fmt.Println(route, data, echo) 19 | jsp, err := Jsong.ParseObject(data) 20 | if err != nil { 21 | fmt.Println("设置更新失败:", err) 22 | } else { 23 | for k, v := range jsp { 24 | //fmt.Println(reflect.TypeOf(v), v) 25 | if v == false || Calc.Any2String(v) == "0" { 26 | Conf.SaveConf("setting", Calc.Any2String(k), "0") 27 | } else if v == true || Calc.Any2String(v) == "1" { 28 | Conf.SaveConf("setting", Calc.Any2String(k), "1") 29 | } else { 30 | Conf.SaveConf("setting", Calc.Any2String(k), Calc.Any2String(v)) 31 | } 32 | } 33 | fmt.Println("设置实时更新完毕") 34 | } 35 | break 36 | 37 | default: 38 | fmt.Println(route, data, echo) 39 | break 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /Conf/Conf.go: -------------------------------------------------------------------------------- 1 | package Conf 2 | 3 | import ( 4 | "github.com/Unknwon/goconfig" 5 | "runtime" 6 | ) 7 | 8 | const Version = "1.5.2" 9 | 10 | const Addr = "go.bilihp.com:181" 11 | 12 | //const Addr = "127.0.0.1:80" 13 | 14 | func SystemType() string { 15 | sysType := runtime.GOOS 16 | return sysType 17 | } 18 | 19 | func LoadConf(section string, key string) string { 20 | cfg, err := goconfig.LoadConfigFile("conf.ini") 21 | if err != nil { 22 | SaveConf(section, key, " ") 23 | return "" 24 | } 25 | value, err := cfg.GetValue(section, key) 26 | if err != nil { 27 | return "" 28 | } else { 29 | return value 30 | } 31 | } 32 | 33 | func LoadSec(section string) map[string]string { 34 | cfg, err := goconfig.LoadConfigFile("conf.ini") 35 | value, err := cfg.GetSection(section) 36 | if err != nil { 37 | return nil 38 | } else { 39 | return value 40 | } 41 | } 42 | 43 | func SaveConf(section string, key string, value string) bool { 44 | cfg, err := goconfig.LoadConfigFile("conf.ini") 45 | if err != nil { 46 | return false 47 | } 48 | cfg.SetValue(section, key, value) 49 | err = goconfig.SaveConfigFile(cfg, "conf.ini") 50 | if err != nil { 51 | return false 52 | } else { 53 | return true 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /tuuz/Log/Log.go: -------------------------------------------------------------------------------- 1 | package Log 2 | 3 | import ( 4 | "fmt" 5 | "log" 6 | "os" 7 | ) 8 | 9 | var logger *log.Logger 10 | var file *os.File 11 | 12 | func Write(file_name string, logs string, discript string, other interface{}) { 13 | _, err := os.Stat("log") 14 | if err != nil { 15 | os.Mkdir("./log", os.ModePerm) 16 | } 17 | file, err := os.OpenFile("log/"+file_name+".log", os.O_APPEND|os.O_WRONLY|os.O_CREATE, 777) 18 | if err != nil { 19 | log.Fatalln(err) 20 | } else { 21 | logger := log.New(file, "", log.LstdFlags) 22 | logger.Println(logs, discript, other) 23 | file.Close() 24 | } 25 | } 26 | 27 | func Error(file_name string, err error) { 28 | Write(file_name, "", "", err) 29 | } 30 | 31 | func Err(err error) { 32 | Write("Error", "", "", err) 33 | } 34 | 35 | func Errs(err error, log string) { 36 | Write("Error", log, "", err) 37 | } 38 | 39 | //Database err 40 | func Drr(err error) { 41 | Write("Database", "", "", err) 42 | } 43 | 44 | func Crr(logs interface{}) { 45 | Write("Common", "", "", logs) 46 | } 47 | 48 | func Crrs(logs interface{}, discript string) { 49 | Write("Common", "", discript, logs) 50 | } 51 | 52 | func Dbrr(err error, log string) { 53 | fmt.Println(err) 54 | Write("Dberror", log, "", err) 55 | } 56 | -------------------------------------------------------------------------------- /Common/update/update.go: -------------------------------------------------------------------------------- 1 | package update 2 | 3 | import ( 4 | "fmt" 5 | "github.com/inconshreveable/go-update" 6 | "net/http" 7 | "runtime" 8 | ) 9 | 10 | func DoUpdate() error { 11 | fmt.Println("----自动升级开始----") 12 | resp, err := http.Get("http://pandorabox.tuuz.cc:8000/app/" + version()) 13 | if err != nil { 14 | return err 15 | } 16 | defer resp.Body.Close() 17 | err = update.Apply(resp.Body, update.Options{}) 18 | if err != nil { 19 | fmt.Println("自动更新错误:", err) 20 | // error handling 21 | } 22 | fmt.Println("----自动升级结束,请重启应用----") 23 | return err 24 | } 25 | 26 | func version() string { 27 | switch runtime.GOOS { 28 | case "windows": 29 | switch runtime.GOARCH { 30 | case "amd64": 31 | return "BiliHP_PCWEB.exe" 32 | 33 | default: 34 | return "BiliHP_PCWEB_386.exe" 35 | } 36 | 37 | case "linux": 38 | switch runtime.GOARCH { 39 | case "amd64": 40 | return "c2c_linux" 41 | 42 | case "386": 43 | return "c2c_linux" 44 | 45 | case "mipsle": 46 | return "BiliHP_Router_linux" 47 | 48 | case "arm", "arm64": 49 | return "BiliHP_ARM_linux" 50 | 51 | case "mips": 52 | return "c2c_linux" 53 | 54 | default: 55 | return "c2c_linux" 56 | } 57 | 58 | case "darwin": 59 | return "BiliHP_Mac_darwin" 60 | 61 | default: 62 | fmt.Println("没有找到对应的版本") 63 | return "c2c_linux" 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /tuuz/Calc/Str.go: -------------------------------------------------------------------------------- 1 | package Calc 2 | 3 | import ( 4 | "fmt" 5 | "math/big" 6 | "reflect" 7 | "strconv" 8 | "strings" 9 | ) 10 | 11 | func Chop(s string, character_mask string) string { 12 | return strings.TrimRight(s, character_mask) 13 | } 14 | 15 | func Any2String(any interface{}) string { 16 | var str string 17 | switch any.(type) { 18 | case string: 19 | str = any.(string) 20 | 21 | case int: 22 | tmp := any.(int) 23 | str = Int2String(tmp) 24 | 25 | case int32: 26 | tmp := int64(any.(int32)) 27 | str = Int642String(tmp) 28 | 29 | case int64: 30 | tmp := any.(int64) 31 | str = Int642String(tmp) 32 | 33 | case float64: 34 | tmp := any.(float64) 35 | str = Float642String(tmp) 36 | 37 | case float32: 38 | tmp := float64(any.(float32)) 39 | str = Float642String(tmp) 40 | 41 | case *big.Int: 42 | tmp := any.(*big.Int) 43 | str = tmp.String() 44 | 45 | case nil: 46 | str = "" 47 | 48 | case bool: 49 | tmp := any.(bool) 50 | if tmp == true { 51 | return "true" 52 | } else { 53 | return "false" 54 | } 55 | 56 | default: 57 | fmt.Println("any2string", any, reflect.TypeOf(any)) 58 | str = "" 59 | } 60 | return str 61 | } 62 | 63 | func String2Int(str string) (int, error) { 64 | return strconv.Atoi(str) 65 | } 66 | 67 | func String2Int64(str string) (int64, error) { 68 | return strconv.ParseInt(str, 10, 64) 69 | } 70 | 71 | func String2Float64(str string) (float64, error) { 72 | float, err := strconv.ParseFloat(str, 64) 73 | return float, err 74 | } 75 | -------------------------------------------------------------------------------- /tuuz/Preg/Preg.go: -------------------------------------------------------------------------------- 1 | package Preg 2 | 3 | import ( 4 | "fmt" 5 | "regexp" 6 | ) 7 | 8 | func Exp(exp string) (*regexp.Regexp, error) { 9 | reg, err := regexp.Compile(exp) 10 | return reg, err 11 | } 12 | 13 | func Match(exp string, str string) (string, error) { 14 | reg, err := Exp(exp) 15 | if err != nil { 16 | fmt.Print(err) 17 | return "", err 18 | } 19 | return reg.FindString(str), err 20 | } 21 | 22 | func MatchOwn(exp string, str *string) (string, error) { 23 | reg, err := Exp(exp) 24 | if err != nil { 25 | fmt.Print(err) 26 | return "", err 27 | } 28 | *str = reg.FindString(*str) 29 | return "", err 30 | } 31 | 32 | func MatchAll(exp string, str string) ([]string, error) { 33 | reg, err := Exp(exp) 34 | if err != nil { 35 | fmt.Print(err) 36 | return []string{""}, err 37 | } 38 | return reg.FindAllString(str, -1), err 39 | } 40 | 41 | func IsMatched(exp string, str string) bool { 42 | reg, err := Exp(exp) 43 | if err != nil { 44 | return false 45 | } 46 | if reg.MatchString(str) { 47 | return true 48 | } else { 49 | return false 50 | } 51 | } 52 | 53 | func FilterOwn(exp string, str *string) (bool, error) { 54 | reg, err := Exp(exp) 55 | if err != nil { 56 | return true, err 57 | } 58 | 59 | *str = reg.ReplaceAllString(*str, "") 60 | return true, err 61 | } 62 | 63 | func Filter(exp string, str string) (string, error) { 64 | reg, err := Exp(exp) 65 | if err != nil { 66 | fmt.Print(err) 67 | return "", err 68 | } 69 | return reg.ReplaceAllString(str, ""), err 70 | 71 | } 72 | -------------------------------------------------------------------------------- /tuuz/RSA/RSA.go: -------------------------------------------------------------------------------- 1 | package RSA 2 | 3 | import ( 4 | "crypto/rand" 5 | "crypto/rsa" 6 | "crypto/x509" 7 | "encoding/pem" 8 | "errors" 9 | "main.go/tuuz/Base64" 10 | ) 11 | 12 | func EncB64(publicKey string, origData []byte) (string, error) { 13 | ret, err := Encrypt(publicKey, origData) 14 | if err != nil { 15 | return "", err 16 | } else { 17 | return Base64.Encode(ret), nil 18 | } 19 | } 20 | 21 | func Encrypt(publicKey string, origData []byte) ([]byte, error) { 22 | //解密pem格式的公钥 23 | block, _ := pem.Decode([]byte(publicKey)) 24 | if block == nil { 25 | return nil, errors.New("public key error") 26 | } 27 | // 解析公钥 28 | pubInterface, err := x509.ParsePKIXPublicKey(block.Bytes) 29 | if err != nil { 30 | return nil, err 31 | } 32 | // 类型断言 33 | pub := pubInterface.(*rsa.PublicKey) 34 | //加密 35 | return rsa.EncryptPKCS1v15(rand.Reader, pub, origData) 36 | } 37 | 38 | func Decrypt(privateKey string, ciphertext []byte) ([]byte, error) { 39 | //解密 40 | block, _ := pem.Decode([]byte(privateKey)) 41 | if block == nil { 42 | return nil, errors.New("private key error!") 43 | } 44 | //解析PKCS1格式的私钥 45 | priv, err := x509.ParsePKCS1PrivateKey(block.Bytes) 46 | if err != nil { 47 | return nil, err 48 | } 49 | // 解密 50 | return rsa.DecryptPKCS1v15(rand.Reader, priv, ciphertext) 51 | } 52 | 53 | func DecB64(privateKey string, base64string string) ([]byte, error) { 54 | b64, err := Base64.Decode(base64string) 55 | if err != nil { 56 | return b64, err 57 | } 58 | return Decrypt(privateKey, b64) 59 | } 60 | -------------------------------------------------------------------------------- /tuuz/Calc/Calc.go: -------------------------------------------------------------------------------- 1 | package Calc 2 | 3 | import ( 4 | "crypto/md5" 5 | "crypto/rand" 6 | "crypto/sha1" 7 | "crypto/sha256" 8 | "crypto/sha512" 9 | "fmt" 10 | "math/big" 11 | rand2 "math/rand" 12 | "time" 13 | ) 14 | 15 | func Md5(str string) string { 16 | return fmt.Sprintf("%x", md5.Sum([]byte(str))) 17 | } 18 | 19 | func Sha1(str string) string { 20 | return fmt.Sprintf("%x", sha1.Sum([]byte(str))) 21 | } 22 | 23 | func Sha256(str string) string { 24 | return fmt.Sprintf("%x", sha256.Sum256([]byte(str))) 25 | } 26 | 27 | func Sha512(str string) string { 28 | return fmt.Sprintf("%x", sha512.Sum512([]byte(str))) 29 | } 30 | 31 | func Mt_rand(min, max int64) int64 { 32 | rand2.Seed(Seed()) 33 | if min == max { 34 | return min 35 | } else { 36 | r := rand2.New(rand2.NewSource(time.Now().UnixNano())) 37 | return r.Int63n(max-min+1) + min 38 | } 39 | } 40 | 41 | func Seed() int64 { 42 | num, _ := rand.Int(rand.Reader, big.NewInt(999999999)) 43 | return num.Int64() 44 | } 45 | 46 | func Rand(min, max int) int { 47 | rand2.Seed(Seed()) 48 | if min == max { 49 | return min 50 | } else { 51 | var randNum int 52 | if max-min < 0 { 53 | randNum = rand2.Intn(min-max) + min 54 | } else { 55 | randNum = rand2.Intn(max-min) + min 56 | } 57 | return randNum 58 | } 59 | } 60 | 61 | func Any2Int64(any interface{}) int64 { 62 | ret, err := String2Int64(Any2String(any)) 63 | if err != nil { 64 | return 0 65 | } 66 | return ret 67 | } 68 | 69 | func Any2Float64(any interface{}) float64 { 70 | ret, err := String2Float64(Any2String(any)) 71 | if err != nil { 72 | return 0 73 | } 74 | return ret 75 | } 76 | 77 | func Any2Int(any interface{}) int { 78 | ret, err := String2Int(Any2String(any)) 79 | if err != nil { 80 | return 0 81 | } 82 | return ret 83 | } 84 | -------------------------------------------------------------------------------- /tuuz/RET/RET.go: -------------------------------------------------------------------------------- 1 | package RET 2 | 3 | import ( 4 | "fmt" 5 | "main.go/tuuz/Jsong" 6 | ) 7 | 8 | func Json(data interface{}) string { 9 | ret, _ := Jsong.Encode(data) 10 | return ret 11 | } 12 | 13 | func Success(code interface{}, data interface{}) string { 14 | ret := make(map[string]interface{}) 15 | ret["code"] = code 16 | ret["data"] = data 17 | jb, err := Jsong.Encode(ret) 18 | //fmt.Println(jb) 19 | if err != nil { 20 | fmt.Println(err) 21 | return "" 22 | } 23 | return string(jb) 24 | } 25 | 26 | func Fail(code int, data interface{}) interface{} { 27 | return Success(code, data) 28 | } 29 | 30 | func Ret_succ(code interface{}, data interface{}) map[string]interface{} { 31 | ret := make(map[string]interface{}) 32 | ret["code"] = code 33 | ret["data"] = data 34 | return ret 35 | } 36 | 37 | func Ret_fail(code interface{}, data interface{}) map[string]interface{} { 38 | return Ret_succ(code, data) 39 | } 40 | 41 | func Ws_succ(typ string, code interface{}, data interface{}, echo interface{}) string { 42 | ret := make(map[string]interface{}) 43 | ret["type"] = typ 44 | ret["code"] = code 45 | ret["data"] = data 46 | ret["echo"] = echo 47 | jb, err := Jsong.Encode(ret) 48 | //fmt.Println(jb) 49 | if err != nil { 50 | fmt.Println(err) 51 | return "" 52 | } 53 | return string(jb) 54 | } 55 | 56 | func Ws_succ2(typ string, route string, code interface{}, data interface{}, echo interface{}) string { 57 | ret := make(map[string]interface{}) 58 | ret["type"] = typ 59 | ret["route"] = route 60 | ret["code"] = code 61 | ret["data"] = data 62 | ret["echo"] = echo 63 | jb, err := Jsong.Encode(ret) 64 | //fmt.Println(jb) 65 | if err != nil { 66 | fmt.Println(err) 67 | return "" 68 | } 69 | return string(jb) 70 | } 71 | 72 | func Ws_fail(typ string, code interface{}, data interface{}, echo interface{}) string { 73 | return Ws_succ(typ, code, data, echo) 74 | } 75 | -------------------------------------------------------------------------------- /tuuz/Array/Array.go: -------------------------------------------------------------------------------- 1 | package Array 2 | 3 | import ( 4 | "main.go/tuuz/Calc" 5 | "main.go/tuuz/Jsong" 6 | ) 7 | 8 | func Merge(args ...map[string]interface{}) map[string]interface{} { 9 | arr := make(map[string]interface{}) 10 | for _, arrs := range args { 11 | for key, value := range arrs { 12 | arr[key] = value 13 | } 14 | } 15 | return arr 16 | } 17 | 18 | func Mapinterface2MapString(maps map[string]interface{}) map[string]string { 19 | strs := make(map[string]string) 20 | for key, value := range maps { 21 | switch value.(type) { 22 | case string: 23 | strs[key] = value.(string) 24 | break 25 | case int: 26 | tmp := value.(int) 27 | strs[key] = Calc.Int2String(tmp) 28 | break 29 | case int64: 30 | tmp := value.(int64) 31 | strs[key] = Calc.Int642String(tmp) 32 | break 33 | case float64: 34 | tmp := value.(float64) 35 | strs[key] = Calc.Float642String(tmp) 36 | break 37 | 38 | case float32: 39 | tmp := value.(float64) 40 | strs[key] = Calc.Float642String(tmp) 41 | break 42 | 43 | default: 44 | strs[key] = value.(string) 45 | break 46 | } 47 | 48 | } 49 | return strs 50 | } 51 | 52 | func MapString2MapInterface(maps map[string]string) map[string]interface{} { 53 | arr := make(map[string]interface{}) 54 | for key, value := range maps { 55 | arr[key] = value 56 | } 57 | return arr 58 | } 59 | 60 | func MapString2Interface(maps map[string]interface{}) map[string]interface{} { 61 | strs := make(map[string]interface{}) 62 | for key, value := range maps { 63 | switch value.(type) { 64 | case string: 65 | strs[key] = value.(string) 66 | case int: 67 | tmp := value.(int) 68 | strs[key] = Calc.Int2String(tmp) 69 | case int64: 70 | tmp := value.(int64) 71 | strs[key] = Calc.Int642String(tmp) 72 | } 73 | } 74 | return strs 75 | } 76 | func InArray(str interface{}, haystack []interface{}) bool { 77 | str, _ = Jsong.Encode(str) 78 | for _, v := range haystack { 79 | v, _ = Jsong.Encode(v) 80 | if str == v { 81 | return true 82 | } 83 | } 84 | return false 85 | } 86 | -------------------------------------------------------------------------------- /tuuz/Redis/Redis.go: -------------------------------------------------------------------------------- 1 | package Redis 2 | 3 | import ( 4 | "fmt" 5 | redigo "github.com/garyburd/redigo/redis" 6 | "main.go/tuuz/Jsong" 7 | ) 8 | 9 | const project = "bilibili" 10 | 11 | var RRedis redigo.Conn 12 | 13 | func Set(key string, value interface{}, duration int) (interface{}, error) { 14 | RRedis := Conn() 15 | defer RRedis.Close() 16 | str, err := Jsong.Encode(value) 17 | if err != nil { 18 | fmt.Println("redis set failed1json:", err) 19 | return str, err 20 | 21 | } 22 | status, errs := RRedis.Do("SET", project+":"+key, str, "EX", duration) 23 | if errs != nil { 24 | fmt.Println("redis set failed2:", errs) 25 | return status, errs 26 | } 27 | return status, err 28 | } 29 | 30 | func Set_permenent(key string, value interface{}) (interface{}, error) { 31 | RRedis := Conn() 32 | defer RRedis.Close() 33 | str, err := Jsong.Encode(value) 34 | if err != nil { 35 | fmt.Println("redis set failed1json:", err) 36 | } 37 | status, err := RRedis.Do("SET", project+":"+key, str) 38 | if err != nil { 39 | fmt.Println("redis set failed:", err) 40 | } 41 | return status, err 42 | } 43 | 44 | func Get(key string) (interface{}, error) { 45 | RRedis := Conn() 46 | defer RRedis.Close() 47 | 48 | status, err := RRedis.Do("GET", project+":"+key) 49 | if err != nil { 50 | //fmt.Println("redis get failed1:", err) 51 | return nil, err 52 | } 53 | status2, err := redigo.String(status, err) 54 | if err != nil { 55 | //fmt.Println("redis get failed2:", err) 56 | return nil, err 57 | } 58 | ret, err := Jsong.JToken(status2) 59 | if err != nil { 60 | fmt.Println("redis get failed3:", err, status2) 61 | return nil, err 62 | } 63 | return ret, err 64 | } 65 | 66 | func Del(key string) (interface{}, error) { 67 | RRedis := Conn() 68 | defer RRedis.Close() 69 | status, err := RRedis.Do("DEL", project+":"+key) 70 | if err != nil { 71 | fmt.Println("redis delete fail", err) 72 | } 73 | return status, err 74 | } 75 | 76 | func Expire(key string, duration float64) (interface{}, error) { 77 | RRedis := Conn() 78 | defer RRedis.Close() 79 | status, err := RRedis.Do("EXPIRE", project+":"+key, duration) 80 | if err != nil { 81 | fmt.Println("err while change duration:", err) 82 | } 83 | return status, err 84 | } 85 | -------------------------------------------------------------------------------- /go.sum: -------------------------------------------------------------------------------- 1 | github.com/Unknwon/goconfig v0.0.0-20191126170842-860a72fb44fd h1:+CYOsXi89xOqBkj7CuEJjA2It+j+R3ngUZEydr6mtkw= 2 | github.com/Unknwon/goconfig v0.0.0-20191126170842-860a72fb44fd/go.mod h1:wngxua9XCNjvHjDiTiV26DaKDT+0c63QR6H5hjVUUxw= 3 | github.com/bitly/go-simplejson v0.5.0 h1:6IH+V8/tVMab511d5bn4M7EwGXZf9Hj6i2xSwkNEM+Y= 4 | github.com/bitly/go-simplejson v0.5.0/go.mod h1:cXHtHw4XUPsvGaxgjIAn8PhEWG9NfngEKAMDJEczWVA= 5 | github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= 6 | github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= 7 | github.com/garyburd/redigo v1.6.0 h1:0VruCpn7yAIIu7pWVClQC8wxCJEcG3nyzpMSHKi1PQc= 8 | github.com/garyburd/redigo v1.6.0/go.mod h1:NR3MbYisc3/PwhQ00EMzDiPmrwpPxAn5GI05/YaO1SY= 9 | github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= 10 | github.com/inconshreveable/go-update v0.0.0-20160112193335-8152e7eb6ccf h1:WfD7VjIE6z8dIvMsI4/s+1qr5EL+zoIGev1BQj1eoJ8= 11 | github.com/inconshreveable/go-update v0.0.0-20160112193335-8152e7eb6ccf/go.mod h1:hyb9oH7vZsitZCiBt0ZvifOrB+qc8PS5IiilCIb87rg= 12 | github.com/json-iterator/go v1.1.9 h1:9yzud/Ht36ygwatGx56VwCZtlI/2AD15T1X2sjSuGns= 13 | github.com/json-iterator/go v1.1.9/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= 14 | github.com/kirinlabs/HttpRequest v0.1.5 h1:BzOb6AmBii232R93birBsf663kt8N9y8N0TCQKoEzhA= 15 | github.com/kirinlabs/HttpRequest v0.1.5/go.mod h1:XV38fA4rXZox83tlEV9KIQ7Cdsut319x6NGzVLuRlB8= 16 | github.com/kirinlabs/HttpRequest v0.1.6 h1:wE8rrYBgdODEijIPl4N0Mg2UnnOeyDJdEjPKfUqocfU= 17 | github.com/kirinlabs/HttpRequest v0.1.6/go.mod h1:XV38fA4rXZox83tlEV9KIQ7Cdsut319x6NGzVLuRlB8= 18 | github.com/kirinlabs/HttpRequest v1.0.5 h1:1bWj23Tzxm5Zyzm3YURa+ujnBXoXiIbsQq3K9U4SP8s= 19 | github.com/kirinlabs/HttpRequest v1.0.5/go.mod h1:XV38fA4rXZox83tlEV9KIQ7Cdsut319x6NGzVLuRlB8= 20 | github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421 h1:ZqeYNhU3OHLH3mGKHDcjJRFFRrJa6eAM5H+CtDdOsPc= 21 | github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= 22 | github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg= 23 | github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= 24 | github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742 h1:Esafd1046DLDQ0W1YjYsBW+p8U2u7vzgW2SQVmlNazg= 25 | github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= 26 | github.com/modern-go/reflect2 v1.0.1 h1:9f412s+6RmYXLWZSEzVVgPGK7C2PphHj5RJrvfx9AWI= 27 | github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= 28 | github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= 29 | github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= 30 | github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= 31 | -------------------------------------------------------------------------------- /tuuz/Net/HttpClient.go: -------------------------------------------------------------------------------- 1 | package Net 2 | 3 | import "github.com/kirinlabs/HttpRequest" 4 | 5 | // 6 | func Request() *HttpRequest.Request { 7 | req := HttpRequest.NewRequest() 8 | //req := HttpRequest.NewRequest().Debug(true).DisableKeepAlives(false).SetTimeout(5) 9 | return req 10 | } 11 | 12 | // 13 | //func head() { 14 | // req.SetHeaders(map[string]string{ 15 | // "Content-Type": "application/x-www-form-urlencoded", 16 | // "Connection": "keep-alive", 17 | // }) 18 | // 19 | // req.SetHeaders(map[string]string{ 20 | // "Source": "api", 21 | // }) 22 | //} 23 | // 24 | //func cook() { 25 | // req.SetCookies(map[string]string{ 26 | // "name": "json", 27 | // "token": "", 28 | // }) 29 | // 30 | // req.SetCookies(map[string]string{ 31 | // "age": "19", 32 | // }) 33 | //} 34 | // 35 | //func auth() { 36 | // req.SetBasicAuth("username", "password") 37 | //} 38 | // 39 | //func timeout() { 40 | // req.SetTimeout(5) 41 | //} 42 | // 43 | //func ignorehttptlscert() { 44 | // req.SetTLSClient(&tls.Config{InsecureSkipVerify: true}) 45 | //} 46 | // 47 | //func Get() { 48 | // res, err := req.Get("http://127.0.0.1:8000") 49 | // res, err := req.Get("http://127.0.0.1:8000?id=10&title=HttpRequest") 50 | // res, err := req.Get("http://127.0.0.1:8000?id=10&title=HttpRequest", nil) 51 | // res, err := req.Get("http://127.0.0.1:8000?id=10&title=HttpRequest", "address=beijing") 52 | // 53 | // res, err := HttpRequest.Get("http://127.0.0.1:8000") 54 | // res, err := HttpRequest.Debug(true).SetHeaders(map[string]string{}).Get("http://127.0.0.1:8000") 55 | // body, err := res.Body() 56 | // if err != nil { 57 | // return 58 | // } 59 | // 60 | // return string(body) 61 | //} 62 | // 63 | //func aaa() { 64 | // req := HttpRequest.NewRequest(). 65 | // Debug(true). 66 | // SetHeaders(map[string]string{ 67 | // "Content-Type": "application/x-www-form-urlencoded", 68 | // }).SetTimeout(5) 69 | // res, err := HttpRequest.NewRequest().Get("http://127.0.0.1") 70 | //} 71 | // 72 | //func upload() { 73 | // res, err := req.Upload("http://127.0.0.1:8000/upload", "/root/demo.txt", "uploadFile") 74 | // body, err := res.Body() 75 | // if err != nil { 76 | // return 77 | // } 78 | // return string(body) 79 | //} 80 | // 81 | //func post() { 82 | // req:=Request(); 83 | // res, err := req.Post("http://127.0.0.1:8000") 84 | // res, err := req.Post("http://127.0.0.1:8000", "title=github&type=1") 85 | // res, err := req.JSON().Post("http://127.0.0.1:8000", "{\"id\":10,\"title\":\"HttpRequest\"}") 86 | // res, err := req.Post("http://127.0.0.1:8000", map[string]interface{}{ 87 | // "id": 10, 88 | // "title": "HttpRequest", 89 | // }) 90 | // body, err := res.Body() 91 | // if err != nil { 92 | // return 93 | // } 94 | // return string(body) 95 | // 96 | // res, err := HttpRequest.Post("http://127.0.0.1:8000") 97 | // res, err := HttpRequest.JSON().Post("http://127.0.0.1:8000", map[string]interface{}{"title": "github"}) 98 | // res, err := HttpRequest.Debug(true).SetHeaders(map[string]string{}).JSON().Post("http://127.0.0.1:8000", "{\"title\":\"github\"}") 99 | //} 100 | -------------------------------------------------------------------------------- /Action/ActionRoute/SuperCurl.go: -------------------------------------------------------------------------------- 1 | package ActionRoute 2 | 3 | import ( 4 | "fmt" 5 | "main.go/Conf" 6 | "main.go/tuuz/Array" 7 | "main.go/tuuz/Calc" 8 | "main.go/tuuz/Jsong" 9 | "main.go/tuuz/Net" 10 | "main.go/tuuz/RET" 11 | "net" 12 | "time" 13 | ) 14 | 15 | func Curl(url string, method string, values map[string]interface{}, headers map[string]interface{}, cookie map[string]interface{}, typ string, echo string, conn net.TCPConn, route string, delay float64) { 16 | defer func() { 17 | err := recover() 18 | if err != nil { 19 | fmt.Println("----Curl-recover----") 20 | fmt.Println(err) 21 | } 22 | }() 23 | ts := Calc.Any2String(delay) 24 | del, err := time.ParseDuration(ts + "s") 25 | if err != nil { 26 | 27 | } else { 28 | time.Sleep(del) 29 | } 30 | SuperCurl(url, method, values, headers, cookie, typ, echo, conn, route) 31 | } 32 | 33 | func SuperCurl(url string, method string, values map[string]interface{}, headers map[string]interface{}, cookie map[string]interface{}, typ string, echo string, conn net.TCPConn, route string) { 34 | defer func() { 35 | err := recover() 36 | if err != nil { 37 | fmt.Println("----SuperCurl-recover----") 38 | fmt.Println(err) 39 | } 40 | }() 41 | header := Array.Mapinterface2MapString(headers) 42 | cookies := Array.Mapinterface2MapString(cookie) 43 | if method == "post" { 44 | req := Net.Request() 45 | req.SetHeaders(header) 46 | req.SetCookies(cookies) 47 | ret, err := req.Post(url, values) 48 | if err != nil { 49 | ecam("[BiliHP-NET-ERROR0]:", err, "") 50 | return 51 | } 52 | body, err := ret.Body() 53 | if err != nil { 54 | ecam("[BiliHP-NET-ERROR1]:", err, "") 55 | return 56 | } 57 | resp_header := ret.Headers() 58 | cook := ret.Cookies() 59 | //fmt.Println(cookie_arr) 60 | if err != nil { 61 | ecam("[BiliHP-NET-ERROR2]:", err, "") 62 | return 63 | } else { 64 | ret := make(map[string]interface{}) 65 | ret["cookie"] = Net.CookieHandler(cook) 66 | ret["route"] = route 67 | ret["body"] = Jsong.Decode(string(body)) 68 | ret["header"] = resp_header 69 | ret["statusCode"] = 200 70 | if Conf.LoadConf("debug", "debug") == "true" { 71 | fmt.Println("ret-post:", RET.Ws_succ(typ, 0, ret, echo)) 72 | } 73 | go Send(conn, SendObj(typ, ret, echo, values)) 74 | } 75 | } else { 76 | req := Net.Request() 77 | req.SetHeaders(header) 78 | req.SetCookies(cookies) 79 | ret, err := req.Get(url, values) 80 | if err != nil { 81 | ecam("[BiliHP-NET-ERROR10]:", err, "") 82 | return 83 | } 84 | body, err := ret.Body() 85 | if err != nil { 86 | ecam("[BiliHP-NET-ERROR11]:", err, "") 87 | return 88 | } 89 | resp_header := ret.Headers() 90 | cook := ret.Cookies() 91 | 92 | if err != nil { 93 | ecam("[BiliHP-NET-ERROR12]:", err, "") 94 | return 95 | } else { 96 | ret := make(map[string]interface{}) 97 | ret["cookie"] = Net.CookieHandler(cook) 98 | ret["route"] = route 99 | ret["body"] = Jsong.Decode(string(body)) 100 | ret["header"] = resp_header 101 | ret["statusCode"] = 200 102 | if Conf.LoadConf("debug", "debug") == "true" { 103 | fmt.Println("ret-get:", RET.Ws_succ(typ, 0, ret, echo)) 104 | } 105 | go Send(conn, RET.Ws_succ(typ, 0, ret, echo)) 106 | } 107 | } 108 | } 109 | -------------------------------------------------------------------------------- /Tcp/Tcp.go: -------------------------------------------------------------------------------- 1 | package Tcp 2 | 3 | import ( 4 | "fmt" 5 | "main.go/Action/ActionRoute" 6 | "main.go/Conf" 7 | "main.go/tuuz/Jsong" 8 | "main.go/tuuz/RET" 9 | "net" 10 | "os" 11 | "sync" 12 | "time" 13 | ) 14 | 15 | var wg = sync.WaitGroup{} 16 | var Conn = make(map[string]*net.TCPConn) 17 | var MaxMSS = 0 18 | var Lock sync.RWMutex 19 | 20 | func Create(username string, token string) { 21 | defer func() { 22 | time.Sleep(1 * time.Second) 23 | Create(username, token) 24 | }() 25 | server := Conf.Addr 26 | tcpAddr, err := net.ResolveTCPAddr("tcp4", server) 27 | 28 | if err != nil { 29 | fmt.Println(os.Stderr, "Fatal error: ", err) 30 | os.Exit(1) 31 | } 32 | //fmt.Println(tcpAddr) 33 | //建立服务器连接 34 | Conn[username], err = net.DialTCP("tcp", nil, tcpAddr) 35 | wg.Add(1) 36 | if err != nil { 37 | fmt.Println("连接故障……正在重连……", err) 38 | time.Sleep(1 * time.Second) 39 | wg.Done() 40 | } else { 41 | fmt.Println("成功连入服务器!") 42 | data := make(map[string]interface{}) 43 | data["username"] = username 44 | data["token"] = token 45 | data["version"] = Conf.Version 46 | data["type"] = "pc" 47 | Sender(username, token, RET.Ws_succ("init", 0, data, "init")) 48 | //fmt.Println("init") 49 | Functions(username, token) 50 | Handler(username, token) 51 | } 52 | wg.Wait() 53 | } 54 | 55 | func Sender(username string, token string, message string) { 56 | conn := Conn[username] 57 | words := message 58 | _, err := conn.Write([]byte(words)) //给服务器发信息 59 | 60 | if err != nil { 61 | fmt.Println(conn.RemoteAddr().String(), "服务器发送失败正在重新建立重连……") 62 | time.Sleep(1 * time.Second) 63 | os.Exit(1) 64 | } 65 | } 66 | 67 | func Functions(username string, token string) { 68 | go yingyuan_sign(username) 69 | go daily_task(username) 70 | go silver_task(username) 71 | go online_silver(username) 72 | go daily_bag(username) 73 | go app_heart(username) 74 | go pc_heart(username) 75 | go do_sign(username) 76 | go manga_sign(username) 77 | go manga_share(username) 78 | } 79 | 80 | func Set_setting(username, key, value string) { 81 | data := make(map[string]string) 82 | data["key"] = key 83 | data["value"] = value 84 | 85 | rt := RET.Ws_succ2("app", "pc_set_setting", 0, data, "pc_set_setting") 86 | //str, _ := Jsong.Encode(data) 87 | if Conn[username] != nil { 88 | ActionRoute.Send(*Conn[username], rt) 89 | } 90 | } 91 | 92 | func Get_settings(username string) { 93 | data := make(map[string]string) 94 | 95 | rt := RET.Ws_succ2("app", "get_config", 0, data, "get_config") 96 | //str, _ := Jsong.Encode(data) 97 | if Conn[username] != nil { 98 | ActionRoute.Send(*Conn[username], rt) 99 | } 100 | } 101 | 102 | func Handler(username string, token string) { 103 | temp := "" 104 | buf := make([]byte, 4096) 105 | for { 106 | n, err := Conn[username].Read(buf) 107 | if n == 0 || err != nil { 108 | wg.Done() 109 | fmt.Println("handler出错:", err) 110 | return 111 | 112 | //将当前用户从在线字典中删除 113 | //address := strings.Split(addr, ":") 114 | //ip := address[0] 115 | //Conclose(conn, addr, ip) 116 | //通知其他客户端该用户退出登录 117 | //Messages <- "logout" 118 | //Send_All("logout") 119 | return 120 | } 121 | temp += string(buf[:n]) 122 | jsons, err := Jsong.TCPJObject(&temp) 123 | if err != nil { 124 | fmt.Println("err:", err) 125 | } else { 126 | for _, jobject := range jsons { 127 | go ActionRoute.ActionRoute(jobject, username, Conn[username]) 128 | } 129 | } 130 | 131 | } 132 | 133 | } 134 | -------------------------------------------------------------------------------- /Readme.md: -------------------------------------------------------------------------------- 1 | # BiliBili助手全设备支持 2 | Centos,Ubuntu等Linux系统,苹果Mac电脑,Openwrt路由器,Windows32位,Windows64位(一般用这个) 3 | 4 | # [主项目地址](https://github.com/tobycroft/BiliHP-APP) 5 | ## [主项目地址](https://github.com/tobycroft/BiliHP-APP) 6 | ### [主项目地址](https://github.com/tobycroft/BiliHP-APP) 7 | #### [主项目地址](https://github.com/tobycroft/BiliHP-APP) 8 | 9 | # 项目运行周期 10 | 11 | 项目开始时间:2020-1-18 12:22:11 12 | 项目预计结束时间:2028-03-30 12:22:11 13 | 14 | ## **重启原因** 15 | 16 | 学了Golang,要找个项目练练手 17 | 18 | ## **项目介绍** 19 | 助手PC版本,这是一个全新的概念版,本版本将会参考BaiduPCS-GO的web版本 20 | 21 | 不带界面,但是开放第三方API 22 | 23 | 2017年,我在客户端做好所有的界面和接口,大家直接用就好了 24 | 25 | 2020年,我打算在做好界面的基础上,向大家开放DIY接口,你可以直接用本项目的html文件实现DIY, 26 | 甚至,如果你愿意,你可以在公网上开放这个接口,或者制作一个集群管理工具,因为都是基于HTTP的, 27 | 所以技术难度很低 28 | 29 | 原来我是我带大家玩,现在我希望大家可以一起来玩,欢迎在本版本开发完成后提交branch! 30 | 31 | ![app](https://github.com/tobycroft/BiliHP-APP/blob/master/res/github-app.png) 32 | 33 | ## 版本号说明 34 | ### 例如v1.12.33: 35 | ##### 首先将版本号切为三段: 36 | - 第一段v1为大版本号,一般是架构变化的时候才会+1,测试版V0,正式版V1,后期架构变化前段+1 37 | 38 | - 第二段12为功能版本号,例如新增了功能,中段版本号+1 39 | 40 | - 第三段33为修复版本号,例如12版本中出现了BUG,后期修复后发布新版本时,后段+1 41 | 42 | - 后段无论升级到什么版本,只要前一段+1,例如功能更新,则默认新功能的包中包含之前已经修复好的bug, 43 | 如果上一个版本中仍旧有BUG,则下个版本中修复后,再下个版本的三段号中+1,以此类推 44 | 45 | 46 | ## 编译版本说明 47 | Centos,Ubuntu等Linux系统 :BiliHP_Linux_linux 48 | 49 | 苹果Mac电脑 :BiliHP_Mac_darwin 50 | 51 | Openwrt路由器 :BiliHP_Router_linux 52 | 53 | Windows32位 :BiliHP_PCWEB_386 54 | 55 | Windows64位(一般用这个) :BiliHP_PCWEB 56 | 57 | 58 | 59 | Windows版本和linux等新版本均不会弹出浏览器(因为新增路由器版本),请手动访问 60 | 61 | http://127.0.0.1 62 | 63 | 或者 64 | 65 | http://localhost 66 | 67 | 68 | 如果部署在路由器,请访问: 69 | 70 | http://127.0.0.1:79 71 | 72 | ### DevLog 73 | ~~~~ 74 | v0.22.0 75 | 1.天选屏蔽词 76 | ~~~~ 77 | ~~~~ 78 | v0.20.3 79 | 1.拆包粘包算法按照C#版本的修复 80 | ~~~~ 81 | ~~~~ 82 | v0.20.2 83 | 1.本地化验证码,避免部分用户验证码死活刷不出来 84 | ~~~~ 85 | ~~~~ 86 | v0.20.0 87 | 1.升级BiliHP全系列的登陆方案,解决异地登陆可能造成的白嫖风险 88 | ~~~~ 89 | ~~~~ 90 | v0.20.0 91 | 1.升级BiliHP全系列的登陆方案,解决异地登陆可能造成的白嫖风险 92 | ~~~~ 93 | ~~~~ 94 | v0.19.0 95 | 1.新增远程监控,从APP上就能看到PC的运行情况了,远程设定,远程查看全部完成! 96 | (非常方便!而且如果你同时使用C2C和PC,那么监控面板将会同时显示C2C和PC的内容) 97 | ~~~~ 98 | ~~~~ 99 | v0.18.11 100 | 1.修正断线动作 101 | ~~~~ 102 | ~~~~ 103 | v0.18.9 104 | 1.修复SuperCurl导致故障的BUG 105 | ~~~~ 106 | ~~~~ 107 | v0.18.8 108 | 1.重写拆包粘包算法,真尴尬,当初写的时候不仔细,今天花了2个小时对数据包进行挨个分析才找到拆包故障所在 109 | 大家在写拆包算法的时候要注意末尾补位问题,另外TCP粘包算法比较简单,UDP 110 | ~~~~ 111 | ~~~~ 112 | v0.18.7 113 | 1.放弃自适应MSS,老老实实采用粘包方案,好气啊! 114 | ~~~~ 115 | ~~~~ 116 | v0.18.1-v0.18.5 117 | 1.修复节奏风暴闪电网络版 118 | ~~~~ 119 | ~~~~ 120 | v0.18.1-v0.18.5 121 | 1.干了傻事要弥补(服务器地址写成了127.0.0.1) 122 | ~~~~ 123 | ~~~~ 124 | v0.18.0 125 | 1.新增节奏风暴闪电网络版 126 | ~~~~ 127 | ~~~~ 128 | v0.17.2 129 | 1.修正MSS算法 130 | ~~~~ 131 | ~~~~ 132 | v0.16.0-v0.17.0 133 | 1.修复关闭小电视PK舰长等所有动态奖励后仍旧领取的bug 134 | 2.新增PK/大乐斗抽奖 135 | 3.新增节奏风暴(等后端开启后下个版本更新按钮) 136 | 4.新增提督/拿督抽奖(总督,舰长,拿督,提督,目前已经做全了,之前只能抽舰长和总督) 137 | 5.新增联动开关更新 138 | 139 | 服务器: 140 | 1.修复PK模板 141 | 2.修复舰长模板 142 | 3.PC/APP接口模拟方案区分,发送方案全模拟(Cookie深度模拟将会在研究后再启用,目前GayHub独一份) 143 | 4.自动更新系统上线 144 | 5.节奏风暴模板编辑中 145 | 6.C2CGo与闪电网络对接完成,目前开放各分区前150个直播间,主网上线后将会根据C2C在线数量动态调节 146 | 147 | ~~~~ 148 | ~~~~ 149 | v0.15.3 150 | 1.修复闪电网络崩坏时出现的报错退出BUG 151 | ~~~~ 152 | ~~~~ 153 | v0.15.2 154 | 1.修复忘记复制html的问题 155 | ~~~~ 156 | ~~~~ 157 | v0.15.1 158 | 1.修复版本忘记填写的问题 159 | ~~~~ 160 | ~~~~ 161 | v0.15.0 162 | 1.新增天选之子 163 | 2.新增linux版本mac版本和openwrt路由器版本 164 | ~~~~ 165 | ~~~~ 166 | v0.14.0 167 | 1.上一个版本太强大,导致程序疯狂进入退出,短时间内创造了几万个TCP链接,服务器就出现了Goroutine Map 168 | 抢资源的问题,然后通过学习,解决了Map多线程问题,老版本不会再影响服务器,导致服务器炸裂了,然后14.0版本 169 | 加入了版本,预计下个版本直接加入自动更新 170 | ~~~~ 171 | ~~~~ 172 | v0.13.6 173 | 1.修复因为没有设定GoRoutine导致的协程阻塞问题 174 | ~~~~ 175 | ~~~~ 176 | v0.13.5 177 | 1.html部分微调 178 | ~~~~ 179 | 180 | ~~~~ 181 | v0.13.4 182 | 1.修复重连BUG 183 | ~~~~ 184 | 185 | ~~~~ 186 | v0.13.1-v0.13.3 187 | 1.新增32位版本(release 188 | 2.修复登录BUG 189 | ~~~~ 190 | ~~~~ 191 | v0.13.0 192 | 1.目前完成了礼物接入功能 193 | TODO// 194 | 目前需要完成基础功能接入,因为群内投票,大家还是喜欢控制本地化,所以这里需要在程序中集成发起 195 | 不过目前界面登录这些可以用了,就先发了 196 | 版本同APP 197 | ~~~~ 198 | ~~~~ 199 | 2020-2-4:目前未完成 200 | ~~~~ 201 | -------------------------------------------------------------------------------- /Tcp/Function.go: -------------------------------------------------------------------------------- 1 | package Tcp 2 | 3 | import ( 4 | "main.go/Action/ActionRoute" 5 | "main.go/Conf" 6 | "time" 7 | ) 8 | 9 | func yingyuan_sign(username string) { 10 | 11 | for { 12 | if Conf.LoadConf("setting", "yingyuan_sign") == "1" { 13 | ret := ActionRoute.SendObj("func", nil, "yingyuan_sign", nil) 14 | Lock.Lock() 15 | if Conn[username] != nil { 16 | go ActionRoute.Send(*Conn[username], ret) 17 | } 18 | Lock.Unlock() 19 | } 20 | time.Sleep(time.Hour * 24) 21 | } 22 | } 23 | 24 | func daily_task(username string) { 25 | for { 26 | if Conf.LoadConf("setting", "daily_bag") == "1" { 27 | ret := ActionRoute.SendObj("func", nil, "daily_task", nil) 28 | Lock.Lock() 29 | if Conn[username] != nil { 30 | go ActionRoute.Send(*Conn[username], ret) 31 | } 32 | Lock.Unlock() 33 | } 34 | time.Sleep(time.Hour * 24) 35 | } 36 | 37 | } 38 | 39 | func silver_task(username string) { 40 | for { 41 | if Conf.LoadConf("setting", "daily_bag") == "1" { 42 | ret := ActionRoute.SendObj("func", nil, "silver_task", nil) 43 | Lock.Lock() 44 | if Conn[username] != nil { 45 | go ActionRoute.Send(*Conn[username], ret) 46 | } 47 | Lock.Unlock() 48 | } 49 | time.Sleep(time.Minute * 10) 50 | } 51 | 52 | } 53 | 54 | func online_silver(username string) { 55 | for { 56 | if Conf.LoadConf("setting", "daily_bag") == "1" { 57 | ret := ActionRoute.SendObj("func", nil, "online_silver", nil) 58 | Lock.Lock() 59 | if Conn[username] != nil { 60 | go ActionRoute.Send(*Conn[username], ret) 61 | } 62 | Lock.Unlock() 63 | } 64 | time.Sleep(time.Minute * 10) 65 | } 66 | 67 | } 68 | 69 | func daily_bag(username string) { 70 | for { 71 | if Conf.LoadConf("setting", "daily_bag") == "1" { 72 | ret := ActionRoute.SendObj("func", nil, "daily_bag", nil) 73 | Lock.Lock() 74 | if Conn[username] != nil { 75 | go ActionRoute.Send(*Conn[username], ret) 76 | } 77 | Lock.Unlock() 78 | } 79 | time.Sleep(time.Hour * 24) 80 | } 81 | 82 | } 83 | 84 | func app_heart(username string) { 85 | for { 86 | if Conf.LoadConf("setting", "app_heart") == "1" { 87 | ret := ActionRoute.SendObj("func", nil, "app_heart", nil) 88 | Lock.Lock() 89 | if Conn[username] != nil { 90 | go ActionRoute.Send(*Conn[username], ret) 91 | } 92 | Lock.Unlock() 93 | } 94 | time.Sleep(time.Second * 59) 95 | } 96 | } 97 | 98 | func pc_heart(username string) { 99 | for { 100 | if Conf.LoadConf("setting", "pc_heart") == "1" { 101 | ret := ActionRoute.SendObj("func", nil, "pc_heart", nil) 102 | Lock.Lock() 103 | if Conn[username] != nil { 104 | go ActionRoute.Send(*Conn[username], ret) 105 | } 106 | Lock.Unlock() 107 | } 108 | time.Sleep(time.Second * 57) 109 | } 110 | } 111 | 112 | func Ping(username string) { 113 | for { 114 | ret := ActionRoute.SendObj("ping", "ping", "ping", nil) 115 | Lock.Lock() 116 | if Conn[username] != nil { 117 | go ActionRoute.Send(*Conn[username], ret) 118 | } 119 | Lock.Unlock() 120 | time.Sleep(time.Second * 10) 121 | } 122 | } 123 | 124 | func do_sign(username string) { 125 | for { 126 | if Conf.LoadConf("setting", "do_sign") == "1" { 127 | ret := ActionRoute.SendObj("func", nil, "do_sign", nil) 128 | Lock.Lock() 129 | if Conn[username] != nil { 130 | go ActionRoute.Send(*Conn[username], ret) 131 | } 132 | Lock.Unlock() 133 | } 134 | time.Sleep(time.Hour * 24) 135 | } 136 | } 137 | 138 | func manga_sign(username string) { 139 | for { 140 | if Conf.LoadConf("setting", "manga_sign") == "1" { 141 | ret := ActionRoute.SendObj("func", nil, "manga_sign", nil) 142 | Lock.Lock() 143 | if Conn[username] != nil { 144 | go ActionRoute.Send(*Conn[username], ret) 145 | } 146 | Lock.Unlock() 147 | } 148 | time.Sleep(time.Hour * 24) 149 | } 150 | } 151 | 152 | func manga_share(username string) { 153 | for { 154 | if Conf.LoadConf("setting", "manga_share") == "1" { 155 | ret := ActionRoute.SendObj("func", nil, "manga_share", nil) 156 | Lock.Lock() 157 | if Conn[username] != nil { 158 | go ActionRoute.Send(*Conn[username], ret) 159 | } 160 | Lock.Unlock() 161 | } 162 | time.Sleep(time.Hour * 24) 163 | } 164 | } 165 | -------------------------------------------------------------------------------- /tuuz/Jsong/Jsong.go: -------------------------------------------------------------------------------- 1 | package Jsong 2 | 3 | import ( 4 | "fmt" 5 | jsoniter "github.com/json-iterator/go" 6 | "strings" 7 | ) 8 | 9 | func Encode(data interface{}) (string, error) { 10 | var json = jsoniter.ConfigCompatibleWithStandardLibrary 11 | jb, err := json.Marshal(data) 12 | //fmt.Println(jb) 13 | if err != nil { 14 | fmt.Println("JENCODEEncode", err) 15 | return "", err 16 | } 17 | return string(jb), err 18 | } 19 | 20 | func Decode(data string) interface{} { 21 | ret, _ := JToken(data) 22 | return ret 23 | } 24 | 25 | func JArray(data string) ([]interface{}, error) { 26 | var arr []interface{} 27 | var json = jsoniter.ConfigCompatibleWithStandardLibrary 28 | err := json.Unmarshal([]byte(data), &arr) 29 | if err != nil { 30 | return nil, err 31 | } 32 | return arr, err 33 | } 34 | 35 | func JObject(data string) (map[string]interface{}, error) { 36 | var arr map[string]interface{} 37 | var json = jsoniter.ConfigCompatibleWithStandardLibrary 38 | err := json.Unmarshal([]byte(data), &arr) 39 | if err != nil { 40 | return nil, err 41 | } 42 | return arr, err 43 | } 44 | 45 | func JToken(data string) (interface{}, error) { 46 | var arr interface{} 47 | var json = jsoniter.ConfigCompatibleWithStandardLibrary 48 | err := json.Unmarshal([]byte(data), &arr) 49 | if err != nil { 50 | return nil, err 51 | } 52 | return arr, err 53 | } 54 | 55 | func TCPJObject(temp *string) ([]map[string]interface{}, error) { 56 | var arr []map[string]interface{} 57 | 58 | var json = jsoniter.ConfigCompatibleWithStandardLibrary 59 | //var strs []string 60 | 61 | data := *temp 62 | if len(*temp) > 65535 { 63 | *temp = "" 64 | return nil, fmt.Errorf("%s", "too long") 65 | } 66 | strs := strings.Split(data, "}{") 67 | if len(strs) > 1 { 68 | unable := "" 69 | for i, v := range strs { 70 | arr2 := make(map[string]interface{}) 71 | if i == 0 { 72 | err := json.Unmarshal([]byte(v+"}"), &arr2) 73 | if err != nil { 74 | unable += v + "}" 75 | fmt.Println(1, i, i+1, v+"}") 76 | } else { 77 | arr = append(arr, arr2) 78 | } 79 | } else if len(strs) == int(i+1) { 80 | err := json.Unmarshal([]byte("{"+v), &arr2) 81 | if err != nil { 82 | unable += "{" + v 83 | fmt.Println(2, i, i+1, "{"+v) 84 | } else { 85 | arr = append(arr, arr2) 86 | } 87 | //fmt.Println(2, "len", len(strs), i+1, "{"+v) 88 | } else { 89 | err := json.Unmarshal([]byte("{"+v+"}"), &arr2) 90 | if err != nil { 91 | unable += "{" + v + "}" 92 | fmt.Println(3, i, "{"+v+"}") 93 | } else { 94 | arr = append(arr, arr2) 95 | } 96 | } 97 | } 98 | 99 | *temp = unable 100 | return arr, nil 101 | //} else if len(strs) > 1 { 102 | // arr2 := make(map[string]interface{}) 103 | // err := json.Unmarshal([]byte(strs[0]+"}"), &arr2) 104 | // if err != nil { 105 | // //fmt.Println("2",data) 106 | // //fmt.Println(err) 107 | // return nil, err 108 | // } else { 109 | // *temp = "{" + strs[1] 110 | // arr = append(arr, arr2) 111 | // return arr, err 112 | // } 113 | } else { 114 | arr2 := make(map[string]interface{}) 115 | err := json.Unmarshal([]byte(data), &arr2) 116 | if err != nil { 117 | //fmt.Println("2",data) 118 | //fmt.Println(err) 119 | return nil, nil 120 | } else { 121 | *temp = "" 122 | arr = append(arr, arr2) 123 | return arr, err 124 | } 125 | } 126 | 127 | } 128 | 129 | func TCPJArray(temp *string) ([]interface{}, error) { 130 | 131 | var arr []interface{} 132 | 133 | var json = jsoniter.ConfigCompatibleWithStandardLibrary 134 | //var strs []string 135 | 136 | data := *temp 137 | strs := strings.Split(data, "][") 138 | if len(strs) > 2 { 139 | unable := "" 140 | for i, v := range strs { 141 | var arr2 interface{} 142 | if i == 0 { 143 | err := json.Unmarshal([]byte(v+"]"), &arr2) 144 | if err != nil { 145 | unable += v + "}" 146 | fmt.Println(1, i, i+1, v+"]") 147 | } else { 148 | arr = append(arr, arr2) 149 | } 150 | } else if len(strs) == int(i+1) { 151 | err := json.Unmarshal([]byte("["+v), &arr2) 152 | if err != nil { 153 | unable += "{" + v 154 | fmt.Println(2, i, i+1, "["+v) 155 | } else { 156 | arr = append(arr, arr2) 157 | } 158 | //fmt.Println(2, "len", len(strs), i+1, "{"+v) 159 | } else { 160 | err := json.Unmarshal([]byte("["+v+"]"), &arr2) 161 | if err != nil { 162 | unable += "{" + v + "}" 163 | fmt.Println(3, i, "["+v+"]") 164 | } else { 165 | arr = append(arr, arr2) 166 | } 167 | } 168 | } 169 | 170 | *temp = unable 171 | return arr, nil 172 | } else if len(strs) > 1 { 173 | var arr2 interface{} 174 | err := json.Unmarshal([]byte(strs[0]+"]"), &arr2) 175 | if err != nil { 176 | //fmt.Println("2",data) 177 | //fmt.Println(err) 178 | return nil, err 179 | } else { 180 | *temp = "[" + strs[1] 181 | arr = append(arr, arr2) 182 | return arr, err 183 | } 184 | } else { 185 | var arr2 interface{} 186 | err := json.Unmarshal([]byte(data), &arr2) 187 | if err != nil { 188 | //fmt.Println("2",data) 189 | //fmt.Println(err) 190 | return nil, err 191 | } else { 192 | *temp = "" 193 | arr = append(arr, arr2) 194 | return arr, err 195 | } 196 | } 197 | 198 | } 199 | 200 | func TCP_JSON_CUT(temp *string) (string, bool) { 201 | var arr []map[string]interface{} 202 | var arr2 map[string]interface{} 203 | var json = jsoniter.ConfigCompatibleWithStandardLibrary 204 | //var strs []string 205 | 206 | data := *temp 207 | strs := strings.Split(data, "}{") 208 | if len(strs) > 1 { 209 | for i, v := range strs { 210 | if i == 0 { 211 | strs[i] = v + "}" 212 | } else if len(strs) == i+1 { 213 | 214 | strs[i] = "{" + v 215 | } else { 216 | strs[i] = "{" + v + "}" 217 | } 218 | //fmt.Println(strs[i]) 219 | } 220 | data = "[" + strings.Join(strs, ",") + "]" 221 | err := json.Unmarshal([]byte(data), &arr) 222 | if err != nil { 223 | fmt.Println(err) 224 | } else { 225 | //fmt.Println("ss:", arr) 226 | } 227 | *temp = "" 228 | return data, true 229 | } else { 230 | err := json.Unmarshal([]byte(data), &arr2) 231 | if err != nil { 232 | //fmt.Println("2",data) 233 | //fmt.Println(err) 234 | return "", false 235 | } else { 236 | *temp = "" 237 | return data, true 238 | } 239 | } 240 | } 241 | -------------------------------------------------------------------------------- /tuuz/Net/Net.go: -------------------------------------------------------------------------------- 1 | package Net 2 | 3 | import ( 4 | "fmt" 5 | "main.go/tuuz/Array" 6 | "main.go/tuuz/Calc" 7 | "main.go/tuuz/Log" 8 | "main.go/tuuz/Redis" 9 | "net/http" 10 | "net/url" 11 | "strings" 12 | ) 13 | 14 | /* 15 | headers = map[string]string{ 16 | "User-Agent": "Sublime", 17 | "Authorization": "Bearer access_token", 18 | "Content-Type": "application/json", 19 | } 20 | 21 | cookies = map[string]string{ 22 | "userId": "12", 23 | "loginTime": "15045682199", 24 | } 25 | 26 | queries = map[string]string{ 27 | "page": "2", 28 | "act": "update", 29 | } 30 | 31 | postData = map[string]interface{}{ 32 | "name": "mike", 33 | "age": 24, 34 | "interests": []string{"basketball", "reading", "coding"}, 35 | "isAdmin": true, 36 | } 37 | */ 38 | 39 | func Post(url string, values map[string]interface{}, headers map[string]string, cookies map[string]string) (int, interface{}, error) { 40 | // 链式操作 41 | req := Request() 42 | req.SetHeaders(headers) 43 | req.SetCookies(cookies) 44 | ret, err := req.Post(url, values) 45 | body, err := ret.Body() 46 | if err != nil { 47 | return 500, "", err 48 | } else { 49 | return 0, string(body), err 50 | } 51 | } 52 | 53 | func PostCookie(url string, queries map[string]interface{}, postData map[string]interface{}, headers map[string]string, cookies map[string]string) (int, interface{}, map[string]interface{}, error) { 54 | req := Request() 55 | req.SetHeaders(headers) 56 | req.SetCookies(cookies) 57 | ret, err := req.Post(url+"?"+Http_build_query(queries), postData) 58 | body, err := ret.Body() 59 | cookie_arr := CookieHandler(ret.Cookies()) 60 | //fmt.Println(cookie_arr) 61 | if err != nil { 62 | return 500, "", cookie_arr, err 63 | } else { 64 | return 0, string(body), cookie_arr, err 65 | } 66 | } 67 | 68 | func PostCookieAuto(url string, queries map[string]interface{}, postData map[string]interface{}, headers map[string]string, ident string) (float64, interface{}, error) { 69 | req := Request() 70 | cookies, err := CookieSelector(ident) 71 | cook := Array.Mapinterface2MapString(cookies) 72 | 73 | req.SetHeaders(headers) 74 | req.SetCookies(cook) 75 | ret, err := req.Post(url+"?"+Http_build_query(queries), postData) 76 | body, err := ret.Body() 77 | 78 | cookie_arr := CookieHandler(ret.Cookies()) 79 | CookieUpdater(cookie_arr, ident) 80 | if err != nil { 81 | return 500, "", err 82 | } else { 83 | return 0, string(body), err 84 | } 85 | } 86 | 87 | func PostCookieManual(url string, queries map[string]interface{}, postData map[string]interface{}, headers map[string]string, cookie map[string]interface{}, ident string) (float64, interface{}, error) { 88 | req := Request() 89 | CookieUpdater(cookie, ident) 90 | cookies, err := CookieSelector(ident) 91 | cook := Array.Mapinterface2MapString(cookies) 92 | 93 | req.SetHeaders(headers) 94 | req.SetCookies(cook) 95 | ret, err := req.Post(url+"?"+Http_build_query(queries), postData) 96 | body, err := ret.Body() 97 | 98 | cookie_arr := CookieHandler(ret.Cookies()) 99 | CookieUpdater(cookie_arr, ident) 100 | if err != nil { 101 | return 500, "", err 102 | } else { 103 | return 0, string(body), err 104 | } 105 | } 106 | 107 | /* 108 | headers = map[string]string{ 109 | "User-Agent": "Sublime", 110 | "Authorization": "Bearer access_token", 111 | "Content-Type": "application/json", 112 | } 113 | 114 | cookies = map[string]string{ 115 | "userId": "12", 116 | "loginTime": "15045682199", 117 | } 118 | 119 | queries = map[string]string{ 120 | "page": "2", 121 | "act": "update", 122 | } 123 | */ 124 | func Get(url string, queries map[string]interface{}, headers map[string]string, cookies map[string]string) (float64, interface{}, error) { 125 | req := Request() 126 | req.SetHeaders(headers) 127 | req.SetCookies(cookies) 128 | ret, err := req.Get(url, queries) 129 | if err != nil { 130 | fmt.Println(err) 131 | return 500, "", err 132 | } 133 | body, err := ret.Body() 134 | 135 | if err != nil { 136 | return 500, "", err 137 | } else { 138 | return 0, string(body), err 139 | } 140 | } 141 | 142 | func GetCookie(url string, queries map[string]interface{}, headers map[string]string, cookies map[string]string) (float64, interface{}, map[string]interface{}, error) { 143 | req := Request() 144 | req.SetHeaders(headers) 145 | req.SetCookies(cookies) 146 | ret, err := req.Get(url, queries) 147 | body, err := ret.Body() 148 | cookie_arr := CookieHandler(ret.Cookies()) 149 | //fmt.Println(cookie_arr) 150 | if err != nil { 151 | return 500, "", cookie_arr, err 152 | } else { 153 | return 0, string(body), cookie_arr, err 154 | } 155 | } 156 | 157 | func GetCookieAuto(url string, queries map[string]interface{}, headers map[string]string, ident string) (float64, interface{}, error) { 158 | req := Request() 159 | cookies, err := CookieSelector(ident) 160 | cook := Array.Mapinterface2MapString(cookies) 161 | 162 | req.SetHeaders(headers) 163 | req.SetCookies(cook) 164 | ret, err := req.Get(url, queries) 165 | if err != nil { 166 | fmt.Println(err) 167 | return 500, "", err 168 | } 169 | body, err := ret.Body() 170 | cookie_arr := CookieHandler(ret.Cookies()) 171 | CookieUpdater(cookie_arr, ident) 172 | if err != nil { 173 | return 500, "", err 174 | } else { 175 | return 0, string(body), err 176 | } 177 | } 178 | 179 | func GetCookieManual(url string, queries map[string]interface{}, headers map[string]string, cookie map[string]interface{}, ident string) (float64, interface{}, error) { 180 | req := Request() 181 | CookieUpdater(cookie, ident) 182 | cookies, err := CookieSelector(ident) 183 | cook := Array.Mapinterface2MapString(cookies) 184 | 185 | req.SetHeaders(headers) 186 | req.SetCookies(cook) 187 | ret, err := req.Get(url, queries) 188 | if err != nil { 189 | fmt.Println(err) 190 | return 500, "", err 191 | } 192 | body, err := ret.Body() 193 | cookie_arr := CookieHandler(ret.Cookies()) 194 | CookieUpdater(cookie_arr, ident) 195 | if err != nil { 196 | return 500, "", err 197 | } else { 198 | return 0, string(body), err 199 | } 200 | } 201 | 202 | func CookieHandler(resp_headers []*http.Cookie) map[string]interface{} { 203 | cookie_arr := make(map[string]interface{}) 204 | for _, resp_header := range resp_headers { 205 | cookie_arr[resp_header.Name] = resp_header.Value 206 | } 207 | return cookie_arr 208 | } 209 | 210 | func CookieHandler2(resp_header map[string]interface{}) map[string]interface{} { 211 | cookie := strings.Split(Calc.Any2String(resp_header["Set-Cookie"]), "; ") 212 | cookie_arr := make(map[string]interface{}) 213 | for _, v := range cookie { 214 | split := strings.Split(v, "=") 215 | if CookieTagChecker(split[0]) == true { 216 | cookie_arr[split[0]] = split[1] 217 | } 218 | } 219 | return cookie_arr 220 | } 221 | 222 | func CookieUpdater(new_cookie map[string]interface{}, ident string) { 223 | user_cookie_map, err := CookieSelector(ident) 224 | if err != nil { 225 | fmt.Println(err) 226 | Log.Err(err) 227 | user_cookie_map = new_cookie 228 | } else { 229 | user_cookie_map = Array.Merge(user_cookie_map, new_cookie) 230 | } 231 | //_, err = Redis.Set("__cookie__"+ident, user_cookie_map, 30*86400) 232 | if err != nil { 233 | fmt.Println(err) 234 | Log.Err(err) 235 | return 236 | } 237 | } 238 | 239 | func CookieSelector(ident string) (map[string]interface{}, error) { 240 | user_cookie_map, err := Redis.Get("__cookie__" + ident) 241 | if err != nil { 242 | return make(map[string]interface{}), err 243 | } 244 | //fmt.Println(user_cookie_map) 245 | return user_cookie_map.(map[string]interface{}), err 246 | } 247 | 248 | func Http_build_query(querymap map[string]interface{}) string { 249 | query := make(url.Values) 250 | for k, v := range querymap { 251 | query.Add(k, Calc.Any2String(v)) 252 | } 253 | //fmt.Println(query.Encode()) 254 | return query.Encode() 255 | } 256 | -------------------------------------------------------------------------------- /main.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "html/template" 6 | "main.go/Conf" 7 | "main.go/Tcp" 8 | "main.go/tuuz/Calc" 9 | "main.go/tuuz/Jsong" 10 | "main.go/tuuz/Net" 11 | "net/http" 12 | "os/exec" 13 | ) 14 | 15 | func main() { 16 | initial() 17 | username := Conf.LoadConf("user", "username") 18 | token := Conf.LoadConf("user", "token") 19 | 20 | fmt.Println(token) 21 | if username != "" && token != "" { 22 | go Tcp.Ping(username) 23 | go Tcp.Create(username, token) 24 | } else { 25 | 26 | } 27 | //exec.Command(`cmd`, `/c`, `start`, `http://localhost/`).Start() 28 | http.HandleFunc("/", index) 29 | http.HandleFunc("/login", login) 30 | http.HandleFunc("/panel", panel) 31 | http.HandleFunc("/writelogin", writelogin) 32 | http.HandleFunc("/logproc", logproc) 33 | http.HandleFunc("/user/login", UserLoginHandler) 34 | http.HandleFunc("/setting_get", setting_get) 35 | http.HandleFunc("/setting_set", setting_set) 36 | http.HandleFunc("/captcha", captcha) 37 | // 设置静态目录 38 | fsh := http.FileServer(http.Dir("./html")) 39 | http.Handle("/html/", http.StripPrefix("/html/", fsh)) 40 | fmt.Println("正在启动程序,请访问http://127.0.0.1") 41 | //time.Sleep(5 * time.Second) 42 | if username == "" || token == "" { 43 | fmt.Println("你还没有登录,请访问上面的地址进行登录") 44 | } 45 | if Conf.SystemType() == "windows" { 46 | exec.Command(`cmd`, `/c`, `start`, `http://localhost/`).Start() 47 | } 48 | err := http.ListenAndServe("0.0.0.0:80", nil) 49 | 50 | if err != nil { 51 | if Conf.SystemType() == "windows" { 52 | exec.Command(`cmd`, `/c`, `start`, `http://localhost:79/`).Start() 53 | } 54 | fmt.Println("80端口被占用,正在使用79端口重试") 55 | fmt.Println("正在更换端口并启动程序,请访问http://127.0.0.1:79") 56 | //time.Sleep(5 * time.Second) 57 | err := http.ListenAndServe("0.0.0.0:79", nil) 58 | if err != nil { 59 | fmt.Println("79端口也被占用……程序自动停止") 60 | } 61 | } 62 | } 63 | 64 | func index(w http.ResponseWriter, r *http.Request) { 65 | w.Header().Set("Access-Control-Allow-Origin", "*") 66 | username := Conf.LoadConf("user", "username") 67 | token := Conf.LoadConf("user", "token") 68 | if username == "" || token == "" { 69 | url := "/login" 70 | http.Redirect(w, r, url, http.StatusFound) 71 | } else { 72 | url := "/panel" 73 | http.Redirect(w, r, url, http.StatusFound) 74 | } 75 | } 76 | 77 | func captcha(w http.ResponseWriter, request *http.Request) { 78 | //fmt.Println(username) 79 | ur := request.URL.Query() 80 | username := ur.Get("username") 81 | req := Net.Request() 82 | ret, _ := req.Get("http://go.bilihp.com:180/v1/index/login/bili_captcha?username=" + username) 83 | r, _ := ret.Body() 84 | w.Write(r) 85 | } 86 | 87 | func logproc(w http.ResponseWriter, request *http.Request) { 88 | username := request.PostFormValue("username") 89 | password := request.PostFormValue("password") 90 | 91 | pm := make(map[string]interface{}) 92 | pm["username"] = username 93 | pm["password"] = password 94 | req := Net.Request() 95 | ret, err := req.Post("http://go.bilihp.com:180/v1/index/login/3", pm) 96 | if err != nil { 97 | return 98 | } 99 | body, err := ret.Body() 100 | if err != nil { 101 | return 102 | } 103 | //resp_header := ret.Headers() 104 | //fmt.Println(cookie_arr) 105 | if err != nil { 106 | return 107 | } else { 108 | 109 | json, err := Jsong.JObject(string(body)) 110 | if err != nil { 111 | fmt.Println("A回传输出出错") 112 | return 113 | } 114 | 115 | code := json["code"] 116 | if code.(float64) == 0 { 117 | data, err := Jsong.ParseObject(json["data"]) 118 | if err != nil { 119 | fmt.Println("data数据错误") 120 | } 121 | header, err := Jsong.ParseObject2(data["header"]) 122 | if err != nil { 123 | fmt.Println("header-数据错误") 124 | } 125 | cookie, err := Jsong.ParseObject2(data["cookie"]) 126 | if err != nil { 127 | fmt.Println("cookie-数据错误") 128 | } 129 | values, err := Jsong.ParseObject(data["values"]) 130 | if err != nil { 131 | fmt.Println("values-数据错误") 132 | } 133 | url := Calc.Any2String(data["url"]) 134 | req2 := Net.Request() 135 | req2.SetHeaders(header) 136 | req2.SetCookies(cookie) 137 | ret, err := req2.Post(url, Net.Http_build_query(values)) 138 | if err != nil { 139 | fmt.Println("ret-数据错误") 140 | return 141 | } 142 | rtt, err := ret.Body() 143 | if err != nil { 144 | fmt.Println("rtt-数据错误") 145 | return 146 | } 147 | arr := make(map[string]interface{}) 148 | 149 | arr["statusCode"] = 200 150 | arr["body"] = Jsong.Decode(string(rtt)) 151 | req3 := Net.Request() 152 | cac := make(map[string]interface{}) 153 | cac["username"] = username 154 | cac["password"] = password 155 | cac["header"] = ret.Headers() 156 | cac["ret"], _ = Jsong.Encode(arr) 157 | ret3, err := req3.Post("http://go.bilihp.com:180/v1/index/login/ret", cac) 158 | b3, err := ret3.Body() 159 | if err != nil { 160 | fmt.Println("b3-数据错误") 161 | return 162 | } 163 | 164 | w.Write([]byte(string(b3))) 165 | } else { 166 | w.Write([]byte(body)) 167 | } 168 | } 169 | } 170 | 171 | func writelogin(w http.ResponseWriter, request *http.Request) { 172 | w.Header().Set("Access-Control-Allow-Origin", "*") 173 | fmt.Println("Handler Hello") 174 | username := request.PostFormValue("username") 175 | token := request.PostFormValue("token") 176 | Conf.SaveConf("user", "username", username) 177 | Conf.SaveConf("user", "token", token) 178 | go Tcp.Create(username, token) 179 | url := "/panel" 180 | http.Redirect(w, request, url, http.StatusFound) 181 | } 182 | 183 | func UserLoginHandler(w http.ResponseWriter, request *http.Request) { 184 | w.Header().Set("Access-Control-Allow-Origin", "*") 185 | fmt.Println("Handler Hello") 186 | fmt.Fprintf(w, "Login Success") 187 | } 188 | 189 | func login(w http.ResponseWriter, r *http.Request) { 190 | w.Header().Set("Access-Control-Allow-Origin", "*") 191 | username := Conf.LoadConf("user", "username") 192 | token := Conf.LoadConf("user", "token") 193 | if username == "" || token == "" { 194 | 195 | } else { 196 | url := "/panel" 197 | http.Redirect(w, r, url, http.StatusFound) 198 | } 199 | r.ParseForm() 200 | if r.Method == "GET" { 201 | t, err := template.ParseFiles("html/login.html") 202 | if err != nil { 203 | fmt.Fprintf(w, "parse template error: %s", err.Error()) 204 | return 205 | } 206 | t.Execute(w, nil) 207 | } else { 208 | username := r.Form["username"] 209 | password := r.Form["password"] 210 | fmt.Fprintf(w, "username = %s, password = %s", username, password) 211 | } 212 | } 213 | 214 | func panel(w http.ResponseWriter, r *http.Request) { 215 | w.Header().Set("Access-Control-Allow-Origin", "*") 216 | username := Conf.LoadConf("user", "username") 217 | token := Conf.LoadConf("user", "token") 218 | if username == "" || token == "" { 219 | url := "/login" 220 | http.Redirect(w, r, url, http.StatusFound) 221 | } 222 | r.ParseForm() 223 | if r.Method == "GET" { 224 | t, err := template.ParseFiles("html/panel.html") 225 | if err != nil { 226 | fmt.Fprintf(w, "parse template error: %s", err.Error()) 227 | return 228 | } 229 | t.Execute(w, nil) 230 | } else { 231 | username := r.Form["username"] 232 | password := r.Form["password"] 233 | fmt.Fprintf(w, "username = %s, password = %s", username, password) 234 | } 235 | } 236 | 237 | func setting_get(w http.ResponseWriter, r *http.Request) { 238 | w.Header().Set("Access-Control-Allow-Origin", "*") 239 | username := Conf.LoadConf("user", "username") 240 | token := Conf.LoadConf("user", "token") 241 | if username == "" || token == "" { 242 | url := "/login" 243 | http.Redirect(w, r, url, http.StatusFound) 244 | } 245 | Tcp.Get_settings(username) 246 | setting := Conf.LoadSec("setting") 247 | ret := make(map[string]interface{}) 248 | ret["code"] = 0 249 | ret["data"] = setting 250 | rrr, _ := Jsong.Encode(ret) 251 | w.Write([]byte(rrr)) 252 | 253 | } 254 | 255 | func setting_set(w http.ResponseWriter, r *http.Request) { 256 | w.Header().Set("Access-Control-Allow-Origin", "*") 257 | username := Conf.LoadConf("user", "username") 258 | token := Conf.LoadConf("user", "token") 259 | if username == "" || token == "" { 260 | url := "/login" 261 | http.Redirect(w, r, url, http.StatusFound) 262 | } 263 | key := r.PostFormValue("key") 264 | value := r.PostFormValue("value") 265 | fmt.Println(Calc.Any2String(value)) 266 | Conf.SaveConf("setting", Calc.Any2String(key), Calc.Any2String(value)) 267 | 268 | //_, ret, err := Net.Post("http://go.bilihp.com:180/v1/pc/setting/setting_set", map[string]interface{}{"username": username, "token": token, "key": key, "value": value}, nil, nil) 269 | //fmt.Println(ret.(string)) 270 | Tcp.Set_setting(username, key, value) 271 | //if err != nil { 272 | // fmt.Println("setting_set", err) 273 | //} else { 274 | ret := map[string]interface{}{"code": 0, "data": "设置完成"} 275 | rrr, _ := Jsong.Encode(ret) 276 | w.Write([]byte(rrr)) 277 | //} 278 | 279 | } 280 | 281 | func initial() { 282 | debug := Conf.LoadConf("debug", "debug") 283 | if debug == "" { 284 | Conf.SaveConf("debug", "debug", "true") 285 | } 286 | } 287 | -------------------------------------------------------------------------------- /html/panel.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 7 | BiliHP-助手网络GoWeb版 8 | 9 | 12 | 13 | 14 | 15 |
16 |
17 | 配置好后,可以关闭本网页,软件不受影响,如果需要再次配置,可直接访问http://127.0.0.1 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 | 93 |
94 |
95 | 96 |
97 | 98 |
99 | 100 |
101 |
102 | 103 |
104 | 105 |
106 | 107 |
108 |
109 | 110 |
111 | 112 |
113 | 114 |
115 |
116 | 117 |
118 | 119 |
120 | 121 |
122 |
123 | 124 |
125 | 126 |
127 | 128 |
129 |
130 |
131 |
132 | {{/*-------------------------------------*/}} 133 |
134 |
135 |
136 | 礼物时间设定 137 |
138 |
139 | 140 |
141 | 142 |
143 |
144 |
145 | 146 |
147 |
148 |
149 |
150 |
151 | 152 | 153 |
154 |
155 | 156 |
157 |
158 | 159 | 160 |
161 | 163 | 164 | 165 | 272 | 273 | 274 | -------------------------------------------------------------------------------- /html/css/login.css: -------------------------------------------------------------------------------- 1 | /* http://meyerweb.com/eric/tools/css/reset/ 2 | v2.0 | 20110126 3 | License: none (public domain) 4 | */ 5 | html, 6 | body, 7 | div, 8 | span, 9 | applet, 10 | object, 11 | iframe, 12 | h1, 13 | h2, 14 | h3, 15 | h4, 16 | h5, 17 | h6, 18 | p, 19 | blockquote, 20 | pre, 21 | a, 22 | abbr, 23 | acronym, 24 | address, 25 | big, 26 | cite, 27 | code, 28 | del, 29 | dfn, 30 | em, 31 | img, 32 | ins, 33 | kbd, 34 | q, 35 | s, 36 | samp, 37 | small, 38 | strike, 39 | strong, 40 | sub, 41 | sup, 42 | tt, 43 | var, 44 | b, 45 | u, 46 | i, 47 | center, 48 | dl, 49 | dt, 50 | dd, 51 | ol, 52 | ul, 53 | li, 54 | fieldset, 55 | form, 56 | label, 57 | legend, 58 | table, 59 | caption, 60 | tbody, 61 | tfoot, 62 | thead, 63 | tr, 64 | th, 65 | td, 66 | article, 67 | aside, 68 | canvas, 69 | details, 70 | embed, 71 | figure, 72 | figcaption, 73 | footer, 74 | header, 75 | hgroup, 76 | menu, 77 | nav, 78 | output, 79 | ruby, 80 | section, 81 | summary, 82 | time, 83 | mark, 84 | audio, 85 | video { 86 | margin: 0; 87 | padding: 0; 88 | border: 0; 89 | font-size: 100%; 90 | font: inherit; 91 | vertical-align: baseline; 92 | } 93 | /* HTML5 display-role reset for older browsers */ 94 | article, 95 | aside, 96 | details, 97 | figcaption, 98 | figure, 99 | footer, 100 | header, 101 | hgroup, 102 | menu, 103 | nav, 104 | section { 105 | display: block; 106 | } 107 | body { 108 | line-height: 1; 109 | } 110 | ol, 111 | ul { 112 | list-style: none; 113 | } 114 | blockquote, 115 | q { 116 | quotes: none; 117 | } 118 | blockquote:before, 119 | blockquote:after, 120 | q:before, 121 | q:after { 122 | content: ''; 123 | content: none; 124 | } 125 | table { 126 | border-collapse: collapse; 127 | border-spacing: 0; 128 | } 129 | * { 130 | box-sizing: border-box; 131 | font-family: "微软雅黑"; 132 | } 133 | /* 作者QQ:951252660 承接:网站建设 平面设计 网页设计*/ 134 | .login { 135 | width: 100vw; 136 | height: 100vh; 137 | background-image: -o-linear-gradient(bottom, #4481eb 0%, #04befe 100%); 138 | background-image: -webkit-gradient(linear, left bottom, left top, from(#4481eb), to(#04befe)); 139 | background-image: linear-gradient(to top, #4481eb 0%, #04befe 100%); 140 | } 141 | .login .center { 142 | width: 100vw; 143 | height: 100vh; 144 | display: -webkit-box; 145 | display: -webkit-flex; 146 | display: -ms-flexbox; 147 | display: flex; 148 | -webkit-box-align: center; 149 | -webkit-align-items: center; 150 | -ms-flex-align: center; 151 | align-items: center; 152 | -webkit-box-pack: center; 153 | -webkit-justify-content: center; 154 | -ms-flex-pack: center; 155 | justify-content: center; 156 | } 157 | .login .main { 158 | width: 400px; 159 | padding: 20px; 160 | min-height: 300px; 161 | background: rgba(255, 255, 255, 0.5); 162 | -webkit-box-shadow: 2px 2px 5px #017293; 163 | box-shadow: 2px 2px 5px #017293; 164 | } 165 | .login .main .title { 166 | padding-bottom: 15px; 167 | display: -webkit-box; 168 | display: -webkit-flex; 169 | display: -ms-flexbox; 170 | display: flex; 171 | height: 65px; 172 | font-weight: 100; 173 | -webkit-box-pack: center; 174 | -webkit-justify-content: center; 175 | -ms-flex-pack: center; 176 | justify-content: center; 177 | color: #fff; 178 | /* 作者QQ:951252660(转载请注明出处2019年11月15日17:42:18) 承接:网站建设 平面设计 网页设计*/ 179 | font-family: Impact, Haettenschweiler, 'Arial Narrow Bold', sans-serif; 180 | background-repeat: no-repeat; 181 | background-position: top center; 182 | background-image: url('data:image/svg+xml;%20charset=utf8,%3Csvg%20t%3D%221573811685980%22%20class%3D%22icon%22%20viewBox%3D%220%200%201024%201024%22%20version%3D%221.1%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20p-id%3D%2221396%22%20width%3D%2264%22%20height%3D%2264%22%3E%3Cpath%20d%3D%22M0%20512C0%20229.226667%20229.226667%200%20512%200s512%20229.226667%20512%20512-229.226667%20512-512%20512S0%20794.773333%200%20512z%22%20fill%3D%22%23ffffff%22%20p-id%3D%2221397%22%20data-spm-anchor-id%3D%22a313x.7781069.0.i15%22%20class%3D%22selected%22%3E%3C%2Fpath%3E%3Cpath%20d%3D%22M490.496%20296.490667L767.936%20256v243.477333l-277.44%202.197334v-205.184z%20m-25.258667%203.733333L256%20328.725333l0.192%20174.506667%20209.130667-1.194667-0.085334-201.813333z%20m0.064%20427.072l-0.170666-201.984-208.981334-1.365333%200.021334%20174.613333%20209.130666%2028.736z%20m302.634667%2042.282667L768%20527.189333l-277.888-0.448%200.384%20203.690667%20277.44%2039.146667z%22%20fill%3D%22%2300ADEF%22%20p-id%3D%2221398%22%3E%3C%2Fpath%3E%3C%2Fsvg%3E'); 183 | /* 作者QQ:951252660(转载请注明出处2019年11月15日17:42:18) 承接:网站建设 平面设计 网页设计*/ 184 | background-size: 45px 45px; 185 | } 186 | .login .main .inputLi { 187 | margin-bottom: 40px; 188 | height: 45px; 189 | display: -webkit-box; 190 | display: -webkit-flex; 191 | display: -ms-flexbox; 192 | display: flex; 193 | position: relative; 194 | /* 作者QQ:951252660(转载请注明出处) 承接:网站建设 平面设计 网页设计*/ 195 | } 196 | .login .main .inputLi input { 197 | background: #018dae; 198 | height: 70px; 199 | line-height: 70px; 200 | width: 100%; 201 | border: none; 202 | padding-left: 45px; 203 | -webkit-appearance: none; 204 | -moz-appearance: none; 205 | appearance: none; 206 | border-radius: 0; 207 | outline: none; 208 | font-weight: bold; 209 | font-size: 24px; 210 | -webkit-box-shadow: 0 2px 2px #017293 inset; 211 | box-shadow: 0 2px 2px #017293 inset; 212 | background-color: #21a8c6; 213 | color: #fff; 214 | } 215 | .login .main .inputLi input:focus { 216 | background-color: #018dae; 217 | font-weight: bold; 218 | -webkit-transition: background-color linear 300ms; 219 | -o-transition: background-color linear 300ms; 220 | transition: background-color linear 300ms; 221 | } 222 | .login .main .inputLi input::-webkit-input-placeholder { 223 | color: #018dae; 224 | font-weight: 300; 225 | font-family: "微软雅黑"; 226 | font-size: 16px; 227 | } 228 | .login .main .inputLi input::-moz-placeholder { 229 | color: #018dae; 230 | font-weight: 300; 231 | font-family: "微软雅黑"; 232 | font-size: 16px; 233 | } 234 | .login .main .inputLi input:-ms-input-placeholder { 235 | color: #018dae; 236 | font-weight: 300; 237 | font-family: "微软雅黑"; 238 | font-size: 16px; 239 | } 240 | .login .main .inputLi input::-ms-input-placeholder { 241 | color: #018dae; 242 | font-weight: 300; 243 | font-family: "微软雅黑"; 244 | font-size: 16px; 245 | } 246 | .login .main .inputLi input::placeholder { 247 | color: #ccc; 248 | font-weight: 300; 249 | font-family: "微软雅黑"; 250 | font-size: 16px; 251 | } 252 | .login .main .inputLi .user { 253 | background-image: url('data:image/svg+xml;%20charset=utf8,%3Csvg%20t%3D%221573808578480%22%20class%3D%22icon%22%20viewBox%3D%220%200%201024%201024%22%20version%3D%221.1%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20p-id%3D%223006%22%20width%3D%2264%22%20height%3D%2264%22%3E%3Cpath%20d%3D%22M266.24%20267.52a248.32%20244.48%200%201%200%20496.64%200%20248.32%20244.48%200%201%200-496.64%200Z%22%20fill%3D%22%23ffffff%22%20p-id%3D%223007%22%3E%3C%2Fpath%3E%3Cpath%20d%3D%22M628.48%20593.28H421.76a320%20320%200%200%200-320%20315.52v20.48c0%2071.04%20143.36%2071.04%20320%2071.04h206.72c177.28%200%20320%200%20320-71.04v-20.48a320%20320%200%200%200-320-315.52z%22%20fill%3D%22%23ffffff%22%20p-id%3D%223008%22%3E%3C%2Fpath%3E%3C%2Fsvg%3E'); 254 | background-repeat: no-repeat; 255 | /* 作者QQ:951252660(转载请注明出处2019-11-15 17:42:01) 承接:网站建设 平面设计 网页设计*/ 256 | background-position: left 10px center; 257 | background-size: 25px 25px; 258 | } 259 | .login .main .inputLi .pwd { 260 | background-image: url('data:image/svg+xml;%20charset=utf8,%3Csvg%20t%3D%221573808756461%22%20class%3D%22icon%22%20viewBox%3D%220%200%201024%201024%22%20version%3D%221.1%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20p-id%3D%228082%22%20width%3D%2264%22%20height%3D%2264%22%3E%3Cpath%20d%3D%22M768.64%20257.28v213.76h-98.56V261.76c0-87.68-70.976-158.72-158.08-158.72-87.04%200-158.08%2071.04-158.08%20158.72v209.28H255.36V257.28C255.36%20115.2%20370.56%200%20512%200s256.64%20115.2%20256.64%20257.28z%22%20fill%3D%22%23ffffff%22%20p-id%3D%228083%22%3E%3C%2Fpath%3E%3Cpath%20d%3D%22M847.36%20428.16H176.64a63.36%2063.36%200%200%200-56.96%2063.36v464c0%2035.264%2028.16%2064%2063.36%2064h657.92c35.264%200%2063.36-28.736%2063.36-64V491.52a63.36%2063.36%200%200%200-56.96-63.36z%20m-299.52%20307.2v101.76c0%204.48-3.84%208.32-8.256%208.32H484.48c-4.48%200-8.32-3.84-8.32-8.32v-101.76c-25.6-12.8-42.88-39.04-42.88-70.464a78.656%2078.656%200%201%201%20157.44%200c0%2031.424-17.28%2057.664-42.88%2070.464z%22%20fill%3D%22%23ffffff%22%20p-id%3D%228084%22%3E%3C%2Fpath%3E%3C%2Fsvg%3E'); 261 | background-repeat: no-repeat; 262 | background-position: left 10px center; 263 | /* 作者QQ:951252660(转载请注明出处2019年11月15日17:42:18) 承接:网站建设 平面设计 网页设计*/ 264 | background-size: 25px 25px; 265 | } 266 | .login .main .inputLi .code { 267 | background-image: url('data:image/svg+xml;%20charset=utf8,%3Csvg%20t%3D%221573809652334%22%20class%3D%22icon%22%20viewBox%3D%220%200%201024%201024%22%20version%3D%221.1%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20p-id%3D%2226754%22%20width%3D%2264%22%20height%3D%2264%22%3E%3Cpath%20d%3D%22M96.019692%20199.286154c0-8.861538%207.128615-14.454154%2021.464616-16.856616%2017.998769-2.875077%2036.076308-5.238154%2054.19323-7.128615%2024.064-2.756923%2047.931077-6.852923%2071.522462-12.248615a204.366769%20204.366769%200%200%200%2073.609846-33.201231c15.990154-10.633846%2031.192615-22.409846%2045.489231-35.249231%2013.430154-12.130462%2026.899692-24.221538%2040.369231-36.273231%2012.327385-11.067077%2025.127385-21.661538%2038.32123-31.66523a162.343385%20162.343385%200%200%201%2040.369231-22.488616v380.140308h-381.243077a3219.416615%203219.416615%200%200%201-3.072-87.394462c-0.708923-32.571077-1.063385-65.102769-1.024-97.634461m630.587077-54.193231a153.403077%20153.403077%200%200%200%2063.369846%2026.584615c23.197538%204.096%2044.977231%206.813538%2065.417847%208.152616%2020.440615%201.378462%2037.651692%202.56%2051.63323%203.584%2013.942154%201.024%2020.952615%204.923077%2020.952616%2011.736615%200%2070.852923-1.024%20133.868308-3.072%20189.085539h-379.195077V0c17.014154%204.096%2033.083077%2011.736615%2048.049231%2023.000615%2015.36%2011.539692%2029.853538%2024.182154%2043.44123%2037.809231%2013.981538%2013.981538%2028.120615%2028.475077%2042.417231%2043.441231s29.971692%2028.632615%2046.985846%2040.841846%22%20fill%3D%22%23ffffff%22%20p-id%3D%2226755%22%3E%3C%2Fpath%3E%3Cpath%20d%3D%22M439.965538%201001.511385a2768.856615%202768.856615%200%200%201-101.179076-80.738462%20909.784615%20909.784615%200%200%201-80.226462-75.618461%20559.537231%20559.537231%200%200%201-61.321846-78.178462%20511.803077%20511.803077%200%200%201-44.977231-87.394462%20613.494154%20613.494154%200%200%201-30.641231-102.715076%201061.218462%201061.218462%200%200%201-17.880615-126.188308h377.186461v568.201846a204.484923%20204.484923%200%200%201-21.464615-7.128615%20106.850462%20106.850462%200%200%201-19.495385-10.24M545.240615%20450.678154h375.099077a1052.435692%201052.435692%200%200%201-15.832615%20125.203692%20644.844308%20644.844308%200%200%201-27.608615%20100.155077c-10.870154%2029.538462-24.891077%2057.816615-41.905231%2084.322462-17.723077%2027.214769-37.533538%2053.011692-59.273846%2077.154461a1154.402462%201154.402462%200%200%201-79.202462%2079.714462c-33.476923%2030.759385-67.229538%2061.243077-101.179077%2091.490461a134.537846%20134.537846%200%200%201-50.097231%2015.320616v-573.361231%22%20fill%3D%22%23ffffff%22%20p-id%3D%2226756%22%3E%3C%2Fpath%3E%3C%2Fsvg%3E'); 268 | background-repeat: no-repeat; 269 | background-position: left 10px center; 270 | background-size: 25px 25px; 271 | padding-right: 80px; 272 | -webkit-box-flex: 1; 273 | -webkit-flex: 1; 274 | -ms-flex: 1; 275 | flex: 1; 276 | } 277 | .login .main .inputLi .codeImg { 278 | width: 200px; 279 | height: 65px; 280 | position: absolute; 281 | top: 2px; 282 | right: 2px; 283 | z-index: 99; 284 | cursor: pointer; 285 | } 286 | .login .main .inputLi .codeImg:active { 287 | opacity: 0.8; 288 | } 289 | .login .main .button-group { 290 | display: -webkit-box; 291 | display: -webkit-flex; 292 | display: -ms-flexbox; 293 | display: flex; 294 | } 295 | .login .main .button-group button { 296 | -webkit-box-flex: 1; 297 | -webkit-flex: 1; 298 | -ms-flex: 1; 299 | flex: 1; 300 | -webkit-appearance: none; 301 | -moz-appearance: none; 302 | appearance: none; 303 | border: none; 304 | height: 45px; 305 | border-radius: 0; 306 | outline: none; 307 | cursor: pointer; 308 | font-weight: bold; 309 | font-size: 18px; 310 | color: #fff; 311 | -webkit-box-sizing: border-box; 312 | box-sizing: border-box; 313 | display: -webkit-box; 314 | display: -webkit-flex; 315 | display: -ms-flexbox; 316 | display: flex; 317 | -webkit-box-pack: center; 318 | -webkit-justify-content: center; 319 | -ms-flex-pack: center; 320 | justify-content: center; 321 | -webkit-box-align: center; 322 | -webkit-align-items: center; 323 | -ms-flex-align: center; 324 | align-items: center; 325 | background: #007193; 326 | letter-spacing: 10px; 327 | /* 作者QQ:951252660(转载请注明出处2019年11月15日17:42:18) 承接:网站建设 平面设计 网页设计*/ 328 | border-top: 2px solid #0097c4; 329 | border-bottom: 3px solid #01566f; 330 | } 331 | .login .main .button-group button:active { 332 | background: #006685; 333 | } 334 | -------------------------------------------------------------------------------- /Action/ActionRoute/ActionRoute.go: -------------------------------------------------------------------------------- 1 | package ActionRoute 2 | 3 | import ( 4 | "fmt" 5 | "main.go/Common/update" 6 | "main.go/Conf" 7 | "main.go/tuuz/Calc" 8 | "main.go/tuuz/Jsong" 9 | "main.go/tuuz/RET" 10 | "net" 11 | "os" 12 | "strings" 13 | "time" 14 | ) 15 | 16 | func ActionRoute(jobject map[string]interface{}, username string, conn *net.TCPConn) { 17 | defer func() { 18 | err := recover() 19 | if err != nil { 20 | fmt.Println("----ActionRoute-recover----") 21 | fmt.Println(err) 22 | } 23 | }() 24 | code := Calc.Any2Int(jobject["code"]) 25 | if code == -1 { 26 | ecam2(conn, "[登录信息]:", "登录信息错误!", "") 27 | Conf.SaveConf("user", "username", "") 28 | Conf.SaveConf("user", "token", "") 29 | os.Exit(1) 30 | return 31 | } 32 | typ := Calc.Any2String(jobject["type"]) 33 | ret := jobject["data"] 34 | echo := Calc.Any2String(jobject["echo"]) 35 | 36 | switch typ { 37 | case "orign": 38 | fmt.Println(ret) 39 | break 40 | 41 | case "app": 42 | PCRoute(jobject, username, conn) 43 | break 44 | 45 | case "supercurl": 46 | ecam2(conn, "", ret, "") 47 | break 48 | 49 | case "info": 50 | ecam2(conn, "", ret, "") 51 | break 52 | 53 | case "warning": 54 | ecam2(conn, "", ret, "") 55 | break 56 | 57 | case "error": 58 | ecam2(conn, "", ret, "") 59 | break 60 | 61 | case "update": 62 | ecam2(conn, "", echo, "") 63 | update.DoUpdate() 64 | break 65 | 66 | case "force_update": 67 | fmt.Println(echo) 68 | //if Conf.SystemType() == "windows" { 69 | // exec.Command(`cmd`, `/c`, `start`, Calc.Any2String(ret)).Start() 70 | //} 71 | //if Conf.SystemType() == "linux" { 72 | // fmt.Println("请执行:" + Calc.Any2String(ret)) 73 | // fmt.Println("------------------START------------------") 74 | // fmt.Println("wget " + Calc.Any2String(ret)) 75 | // fmt.Println("------------------END------------------") 76 | //} 77 | update.DoUpdate() 78 | os.Exit(1) 79 | break 80 | 81 | case "reinit": 82 | token := Conf.LoadConf("user", "token") 83 | data := make(map[string]interface{}) 84 | data["username"] = username 85 | data["token"] = token 86 | Send(*conn, RET.Ws_succ("init", 0, data, "init")) 87 | break 88 | 89 | case "debug": 90 | if Conf.LoadConf("debug", "debug") == "true" { 91 | ecam2(conn, "[BiliHP-Debug]:", ret, "") 92 | } 93 | break 94 | 95 | case "other": 96 | ecam2(conn, "[BiliHP-Other]:", ret, "") 97 | break 98 | 99 | case "ecam": 100 | ecam2(conn, "[BiliHP-ECAM]:", ret, "") 101 | break 102 | 103 | case "alert": 104 | ecam2(conn, "[BiliHP-Alert]:", ret, "") 105 | break 106 | 107 | case "login": 108 | ecam2(conn, "[BiliHP-Login]:", ret, "") 109 | break 110 | 111 | case "loged": 112 | ecam2(conn, "[BiliHP-Loged]:", ret, "") 113 | break 114 | 115 | case "clear": 116 | fmt.Println(ret) 117 | break 118 | 119 | case "notam": 120 | ecam2(conn, "[BiliHP-NOTAM]:", ret, "") 121 | break 122 | 123 | case "system": 124 | ecam2(conn, "[BiliHP-系统消息]:", ret, "") 125 | break 126 | 127 | case "pong": 128 | if Conf.LoadConf("debug", "debug") == "true" { 129 | ecam("[BiliHP-Ping]:", ret, "") 130 | } 131 | break 132 | 133 | case "curl": 134 | rets, err := Jsong.ParseObject(ret) 135 | if err != nil { 136 | fmt.Println("CURL信息不正确") 137 | } else { 138 | var header, err2 = Jsong.ParseObject(rets["header"]) 139 | if err2 != nil { 140 | ecam2(conn, "[BiliHP-LOCAL-ERROR]:", err2, "") 141 | break 142 | } 143 | var values, err3 = Jsong.ParseObject(rets["values"]) 144 | if err3 != nil { 145 | ecam2(conn, "[BiliHP-LOCAL-ERROR]:", err3, "") 146 | break 147 | } 148 | var cookie, err4 = Jsong.ParseObject(rets["cookie"]) 149 | if err4 != nil { 150 | ecam2(conn, "[BiliHP-LOCAL-ERROR]:", err4, "") 151 | break 152 | } 153 | var url = Calc.Any2String(rets["url"]) 154 | var method = Calc.Any2String(rets["method"]) 155 | var route = Calc.Any2String(rets["route"]) 156 | var typ = Calc.Any2String(rets["type"]) 157 | var delay = Calc.Any2Float64(rets["delay"]) 158 | ecam2(conn, "", echo, "") 159 | go Curl(url, method, values, header, cookie, typ, echo, *conn, route, delay) 160 | } 161 | break 162 | 163 | case "join_room": 164 | rets, err := Jsong.ParseObject(ret) 165 | if err != nil { 166 | fmt.Println("CURL信息不正确") 167 | } else { 168 | var header, err2 = Jsong.ParseObject(rets["header"]) 169 | if err2 != nil { 170 | ecam2(conn, "[BiliHP-LOCAL-ERROR]:", err2, "") 171 | break 172 | } 173 | var values, err3 = Jsong.ParseObject(rets["values"]) 174 | if err3 != nil { 175 | ecam2(conn, "[BiliHP-LOCAL-ERROR]:", err3, "") 176 | break 177 | } 178 | var cookie, err4 = Jsong.ParseObject(rets["cookie"]) 179 | if err4 != nil { 180 | ecam2(conn, "[BiliHP-LOCAL-ERROR]:", err4, "") 181 | break 182 | } 183 | var url = Calc.Any2String(rets["url"]) 184 | var method = Calc.Any2String(rets["method"]) 185 | var route = Calc.Any2String(rets["route"]) 186 | var typ = Calc.Any2String(rets["type"]) 187 | var delay = Calc.Any2Float64(rets["delay"]) 188 | ecam2(conn, "", echo, "") 189 | if Conf.LoadConf("setting", "join_room") == "1" { 190 | go Curl(url, method, values, header, cookie, typ, echo, *conn, route, delay) 191 | } 192 | } 193 | break 194 | 195 | case "gift": 196 | rets, err := Jsong.ParseObject(ret) 197 | if err != nil { 198 | fmt.Println("CURL信息不正确") 199 | } else { 200 | var header, err2 = Jsong.ParseObject(rets["header"]) 201 | if err2 != nil { 202 | ecam2(conn, "[BiliHP-LOCAL-ERROR]:", err2, "") 203 | break 204 | } 205 | var values, err3 = Jsong.ParseObject(rets["values"]) 206 | if err3 != nil { 207 | ecam2(conn, "[BiliHP-LOCAL-ERROR]:", err3, "") 208 | break 209 | } 210 | var cookie, err4 = Jsong.ParseObject(rets["cookie"]) 211 | if err4 != nil { 212 | ecam2(conn, "[BiliHP-LOCAL-ERROR]:", err4, "") 213 | break 214 | } 215 | var url = Calc.Any2String(rets["url"]) 216 | var method = Calc.Any2String(rets["method"]) 217 | var route = Calc.Any2String(rets["route"]) 218 | var typ = Calc.Any2String(rets["type"]) 219 | var delay = Calc.Any2Float64(rets["delay"]) 220 | ecam2(conn, "", echo, "") 221 | if Conf.LoadConf("setting", "raffle") == "1" { 222 | Time := Conf.LoadConf("setting", "time") 223 | ok, reason := Gift_check(Time) 224 | if !ok { 225 | ecam2(conn, "", "[BiliHP-Security]+"+reason, "") 226 | break 227 | } 228 | Percent := Conf.LoadConf("setting", "percent") 229 | ok2, reason2 := Gift_ratio(Calc.Any2Int(Percent)) 230 | if !ok2 { 231 | ecam2(conn, "", "[BiliHP-Security]+"+reason2, "") 232 | break 233 | } 234 | go Curl(url, method, values, header, cookie, typ, echo, *conn, route, delay) 235 | } else { 236 | ecam2(conn, "", "小电视-领取被关闭", "") 237 | //fmt.Println("小电视-领取被关闭") 238 | } 239 | } 240 | break 241 | 242 | case "guard": 243 | rets, err := Jsong.ParseObject(ret) 244 | if err != nil { 245 | fmt.Println("CURL信息不正确") 246 | } else { 247 | var header, err2 = Jsong.ParseObject(rets["header"]) 248 | if err2 != nil { 249 | ecam2(conn, "[BiliHP-LOCAL-ERROR]:", err2, "") 250 | break 251 | } 252 | var values, err3 = Jsong.ParseObject(rets["values"]) 253 | if err3 != nil { 254 | ecam2(conn, "[BiliHP-LOCAL-ERROR]:", err3, "") 255 | break 256 | } 257 | var cookie, err4 = Jsong.ParseObject(rets["cookie"]) 258 | if err4 != nil { 259 | ecam2(conn, "[BiliHP-LOCAL-ERROR]:", err4, "") 260 | break 261 | } 262 | var url = Calc.Any2String(rets["url"]) 263 | var method = Calc.Any2String(rets["method"]) 264 | var route = Calc.Any2String(rets["route"]) 265 | var typ = Calc.Any2String(rets["type"]) 266 | var delay = Calc.Any2Float64(rets["delay"]) 267 | ecam2(conn, "", echo, "") 268 | if Conf.LoadConf("setting", "guard") == "1" { 269 | Time := Conf.LoadConf("setting", "time") 270 | ok, reason := Gift_check(Time) 271 | if !ok { 272 | ecam2(conn, "", "[BiliHP-Security]+"+reason, "") 273 | break 274 | } 275 | Percent := Conf.LoadConf("setting", "percent") 276 | ok2, reason2 := Gift_ratio(Calc.Any2Int(Percent)) 277 | if !ok2 { 278 | ecam2(conn, "", "[BiliHP-Security]+"+reason2, "") 279 | break 280 | } 281 | go Curl(url, method, values, header, cookie, typ, echo, *conn, route, delay) 282 | } else { 283 | ecam2(conn, "", "总督-领取被关闭", "") 284 | } 285 | } 286 | break 287 | 288 | case "tianxuan": 289 | rets, err := Jsong.ParseObject(ret) 290 | if err != nil { 291 | fmt.Println("CURL信息不正确") 292 | } else { 293 | var header, err2 = Jsong.ParseObject(rets["header"]) 294 | if err2 != nil { 295 | ecam2(conn, "[BiliHP-LOCAL-ERROR]:", err2, "") 296 | break 297 | } 298 | var values, err3 = Jsong.ParseObject(rets["values"]) 299 | if err3 != nil { 300 | ecam2(conn, "[BiliHP-LOCAL-ERROR]:", err3, "") 301 | break 302 | } 303 | var cookie, err4 = Jsong.ParseObject(rets["cookie"]) 304 | if err4 != nil { 305 | ecam2(conn, "[BiliHP-LOCAL-ERROR]:", err4, "") 306 | break 307 | } 308 | var url = Calc.Any2String(rets["url"]) 309 | var method = Calc.Any2String(rets["method"]) 310 | var route = Calc.Any2String(rets["route"]) 311 | var typ = Calc.Any2String(rets["type"]) 312 | var delay = Calc.Any2Float64(rets["delay"]) 313 | ecam2(conn, "", echo, "") 314 | if Conf.LoadConf("setting", "tianxuan") == "1" { 315 | Time := Conf.LoadConf("setting", "time") 316 | ok, reason := Gift_check(Time) 317 | if !ok { 318 | ecam2(conn, "", "[BiliHP-Security]+"+reason, "") 319 | break 320 | } 321 | Percent := Conf.LoadConf("setting", "percent") 322 | ok2, reason2 := Gift_ratio(Calc.Any2Int(Percent)) 323 | if !ok2 { 324 | ecam2(conn, "", "[BiliHP-Security]+"+reason2, "") 325 | break 326 | } 327 | bw := Conf.LoadConf("setting", "ban_words") 328 | bws := strings.Split(bw, ",") 329 | bdm := Conf.LoadConf("setting", "ban_danmu") 330 | bdms := strings.Split(bdm, ",") 331 | wdm := Conf.LoadConf("setting", "white_words") 332 | wdms := strings.Split(wdm, ",") 333 | mr := Conf.LoadConf("setting", "medal_room") 334 | mrs := strings.Split(mr, ",") 335 | br := Conf.LoadConf("setting", "ban_room") 336 | brs := strings.Split(br, ",") 337 | obj, ess := Jsong.ParseObject(jobject["object"]) 338 | cont := true 339 | if ess != nil { 340 | 341 | } else { 342 | for _, word := range brs { 343 | if Calc.Any2String(obj["room_id"]) == word && len(word) > 1 { 344 | cont = false 345 | fmt.Println("触发天选屏蔽房间:", bws) 346 | ecam2(conn, "", "天选时刻-房间号"+Calc.Any2String(obj["room_id"])+"在屏蔽房间("+word+")中,不参与", "") 347 | break 348 | } 349 | } 350 | if cont { 351 | for _, word := range bws { 352 | if strings.Contains(strings.ToLower(Calc.Any2String(obj["award_name"])), strings.ToLower(word)) && len(word) > 1 { 353 | cont = false 354 | fmt.Println("设定屏蔽词:", bws) 355 | ecam2(conn, "", "天选时刻-奖品"+Calc.Any2String(obj["award_name"])+"与("+word+")匹配,不参与", "") 356 | break 357 | } 358 | } 359 | } 360 | if cont { 361 | for _, dm := range bdms { 362 | if strings.Contains(strings.ToLower(Calc.Any2String(obj["danmu"])), strings.ToLower(dm)) && len(dm) > 1 { 363 | cont = false 364 | fmt.Println("触发弹幕屏蔽词:", dm) 365 | ecam2(conn, "", "天选时刻-弹幕"+Calc.Any2String(obj["danmu"])+"与("+dm+")匹配,不参与", "") 366 | break 367 | } 368 | } 369 | } 370 | if Conf.LoadConf("setting", "blacklist_first") == "1" { 371 | if !cont { 372 | break 373 | } 374 | } 375 | if Conf.LoadConf("setting", "use_white") == "1" { 376 | for _, word := range wdms { 377 | cont = false 378 | if strings.Contains(strings.ToLower(Calc.Any2String(obj["award_name"])), strings.ToLower(word)) && len(word) > 1 { 379 | cont = true 380 | fmt.Println("触发天选白名单:", bws) 381 | ecam2(conn, "", "天选时刻-奖品"+Calc.Any2String(obj["award_name"])+"与("+word+")匹配,正常参与", "") 382 | break 383 | } 384 | } 385 | } 386 | if cont && Calc.Any2String(obj["need_medal"]) == "1" { 387 | cont = false 388 | for _, word := range mrs { 389 | if Calc.Any2String(obj["room_id"]) == word && len(word) > 1 { 390 | cont = true 391 | break 392 | } 393 | if !cont { 394 | ecam2(conn, "", "你没有该主播抽奖所需的需要2级勋章,自动跳过", "") 395 | } 396 | } 397 | } 398 | } 399 | if cont { 400 | go Curl(url, method, values, header, cookie, typ, echo, *conn, route, delay) 401 | } 402 | } else { 403 | ecam2(conn, "", "天选时刻-领取被关闭", "") 404 | } 405 | } 406 | break 407 | 408 | case "box": 409 | rets, err := Jsong.ParseObject(ret) 410 | if err != nil { 411 | fmt.Println("CURL信息不正确") 412 | } else { 413 | var header, err2 = Jsong.ParseObject(rets["header"]) 414 | if err2 != nil { 415 | ecam2(conn, "[BiliHP-LOCAL-ERROR]:", err2, "") 416 | break 417 | } 418 | var values, err3 = Jsong.ParseObject(rets["values"]) 419 | if err3 != nil { 420 | ecam2(conn, "[BiliHP-LOCAL-ERROR]:", err3, "") 421 | break 422 | } 423 | var cookie, err4 = Jsong.ParseObject(rets["cookie"]) 424 | if err4 != nil { 425 | ecam2(conn, "[BiliHP-LOCAL-ERROR]:", err4, "") 426 | break 427 | } 428 | var url = Calc.Any2String(rets["url"]) 429 | var method = Calc.Any2String(rets["method"]) 430 | var route = Calc.Any2String(rets["route"]) 431 | var typ = Calc.Any2String(rets["type"]) 432 | var delay = Calc.Any2Float64(rets["delay"]) 433 | 434 | ecam2(conn, "", echo, "") 435 | 436 | if Conf.LoadConf("setting", "box") == "1" { 437 | Time := Conf.LoadConf("setting", "time") 438 | ok, reason := Gift_check(Time) 439 | if !ok { 440 | ecam2(conn, "", "[BiliHP-Security]+"+reason, "") 441 | break 442 | } 443 | Percent := Conf.LoadConf("setting", "percent") 444 | ok2, reason2 := Gift_ratio(Calc.Any2Int(Percent)) 445 | if !ok2 { 446 | ecam2(conn, "", "[BiliHP-Security]+"+reason2, "") 447 | break 448 | } 449 | bw := Conf.LoadConf("setting", "ban_words") 450 | bws := strings.Split(bw, ",") 451 | obj, ess := Jsong.ParseObject(jobject["object"]) 452 | cont := true 453 | if ess != nil { 454 | 455 | } else { 456 | for _, word := range bws { 457 | if strings.Contains(Calc.Any2String(obj["title"]), word) && len(word) > 1 { 458 | cont = false 459 | fmt.Println("设定屏蔽词:", bws) 460 | ecam2(conn, "", "活动抽奖-奖品"+Calc.Any2String(obj["award_name"])+"与("+word+")匹配,不参与", "") 461 | break 462 | } 463 | } 464 | } 465 | if cont { 466 | go Curl(url, method, values, header, cookie, typ, echo, *conn, route, delay) 467 | } 468 | 469 | } else { 470 | ecam2(conn, "", "活动抽奖-领取被关闭", "") 471 | } 472 | } 473 | break 474 | 475 | case "pk": 476 | rets, err := Jsong.ParseObject(ret) 477 | if err != nil { 478 | fmt.Println("CURL信息不正确") 479 | } else { 480 | var header, err2 = Jsong.ParseObject(rets["header"]) 481 | if err2 != nil { 482 | ecam2(conn, "[BiliHP-LOCAL-ERROR]:", err2, "") 483 | break 484 | } 485 | var values, err3 = Jsong.ParseObject(rets["values"]) 486 | if err3 != nil { 487 | ecam2(conn, "[BiliHP-LOCAL-ERROR]:", err3, "") 488 | break 489 | } 490 | var cookie, err4 = Jsong.ParseObject(rets["cookie"]) 491 | if err4 != nil { 492 | ecam2(conn, "[BiliHP-LOCAL-ERROR]:", err4, "") 493 | break 494 | } 495 | var url = Calc.Any2String(rets["url"]) 496 | var method = Calc.Any2String(rets["method"]) 497 | var route = Calc.Any2String(rets["route"]) 498 | var typ = Calc.Any2String(rets["type"]) 499 | var delay = Calc.Any2Float64(rets["delay"]) 500 | ecam2(conn, "", echo, "") 501 | if Conf.LoadConf("setting", "pk") == "1" { 502 | Time := Conf.LoadConf("setting", "time") 503 | ok, reason := Gift_check(Time) 504 | if !ok { 505 | ecam2(conn, "", "[BiliHP-Security]+"+reason, "") 506 | break 507 | } 508 | Percent := Conf.LoadConf("setting", "percent") 509 | ok2, reason2 := Gift_ratio(Calc.Any2Int(Percent)) 510 | if !ok2 { 511 | ecam2(conn, "", "[BiliHP-Security]+"+reason2, "") 512 | break 513 | } 514 | go Curl(url, method, values, header, cookie, typ, echo, *conn, route, delay) 515 | } else { 516 | ecam2(conn, "", "天选时刻-领取被关闭", "") 517 | } 518 | } 519 | break 520 | 521 | case "storm", "STORM": 522 | rets, err := Jsong.ParseObject(ret) 523 | if err != nil { 524 | fmt.Println("CURL信息不正确") 525 | } else { 526 | var header, err2 = Jsong.ParseObject(rets["header"]) 527 | if err2 != nil { 528 | ecam2(conn, "[BiliHP-LOCAL-ERROR]:", err2, "") 529 | break 530 | } 531 | var values, err3 = Jsong.ParseObject(rets["values"]) 532 | if err3 != nil { 533 | ecam2(conn, "[BiliHP-LOCAL-ERROR]:", err3, "") 534 | break 535 | } 536 | var cookie, err4 = Jsong.ParseObject(rets["cookie"]) 537 | if err4 != nil { 538 | ecam2(conn, "[BiliHP-LOCAL-ERROR]:", err4, "") 539 | break 540 | } 541 | var url = Calc.Any2String(rets["url"]) 542 | var method = Calc.Any2String(rets["method"]) 543 | var route = Calc.Any2String(rets["route"]) 544 | var typ = Calc.Any2String(rets["type"]) 545 | var delay = Calc.Any2Float64(rets["delay"]) 546 | ecam2(conn, "", echo, "") 547 | if Conf.LoadConf("setting", "storm") == "1" { 548 | Time := Conf.LoadConf("setting", "time") 549 | ok, reason := Gift_check(Time) 550 | if !ok { 551 | ecam2(conn, "", "[BiliHP-Security]+"+reason, "") 552 | break 553 | } 554 | Percent := Conf.LoadConf("setting", "percent") 555 | ok2, reason2 := Gift_ratio(Calc.Any2Int(Percent)) 556 | if !ok2 { 557 | ecam2(conn, "", "[BiliHP-Security]+"+reason2, "") 558 | break 559 | } 560 | go Curl(url, method, values, header, cookie, typ, echo, *conn, route, delay) 561 | } else { 562 | ecam2(conn, "", "节奏风暴-领取被关闭", "") 563 | } 564 | } 565 | break 566 | 567 | default: 568 | fmt.Println("undefine-route", typ, ret, echo) 569 | break 570 | 571 | } 572 | } 573 | 574 | func Gift_check(Time string) (bool, string) { 575 | timing := time.Now().Hour() 576 | times, err := Jsong.JObject(Time) 577 | if err != nil { 578 | return true, "解析出错,本时段自动启用" 579 | } else { 580 | for timer, bool := range times { 581 | if timer == "t"+Calc.Any2String(timing) { 582 | if bool == true { 583 | return true, "本时段可用" 584 | } 585 | } 586 | 587 | } 588 | } 589 | return false, "本时段用户不参与抢礼物,如需启用,请在PC/C2C远程设置中开启" 590 | } 591 | 592 | func Gift_ratio(ratio int) (bool, string) { 593 | num := Calc.Rand(1, 100) 594 | if num < ratio { 595 | return true, "概率系统自动捕捉" + Calc.Any2String(num) 596 | } else { 597 | return false, "概率系统自动跳过" + Calc.Any2String(num) 598 | } 599 | } 600 | 601 | func ecam(msg interface{}, ret interface{}, color string) { 602 | fmt.Println(msg, ret, color) 603 | } 604 | 605 | func ecam2(conn *net.TCPConn, msg interface{}, ret interface{}, color string) { 606 | ecam(msg, ret, color) 607 | Send(*conn, SendObj("send_app", msg, "", ret)) 608 | } 609 | 610 | func SendObj(typ string, data interface{}, echo string, values interface{}) string { 611 | obj := make(map[string]interface{}) 612 | obj["type"] = typ 613 | obj["data"] = data 614 | obj["echo"] = echo 615 | obj["values"] = values 616 | ret, _ := Jsong.Encode(obj) 617 | return ret 618 | } 619 | 620 | func Send(conn net.TCPConn, message string) bool { 621 | words := message 622 | //fmt.Println(words) 623 | _, err := conn.Write([]byte(words)) //给服务器发信息 624 | 625 | if err != nil { 626 | fmt.Println(conn.RemoteAddr().String(), "服务器发送失败,检测到断线,开始重连") 627 | return false 628 | } else { 629 | return true 630 | } 631 | } 632 | 633 | func Reconnect(conn *net.TCPConn) { 634 | server := Conf.Addr 635 | tcpAddr, err := net.ResolveTCPAddr("tcp4", server) 636 | if err != nil { 637 | fmt.Println("重连故障:", err) 638 | } 639 | conn, err = net.DialTCP("tcp", nil, tcpAddr) 640 | } 641 | -------------------------------------------------------------------------------- /html/login.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 登录 9 | 10 | 49 | 50 | 51 | 52 | 53 |
54 |
55 |
56 |
57 |
58 | 60 |
61 |
62 | 63 |
64 | 65 |
66 | 67 |
68 |
69 |
70 |
71 | 73 | 74 | 82 | 154 | 155 | 156 | 157 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU General Public License is a free, copyleft license for 11 | software and other kinds of works. 12 | 13 | The licenses for most software and other practical works are designed 14 | to take away your freedom to share and change the works. By contrast, 15 | the GNU General Public License is intended to guarantee your freedom to 16 | share and change all versions of a program--to make sure it remains free 17 | software for all its users. We, the Free Software Foundation, use the 18 | GNU General Public License for most of our software; it applies also to 19 | any other work released this way by its authors. You can apply it to 20 | your programs, too. 21 | 22 | When we speak of free software, we are referring to freedom, not 23 | price. Our General Public Licenses are designed to make sure that you 24 | have the freedom to distribute copies of free software (and charge for 25 | them if you wish), that you receive source code or can get it if you 26 | want it, that you can change the software or use pieces of it in new 27 | free programs, and that you know you can do these things. 28 | 29 | To protect your rights, we need to prevent others from denying you 30 | these rights or asking you to surrender the rights. Therefore, you have 31 | certain responsibilities if you distribute copies of the software, or if 32 | you modify it: responsibilities to respect the freedom of others. 33 | 34 | For example, if you distribute copies of such a program, whether 35 | gratis or for a fee, you must pass on to the recipients the same 36 | freedoms that you received. You must make sure that they, too, receive 37 | or can get the source code. And you must show them these terms so they 38 | know their rights. 39 | 40 | Developers that use the GNU GPL protect your rights with two steps: 41 | (1) assert copyright on the software, and (2) offer you this License 42 | giving you legal permission to copy, distribute and/or modify it. 43 | 44 | For the developers' and authors' protection, the GPL clearly explains 45 | that there is no warranty for this free software. For both users' and 46 | authors' sake, the GPL requires that modified versions be marked as 47 | changed, so that their problems will not be attributed erroneously to 48 | authors of previous versions. 49 | 50 | Some devices are designed to deny users access to install or run 51 | modified versions of the software inside them, although the manufacturer 52 | can do so. This is fundamentally incompatible with the aim of 53 | protecting users' freedom to change the software. The systematic 54 | pattern of such abuse occurs in the area of products for individuals to 55 | use, which is precisely where it is most unacceptable. Therefore, we 56 | have designed this version of the GPL to prohibit the practice for those 57 | products. If such problems arise substantially in other domains, we 58 | stand ready to extend this provision to those domains in future versions 59 | of the GPL, as needed to protect the freedom of users. 60 | 61 | Finally, every program is threatened constantly by software patents. 62 | States should not allow patents to restrict development and use of 63 | software on general-purpose computers, but in those that do, we wish to 64 | avoid the special danger that patents applied to a free program could 65 | make it effectively proprietary. To prevent this, the GPL assures that 66 | patents cannot be used to render the program non-free. 67 | 68 | The precise terms and conditions for copying, distribution and 69 | modification follow. 70 | 71 | TERMS AND CONDITIONS 72 | 73 | 0. Definitions. 74 | 75 | "This License" refers to version 3 of the GNU General Public License. 76 | 77 | "Copyright" also means copyright-like laws that apply to other kinds of 78 | works, such as semiconductor masks. 79 | 80 | "The Program" refers to any copyrightable work licensed under this 81 | License. Each licensee is addressed as "you". "Licensees" and 82 | "recipients" may be individuals or organizations. 83 | 84 | To "modify" a work means to copy from or adapt all or part of the work 85 | in a fashion requiring copyright permission, other than the making of an 86 | exact copy. The resulting work is called a "modified version" of the 87 | earlier work or a work "based on" the earlier work. 88 | 89 | A "covered work" means either the unmodified Program or a work based 90 | on the Program. 91 | 92 | To "propagate" a work means to do anything with it that, without 93 | permission, would make you directly or secondarily liable for 94 | infringement under applicable copyright law, except executing it on a 95 | computer or modifying a private copy. Propagation includes copying, 96 | distribution (with or without modification), making available to the 97 | public, and in some countries other activities as well. 98 | 99 | To "convey" a work means any kind of propagation that enables other 100 | parties to make or receive copies. Mere interaction with a user through 101 | a computer network, with no transfer of a copy, is not conveying. 102 | 103 | An interactive user interface displays "Appropriate Legal Notices" 104 | to the extent that it includes a convenient and prominently visible 105 | feature that (1) displays an appropriate copyright notice, and (2) 106 | tells the user that there is no warranty for the work (except to the 107 | extent that warranties are provided), that licensees may convey the 108 | work under this License, and how to view a copy of this License. If 109 | the interface presents a list of user commands or options, such as a 110 | menu, a prominent item in the list meets this criterion. 111 | 112 | 1. Source Code. 113 | 114 | The "source code" for a work means the preferred form of the work 115 | for making modifications to it. "Object code" means any non-source 116 | form of a work. 117 | 118 | A "Standard Interface" means an interface that either is an official 119 | standard defined by a recognized standards body, or, in the case of 120 | interfaces specified for a particular programming language, one that 121 | is widely used among developers working in that language. 122 | 123 | The "System Libraries" of an executable work include anything, other 124 | than the work as a whole, that (a) is included in the normal form of 125 | packaging a Major Component, but which is not part of that Major 126 | Component, and (b) serves only to enable use of the work with that 127 | Major Component, or to implement a Standard Interface for which an 128 | implementation is available to the public in source code form. A 129 | "Major Component", in this context, means a major essential component 130 | (kernel, window system, and so on) of the specific operating system 131 | (if any) on which the executable work runs, or a compiler used to 132 | produce the work, or an object code interpreter used to run it. 133 | 134 | The "Corresponding Source" for a work in object code form means all 135 | the source code needed to generate, install, and (for an executable 136 | work) run the object code and to modify the work, including scripts to 137 | control those activities. However, it does not include the work's 138 | System Libraries, or general-purpose tools or generally available free 139 | programs which are used unmodified in performing those activities but 140 | which are not part of the work. For example, Corresponding Source 141 | includes interface definition files associated with source files for 142 | the work, and the source code for shared libraries and dynamically 143 | linked subprograms that the work is specifically designed to require, 144 | such as by intimate data communication or control flow between those 145 | subprograms and other parts of the work. 146 | 147 | The Corresponding Source need not include anything that users 148 | can regenerate automatically from other parts of the Corresponding 149 | Source. 150 | 151 | The Corresponding Source for a work in source code form is that 152 | same work. 153 | 154 | 2. Basic Permissions. 155 | 156 | All rights granted under this License are granted for the term of 157 | copyright on the Program, and are irrevocable provided the stated 158 | conditions are met. This License explicitly affirms your unlimited 159 | permission to run the unmodified Program. The output from running a 160 | covered work is covered by this License only if the output, given its 161 | content, constitutes a covered work. This License acknowledges your 162 | rights of fair use or other equivalent, as provided by copyright law. 163 | 164 | You may make, run and propagate covered works that you do not 165 | convey, without conditions so long as your license otherwise remains 166 | in force. You may convey covered works to others for the sole purpose 167 | of having them make modifications exclusively for you, or provide you 168 | with facilities for running those works, provided that you comply with 169 | the terms of this License in conveying all material for which you do 170 | not control copyright. Those thus making or running the covered works 171 | for you must do so exclusively on your behalf, under your direction 172 | and control, on terms that prohibit them from making any copies of 173 | your copyrighted material outside their relationship with you. 174 | 175 | Conveying under any other circumstances is permitted solely under 176 | the conditions stated below. Sublicensing is not allowed; section 10 177 | makes it unnecessary. 178 | 179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 180 | 181 | No covered work shall be deemed part of an effective technological 182 | measure under any applicable law fulfilling obligations under article 183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 184 | similar laws prohibiting or restricting circumvention of such 185 | measures. 186 | 187 | When you convey a covered work, you waive any legal power to forbid 188 | circumvention of technological measures to the extent such circumvention 189 | is effected by exercising rights under this License with respect to 190 | the covered work, and you disclaim any intention to limit operation or 191 | modification of the work as a means of enforcing, against the work's 192 | users, your or third parties' legal rights to forbid circumvention of 193 | technological measures. 194 | 195 | 4. Conveying Verbatim Copies. 196 | 197 | You may convey verbatim copies of the Program's source code as you 198 | receive it, in any medium, provided that you conspicuously and 199 | appropriately publish on each copy an appropriate copyright notice; 200 | keep intact all notices stating that this License and any 201 | non-permissive terms added in accord with section 7 apply to the code; 202 | keep intact all notices of the absence of any warranty; and give all 203 | recipients a copy of this License along with the Program. 204 | 205 | You may charge any price or no price for each copy that you convey, 206 | and you may offer support or warranty protection for a fee. 207 | 208 | 5. Conveying Modified Source Versions. 209 | 210 | You may convey a work based on the Program, or the modifications to 211 | produce it from the Program, in the form of source code under the 212 | terms of section 4, provided that you also meet all of these conditions: 213 | 214 | a) The work must carry prominent notices stating that you modified 215 | it, and giving a relevant date. 216 | 217 | b) The work must carry prominent notices stating that it is 218 | released under this License and any conditions added under section 219 | 7. This requirement modifies the requirement in section 4 to 220 | "keep intact all notices". 221 | 222 | c) You must license the entire work, as a whole, under this 223 | License to anyone who comes into possession of a copy. This 224 | License will therefore apply, along with any applicable section 7 225 | additional terms, to the whole of the work, and all its parts, 226 | regardless of how they are packaged. This License gives no 227 | permission to license the work in any other way, but it does not 228 | invalidate such permission if you have separately received it. 229 | 230 | d) If the work has interactive user interfaces, each must display 231 | Appropriate Legal Notices; however, if the Program has interactive 232 | interfaces that do not display Appropriate Legal Notices, your 233 | work need not make them do so. 234 | 235 | A compilation of a covered work with other separate and independent 236 | works, which are not by their nature extensions of the covered work, 237 | and which are not combined with it such as to form a larger program, 238 | in or on a volume of a storage or distribution medium, is called an 239 | "aggregate" if the compilation and its resulting copyright are not 240 | used to limit the access or legal rights of the compilation's users 241 | beyond what the individual works permit. Inclusion of a covered work 242 | in an aggregate does not cause this License to apply to the other 243 | parts of the aggregate. 244 | 245 | 6. Conveying Non-Source Forms. 246 | 247 | You may convey a covered work in object code form under the terms 248 | of sections 4 and 5, provided that you also convey the 249 | machine-readable Corresponding Source under the terms of this License, 250 | in one of these ways: 251 | 252 | a) Convey the object code in, or embodied in, a physical product 253 | (including a physical distribution medium), accompanied by the 254 | Corresponding Source fixed on a durable physical medium 255 | customarily used for software interchange. 256 | 257 | b) Convey the object code in, or embodied in, a physical product 258 | (including a physical distribution medium), accompanied by a 259 | written offer, valid for at least three years and valid for as 260 | long as you offer spare parts or customer support for that product 261 | model, to give anyone who possesses the object code either (1) a 262 | copy of the Corresponding Source for all the software in the 263 | product that is covered by this License, on a durable physical 264 | medium customarily used for software interchange, for a price no 265 | more than your reasonable cost of physically performing this 266 | conveying of source, or (2) access to copy the 267 | Corresponding Source from a network server at no charge. 268 | 269 | c) Convey individual copies of the object code with a copy of the 270 | written offer to provide the Corresponding Source. This 271 | alternative is allowed only occasionally and noncommercially, and 272 | only if you received the object code with such an offer, in accord 273 | with subsection 6b. 274 | 275 | d) Convey the object code by offering access from a designated 276 | place (gratis or for a charge), and offer equivalent access to the 277 | Corresponding Source in the same way through the same place at no 278 | further charge. You need not require recipients to copy the 279 | Corresponding Source along with the object code. If the place to 280 | copy the object code is a network server, the Corresponding Source 281 | may be on a different server (operated by you or a third party) 282 | that supports equivalent copying facilities, provided you maintain 283 | clear directions next to the object code saying where to find the 284 | Corresponding Source. Regardless of what server hosts the 285 | Corresponding Source, you remain obligated to ensure that it is 286 | available for as long as needed to satisfy these requirements. 287 | 288 | e) Convey the object code using peer-to-peer transmission, provided 289 | you inform other peers where the object code and Corresponding 290 | Source of the work are being offered to the general public at no 291 | charge under subsection 6d. 292 | 293 | A separable portion of the object code, whose source code is excluded 294 | from the Corresponding Source as a System Library, need not be 295 | included in conveying the object code work. 296 | 297 | A "User Product" is either (1) a "consumer product", which means any 298 | tangible personal property which is normally used for personal, family, 299 | or household purposes, or (2) anything designed or sold for incorporation 300 | into a dwelling. In determining whether a product is a consumer product, 301 | doubtful cases shall be resolved in favor of coverage. For a particular 302 | product received by a particular user, "normally used" refers to a 303 | typical or common use of that class of product, regardless of the status 304 | of the particular user or of the way in which the particular user 305 | actually uses, or expects or is expected to use, the product. A product 306 | is a consumer product regardless of whether the product has substantial 307 | commercial, industrial or non-consumer uses, unless such uses represent 308 | the only significant mode of use of the product. 309 | 310 | "Installation Information" for a User Product means any methods, 311 | procedures, authorization keys, or other information required to install 312 | and execute modified versions of a covered work in that User Product from 313 | a modified version of its Corresponding Source. The information must 314 | suffice to ensure that the continued functioning of the modified object 315 | code is in no case prevented or interfered with solely because 316 | modification has been made. 317 | 318 | If you convey an object code work under this section in, or with, or 319 | specifically for use in, a User Product, and the conveying occurs as 320 | part of a transaction in which the right of possession and use of the 321 | User Product is transferred to the recipient in perpetuity or for a 322 | fixed term (regardless of how the transaction is characterized), the 323 | Corresponding Source conveyed under this section must be accompanied 324 | by the Installation Information. But this requirement does not apply 325 | if neither you nor any third party retains the ability to install 326 | modified object code on the User Product (for example, the work has 327 | been installed in ROM). 328 | 329 | The requirement to provide Installation Information does not include a 330 | requirement to continue to provide support service, warranty, or updates 331 | for a work that has been modified or installed by the recipient, or for 332 | the User Product in which it has been modified or installed. Access to a 333 | network may be denied when the modification itself materially and 334 | adversely affects the operation of the network or violates the rules and 335 | protocols for communication across the network. 336 | 337 | Corresponding Source conveyed, and Installation Information provided, 338 | in accord with this section must be in a format that is publicly 339 | documented (and with an implementation available to the public in 340 | source code form), and must require no special password or key for 341 | unpacking, reading or copying. 342 | 343 | 7. Additional Terms. 344 | 345 | "Additional permissions" are terms that supplement the terms of this 346 | License by making exceptions from one or more of its conditions. 347 | Additional permissions that are applicable to the entire Program shall 348 | be treated as though they were included in this License, to the extent 349 | that they are valid under applicable law. If additional permissions 350 | apply only to part of the Program, that part may be used separately 351 | under those permissions, but the entire Program remains governed by 352 | this License without regard to the additional permissions. 353 | 354 | When you convey a copy of a covered work, you may at your option 355 | remove any additional permissions from that copy, or from any part of 356 | it. (Additional permissions may be written to require their own 357 | removal in certain cases when you modify the work.) You may place 358 | additional permissions on material, added by you to a covered work, 359 | for which you have or can give appropriate copyright permission. 360 | 361 | Notwithstanding any other provision of this License, for material you 362 | add to a covered work, you may (if authorized by the copyright holders of 363 | that material) supplement the terms of this License with terms: 364 | 365 | a) Disclaiming warranty or limiting liability differently from the 366 | terms of sections 15 and 16 of this License; or 367 | 368 | b) Requiring preservation of specified reasonable legal notices or 369 | author attributions in that material or in the Appropriate Legal 370 | Notices displayed by works containing it; or 371 | 372 | c) Prohibiting misrepresentation of the origin of that material, or 373 | requiring that modified versions of such material be marked in 374 | reasonable ways as different from the original version; or 375 | 376 | d) Limiting the use for publicity purposes of names of licensors or 377 | authors of the material; or 378 | 379 | e) Declining to grant rights under trademark law for use of some 380 | trade names, trademarks, or service marks; or 381 | 382 | f) Requiring indemnification of licensors and authors of that 383 | material by anyone who conveys the material (or modified versions of 384 | it) with contractual assumptions of liability to the recipient, for 385 | any liability that these contractual assumptions directly impose on 386 | those licensors and authors. 387 | 388 | All other non-permissive additional terms are considered "further 389 | restrictions" within the meaning of section 10. If the Program as you 390 | received it, or any part of it, contains a notice stating that it is 391 | governed by this License along with a term that is a further 392 | restriction, you may remove that term. If a license document contains 393 | a further restriction but permits relicensing or conveying under this 394 | License, you may add to a covered work material governed by the terms 395 | of that license document, provided that the further restriction does 396 | not survive such relicensing or conveying. 397 | 398 | If you add terms to a covered work in accord with this section, you 399 | must place, in the relevant source files, a statement of the 400 | additional terms that apply to those files, or a notice indicating 401 | where to find the applicable terms. 402 | 403 | Additional terms, permissive or non-permissive, may be stated in the 404 | form of a separately written license, or stated as exceptions; 405 | the above requirements apply either way. 406 | 407 | 8. Termination. 408 | 409 | You may not propagate or modify a covered work except as expressly 410 | provided under this License. Any attempt otherwise to propagate or 411 | modify it is void, and will automatically terminate your rights under 412 | this License (including any patent licenses granted under the third 413 | paragraph of section 11). 414 | 415 | However, if you cease all violation of this License, then your 416 | license from a particular copyright holder is reinstated (a) 417 | provisionally, unless and until the copyright holder explicitly and 418 | finally terminates your license, and (b) permanently, if the copyright 419 | holder fails to notify you of the violation by some reasonable means 420 | prior to 60 days after the cessation. 421 | 422 | Moreover, your license from a particular copyright holder is 423 | reinstated permanently if the copyright holder notifies you of the 424 | violation by some reasonable means, this is the first time you have 425 | received notice of violation of this License (for any work) from that 426 | copyright holder, and you cure the violation prior to 30 days after 427 | your receipt of the notice. 428 | 429 | Termination of your rights under this section does not terminate the 430 | licenses of parties who have received copies or rights from you under 431 | this License. If your rights have been terminated and not permanently 432 | reinstated, you do not qualify to receive new licenses for the same 433 | material under section 10. 434 | 435 | 9. Acceptance Not Required for Having Copies. 436 | 437 | You are not required to accept this License in order to receive or 438 | run a copy of the Program. Ancillary propagation of a covered work 439 | occurring solely as a consequence of using peer-to-peer transmission 440 | to receive a copy likewise does not require acceptance. However, 441 | nothing other than this License grants you permission to propagate or 442 | modify any covered work. These actions infringe copyright if you do 443 | not accept this License. Therefore, by modifying or propagating a 444 | covered work, you indicate your acceptance of this License to do so. 445 | 446 | 10. Automatic Licensing of Downstream Recipients. 447 | 448 | Each time you convey a covered work, the recipient automatically 449 | receives a license from the original licensors, to run, modify and 450 | propagate that work, subject to this License. You are not responsible 451 | for enforcing compliance by third parties with this License. 452 | 453 | An "entity transaction" is a transaction transferring control of an 454 | organization, or substantially all assets of one, or subdividing an 455 | organization, or merging organizations. If propagation of a covered 456 | work results from an entity transaction, each party to that 457 | transaction who receives a copy of the work also receives whatever 458 | licenses to the work the party's predecessor in interest had or could 459 | give under the previous paragraph, plus a right to possession of the 460 | Corresponding Source of the work from the predecessor in interest, if 461 | the predecessor has it or can get it with reasonable efforts. 462 | 463 | You may not impose any further restrictions on the exercise of the 464 | rights granted or affirmed under this License. For example, you may 465 | not impose a license fee, royalty, or other charge for exercise of 466 | rights granted under this License, and you may not initiate litigation 467 | (including a cross-claim or counterclaim in a lawsuit) alleging that 468 | any patent claim is infringed by making, using, selling, offering for 469 | sale, or importing the Program or any portion of it. 470 | 471 | 11. Patents. 472 | 473 | A "contributor" is a copyright holder who authorizes use under this 474 | License of the Program or a work on which the Program is based. The 475 | work thus licensed is called the contributor's "contributor version". 476 | 477 | A contributor's "essential patent claims" are all patent claims 478 | owned or controlled by the contributor, whether already acquired or 479 | hereafter acquired, that would be infringed by some manner, permitted 480 | by this License, of making, using, or selling its contributor version, 481 | but do not include claims that would be infringed only as a 482 | consequence of further modification of the contributor version. For 483 | purposes of this definition, "control" includes the right to grant 484 | patent sublicenses in a manner consistent with the requirements of 485 | this License. 486 | 487 | Each contributor grants you a non-exclusive, worldwide, royalty-free 488 | patent license under the contributor's essential patent claims, to 489 | make, use, sell, offer for sale, import and otherwise run, modify and 490 | propagate the contents of its contributor version. 491 | 492 | In the following three paragraphs, a "patent license" is any express 493 | agreement or commitment, however denominated, not to enforce a patent 494 | (such as an express permission to practice a patent or covenant not to 495 | sue for patent infringement). To "grant" such a patent license to a 496 | party means to make such an agreement or commitment not to enforce a 497 | patent against the party. 498 | 499 | If you convey a covered work, knowingly relying on a patent license, 500 | and the Corresponding Source of the work is not available for anyone 501 | to copy, free of charge and under the terms of this License, through a 502 | publicly available network server or other readily accessible means, 503 | then you must either (1) cause the Corresponding Source to be so 504 | available, or (2) arrange to deprive yourself of the benefit of the 505 | patent license for this particular work, or (3) arrange, in a manner 506 | consistent with the requirements of this License, to extend the patent 507 | license to downstream recipients. "Knowingly relying" means you have 508 | actual knowledge that, but for the patent license, your conveying the 509 | covered work in a country, or your recipient's use of the covered work 510 | in a country, would infringe one or more identifiable patents in that 511 | country that you have reason to believe are valid. 512 | 513 | If, pursuant to or in connection with a single transaction or 514 | arrangement, you convey, or propagate by procuring conveyance of, a 515 | covered work, and grant a patent license to some of the parties 516 | receiving the covered work authorizing them to use, propagate, modify 517 | or convey a specific copy of the covered work, then the patent license 518 | you grant is automatically extended to all recipients of the covered 519 | work and works based on it. 520 | 521 | A patent license is "discriminatory" if it does not include within 522 | the scope of its coverage, prohibits the exercise of, or is 523 | conditioned on the non-exercise of one or more of the rights that are 524 | specifically granted under this License. You may not convey a covered 525 | work if you are a party to an arrangement with a third party that is 526 | in the business of distributing software, under which you make payment 527 | to the third party based on the extent of your activity of conveying 528 | the work, and under which the third party grants, to any of the 529 | parties who would receive the covered work from you, a discriminatory 530 | patent license (a) in connection with copies of the covered work 531 | conveyed by you (or copies made from those copies), or (b) primarily 532 | for and in connection with specific products or compilations that 533 | contain the covered work, unless you entered into that arrangement, 534 | or that patent license was granted, prior to 28 March 2007. 535 | 536 | Nothing in this License shall be construed as excluding or limiting 537 | any implied license or other defenses to infringement that may 538 | otherwise be available to you under applicable patent law. 539 | 540 | 12. No Surrender of Others' Freedom. 541 | 542 | If conditions are imposed on you (whether by court order, agreement or 543 | otherwise) that contradict the conditions of this License, they do not 544 | excuse you from the conditions of this License. If you cannot convey a 545 | covered work so as to satisfy simultaneously your obligations under this 546 | License and any other pertinent obligations, then as a consequence you may 547 | not convey it at all. For example, if you agree to terms that obligate you 548 | to collect a royalty for further conveying from those to whom you convey 549 | the Program, the only way you could satisfy both those terms and this 550 | License would be to refrain entirely from conveying the Program. 551 | 552 | 13. Use with the GNU Affero General Public License. 553 | 554 | Notwithstanding any other provision of this License, you have 555 | permission to link or combine any covered work with a work licensed 556 | under version 3 of the GNU Affero General Public License into a single 557 | combined work, and to convey the resulting work. The terms of this 558 | License will continue to apply to the part which is the covered work, 559 | but the special requirements of the GNU Affero General Public License, 560 | section 13, concerning interaction through a network will apply to the 561 | combination as such. 562 | 563 | 14. Revised Versions of this License. 564 | 565 | The Free Software Foundation may publish revised and/or new versions of 566 | the GNU General Public License from time to time. Such new versions will 567 | be similar in spirit to the present version, but may differ in detail to 568 | address new problems or concerns. 569 | 570 | Each version is given a distinguishing version number. If the 571 | Program specifies that a certain numbered version of the GNU General 572 | Public License "or any later version" applies to it, you have the 573 | option of following the terms and conditions either of that numbered 574 | version or of any later version published by the Free Software 575 | Foundation. If the Program does not specify a version number of the 576 | GNU General Public License, you may choose any version ever published 577 | by the Free Software Foundation. 578 | 579 | If the Program specifies that a proxy can decide which future 580 | versions of the GNU General Public License can be used, that proxy's 581 | public statement of acceptance of a version permanently authorizes you 582 | to choose that version for the Program. 583 | 584 | Later license versions may give you additional or different 585 | permissions. However, no additional obligations are imposed on any 586 | author or copyright holder as a result of your choosing to follow a 587 | later version. 588 | 589 | 15. Disclaimer of Warranty. 590 | 591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 599 | 600 | 16. Limitation of Liability. 601 | 602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 610 | SUCH DAMAGES. 611 | 612 | 17. Interpretation of Sections 15 and 16. 613 | 614 | If the disclaimer of warranty and limitation of liability provided 615 | above cannot be given local legal effect according to their terms, 616 | reviewing courts shall apply local law that most closely approximates 617 | an absolute waiver of all civil liability in connection with the 618 | Program, unless a warranty or assumption of liability accompanies a 619 | copy of the Program in return for a fee. 620 | 621 | END OF TERMS AND CONDITIONS 622 | 623 | How to Apply These Terms to Your New Programs 624 | 625 | If you develop a new program, and you want it to be of the greatest 626 | possible use to the public, the best way to achieve this is to make it 627 | free software which everyone can redistribute and change under these terms. 628 | 629 | To do so, attach the following notices to the program. It is safest 630 | to attach them to the start of each source file to most effectively 631 | state the exclusion of warranty; and each file should have at least 632 | the "copyright" line and a pointer to where the full notice is found. 633 | 634 | 635 | Copyright (C) 636 | 637 | This program is free software: you can redistribute it and/or modify 638 | it under the terms of the GNU General Public License as published by 639 | the Free Software Foundation, either version 3 of the License, or 640 | (at your option) any later version. 641 | 642 | This program is distributed in the hope that it will be useful, 643 | but WITHOUT ANY WARRANTY; without even the implied warranty of 644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 645 | GNU General Public License for more details. 646 | 647 | You should have received a copy of the GNU General Public License 648 | along with this program. If not, see . 649 | 650 | Also add information on how to contact you by electronic and paper mail. 651 | 652 | If the program does terminal interaction, make it output a short 653 | notice like this when it starts in an interactive mode: 654 | 655 | Copyright (C) 656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 657 | This is free software, and you are welcome to redistribute it 658 | under certain conditions; type `show c' for details. 659 | 660 | The hypothetical commands `show w' and `show c' should show the appropriate 661 | parts of the General Public License. Of course, your program's commands 662 | might be different; for a GUI interface, you would use an "about box". 663 | 664 | You should also get your employer (if you work as a programmer) or school, 665 | if any, to sign a "copyright disclaimer" for the program, if necessary. 666 | For more information on this, and how to apply and follow the GNU GPL, see 667 | . 668 | 669 | The GNU General Public License does not permit incorporating your program 670 | into proprietary programs. If your program is a subroutine library, you 671 | may consider it more useful to permit linking proprietary applications with 672 | the library. If this is what you want to do, use the GNU Lesser General 673 | Public License instead of this License. But first, please read 674 | . 675 | --------------------------------------------------------------------------------