示例#1
0
 public popup(IPRecord rec)
 {
     label_city.Content     = "City: " + rec.city;
     label_country.Content  = "Country: " + rec.country;
     label_hostname.Content = "Hostname: " + rec.hostname;
     label_org.Content      = "Org: " + rec.org;
     label_region.Content   = "Region: " + rec.region;
 }
示例#2
0
        public static void newConnection(TcpConnectionInformation conn)
        {
            IPRecord ipR = new IPRecord();

            ipR.RemoteEndPoint = conn.RemoteEndPoint.ToString();
            GetInfo(ipR);
            ipList.Add(ipR);
        }
示例#3
0
        public static void GetInfo(IPRecord rec)
        {
            var res = "";

            rec.remote_ip = rec.RemoteEndPoint.ToString().Split(':')[0];

            WebRequest request = WebRequest.Create("http://ipinfo.io/" + rec.remote_ip);

            using (WebResponse response = request.GetResponse())
                using (StreamReader stream = new StreamReader(response.GetResponseStream()))
                {
                    string line;
                    while ((line = stream.ReadLine()) != null)
                    {
                        if (line.Contains("hostname"))
                        {
                            rec.hostname = line.Split(':')[1].Split(',')[0].Replace('\"', ' ');
                        }
                        if (line.Contains("city"))
                        {
                            rec.city = line.Split(':')[1].Split(',')[0].Replace('\"', ' ');
                        }
                        if (line.Contains("region"))
                        {
                            rec.region = line.Split(':')[1].Split(',')[0].Replace('\"', ' ');
                        }
                        if (line.Contains("country"))
                        {
                            rec.country = line.Split(':')[1].Split(',')[0].Replace('\"', ' ');
                        }
                        if (line.Contains("loc"))
                        {
                            rec.loc = line.Split(':')[1].Replace('\"', ' ');
                        }
                        if (line.Contains("org"))
                        {
                            rec.org = line.Split(':')[1].Split(',')[0].Replace('\"', ' ');
                        }
                        if (line.Contains("postal"))
                        {
                            rec.postal = line.Split(':')[1].Split(',')[0].Replace('\"', ' ');
                        }

                        //Console.WriteLine(line);
                        //Console.WriteLine(":::::" + ipList[IPListIndex].ip);
                    }
                }
            try
            {
                rec.loc_lat = float.Parse(rec.loc.Replace('\"', ' ').Split(',')[0]);
                rec.loc_lon = float.Parse(rec.loc.Replace('\"', ' ').Split(',')[1]);
            }
            catch (Exception e)
            {
            }
        }
示例#4
0
 public void update(IPRecord rec)
 {
     label_city.Content     = "City: " + rec.city;
     label_country.Content  = "Country: " + rec.country;
     label_hostname.Content = "Hostname: " + rec.hostname;
     label_org.Content      = "Org: " + rec.org;
     label_region.Content   = "Region: " + rec.region;
     label_ip.Content       = "IP: " + rec.remote_ip;
     label_program.Content  = "Program: " + rec.program;
     this.rec = rec;
 }
示例#5
0
        public void map_refresh(double latIn, double LongIn, IPRecord rec)
        {
            double lat  = -latIn * (Convert.ToDouble(map_img.ActualHeight) / 180);
            double lon  = LongIn * (Convert.ToDouble(map_img.ActualWidth) / 360);
            double lat2 = -rec.loc_lat * (Convert.ToDouble(map_img.ActualHeight) / 180);
            double lon2 = rec.loc_lon * (Convert.ToDouble(map_img.ActualWidth) / 360);

            Ellipse circle = new Ellipse()
            {
                Width           = 10,
                Height          = 10,
                Stroke          = Brushes.Black,
                StrokeThickness = 1.5
            };

            //circle.HorizontalAlignment = HorizontalAlignment.Left;
            //
            //circle.VerticalAlignment = VerticalAlignment.Top;
            circle.Fill   = new SolidColorBrush(Colors.DarkSeaGreen);
            circle.Stroke = new SolidColorBrush(Colors.Azure);
            Canvas.SetTop(circle, lat2 + (90 * (Convert.ToDouble(map_img.ActualHeight) / 180)) - 5);
            Canvas.SetLeft(circle, lon2 + ((Convert.ToDouble(map_img.ActualWidth) / 360) * 180) - 5);
            circle.MouseDown += Circle_MouseDown;
            //circle.Margin = new Thickness(lat2 + (90 * (Convert.ToDouble(map_img.ActualHeight) / 180)), lon2 + ((Convert.ToDouble(map_img.ActualWidth) / 360) * 180), 0, 0);
            map_img.Children.Add(circle);

            Line line = new Line();

            if (rec.isSelected)
            {
                line.Stroke = new SolidColorBrush(Colors.Blue);
            }
            else
            {
                line.Stroke = new SolidColorBrush(Colors.Green);
            }

            line.X1 = (float)((lon + ((Convert.ToDouble(map_img.ActualWidth) / 360) * 180)));
            line.Y1 = (float)((lat + (90 * (Convert.ToDouble(map_img.ActualHeight) / 180))));
            line.X2 = (float)((lon2 + ((Convert.ToDouble(map_img.ActualWidth) / 360) * 180)));
            line.Y2 = (float)((lat2 + (90 * (Convert.ToDouble(map_img.ActualHeight) / 180))));
            map_img.Children.Add(line);
            //grap.FillEllipse(Brushes.Aquamarine, (float)((lon + ((Convert.ToDouble(map_img.Width) / 360) * 180))), (float)((lat + (90 * (Convert.ToDouble(map_img.Height) / 180)))), 5, 5);
            //grap.FillEllipse(Brushes.OrangeRed, (float)((lon2 + ((Convert.ToDouble(map_img.Width) / 360) * 180))), (float)((lat2 + (90 * (Convert.ToDouble(map_img.Height) / 180)))), 5, 5);
            //grap.DrawLine(Pens.Aqua, (float)((lon + ((Convert.ToDouble(map_img.Width) / 360) * 180))), (float)((lat + (90 * (Convert.ToDouble(map_img.Height) / 180)))), (float)((lon2 + ((Convert.ToDouble(map_img.Width) / 360) * 180))), (float)((lat2 + (90 * (Convert.ToDouble(map_img.Height) / 180)))));
            //grap.DrawString(ip.ip, SystemFonts.MessageBoxFont, Brushes.Gold, (float)((lon2 + ((Convert.ToDouble(map_img.Width) / 360) * 180))), (float)((lat2 + (90 * (Convert.ToDouble(map_img.Height) / 180)))));
        }
示例#6
0
        private void connectListBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            try
            {
                IPRecord rec = TCPConnectionManager.getList()[connectListBox.SelectedIndex];
                if (prev_selected != null)
                {
                    prev_selected.isSelected = false;
                }
                rec.isSelected = true;

                map_refresh(28.5383, -81.3792, rec);
                popmenu.update(rec);
                prev_selected = rec;
            }
            catch (Exception ne) { }
        }