2 Replies Latest reply on Jun 29, 2017 3:03 PM by Bradford

    Find IP by username.



      How can I find IP by username? I like to find the IP address of my clients that connected to my OpenFire server.


      Thank you.

        • Re: Find IP by username.
          Austin Barrett

          Information Summarized from this post:
          You can read it manually from the session list on the Admin Console ( server:port/session-summary.jsp ), or there is a plugin that may or may not still exist that you can use to get it programmatically. See the original post more more details on that front.

          2 of 2 people found this helpful
          • Re: Find IP by username.

            You can use the ReST API plugin and powershell's invoke-restmethod like:
            $Servername = <your server's hostname here>
            $AuthKey = <your authkey here>
            $header = @{ 'ServerHost'  = $Servername ; 'Authorization' = "basic $AuthKey" }
            $sessions = (invoke-restmethod -method get -headers $header -uri http://$servername:9090/plugins/restapi/v1/sessions).sessions.session


            The variable $sessions will then hold all info for all sessions, so then if you are looking for user bob.saget you can say something like:

            $sessions | foreach-object { if($_.username -like "bob.saget"){$_.hostAddress}}

            This would return the IP address for bob.saget


            Or you can do something more complex like to show all users logged in at a specific site or subnet:

            $sessions | foreach-object { if($_.hostAddress -like "192.168.5.*"}("$($_.hostAddress)`t$($_.Username)")

            This will return a list of the IP and the username for anyone logged in from a 192.168.5.x address.


            I have a whole module dedicated to working with openfire via powershell and the ReST API... I may publish in the future .

            More Info:
            Introducing restAPI plugin for Openfire


            1 of 1 people found this helpful