Ejemplo n.º 1
0
func Test_RC4(t *testing.T) {
	str := "afsfeqrfqgqarfq234esadf123wasd#192.168.13216:8081;192.168.13.216:8081#guid"
	key := "12345678901234567890123456789012"
	tmp1 := common.Rc4Encrypt([]byte(str), key)
	tmp2 := common.ToHexString(tmp1)
	fmt.Println(tmp2)
	tmp3 := common.FromHexString(tmp2)
	tmp4 := common.Rc4Encrypt(tmp3, key)
	if str != string(tmp4) {
		t.Errorf("rc4 failed")
	}
}
Ejemplo n.º 2
0
Archivo: proxy.go Proyecto: ilahsa/go
func login(req *http.Http_Request, sessionInfo *Session_Info) (resp *http.Http_Response) {
	resp = &http.Http_Response{STATUSCODE: http.Status_OK}
	content := req.HEADER["Content"]
	strs1 := strings.Split(content, " ")
	var clientType, credential, cinfo string
	clientType = strings.Split(strs1[0], "=")[1]
	credential = strings.Split(strs1[1], "=")[1]
	_, _ = credential, cinfo

	if clientType == "c" {
		cinfo = strings.Split(strs1[2], "=")[1]
		tmp1 := common.VigenereDecrypt(credential)
		tmp2 := common.FromHexString(tmp1)
		tmp3 := common.Rc4Encrypt(tmp2, common.DefaultRC4Key)
		decryptCredential := string(tmp3)
		decryptCinfo := string(common.Rc4Encrypt(common.FromHexString(common.VigenereDecrypt(cinfo)), "1234567wet1234567890abce56adcseq"))
		common.ULogger.Info(decryptCinfo)
		if strings.Index(decryptCredential, "afsfeqrfqgqarfq234esadf123wasd#") < 0 {
			resp.STATUSCODE = http.Status_Failed

		} else {
			dataEx := `POST /ipinforeq HTTP/1.1
Resp:host=ipinfo.io
CallId:ipinforeq_e4641547-6e66-49a0-b23f-db2bf71d4584
Content-Length:96

R0VUIC8gSFRUUC8xLjENClVzZXItQWdlbnQ6Y3VybC83LjMyLjANCkhvc3Q6aXBpbmZvLmlvDQpBY2NlcHQ6Ki8qDQoNCg==`
			sessionInfo.Last_Active_Time = time.Now().Unix()
			sessionInfo.Data_Ex = dataEx

			sessionInfo.Login_Status = true
			sessionInfo.Client_Type = "c"
			cinfos := strings.Split(decryptCinfo, "|")
			if len(cinfos) == 3 {
				sessionInfo.os = cinfos[0]
				sessionInfo.language = cinfos[1]
				sessionInfo.clientversion = cinfos[2]
			}

		}
	} else if clientType == "r" {
		return resp
	} else {

	}

	common.ULogger.Info("sessioninfo\r\n %v", sessionInfo)

	return resp
}
Ejemplo n.º 3
0
func Test_DecsCinfo(t *testing.T) {
	cinfo := "OAdLAIAHtL8ztLPlCjdbBKBHeaPJaAcjabsieHtBDIbHtlBhCIAbCLeiCb"
	t1 := common.VigenereDecrypt(cinfo)
	t2 := common.FromHexString(t1)
	t3 := common.Rc4Encrypt(t2, "1234567wet1234567890abce56adcseq")
	decryptCinfo := string(t3)
	fmt.Println(decryptCinfo)
}
Ejemplo n.º 4
0
func Test_CLogin(t *testing.T) {
	credential := "AheIPJDjDa8kBBahAbchsKOhBlABbkOhsJezdHDyEBtiaiEjbycKBLPbDLsich2hBzOlcadjAhCb2zaKOBPlehdidyabcJ8ishckeh2LcAaLcKtjsKbAdKdIsKdhAzdLCJsIakdjsi8zAIByAKOjtaPa2J2AcJBJOIOLPkAjCaeB"
	tmp1 := common.VigenereDecrypt(credential)
	tmp2 := common.FromHexString(tmp1)
	tmp3 := common.Rc4Encrypt(tmp2, common.DefaultRC4Key)
	decryptCredential := string(tmp3)
	fmt.Println(decryptCredential)
	if strings.Index(decryptCredential, "afsfeqrfqgqarfq234esadf123wasd#") < 0 {
		fmt.Println("22222222222222")
		t.Errorf("clogin failed")
	}
	//fmt.Println("3333333333333")
}