Do a tracert, you connected because those two routers are probably routing between each other. Well the moment you logged in your crossed the line of legality. So yes it's illegal. You find the owner by asking around who set up the AP's.