static void Main(string[] args) { AppDomain.CurrentDomain.AssemblyResolve += CurrentDomain_AssemblyResolve; Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); if (!MachineFunctions.IsRunAsAdmin()) { Messages.NoAdminRightsMessage(); return; } foreach (string arg in args) { CatchStartArgument(arg); } if (!noUpdate) { RunWithUpdate(); } else { ContinueFromUpdateCheck(); } }
/// <summary> /// Process the received data from the attached BinarySocket /// </summary> /// <param name="page">Which page was returned</param> /// <param name="data">The data that was written to the page</param> public void ReceiveData(ushort page, List <byte> data) { _receivedData.Clear(); _receivedData.AddRange(DataConversions.ConvertUInt16ToList(page)); _receivedData.AddRange(data.CloneList()); if (_payload.SequenceEqual(_receivedData)) { // housekeeping variables _pointer += _readLength; _currentPage += PagesTransmitted; // determine next step if (_pointer == _workingFile.Count) { // we have reached the end of the file, so tell the system we are done _binarySocketRef.SendBinaryCommand(_bootloaderCommand); // end state machine SetTransferState(TransferState.Succeeded); Stop(); return; } // not done with file, send the next page MachineFunctions.JumpToStep("Transfer Packet", WorkerStateMachine); return; } // process the missed packet count ProcessMissedPage(_currentPage); }
private void button1_Click(object sender, EventArgs e) { string key = maskedTextBox_key.Text.Trim(); CheckerWebClient wc = new CheckerWebClient(); try { string response = wc.DownloadString(Constants.updateUrlFirst + Constants.ActivateScript + "?k=" + key + "&u=" + UUID); if (response == "1") { File.WriteAllText(Constants.ActivateFile, key); MessageBox.Show("MultiCheat успешно активирован", "MultiCheat", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1); MachineFunctions.DisposeRestart(); } else { MessageBox.Show("Введён неверный ключ", "MultiCheat", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1); maskedTextBox_key.Focus(); maskedTextBox_key.SelectAll(); } } catch (Exception ex) { Messages.CheckConnectErrorMessage(ex.Message); Program.ExitProgram(); } }
/// <summary> /// Create a new LogDownloader /// </summary> /// <param name="isAsyncTransfer">Determines if this machine will be set up asyncronus transfers.</param> /// <param name="threadName">The name to report in closing operations for this binary socket.</param> /// <param name="closingWorker">The closing worker to add this binary socket too.</param> protected ThreadedTransferMachine(bool isAsyncTransfer, string threadName, ClosingWorker closingWorker) : base(threadName) { // add thread to the closing worker closingWorker?.AddThread(this); // initialize the StateMachine WorkerState = new StateDefinition(); if (isAsyncTransfer) { MachineFunctions.InitializeStates(WorkerStateMachine = new StepDefinition(threadName, true, WorkerState) { #region StateMachine SubSteps = new List <StepDefinition> { new StepDefinition("Transfer Packet") { Delegate = StateMachine_TransferPacket, DelayTimeMs = 500 }, new StepDefinition("Packet Timeout") { Delegate = StateMachine_PacketTimeout, DelayTimeMs = 0 }, new StepDefinition("Complete") { Delegate = StateMachine_Complete, DelayTimeMs = 200 } } #endregion // StateMachine }); } else { MachineFunctions.InitializeStates(WorkerStateMachine = new StepDefinition(threadName, true, WorkerState) { #region StateMachine SubSteps = new List <StepDefinition> { new StepDefinition("Transfer Packet") { Delegate = StateMachine_TransferPacket, DelayTimeMs = 0 }, new StepDefinition("Complete") { Delegate = StateMachine_Complete, DelayTimeMs = 200 } } #endregion // StateMachine }); } // start the StateMachine in the Complete state MachineFunctions.JumpToLast(WorkerStateMachine); // initialize ThreadingBase WorkerThreads = new List <ThreadInfo> { new ThreadInfo(new Thread(Worker), "State Machine", threadName, WorkerStateMachine) }; }
protected bool ProcessMissedPage(int page) { if (page == _missedPage) { _missedPageCount++; } else { _missedPage = page; _missedPageCount = 1; } // decide how to proceed if (_missedPageCount <= 5) { // request packet again MachineFunctions.JumpToStep("Transfer Packet", WorkerStateMachine); return(StepReturn.JumpCommandUsed); } // failed the upload, jump to end SetTransferState(TransferState.FailedLostPackets); MachineFunctions.JumpToLast(WorkerStateMachine); return(StepReturn.JumpCommandUsed); }
private void timer_CSGORunning_Tick(object sender, EventArgs e) { int isRunning = MachineFunctions.IsGameEnable(); if (isRunning == 1) { rightsError = false; lab_csgoRunning.Text = Constants.csgoRunning; lab_csgoRunning.BackColor = Constants.colorDarkGreen; timer_CSGORunning.Interval = Constants.timerCheckOnDelay; if (!lastRun) { multiCheat.CsgoStarted(); } lastRun = true; } else { lab_csgoRunning.Text = Constants.csgoNotRunning; lab_csgoRunning.BackColor = Constants.colorDarkRed; timer_CSGORunning.Interval = Constants.timerCheckOffDelay; if (lastRun) { multiCheat.OffAllCheats(); } lastRun = false; if (isRunning == -1 && rightsError == false) { rightsError = true; MessageBox.Show("Отказано в доступе к процессу. Запустите MultiCheat от имени Администратора!", "MultiCheat", MessageBoxButtons.OK, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1); } } }
private static string GetDump() { if (!File.Exists(Constants.tempFolder + Constants.dumperName)) { MachineFunctions.UnpackTempFiles(); return(GetDump()); } else { File.WriteAllBytes(Constants.dumperConfigName, Properties.Resources.config); Process pr = MachineFunctions.StartHiddenProcess(Constants.tempFolder + Constants.dumperName, "-c " + Constants.dumperConfigName); pr.WaitForExit(Constants.dumpWaitTime); File.Delete(Constants.dumperConfigName); if (File.Exists(Constants.varsFile)) { string data; StreamReader reader = new StreamReader(Constants.varsFile); data = reader.ReadToEnd(); reader.Close(); RemoveAll(); return(data); } else { RemoveAll(); return(null); } } }
public static void StartProgram() { string tempFolder = Path.GetTempPath() + "csgoMulticheat/"; Directory.CreateDirectory(tempFolder); Constants.tempFolder = tempFolder; MachineFunctions.UnpackTempFiles(); MultiCheat multiCheat = new MultiCheat(); OverlayWFController overlayWFController = new OverlayWFController(multiCheat); }
private void timerWaitTick(object sender, EventArgs args) { ((Timer)sender).Stop(); string[] path = System.Diagnostics.Process.GetCurrentProcess().MainModule.FileName.Split('\\'); string yourFileName = path[path.Length - 1]; createBatFile(yourFileName); MachineFunctions.StartHiddenProcess("update.bat", ""); Program.ExitProgram(); }
protected override bool StateMachine_TransferPacket(StepDefinition currentStep) { // check for connection if (!_comPortRef.IsConnected) { SetTransferState(TransferState.FailedConnection); MachineFunctions.JumpToLast(currentStep); return(StepReturn.JumpCommandUsed); } // update the users with % complete RunPercentUpdate(); var returnStrings = _comPortRef.SendCommand($"&@i{_currentPage}", 5000); // check for response if (returnStrings.Count > 0 && returnStrings[0].Contains($"&@i{_currentPage},")) { if (returnStrings[0].Contains($"&@i{_currentPage},MULTILINECOMPLETE")) { // ini downloaded SetTransferState(TransferState.Succeeded); // end the downloader MachineFunctions.JumpToLast(currentStep); return(StepReturn.JumpCommandUsed); } // we have data returnStrings[0] = returnStrings[0].Replace($"&@i{_currentPage},", ""); returnStrings.RemoveRange(returnStrings.Count - 2, 2); _fileText += string.Join("\r\n", returnStrings.ToArray()); _currentPage++; return(StepReturn.RepeatStep); } // deal with any errors switch (returnStrings[0]) { case "&@i!o": SetTransferState(_currentTransferState, "Buffer overflow!"); break; case "&@i!v": SetTransferState(_currentTransferState, "Invalid Page Number!"); break; default: break; } // we had a bad log, try again return(ProcessMissedPage(_currentPage)); }
private bool Init() { while (working) { if (MachineFunctions.IsGameEnable() == 1 && MachineFunctions.GetGameModules(out dll_client_address, out dll_engine_address) == 1) { break; } Thread.Sleep(Constants.cheatRefreshDelay); } return(working); }
private void OnDeleteScaleUnit(object sender, RoutedEventArgs e) { var delScaleUnit = (sender as FrameworkElement).DataContext as ScaleUnit; var mf = MachineFunctions.FirstOrDefault(_ => _.ScaleUnits.Contains(delScaleUnit)); if (mf != null) { mf.ScaleUnits.Remove(delScaleUnit); foreach (var scaleUnit in mf.ScaleUnits) { scaleUnit.Index = mf.ScaleUnits.IndexOf(scaleUnit); } } }
private bool StateMachine_ConnectionCheck(StepDefinition currentStep) { // it has been long enough, we need to test the connection if (CurrentConnection?.SendConnectionTest() == true) { if (IsConnected) { return(StepReturn.RepeatStep); } IsConnected = true; RunConnectionUpdate(); } else { if (IsConnected) { IsConnected = false; RunConnectionUpdate(); } if (TargetMode != ConnectionMode.PersistentPort) { currentStep.SkipDelayTime = true; MachineFunctions.JumpToFirst(currentStep); } else { // see if the port is still listed in the registry if (ComPortInfo.GetDescriptions().FirstOrDefault(x => x.Port == PortName) != null) { return(StepReturn.RepeatStep); } // if the port is no longer there, we know the port was removed from the system currentStep.SkipDelayTime = true; MachineFunctions.JumpToFirst(currentStep); } return(StepReturn.JumpCommandUsed); } // this step should never move on automatically return(StepReturn.RepeatStep); }
protected override bool StateMachine_TransferPacket(StepDefinition currentStep) { // check for connection if (!_binarySocketRef.IsConnected) { SetTransferState(TransferState.FailedConnection); MachineFunctions.JumpToLast(currentStep); return(StepReturn.JumpCommandUsed); } // update the users with % complete RunPercentUpdate(); _binarySocketRef.SendBinaryCommand(CommandSets.Admin, (ushort)AdminCommands.AdminLogsRead, true, DataConversions.ConvertUInt16ToList(_currentPage)); return(StepReturn.ContinueToNext); }
protected override bool StateMachine_TransferPacket(StepDefinition currentStep) { // check for connection if (!_binarySocketRef.IsConnected) { SetTransferState(TransferState.FailedConnection); MachineFunctions.JumpToLast(currentStep); return(StepReturn.JumpCommandUsed); } // update the users with % complete RunPercentUpdate(); if (_pointer < _workingFile.Count) { if (_payloadPage != _currentPage) { // calculate read length _readLength = PageSize * PagesTransmitted; if (_pointer + _readLength > _workingFile.Count) { _readLength = _workingFile.Count - _pointer; } // load the array into a list with page information _payload.Clear(); _payload.AddRange(DataConversions.ConvertUInt16ToList(_currentPage)); _payload.AddRange(_workingFile.GetRange(_pointer, _readLength)); // update the housekeeping variables _payloadPage = _currentPage; } // send the data _binarySocketRef.SendBinaryCommand(CommandSets.Admin, (ushort)AdminCommands.AdminConfigImport, true, _payload); } else { _binarySocketRef.SendBinaryCommand(CommandSets.Admin, (ushort)AdminCommands.AdminConfigImportComplete, true); } // wait for packet return(StepReturn.ContinueToNext); }
/// <summary> /// Process the data received by the attached BinarySocket /// </summary> /// <param name="page">Which page was returned</param> /// <param name="data">The data that was written to the page</param> public void ReceiveData(ushort page, List <byte> data) { _receivedData.Clear(); _receivedData.AddRange(DataConversions.ConvertUInt16ToList(page)); _receivedData.AddRange(data.CloneList()); if (_payload.SequenceEqual(_receivedData)) { // housekeeping variables _pointer += _readLength; _currentPage += PagesTransmitted; // send the next page MachineFunctions.JumpToStep("Transfer Packet", WorkerStateMachine); return; } // process the missed packet count ProcessMissedPage(_currentPage); }
/// <summary> /// Creates a new ThreadedComPortBase object. /// </summary> /// <param name="threadName">The threadname to report during closing and error events.</param> /// <param name="closingWorker">The closing worker this thread should subscribe too.</param> /// <param name="connectionParameters">The ComParameters to use when testing connections</param> /// <param name="mode">Which connection mode to use when selecting ComPorts to test.</param> /// <param name="selectionRule">The selectionRule to use when mode = SelectionRule.</param> public ThreadedComPortBase(string threadName, ClosingWorker closingWorker, ComParameters connectionParameters, ConnectionMode mode, Func <ComPortInfo, bool> selectionRule = null) : base(threadName) { _threadName = threadName; closingWorker?.AddThread(this); ConnectionParameters.CopyFrom(connectionParameters); // initialize the StateMachine WorkerState = new StateDefinition(); MachineFunctions.InitializeStates(WorkerStateMachine = new StepDefinition(threadName, true, WorkerState) { #region StateMachine SubSteps = new List <StepDefinition> { new StepDefinition("Searching") { Delegate = StateMachine_Searching, DelayTimeMs = 200 }, new StepDefinition("Connection Check") { Delegate = StateMachine_ConnectionCheck, DelayTimeMs = 200 }, new StepDefinition("Complete") { Delegate = StateMachine_Complete, DelayTimeMs = 200 } } #endregion // StateMachine }); // set the mode for this com port ChangeMode(mode, selectionRule); // initialize ThreadingBase WorkerThreads = new List <ThreadInfo> { new ThreadInfo(new Thread(Worker), "State Machine", threadName, WorkerStateMachine) }; }
public static void ContinueFromUpdateCheck() { int scondsLeft = MachineFunctions.CheckActivation(); if (scondsLeft == 0) { (new ActivateForm()).ShowDialog(); } else { if (scondsLeft == -1) { MessageBox.Show("У вас пожизненная лицензия", "MultiCheat", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { TimeSpan ts = TimeSpan.FromSeconds(scondsLeft); string answer = string.Format("{0} дн {1:D2} час {2:D2} мин {3:D2} сек", ts.Days, ts.Hours, ts.Minutes, ts.Seconds); MessageBox.Show("Лицензия закончится через " + answer, "MultiCheat", MessageBoxButtons.OK, MessageBoxIcon.Information); } StartProgram(); } }
protected override bool StateMachine_TransferPacket(StepDefinition currentStep) { // check for connection if (!_comPortRef.IsConnected) { SetTransferState(TransferState.FailedConnection); MachineFunctions.JumpToLast(currentStep); return(StepReturn.JumpCommandUsed); } // update the users with % complete RunPercentUpdate(); LogData log = null; if (_comPortRef.Protocol?.Diagnostics.GetLog(_currentPage, out log) == true) { if (log != null) { // good log, add to list _currentPage++; _logs.Add(log); } else { // all logs gathered SetTransferState(TransferState.Succeeded); // end the downloader MachineFunctions.JumpToLast(currentStep); return(StepReturn.JumpCommandUsed); } } // we had a bad log, try again return(ProcessMissedPage(_currentPage)); }
/// <summary> /// Process the data received data from the attached BinarySocket /// </summary> /// <param name="page">Which page was returned</param> /// <param name="data">The data that was written to the page</param> public void ReceiveData(ushort page, List <byte> data) { if (page == _currentPage) { if (data.Count > 0) { // we have a page _logs.Add(new LogData(data)); _currentPage++; MachineFunctions.JumpToStep("Transfer Packet", WorkerStateMachine); return; } // transfer complete, set state SetTransferState(TransferState.Succeeded); // end the transfer Stop(); return; } // we had a bad packet, try again ProcessMissedPage(_currentPage); }
/// <summary> /// Flag upload as successfull /// </summary> public void ReceiveUploadSuccess() { SetTransferState(TransferState.Succeeded); MachineFunctions.JumpToLast(WorkerStateMachine); }
private bool StateMachine_Searching(StepDefinition currentStep) { // get list of current system com ports var descriptions = ComPortInfo.GetDescriptions(); // clear out any old connections if (IsOpen) { IsConnected = false; CurrentConnection?.Disconnect(); } RunConnectionUpdate(); switch (TargetMode) { case ConnectionMode.AnyCom: CurrentConnection = AutoConnectComPort( descriptions.Select(s => s.Port).ToList(), ConnectionParameters); break; case ConnectionMode.SelectionRule: CurrentConnection = AutoConnectComPort( descriptions.Where(TargetSelectionRule).Select(s => s.Port).ToList(), ConnectionParameters); break; case ConnectionMode.PersistentPort: descriptions = descriptions.Where(TargetSelectionRule).ToList(); if (descriptions.Count == 1) { CurrentConnection = ConnectComPort( descriptions.Select(s => s.Port).First(), ConnectionParameters); CurrentConnection?.Connect(); if (CurrentConnection?.IsConnected != true) { CurrentConnection?.Disconnect(); CurrentConnection = null; } } else if (descriptions.Count > 1) { MachineFunctions.JumpToLast(currentStep); return(StepReturn.JumpCommandUsed); } break; default: break; } // if we didn't open a port, try again if (!IsOpen) { return(StepReturn.RepeatStep); } // we opened a port, so update the listeners ConnectionEventRegister(); RunConnectionUpdate(); // move to the next step return(StepReturn.ContinueToNext); }
public ActivateForm() { InitializeComponent(); UUID = MachineFunctions.GetUUID(); }
private void OnDeleteMachineFunction(object sender, RoutedEventArgs e) { MachineFunctions.Remove((sender as FrameworkElement).DataContext as MachineFunction); }
private void OnAddMachineFunction(object sender, RoutedEventArgs e) { MachineFunctions.Add(new MachineFunction()); }
/// <summary> /// Change the connection mode of the ThreadedComPortBase. /// </summary> /// <param name="mode">The new mode to use for selection of the ComPorts.</param> /// <param name="selectionRule">The new rule to use for selecting ComPorts when mode = SelectionRule.</param> public void ChangeMode(ConnectionMode mode, Func <ComPortInfo, bool> selectionRule = null) { TargetSelectionRule = selectionRule; TargetMode = mode; MachineFunctions.JumpToStep("Searching", WorkerStateMachine); }
/// <summary> /// Process Logs from the upload /// </summary> /// <param name="data"></param> public void ReceiveUploadLogs(List <byte> data) { SetTransferState(TransferState.FailedInvalidFile, $"INI Upload Failed! The INI file had the following errors:{Environment.NewLine}{System.Text.Encoding.UTF8.GetString(data.ToArray())}"); MachineFunctions.JumpToLast(WorkerStateMachine); }
protected override bool StateMachine_TransferPacket(StepDefinition currentStep) { // check for connection if (!_comPortRef.IsConnected) { SetTransferState(TransferState.FailedConnection); MachineFunctions.JumpToLast(currentStep); return(StepReturn.JumpCommandUsed); } // update the users with % complete RunPercentUpdate(); if (_payloadPage != _currentPage) { // calculate read length _readLength = PageSize * PagesTransmitted; if (_pointer + _readLength > _workingFile.Count) { _readLength = _workingFile.Count - _pointer; } // load the array into a list with _page information _payload.Clear(); _payload.AddRange(DataConversions.ConvertUInt16ToList(_currentPage)); _payload.AddRange(_workingFile.GetRange(_pointer, _readLength)); _payload.AddRange(Checksums.Fletcher16(_payload)); // add escapes to the payload _payload.EscapeList(); // add the command to the front of the payload _payload.InsertRange(0, Encoding.ASCII.GetBytes(_command)); // update the housekeeping variables _payloadPage = _currentPage; } // send the data var returnString = _comPortRef.SendCommand(_payload, 1).FirstOrDefault(); if (returnString?.Contains($"{_command}{_currentPage},{_readLength}") == true) { // housekeeping variables _pointer += _readLength; _currentPage += PagesTransmitted; // we had a good transfer, determine next step if (_pointer == _workingFile.Count) { // we are at the end of the file, so tell the system we are done _payload.Clear(); _payload.AddRange(DataConversions.ConvertUInt16ToList(0xFFFF)); _payload.AddRange(Checksums.Fletcher16(_payload)); // add escapes to the payload _payload.EscapeList(); // add the command to the front of the payload _payload.InsertRange(0, Encoding.ASCII.GetBytes(_command)); // send command _comPortRef.SendCommand(_payload, 1); // let the user know SetTransferState(TransferState.Succeeded); // move to end MachineFunctions.JumpToLast(currentStep); return(StepReturn.JumpCommandUsed); } // not done with file, so send the next packet return(StepReturn.RepeatStep); } // switch to deal with packet error types switch (returnString) { case "&@f!c": // checksum error break; case "&@f!w": // flash write error break; case "&@f!r": // rebooting unit break; case "": // lost connection break; default: break; } // process the missed packet count return(ProcessMissedPage(_currentPage)); }
protected override bool StateMachine_TransferPacket(StepDefinition currentStep) { // check for connection if (!_comPortRef.IsConnected) { SetTransferState(TransferState.FailedConnection); MachineFunctions.JumpToLast(currentStep); return(StepReturn.JumpCommandUsed); } // update the users with % complete RunPercentUpdate(); var payloadLength = Math.Min(_workingFile.Count - _pointer, 1024); if (_payloadPage != _currentPage) { // calculate read length _readLength = PageSize * PagesTransmitted; if (_pointer + _readLength > _workingFile.Count) { _readLength = _workingFile.Count - _pointer; } // load the array into a list with _currentPage information _payload.Clear(); _payload.AddRange(DataConversions.ConvertUInt16ToList(_currentPage)); _payload.AddRange(_workingFile.GetRange(_pointer, _readLength)); _payload.AddRange(Checksums.Fletcher16(_payload)); // add escapes to the payload _payload.EscapeList(); // add the command to the front of the payload _payload.InsertRange(0, Encoding.ASCII.GetBytes(Command)); // update the housekeeping variables _payloadPage = _currentPage; } // send the data var returnString = _comPortRef.SendCommand(_payload, 1).FirstOrDefault(); if (returnString?.Contains($"{Command}{_currentPage},{payloadLength}") == true) { // housekeeping variables _pointer += payloadLength; _currentPage += PagesTransmitted; // we had a good transfer, determine next step if (_pointer == _workingFile.Count) { // we are at the end of the file, so tell the system we are done _payload.Clear(); _payload.AddRange(DataConversions.ConvertUInt16ToList(0xFFFF)); _payload.AddRange(Checksums.Fletcher16(_payload)); // add escapes to the payload _payload.EscapeList(); // add the command to the front of the payload _payload.InsertRange(0, Encoding.ASCII.GetBytes(Command)); // send command var returnStrings = _comPortRef.SendCommand(_payload, 5000); if (returnStrings.Count > 0) { if (returnStrings[0].Contains("&@us")) { // upload successfull SetTransferState(TransferState.Succeeded); // move to end MachineFunctions.JumpToLast(currentStep); return(StepReturn.JumpCommandUsed); } if (returnStrings[0].Contains("&@ue")) { // file error returnStrings[0] = returnStrings[0].Replace("&@ue", ""); returnStrings.RemoveRange(returnStrings.Count - 2, 2); var substring = string.Join("\r\n", returnStrings.ToArray()); SetTransferState(TransferState.FailedInvalidFile, $"INI Upload Failed! The INI file had the following errors:{Environment.NewLine}{substring}"); // move to end MachineFunctions.JumpToLast(currentStep); return(StepReturn.JumpCommandUsed); } } else { SetTransferState(TransferState.Failed, "Unable to parse INI file, unknown error!"); // move to end MachineFunctions.JumpToLast(currentStep); return(StepReturn.JumpCommandUsed); } } // next loop return(StepReturn.RepeatStep); } // switch to deal with packet error types switch (returnString) { case "&@u!c": SetTransferState(_currentTransferState, "Checksum Error!"); break; case "&@u!w": SetTransferState(_currentTransferState, "Data Processing Error"); break; case "&@u!s": SetTransferState(_currentTransferState, "Upload Complete"); break; case "&@u!e": SetTransferState(_currentTransferState, "Upload Error"); break; case "": SetTransferState(_currentTransferState, "Lost Connection"); break; default: break; } // process the missed packet count return(ProcessMissedPage(_currentPage)); }