private void Eval_Redirect(TCPPacketReader packet, uint time) { if (Settings.GetReg <bool>("block_redirect", false)) { return; } Redirect redirect = new Redirect(); redirect.IP = packet; redirect.Port = packet; packet.SkipBytes(4); redirect.Name = packet.ReadString(this.crypto); redirect.Hashlink = Hashlink.EncodeHashlink(redirect); if (ScriptEvents.OnRedirecting(this, redirect)) { this.Credentials.IP = redirect.IP; this.Credentials.Port = redirect.Port; this.Credentials.Name = redirect.Name; this.ticks = (time - 19); this.state = SessionState.Sleeping; this.sock.Disconnect(); this.Panel.AnnounceText(StringTemplate.Get(STType.Messages, 15).Replace("+x", redirect.Name)); } }
public static byte[] Nudge(String myName, String target, CryptoService c) { byte[] temp = Encoding.UTF8.GetBytes("0" + myName); temp = Hashlink.e67(temp, 0x5d0); temp = Encoding.Default.GetBytes(Convert.ToBase64String(temp)); TCPPacketWriter packet = new TCPPacketWriter(); packet.WriteString("cb0t_nudge", c); packet.WriteString(target, c); packet.WriteBytes(temp); return(packet.ToAresPacket(TCPMsg.MSG_CHAT_CLIENT_CUSTOM_DATA)); }
protected override void OnLinkClicked(LinkClickedEventArgs e) { base.OnLinkClicked(e); if (e.LinkText.StartsWith("\\\\arlnk://")) { DecryptedHashlink hashlink = Hashlink.DecodeHashlink(e.LinkText.Substring(10)); if (hashlink != null) { this.HashlinkClicked(hashlink, EventArgs.Empty); } } else if (e.LinkText.StartsWith("\\\\cb0t://script/?file=")) { String str = e.LinkText.Substring(22); if (!String.IsNullOrEmpty(str)) { Scripting.ScriptManager.InstallScript(str); } } else if (e.LinkText.StartsWith("\\\\voice_clip_#")) { String vc_check = e.LinkText.Substring(14); uint vc_finder = 0; if (uint.TryParse(vc_check, out vc_finder)) { VoicePlayerItem vc = VoicePlayer.Records.Find(x => x.ShortCut == vc_finder); if (vc != null) { vc.Auto = false; VoicePlayer.QueueItem(vc); } } } else { String check = e.LinkText.ToUpper(); if (check.StartsWith("HTTP://") || check.StartsWith("HTTPS://") || check.StartsWith("WWW.")) { Scripting.JSOutboundTextItem cb = new Scripting.JSOutboundTextItem(); cb.Type = Scripting.JSOutboundTextItemType.Link; cb.Text = e.LinkText; cb.EndPoint = this.EndPoint; Scripting.ScriptManager.PendingUIText.Enqueue(cb); } } }
private void ExportHashlink(FavouritesListItem room) { StringBuilder sb = new StringBuilder(); sb.AppendLine(room.Name); sb.Append("arlnk://"); sb.AppendLine(Hashlink.EncodeHashlink(room)); try { File.WriteAllText(Settings.DataPath + "hashlink.txt", sb.ToString()); Process.Start("notepad.exe", Settings.DataPath + "hashlink.txt"); } catch { } }
private void button1_Click(object sender, EventArgs e) { String hashlink = this.textBox1.Text.Trim(' ', '\r', '\n'); if (hashlink.StartsWith("arlnk://")) { hashlink = hashlink.Substring(8); } DecryptedHashlink h = Hashlink.DecodeHashlink(hashlink); if (h != null) { this.JoinFromHashlink(h, EventArgs.Empty); } else { MessageBox.Show("Invalid hashlink", "cb0t", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void toolStrip2_ItemClicked(object sender, ToolStripItemClickedEventArgs e) { if (e.ClickedItem.Equals(this.toolStripButton2)) { this.accuTextBox1.AppendText("\x00026"); this.accuTextBox1.SelectionStart = this.accuTextBox1.Text.Length; } else if (e.ClickedItem.Equals(this.toolStripButton3)) { this.accuTextBox1.AppendText("\x00029"); this.accuTextBox1.SelectionStart = this.accuTextBox1.Text.Length; } else if (e.ClickedItem.Equals(this.toolStripButton4)) { this.accuTextBox1.AppendText("\x00027"); this.accuTextBox1.SelectionStart = this.accuTextBox1.Text.Length; } else if (e.ClickedItem.Equals(this.toolStripButton5)) { SharedUI.CMenu.StartPosition = FormStartPosition.Manual; SharedUI.CMenu.Location = new Point(MousePosition.X - 40, MousePosition.Y - 164); SharedUI.CMenu.SetCallback(this, false); SharedUI.CMenu.Show(); } else if (e.ClickedItem.Equals(this.toolStripButton6)) { SharedUI.CMenu.StartPosition = FormStartPosition.Manual; SharedUI.CMenu.Location = new Point(MousePosition.X - 40, MousePosition.Y - 164); SharedUI.CMenu.SetCallback(this, true); SharedUI.CMenu.Show(); } else if (e.ClickedItem.Equals(this.toolStripButton7)) { SharedUI.EMenu.StartPosition = FormStartPosition.Manual; SharedUI.EMenu.Location = new Point(MousePosition.X - 40, MousePosition.Y - 300); SharedUI.EMenu.SetCallback(this); SharedUI.EMenu.Show(); } else if (e.ClickedItem.Equals(this.toolStripButton9)) { this.WantScribble(null, EventArgs.Empty); } else if (e.ClickedItem.Equals(this.toolStripLabel1)) { if (this.url_tag.StartsWith("\\\\arlnk://")) { DecryptedHashlink hashlink = Hashlink.DecodeHashlink(this.url_tag.Substring(10)); if (hashlink != null) { this.HashlinkClicked(hashlink, EventArgs.Empty); } } else if (this.url_tag.StartsWith("arlnk://")) { DecryptedHashlink hashlink = Hashlink.DecodeHashlink(this.url_tag.Substring(8)); if (hashlink != null) { this.HashlinkClicked(hashlink, EventArgs.Empty); } } else { String check = this.url_tag.ToUpper(); if (check.StartsWith("HTTP://") || check.StartsWith("HTTPS://") || check.StartsWith("WWW.")) { Scripting.JSOutboundTextItem cb = new Scripting.JSOutboundTextItem(); cb.Type = Scripting.JSOutboundTextItemType.Link; cb.Text = this.url_tag; cb.EndPoint = this.EndPoint; Scripting.ScriptManager.PendingUIText.Enqueue(cb); } } } }
private void ClientConnected(IAsyncResult result) { this.listener.EndWaitForConnection(result); List <byte> list = new List <byte>(); byte[] buf = new byte[1024]; int size = 0; while ((size = listener.Read(buf, 0, 1024)) > 0) { list.AddRange(buf.Take(size)); } String str = Encoding.UTF8.GetString(list.ToArray()); if (!String.IsNullOrEmpty(str)) { if (str.StartsWith("cb0t://")) { str = str.Substring(7); if (str.StartsWith("script/?file=")) { String filename = str.Substring(13); if (!String.IsNullOrEmpty(filename)) { Scripting.ScriptManager.InstallScript(filename); } } else { DecryptedHashlink dh = Hashlink.DecodeHashlink(str); if (dh == null) { if (str.EndsWith("/")) { str = str.Substring(0, str.Length - 1); } } dh = Hashlink.DecodeHashlink(str); if (dh != null) { this.HashlinkReceived(null, new IPCListenerEventArgs { Hashlink = dh }); } } } else if (str.StartsWith("cbjl_")) { str = str.Substring(5); this.CommandReceived(null, new IPCListenerEventArgs { Command = str }); } } this.listener.Disconnect(); this.listener.BeginWaitForConnection(new AsyncCallback(this.ClientConnected), null); }