Exemple #1
0
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
}
Exemple #2
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)
}
Exemple #3
0
func Test_Vigenere(t *testing.T) {
	str := "afsfeqrfqgqarfq234esadf123wasd192168132168081192168132168081guid"
	str1 := common.VigenereEncript(str)
	fmt.Println(str1)
	str2 := common.VigenereDecrypt(str1)
	fmt.Println(str2)

	if str2 != str {
		t.Errorf("failed")
	}
}
Exemple #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")
}