public static CreateThread Read(BinaryReader reader) { CreateThread result = new CreateThread(); result.ThreadId = Utilities.Read7BitEncodedInt(reader); return(result); }
public static void Set(string tag) { if (Address == IntPtr.Zero) { Allocator alloc = new Allocator(); Address = alloc.Alloc(Size); alloc.Free(); if (Address == IntPtr.Zero) { return; } Buffer.BlockCopy(BitConverter.GetBytes((int)(Address + 18)), 0, Shellcode, 1, 4); Buffer.BlockCopy(BitConverter.GetBytes((int)(Address + 18)), 0, Shellcode, 6, 4); Buffer.BlockCopy(BitConverter.GetBytes(Memory.Engine + signatures.dwSetClanTag), 0, Shellcode, 11, 4); } if (!LocalPlayer.InGame) { return; } byte[] tag_bytes = Encoding.UTF8.GetBytes(tag + "\0"); byte[] reset = new byte[] { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; Buffer.BlockCopy(reset, 0, Shellcode, 18, reset.Length); Buffer.BlockCopy(tag_bytes, 0, Shellcode, 18, tag.Length > 15 ? 15 : tag.Length); CreateThread.Create(Address, Shellcode); }
public bool CreateThread(CreateThread model) { try { var entity = new Thread { Id = model.Id, Name = model.Name, OwnerId = _userId, CreationDate = DateTime.Now, CategoryId = model.CategoryId, }; using (var ctx = new ApplicationDbContext()) { ctx.Threads.Add(entity); return(ctx.SaveChanges() == 1); } } catch (NullReferenceException) { return(false); } catch (ArgumentNullException) { return(false); } }
public async Task <ActionResult> Post([FromBody] CreateThread command, CancellationToken token) { if (!ModelState.IsValid) { return(NotFound("not found")); } return(new JsonResult(new { Thread = await _mediator.Send(new CreateThreadCommand { Content = _stringToHtmlHelper.GetHtml(command.Content), SubjectName = command.SubjectName, Title = command.Title, UserId = User.Claims.Single(x => x.Type == "Id").Value }, token) })); }
public IHttpActionResult Post(CreateThread thread) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } var service = CreateThreadService(); if (service == null) { return(BadRequest()); } if (!service.CreateThread(thread)) { return(InternalServerError()); } return(Ok()); }
protected override unsafe int OnCreateThread(CorDebugAppDomain pAppDomain, CorDebugThread thread) { CreateThread?.Invoke(this, pAppDomain, thread); return(Continue()); }
public void Main() { pInfo = NativeHelpers.CreateProcess( applicationName: null, commandLine: opt.Process, //flags: CreateProcessFlags.DEBUG_ONLY_THIS_PROCESS | CreateProcessFlags.DETACHED_PROCESS flags: CreateProcessFlags.DETACHED_PROCESS | CreateProcessFlags.DEBUG_PROCESS ); if (pInfo.dwProcessId == decimal.Zero) { Environment.Exit(-1); } var _ = NativeMethods.DebugActiveProcess(pInfo.dwProcessId); var code = Marshal.GetLastWin32Error(); NativeMethods.DebugSetProcessKillOnExit(false); if (opt.LoadDLL) { LoadDLL += (IntPtr address) => { Console.WriteLine($"ModLoad: {address.Address()} {LoadedDlls[address]}"); } } ; if (opt.UnloadDLL) { UnloadDLL += (IntPtr address) => { Console.WriteLine($"ModUnLoad: {address.Address()} {LoadedDlls[address]}"); } } ; if (opt.CreateProcess) { CreateProcess += Console.WriteLine; } if (opt.ExitProcess) { ExitProcess += Console.WriteLine; } if (opt.CreateThread) { CreateThread += Console.WriteLine; } if (opt.ExitThread) { ExitThread += Console.WriteLine; } if (opt.Exception) { Exception += Console.WriteLine; } debuggee = Process.GetProcessById(pInfo.dwProcessId); Console.WriteLine($@"{debuggee.ProcessName} started for debugging: PID: {pInfo.dwProcessId}"); Loop(debuggee); }
public static void Start() { // Some biolerplate to react to close window event, CTRL-C, kill, etc _handler += Handler; SetConsoleCtrlHandler(_handler, true); PluginManager.LoadPlugins(); Console.WriteLine("SiteServer Service is running..."); var thr1 = new CreateThread(); var thr2 = new TaskThread(); var tid1 = new Thread(thr1.Run); var tid2 = new Thread(thr2.Run); tid1.IsBackground = true; tid1.Priority = ThreadPriority.Highest; tid2.IsBackground = true; tid2.Priority = ThreadPriority.Lowest; try { tid1.Start(); tid2.Start(); } catch (ThreadStateException te) { Console.WriteLine(te.ToString()); } var watcher = new FileSystemWatcher { Path = Environment.CurrentDirectory, IncludeSubdirectories = true, Filter = "*.*" }; watcher.Changed += (sender, e) => { if (PathUtils.IsSystemPath(e.FullPath)) { return; } try { watcher.EnableRaisingEvents = false; ServiceUtils.OnFileChanged(sender, e); } finally { watcher.EnableRaisingEvents = true; } }; watcher.EnableRaisingEvents = true; Thread.Sleep(10); while (true) { } //_commandRun = new CommandRun(); //_commandRun.StartService(); }
public static CreateThread Read(BinaryReader reader) { CreateThread result = new CreateThread(); result.ThreadId = Utilities.Read7BitEncodedInt(reader); return result; }