Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Catalog · How the catalog works
Anything · Lazarus or Delphi
Random projectRandom project

IP-Sniffer

IP Sniffer is a comprehensive network tool for capturing and analyzing all traffic on a network, including IP addresses.

View on GitHub

Member rating

3.0 from 1 member

Sign in to rate this project.

README

:computer: IP-Sniffer:

Compiler 10 Seattle 10 1 Berlin 10 2 Tokyo 10 3 Rio
10 4 Sydney 11 Alexandria 12 Athens
Components None

An IP sniffer is a type of monitoring tool that monitors and analyzes network traffic. It operates at a low level of the network stack, allowing it to intercept and examine data packets as they travel through a network. These tools are often referred to as "packet sniffer" or "network sniffer."

An IP sniffer intercepts all or selected data packets passing through a network. Each packet contains various information, including the source and destination IP addresses, protocols, and possibly the data content.

:wrench: Features:

  • Scan domains
  • Ping ip
  • Whois (Can cause problems)
  • Determine individual hosts
  • Geolocation (complete)
    • Country
    • City
    • Region
    • Coordinates (Latidude)
    • Owner (Company)
    • Postal number
    • own location

After capturing the packets, the sniffer can analyze them to learn details about network activity, such as which devices are communicating with each other, what type of data is being transferred, and which IP addresses are involved.

IT administrators use sniffers to diagnose network problems, such as identifying bottlenecks, misconfigurations, or unauthorized devices. Security professionals use sniffers to detect suspicious activity, such as potential intrusions or data exfiltration. Developers and researchers use sniffers to investigate the functionality of various network and internet protocols or to debug network applications.

:wrench: Sniffed Protocols:

Protocol Number Protocol
1 ICMP (Internet Control Message Protocol)
2 IGMP (Internet Group Management Protocol)
3 GGP (Gateway-to-Gateway)
4 IP (IP in IP (encapsulation))
6 TCP (Transmission Control Protocol)
12 PUP PARC Universal Packet (PUP)
17 UDP (User Datagram Protocol)
22 IDP XNS-IDP (XEROX NS IDP)
77 NDP SUN-ND (SUN ND PROTOCOL-Temporary)
255 RAW (Reserved)

:speech_balloon: Add Protocols:

To integrate additional protocols, the protocol numbers and the name of the protocol must be added in this part of the code.

