Type something to search...
10分钟打造属于你的AI侦查工具——深度探索DeepSeek-R1与Ollama完美结合!

10分钟打造属于你的AI侦查工具——深度探索DeepSeek-R1与Ollama完美结合!

大家好!在这篇博客中,我将帮助您利用DeepSeek-R1模型提升生产力,并指导您在系统上进行设置。对于不同的操作系统,有多种安装方法,您可以在博客中进行探索。然而,我不会将其与ChatGPT或OpenAI进行比较,因为这是一个有争议的话题,并超出了本文的范围。

什么是 DeepSeek?

DeepSeek 人工智能有限公司是一家专注于推进 AGI(人工通用智能) 的中国人工智能公司。他们开发了像 DeepSeek-R1(机器人技术)和 DeepSeek-V2(一种成本效益高的 LLM)这样的模型。

DeepSeek-R1 Github 仓库:

主要特点包括:

  • 自动化:脚本化重复任务。
  • 数据洞察:使用 AI 驱动的工具分析数据集。
  • 自定义工作流程:为您的需求构建量身定制的解决方案。
  • 协作:与团队共享洞察和工作流程。

在您的系统上安装 DeepSeek

前提条件

  1. 操作系统:兼容 Windows、macOS 和 Linux。
  2. Python:确保安装 Python 3.7+(CLI/Python 集成所需)。
  3. 硬件:8GB+ RAM 和 20GB+ 存储以获得最佳性能。 (我们不安装更高版本的模型,如果您想要更高版本的模型,则需要 400GB 磁盘空间和大量 CPU)

Deepseek R1模型的安装步骤:

方法 1 安装 Ollama:

  1. 前往 https://ollama.com/

2. 安装下载的 Ollama 最新版本

3. 通过打开命令提示符并输入以下内容来验证 Ollama 是否已安装在您的系统上:

Ollama

方法 2 安装模块

  1. Ollama.com 的搜索框中搜索 deepseek-r1

2. 点击 deepseek-r1 选项,您将被重定向到 Ollama deepseek-r1 模型页面。

3. 您可以从多个模型中进行选择,但在这篇博客中,我选择了 1.5B 参数和 1.1GB 大小small 模型。

4. 从右侧复制 Ollama 命令。

5. 在执行命令之前,将 Run 修改为 Pull,因为我不想立即下载并运行它。

ollama pull deepseek-r1:1.5b

6. 使用以下命令检查您系统上安装的模型列表。

ollama list

7. 使用以下命令测试下载的模型。

ollama run deepseek-r1:1.5b

方法 3 为该模型设置 Python 搜索环境

1. 前往 C:\ 驱动器并通过在命令提示符中运行以下命令创建一个 DeepSeek-R1 文件夹:

cd\
mkdir DeepSeek-R1
cd DeepSeek-R1

注意:此文件夹将用于为 DeepSeek-R1 模型设置 Python 环境。

2. 使用以下命令验证您的系统上是否安装了 Python:

python -- version

或者

py --version

如果未安装 Python,请从 官方 Python 网站 或 Microsoft Store 下载并安装最新版本。

3. 创建一个 Python 虚拟环境运行以下命令以创建虚拟环境:

py -m venv env1

4. 激活虚拟环境使用以下命令激活虚拟环境:

env1\Scripts\activate.bat

5. 安装 Ollama 库在虚拟环境中使用以下命令安装 Ollama 库:

pip install ollama

6. 要打开 VS Code,请运行以下命令:

code .

7. 创建一个 Python 文件- 在 VS Code 中创建一个名为 test.py 的新文件- 将其保存在 DeepSeek-R1 文件夹中。

8. 编写 Python 代码- 打开 test.py 并编写您的 Python 脚本。以下是一个针对网络侦察的 Python 脚本,使用 Deepseek-R1 模型进行网络安全:

import ollama
import requests
import socket
from urllib.parse import urlparse
import concurrent.futures

TARGET_DOMAIN = "example.com"  # Replace with your target domain
COMMON_SUBDOMAINS = [
    'www', 'mail', 'admin', 'dev', 'test', 'staging', 'api',
    'secure', 'portal', 'webmail', 'blog', 'ftp', 'vpn', 'mx'
]

def save_report(content: str):
    """Save results to a timestamped file"""
    filename = f"{TARGET_DOMAIN.replace('.', '_')}-recon.txt"
    with open(filename, 'w') as f:
        f.write(f"Subdomain Recon Report for {TARGET_DOMAIN}\n")
        f.write(f"Generated at: {datetime.now().strftime('%Y-%m-%d %H:%M:%S')}\n")
        f.write("="*50 + "\n")
        f.write(content)
    return filename

