[tor-commits] [fallback-scripts/master] scripts: Rewrite generate and lookup to be more robust