pascal
repeat
     if Form1.Button1.Enabled = false then Exit;
     count := recv(s, Buffer, sizeof(Buffer), 0);
      if (count >= sizeof(TIPHeader)) then
      with LV.Items.Add do
      begin
        hdr := @Buffer;
        Caption:= TimeToStr(Time);

        case hdr.iph_protocol of
          IPPROTO_IP: begin
                      a := a + 1;
                      Form1.CheckBox1.Caption := 'IP (' + IntToStr(a) + ')';
                      end;

          IPPROTO_TCP:begin
                      b := b + 1;
                      Form1.CheckBox2.Caption := 'TCP (' + IntToStr(b) + ')';
                      end;

          IPPROTO_UDP:begin
                      c := c + 1;
                      Form1.CheckBox3.Caption := 'UDP (' + IntToStr(c) + ')';
                      end;

          IPPROTO_ICMP: begin
                        d := d + 1;
                        Form1.CheckBox4.Caption := 'ICMP (' + IntToStr(d) + ')';
                        end;

          IPPROTO_IGMP: begin
                        e := e + 1;
                        Form1.CheckBox4.Caption := 'IGMP (' + IntToStr(e) + ')';
                        end;

          IPPROTO_GGP: begin
                        f := f + 1;
                        Form1.CheckBox5.Caption := 'PUP (' + IntToStr(f) + ')';
                        end;

          IPPROTO_PUP: begin
                        g := g + 1;
                        Form1.CheckBox6.Caption := 'IDP (' + IntToStr(g) + ')';
                        end;

          IPPROTO_IDP: begin
                        h := h + 1;
                        Form1.CheckBox7.Caption := 'GGP (' + IntToStr(h) + ')';
                        end;
          IPPROTO_ND: begin
                      j := j + 1;
                      Form1.CheckBox8.Caption := 'NDP (' + IntToStr(j) + ')';
                      end;
          IPPROTO_RAW:  begin
                        k := k + 1;
                        Form1.CheckBox9.Caption := 'RAW (' + IntToStr(k) + ')';
                        end;
        //else
          //SubItems.Add('Socket Error!')  // Intigrate when you want!
        end;

        if Form1.CheckBox1.Checked = true then begin
          if hdr.iph_protocol = 4 then SubItems.Add('IP');
        end;

        if Form1.CheckBox2.Checked = true then begin
          if hdr.iph_protocol = 6 then SubItems.Add('TCP');
        end;

        if Form1.CheckBox3.Checked = true then begin
          if hdr.iph_protocol = 17 then SubItems.Add('UDP');
        end;

        if Form1.CheckBox4.Checked = true then begin
          if hdr.iph_protocol = 1 then SubItems.Add('ICMP');
        end;

        if Form1.CheckBox5.Checked = true then begin
          if hdr.iph_protocol = 2 then SubItems.Add('IGMP');
        end;

        if Form1.CheckBox6.Checked = true then begin
          if hdr.iph_protocol = 12 then SubItems.Add('PUP');
        end;

        if Form1.CheckBox7.Checked = true then begin
          if hdr.iph_protocol = 22 then SubItems.Add('IDP');
        end;

        if Form1.CheckBox8.Checked = true then begin
          if hdr.iph_protocol = 3 then SubItems.Add('GGP');
        end;

        if Form1.CheckBox9.Checked = true then begin
          if hdr.iph_protocol = 77 then SubItems.Add('NDP');
        end;

        if Form1.CheckBox10.Checked = true then begin
          if hdr.iph_protocol = 255 then SubItems.Add('RAW');
        end;

        try
          // Sender's IP address
          sa1.s_addr := hdr.iph_src;
          // converts an IPv4 address (network byte order / in_addr structure) into a readable, dotted string
          SubItems.Add(inet_ntoa(sa1));
          // Destination IP address
          sa1.s_addr := hdr.iph_dest;
          // convert binary network byte order into a readable string in dotted-decimal format
          SubItems.Add(inet_ntoa(sa1));
          // Bitwise right shift by 8 bits
          lowbyte := hdr.iph_length shr 8;
          // To shift the value of the iph_length field 8 bits to the left
          hibyte := hdr.iph_length shl 8;
          // put it together
          hibyte := hibyte + lowbyte;

          // complete output of the information
          SubItems.Add(IntToStr(hibyte));           // Port
          SubItems.Add(IntToStr(hdr.iph_ttl));      // TimeToLive
          SubItems.Add(IntToStr(hdr.iph_xsum));     // Header checksum field
          SubItems.Add(IntToStr(hdr.iph_length));   // Length of an IP header
          SubItems.Add(IntToStr(hdr.iph_offset));   // Fragment offset in IPv4 header
          SubItems.Add(IntToStr(hdr.iph_tos));      // (Type of Service) within an IP header
          SubItems.Add(IntToStr(hdr.iph_id));       // Identification field (ID) within an IPv4 header structure object
          SubItems.Add(IntToStr(hdr.iph_verlen));   // first data field (1 byte) within an IPv4 header structure
          SubItems.Add(IntToStr(sizeof(Buffer)));   // Buffer data size

          if SubItems.Text = '' then begin
          Form1.ListView1.Items.Delete(Form1.ListView1.ItemIndex)
          end;
        except
        end;

      Form1.StatusBar1.Panels[1].Text := IntToStr(Form1.ListView1.Items.Count);
      end;
  until false;

:speech_balloon: Internet geolocation

The general term internet geolocation refers to the process of localizing a device connected to the internet. For example, the device's IP address can be used to determine the country, city, or ZIP code, determining its geographical location. Other methods include examination of Wi-Fi hotspots and other radio signals.

Internet geolocation has several applications, including law enforcement, marketing, online regulation compliance, and delivery of specific services based on the user's location.

:speech_balloon: How geolocation works

Geolocation works by collecting, processing, and transmitting data. Geolocation databases are utilized by ridesharing services, streaming platforms, e-commerce sites, and more. A device dedicated to geotracking collects data from cellular tower and WiFi pings, GPS signals, and other services.

The device then transmits collected data to the cloud or to a central, dedicated server.

The collected data is then analyzed and processed to triangulate a location by measuring the distance between your device and the signal or ping.

For example, say you’re looking for a Sushi restaurant near you via your phone’s internet browser. The results that appear might include restaurants within a mile of your current location.

This is possible because your cell phone transmits a signal to a local cellular tower, and collected data determining your phone’s location is then processed and analyzed within seconds.