powered by Jive Software

Find IP by username

Hello.

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.

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.

You can use the ReST API plugin and powershell’s invoke-restmethod like:
$Servername = <your server’s hostname here>
$AuthKey =
$header = @{ ‘ServerHost’ = $Servername ; ‘Authorization’ = “basic $AuthKey” }
$sessions = (invoke-restmethod -method get -headers $header -uri http://:9090$servername/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

Invoke-RestMethod