Exemplo n.º 1
0
        public override string ToString()
        {
            string info = "";

            info += "Date = " + Date.ToString();
            info += "\nip = " + IP_Address.ToString();
            info += "\nAttacked Ports = " + string.Join(",", AttackedPorts);
            info += "\nCountry = " + Country;
            if (Attacks != null)
            {
                info += "\nAttacks = " + string.Join(",", Attacks);
            }
            info += "\nNetwork Distance = " + NetworkDistance.ToString();
            info += "\nOperation System = " + OS;
            if (OpenPorts != null)
            {
                info += "\nOpen Ports = " + string.Join(",", OpenPorts);
            }
            if (AttacksPeriods != null)
            {
                info += "\nTime Spans = " + string.Join(",", AttacksPeriods);
            }

            return(info);
        }
        private void PacketHandler(Packet packet)
        {
            IpV4Datagram ip  = packet.Ethernet.IpV4;
            UdpDatagram  udp = ip.Udp;
            IP_Address   customer;

            if (!ipAddresses.Contains(ip.Destination.ToString()))
            {
                ipAddresses.Add(ip.Destination.ToString());
                String[] rows = { ip.Destination.ToString(),
                                  getGeoInfo(ip.Destination.ToString())[0],
                                  getGeoInfo(ip.Destination.ToString())[1],
                                  getGeoInfo(ip.Destination.ToString())[2],
                                  getGeoInfo(ip.Destination.ToString())[3],
                                  getGeoInfo(ip.Destination.ToString())[4] };

                if (checkBox_store_In_DB.Checked)
                {
                    using (var db = new LiteDatabase(@"IP_Addresses.db"))
                    {
                        var col = db.GetCollection <IP_Address>("IP_Address");

                        customer = new IP_Address
                        {
                            IP       = ip.Destination.ToString(),
                            Country  = getGeoInfo(ip.Destination.ToString())[0],
                            City     = getGeoInfo(ip.Destination.ToString())[1],
                            State    = getGeoInfo(ip.Destination.ToString())[2],
                            ZipCode  = getGeoInfo(ip.Destination.ToString())[3],
                            TimeZone = getGeoInfo(ip.Destination.ToString())[4]
                        };

                        col.Insert(customer);
                    }
                }

                ListViewItem item = new ListViewItem(rows);
                listView1.Items.Add(item);
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// Creates the connection to the RFID Reader
        /// </summary>
        /// <returns>PortHandle -- Success or failure of the connection</returns>
        public int OpenConnection()
        {
            StaticClassReaderB.OpenNetPort(Port, IP_Address.ToString(), ref ComAddrr, ref PortHandle);

            return(PortHandle);
        }