This script is just a code snippet to help people and for educational purposes. I am not responsible in any way of it's illicit or unintended use.
This script may help you to easily get anybody's IP address who visits your website with 3 lines of javascript.
fetch('https://api.ipify.org?format=json')
.then(results => results.json())
.then(data => console.log(data.ip));