1 Star 0 Fork 0

K1tter/nuclei poc

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
1-clone_repos.py 1.52 KB
一键复制 编辑 原始数据 按行查看 历史
AdySec 提交于 2024-06-26 11:25 . Update 1-clone_repos.py
import os
repo_file = "repo.csv"
clone_dir = "clone-templates"
# 确保克隆目录存在
try:
os.makedirs(clone_dir, exist_ok=True)
except OSError as e:
print(f"创建目录 {clone_dir} 时出错: {e}")
exit(1)
# 读取并处理仓库文件中的URL
try:
with open(repo_file, 'r') as file:
urls = list(set(line.strip() for line in file if line.strip()))
except FileNotFoundError:
print(f"文件 {repo_file} 未找到。")
exit(1)
except Exception as e:
print(f"读取文件 {repo_file} 时出错: {e}")
exit(1)
for url in urls:
parts = url.split('/')
if len(parts) >= 2:
owner, repo_name = parts[-2], parts[-1]
target_dir = os.path.join(clone_dir, f"{owner}/{repo_name}".lower())
else:
print(f"无效的URL格式: {url}")
continue
if os.path.isdir(target_dir):
print(f"更新 {repo_name}{target_dir}")
try:
result = os.system(f"git -C {target_dir} pull")
if result != 0:
print(f"更新仓库 {repo_name}{target_dir} 时出错")
except Exception as e:
print(f"更新仓库 {repo_name}{target_dir} 时出错: {e}")
else:
print(f"克隆 {repo_name}{target_dir}")
try:
result = os.system(f"git clone {url} {target_dir}")
if result != 0:
print(f"克隆仓库 {repo_name}{target_dir} 时出错")
except Exception as e:
print(f"克隆仓库 {repo_name}{target_dir} 时出错: {e}")
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/k1tter/nuclei-poc.git
[email protected]:k1tter/nuclei-poc.git
k1tter
nuclei-poc
nuclei poc
main

搜索帮助