MANAMA, Bahrain — When Iran's military planners prepared to hit American bases in the Middle East, they relied on intelligence from an unlikely source: U.S. service members themselves. According to security experts and even the U.S. military, Iran harvested data from social media accounts, fitness apps and even ads to establish patterns of life in U.S. bases across the region.