def analyze_with_deepseek(report: str) -> str:
    """Analyze subdomain findings with Deepseek-R1"""
    prompt = f"""Act as a cybersecurity expert. Analyze these subdomain reconnaissance findings:
{report}

List potential security risks with:
- Vulnerability Type
- Severity (Critical/High/Medium/Low)
- Explanation
- Remediation Steps
Format as markdown table."""
    
    try:
        response = ollama.generate(
            model="deepseek-r1",
            prompt=prompt,
            options={'temperature': 0.2, 'num_ctx': 4096}
        )
        return response['response']
    except Exception as e:
        return f"Analysis failed: {str(e)}"

def check_subdomain(subdomain: str) -> dict:
    """Check subdomain existence and HTTP details"""
    full_domain = f"{subdomain}.{TARGET_DOMAIN}"
    result = {'subdomain': full_domain, 'exists': False}
    
    try:
        # DNS Resolution
        socket.gethostbyname(full_domain)
        result['exists'] = True
        
        # HTTP Check
        try:
            response = requests.get(
                f"http://{full_domain}", 
                timeout=5, 
                allow_redirects=False
            )
            result.update({
                'status': response.status_code,
                'headers': dict(response.headers),
                'server': response.headers.get('Server', 'Unknown')
            })
        except requests.exceptions.SSLError:
            # Try HTTPS
            response = requests.get(
                f"https://{full_domain}", 
                timeout=5, 
                verify=True
            )
            result.update({
                'status': response.status_code,
                'headers': dict(response.headers),
                'server': response.headers.get('Server', 'Unknown'),
                'https': True
            })
            
    except (socket.gaierror, requests.RequestException):
        pass
        
    return result

def main():
    print(f"[*] Starting subdomain scan for {TARGET_DOMAIN}")
    
    # Multithreaded subdomain checking
    with concurrent.futures.ThreadPoolExecutor(max_workers=20) as executor:
        futures = {executor.submit(check_subdomain, sub): sub for sub in COMMON_SUBDOMAINS}
        results = []
        
        for future in concurrent.futures.as_completed(futures):
            result = future.result()
            if result['exists']:
                results.append(result)
    
    # Generate report
    report_header = f"Found {len(results)} active subdomains:\n\n"
    report_body = "\n".join([
        f"Subdomain: {res['subdomain']}\n"
        f"Status: {res.get('status', 'N/A')}\n"
        f"Server: {res.get('server', 'Unknown')}\n"
        f"HTTPS: {res.get('https', False)}\n"
        f"Headers: {res.get('headers', {})}\n{'-'*40}"
        for res in results
    ])
    
    full_report = report_header + report_body
    
    print("\n[*] Requesting AI analysis...")
    analysis = analyze_with_deepseek(full_report)
    
    # Combine findings and analysis
    final_output = f"{full_report}\n\n{'='*50}\nAI ANALYSIS:\n{analysis}"
    
    # Save to file
    filename = save_report(final_output)
    print(f"\n[+] Report saved to: {filename}")

if __name__ == "__main__":
    main()

- 编辑后保存文件。

9. 选择 Python 解释器- 按 Ctrl + Shift + P,搜索 “Python: Select Interpreter”,并选择来自您虚拟环境 (env1) 的解释器。

10. 只需单击 VS Code 右上角的运行按钮以执行脚本。运行后,我在运行时遇到了 Import request error

要解决此问题,请使用以下命令:

.\env1\Scripts\activate
pip install requests ollama beautifulsoup4

再次运行脚本。如果您遇到任何问题,请随时在下面评论 — 我会尽快帮助您!

以下是显示目标侦察输出文件内容的命令:

Get-Content .\example_com-recon.txt

示例:

Get-Content .\evil_com-recon.txt

开始使用 DeepSeek

1. 自动化重复任务

使用 DeepSeek 的脚本引擎来自动化文件管理或电子邮件分类等任务。

示例:自动化数据备份

from deepseek import Automator  

automator = Automator()  
automator.schedule_task(  
    task_type="backup",  
    source_dir="/home/user/documents",  
    target_dir="/cloud/backup",  
    interval="daily"  
)  

2. 数据分析与可视化

利用 DeepSeek 与 pandas 和 Matplotlib 的集成快速获取洞察。

示例:销售报告生成

import deepseek.analytics as ds  

data = ds.load_csv("sales_data.csv")  
summary = ds.analyze(data, report_type="summary")  
ds.visualize(summary, chart_type="bar", output_file="sales_report.png")  

3. 构建自定义工作流程

结合 DeepSeek 模块创建端到端解决方案。

客户反馈分析的示例工作流程

  1. 从电子邮件/社交媒体抓取反馈。
  2. 使用 DeepSeek 的 NLP 工具进行情感分析。
  3. 生成报告并通过 Slack 提醒您的团队。

使用 DeepSeek 提高生产力

1. 与现有工具集成

  • 将 DeepSeek 连接到 SlackMicrosoft TeamsZapier 以获取通知。
  • Google SheetsNotion 同步以实现实时数据更新。

