Jump to content

Barqs

Members
  • Posts

    1
  • Joined

  • Last visited

Posts posted by Barqs

  1. ; IP Retrieval Script v1.0 by Barqs @ irc.Koach.com
    ; 2023-08-21

    ; Discover a seamless way to uncover your public IP address within the mIRC environment
    ; with the IP Retrieval Script v1.0. Crafted by Barqs, this script simplifies the process of 
    ; obtaining your IP address, whether you're a seasoned mIRC user or just starting your IRC journey.

    ; With a single command, the /ip command, you can harness the power of the script.
    ; Watch as it effortlessly establishes a connection to the reliable httpbin.org API and retrieves
    ; your public IP address. The result is swiftly presented on your mIRC client screen, making it
    ; easy to access the vital information that defines your online presence.

    ; Whether you're curious about your IP address or looking to enhance your mIRC experience,
    ; the IP Retrieval Script v1.0 offers a user-friendly solution that emphasizes simplicity,
    ; effectiveness, and convenience. Elevate your mIRC experience and embark on your journey
    ; into the world of IP retrieval with Barqs' expertly crafted script.

    ; Uncover your digital identity effortlessly with the IP Retrieval Script v1.0 – because knowing
    ; your IP address shouldn't be a challenge.

    ; Command usage: /ip

    alias ip {
      ; This is the alias definition for the /ip command.

      if ($sock(ip)) sockclose ip
      ; Checks if a socket with the identifier "ip" is open.
      ; If it is, the existing socket is closed using sockclose.

      sockopen ip httpbin.org 80
      ; Opens a new socket with the identifier "ip" to the host "httpbin.org" on port 80.
      ; This will establish a connection to httpbin.org for communication.

      echo -ca info * Retrieving IP address...
      ; Displays a message in the mIRC client indicating that the script is retrieving the IP address.
    }

    on *:SOCKOPEN:ip: {
      ; This event is triggered when the socket with the identifier "ip" is successfully opened.

      sockwrite -nt ip GET /ip HTTP/1.1
      ; Writes a GET request to the socket to retrieve the IP address.
      ; It specifies the path "/ip" and the HTTP version 1.1.

      sockwrite -nt ip Host: httpbin.org
      ; Writes the "Host" header to the socket, indicating the host to request data from.

      sockwrite -nt ip Connection: close
      ; Writes the "Connection" header to the socket, indicating that the connection should be closed after the response.

      sockwrite -nt ip $crlf
      ; Writes an empty line (carriage return + line feed) to indicate the end of the request headers.
    }

    on *:SOCKREAD:ip: {
      ; This event is triggered when data is read from the socket with the identifier "ip".

      var %ipAddress
      ; Declares a variable named %ipAddress to store the extracted IP address.

      sockread %ipAddress
      ; Reads a line of data from the socket and stores it in the %ipAddress variable.

      if ($regex(%ipAddress,/"origin": "(.*?)"/)) {
        ; Checks if the line of data matches a regular expression pattern.
        ; This pattern captures the IP address information from the response.
        ; The captured IP address will be stored in the $regml(1) identifier.

        var %ipAddress = $regml(1)
        ; Assigns the captured IP address to the %ipAddress variable.

        echo -ca info2 * Your IP: %ipAddress
        ; Displays a message in the mIRC client showing your IP address.

        echo -ca info * Retrieving IP address finished...
        ; Displays a message indicating that the process of retrieving the IP address is complete.

        sockclose ip
        ; Closes the socket with the identifier "ip" now that the IP address has been extracted.
      }
    }

×
×
  • Create New...