2. 安排任务

使用 DeepSeek 的调度程序或系统工具,如 cron(Linux)或 任务调度程序(Windows),在非高峰时段运行任务。

3. 监控性能

通过 DeepSeek 的仪表板跟踪任务执行和资源使用:

deepseek monitor --dashboard  

4. 高效协作

  • 使用 DeepSeek 的导出功能与团队共享工作流程:
deepseek workflow export --name "customer_analysis" --format json  
  • 使用版本控制(Git)来管理工作流程的更改。

高级技巧

  • 训练自定义模型:在您的数据集上微调 DeepSeek 的 AI,以执行特定任务。
  • API:使用其 REST API 将 DeepSeek 集成到 Web 应用程序中。
  • 安全性:使用 DeepSeek 内置的 secure_mode 加密敏感数据:
automator.enable_secure_mode(encryption_key="your_private_key")  

DeepSeek 是一个多功能工具,可以无缝适应您的工作流程,无论您是在自动化重复任务还是提取数据驱动的洞察。通过遵循本指南,您已经迈出了提升生产力的第一步。可以从小处着手——自动化一个任务——随着您的成长逐渐探索更多用例。

我很高兴通过这个博客提供有用的见解和知识。如果您觉得有帮助,请点赞、在下方评论,并分享您对 DeepSeek 的看法。

祝您编码愉快,别忘了关注以获取更多内容!

Related Posts

结合chatgpt-o3-mini与perplexity Deep Research的3步提示:提升论文写作质量的终极指南

结合chatgpt-o3-mini与perplexity Deep Research的3步提示:提升论文写作质量的终极指南

AI 研究报告和论文写作 合并两个系统指令以获得两个模型的最佳效果 Perplexity AI 的 Deep Research 工具提供专家级的研究报告,而 OpenAI 的 ChatGPT-o3-mini-high 擅长推理。我发现你可以将它们结合起来生成令人难以置信的论文,这些论文比任何一个模型单独撰写的都要好。你只需要将这个一次性提示复制到 **

阅读更多
让 Excel 过时的 10 种 Ai 工具:实现数据分析自动化,节省手工作业时间

让 Excel 过时的 10 种 Ai 工具:实现数据分析自动化,节省手工作业时间

Non members click here作为一名软件开发人员,多年来的一个发现总是让我感到惊讶,那就是人们还在 Excel

阅读更多
使用 ChatGPT 搜索网络功能的 10 种创意方法

使用 ChatGPT 搜索网络功能的 10 种创意方法

例如,提示和输出 你知道可以使用 ChatGPT 的“搜索网络”功能来完成许多任务,而不仅仅是基本的网络搜索吗? 对于那些不知道的人,ChatGPT 新的“搜索网络”功能提供实时信息。 截至撰写此帖时,该功能仅对使用 ChatGPT 4o 和 4o-mini 的付费会员开放。 ![](https://images.weserv.nl/?url=https://cdn-im

阅读更多
掌握Ai代理:解密Google革命性白皮书的10个关键问题解答

掌握Ai代理:解密Google革命性白皮书的10个关键问题解答

10 个常见问题解答 本文是我推出的一个名为“10 个常见问题解答”的新系列的一部分。在本系列中,我旨在通过回答关于该主题的十个最常见问题来分解复杂的概念。我的目标是使用简单的语言和相关的类比,使这些想法易于理解。 图片来自 [Solen Feyissa](https://unsplash.com/@solenfeyissa?utm_source=medium&utm_medi

阅读更多
在人工智能和技术领域保持领先地位的 10 项必学技能 📚

在人工智能和技术领域保持领先地位的 10 项必学技能 📚

在人工智能和科技这样一个动态的行业中,保持领先意味着不断提升你的技能。无论你是希望深入了解人工智能模型性能、掌握数据分析,还是希望通过人工智能转变传统领域如法律,这些课程都是你成功的捷径。以下是一个精心策划的高价值课程列表,可以助力你的职业发展,并让你始终处于创新的前沿。 1. 生成性人工智能简介课程: [生成性人工智能简介](https://genai.works

阅读更多
揭开真相!深度探悉DeepSeek AI的十大误区,您被误导了吗?

揭开真相!深度探悉DeepSeek AI的十大误区,您被误导了吗?

在AI军备竞赛中分辨事实与虚构 DeepSeek AI真的是它所宣传的游戏规则改变者,还是仅仅聪明的营销和战略炒作?👀 虽然一些人将其视为AI效率的革命性飞跃,但另一些人则认为它的成功建立在借用(甚至窃取的)创新和可疑的做法之上。传言称,DeepSeek的首席执行官在疫情期间像囤积卫生纸一样囤积Nvidia芯片——这只是冰山一角。 从其声称的550万美元培训预算到使用Open

阅读更多
Type something to search...