当前位置: 首页 > news >正文

企业网站建设指导思想网站建建设心的

企业网站建设指导思想,网站建建设心的,制作网页一般需要兼容哪些软件,买卖友情链接目录 安装Ollama更改模型存放位置 拉取模型GemmaMistralQwen1.5(通义千问)codellama 部署Open webui测试性能知识广度问题1问题2 代码能力总结 最近突然对大语言模型感兴趣 同时在平时的一些线下断网的CTF比赛中#xff0c;大语言模型也可以作为一个能对话交互的高级知识检索… 目录 安装Ollama更改模型存放位置 拉取模型GemmaMistralQwen1.5(通义千问)codellama 部署Open webui测试性能知识广度问题1问题2 代码能力总结 最近突然对大语言模型感兴趣 同时在平时的一些线下断网的CTF比赛中大语言模型也可以作为一个能对话交互的高级知识检索库 本篇文章旨在记录我在本地部署大语言模型的过程 安装Ollama Ollama是一个轻量级、可扩展的框架旨在帮助用户在本地机器上构建、运行和分享大语言模型。 前往Ollama的官网Ollama下载最新版本的安装包 需要注意的是该软件默认安装在C盘下所以如果有精神洁癖的小伙伴也可以使用docker部署Ollama 在终端中输入ollama --version 返回版本信息说明安装成功 更改模型存放位置 前往系统环境变量设置添加如下系统变量 重启Ollama 拉取模型 Gemma 目前在Ollama上Gemma模型已经拥有超过430K的拉取次数。基本上Gemma可以算是Ollama最热门的模型了 Gemma提供了不同参数规模的版本2b20亿参数和7b70亿参数。参数的数量直接影响了模型对语言的理解能力更多的参数通常意味着更好的理解、生成和预测能力但同时也需要更强大的计算资源和更长的处理时间 每个参数版分为轻量版和全量版2b模型即便是在没有独显的笔记本电脑上都能尝试运行而规模更大的7b、7b全量版分别需要8GB和16GB显存。 因为本人的笔记本显卡是RTX 3070Laptop为了防止显卡撑爆选择部署2b全量版 首先确保Ollama框架有在运行在终端中输入ollama pull gemma:2b-instruct-fp16拉取模型 gemma后跟的是参数版本 拉取模型的过程中尽量开代理因为Ollama的数据库在海外 提示success说明拉取成功 Mistral Mistral 7B 是一款拥有70亿参数的精心设计的语言模型旨在实现卓越性能和高效运行。它在各类基准测试中表现出色超越了当前最佳的开源13B模型——Llama 2并在推理能力、数学计算精准度以及代码生成任务上均超越了已公开的34B模型——Llama 1 执行ollama pull qwen:7b拉取模型 Qwen1.5(通义千问) 考虑到本地部署时对硬件的要求我们不得不选取参数量较小的模型 通常的游戏笔记本的显卡内存在4G到8G之间对应的模型参数量范围在20亿到70亿间 而今年年初阿里巴巴开源的Qwen1.5恰好有一个70亿参数量的版本显存占用在7G左右非常适合在中高端游戏本上部署 执行ollama pull mistral:latest拉取模型 codellama code llama在llama2模型的基础上利用代码数据进行训练和微调提高了llama2在代码生成上的能力 code llama提供了三种模型每种模型包含7B,13B,34B三个尺寸支持多种编程语言如Python, C, Java, PHP, Typescript (Javascript), C#, Bash等。 Code Llama代码生成的基础模型Code Llama-Python单独针对于python的模型Code Llama-Instruct根据人工指令微调的模型。 这里我们选用基础模型执行ollama pull codellama:7b拉取模型 部署Open webui Open WebUI是目前GitHub上开源的类Chatgpt前端界面中star数量最多的框架之一 而更重要的是Open WebUI的前身即Ollama WebUI所以它对于Ollama的支持非常好 执行下面的指令来拉取并部署Open WebUI的docker容器 docker run -d -p 3000:8080 --add-hosthost.docker.internal:host-gateway -v open-webui:/app/backend/data --name open-webui --restart always ghcr.io/open-webui/open-webui:main在浏览器上访问https://localhost:3000 点击加号添加刚刚拉取的所有模型方便后续同时测试多个模型 测试性能 在本文章中会对部署在本地的模型进行相同的提问测试包括知识广度和代码能力 知识广度 首先是知识广度上的测试我们询问2道安全岗的面试题 问题1 请向我介绍一下蜜罐技术 Mistral从原理和应用上全方位介绍了蜜罐技术它的回答不仅准确用词也非常专业。 Qwen的回答非常模板化使用总分总的形式展开回答但相比Mistral的回答少一些实用细节 Gemma的回答虽然详细但完全不适用因为它误解了蜜罐技术的定义说明它在知识广度上和其他模型存在差距 Codellama的回答提供了一个与网络安全不同的视角专注于使用蜜罐收集用户行为数据的概念。虽然这种用法在市场研究和用户行为分析中可能有其价值但它与蜜罐技术在网络安全领域的典型应用相去甚远。 问题2 信息收集如何处理子域名爆破的泛解析问题? MIstral回答如下 During information gathering or subdomain enumeration, an attacker may use techniques like DNS brute-forcing or subdomain enumeration tools to discover potential subdomains of a target domain. One common issue they might encounter is the presence of Zone Transfer (MX) records or CNAME records pointing to IP addresses with open resolver servers or to other domains, which can facilitate the discovery of additional subdomains through a process called transitive name resolution, also known as “glue” or “tied” records. To mitigate this issue, organizations can take several steps when handling subdomain enumeration: Disable Open Resolver Servers: Ensure that your DNS servers are not configured to respond to unsolicited recursive queries from external sources. This will prevent attackers from using them as a means to discover additional subdomains through transitive name resolution.Configure Response Rate Limiting (RRL): Implement RRL on your DNS servers to limit the number of requests that can be sent by a single source in a given time frame. This will help prevent attackers from quickly enumerating multiple subdomains using brute-forcing tools.Filter Out Undesired Records: Use firewalls and access control lists (ACLs) to block or filter out unnecessary DNS records, such as MX records that contain open resolver servers or CNAME records pointing to external domains.Monitor for Anomalous Activity: Set up intrusion detection systems (IDS) and security information and event management (SIEM) solutions to monitor and alert on anomalous DNS queries, such as rapid subdomain enumeration attempts.Implement Honeypots and Decoys: Use Honeypot technologies and decoy domains to misdirect attackers from the real infrastructure. This can help protect sensitive information and resources while also providing valuable intelligence about the attacker’s tactics, techniques, and procedures (TTPs).Regularly Update DNS Records: Ensure that your subdomain records are updated regularly to minimize the exposure of old or outdated services or applications. This will help reduce the likelihood of discovery through enumeration attempts.Implement DNS Security Extensions: Use DNS security extensions such as DNSSEC and DANE to secure your DNS infrastructure and prevent attackers from manipulating or poisoning your records. Gemma回答如下 信息收集如何处理子域名爆破的泛解析问题取决于具体情况以下是一些常见解决方案 1. 分析泛解析结果 首先需要确认子域名是否真正属于您。您可以通过域名注册页面或 DNS 管控器的 DNS 查询来查询子域名是否指向您指定的服务器。您可以分析泛解析结果的来源例如如果子域名来自根域名注册服务器那么它可能被恶意攻击者通过 DNS poisoning攻击。您可以分析泛解析结果的记录例如如果记录中存在一个指向恶意网站的记录则可能是一个恶意攻击者的攻击目标。 2. 识别恶意记录 恶意记录通常包含以下特征 与您网络相关的名称例如子域名或 IP 地址。与您的网站或服务相关的名称。与其他恶意记录相同的语法或内容。与您服务器连接的端口或协议。与您网站上部署的软件或工具相关的名称。 您可以使用工具例如 iRule 或 Nessus来分析网络记录并识别恶意记录。 3. 阻止恶意记录 您可以使用 DNS 过滤器或其他安全工具来阻止恶意记录的创建或更新。您可以使用 DNS 记录过滤技术来阻止特定子域名或 IP 地址访问特定网站或服务。您可以使用反恶意软件扫描工具来扫描您的网络以识别并删除恶意软件。 4. 监控子域名的变化 定期检查子域名的 DNS 记录以确保它们仍然指向您的服务器。如果您发现子域名已改变指向恶意网站请立即采取行动。 5. 考虑实施安全措施 使用 SSL 证书来加密您的网站连接。使用防火墙和入侵检测系统 (IDS) 来保护您的网络。使用安全软件例如恶意软件扫描工具和 DNS 过滤工具来保护您的设备和数据。确保您的设备和软件的更新及时完成。 请注意处理子域名爆破的泛解析问题需要专业技能和经验建议您寻求安全专家或安全团队的帮助。 在这个问题上Codellama的回答显然优于其他三种模型因为他理解了信息收集的含义所以提出了攻击建议而不是防御建议 代码能力 在代码能力上我们让模型进行代码审计来测试它们对代码的理解能力 问题如下 ?php // 获取用户提交的用户名 $username $_GET[username];// 连接到数据库 $conn new mysqli(localhost, user, password, database);// 检查连接 if ($conn-connect_error) {die(连接失败: . $conn-connect_error); }// 构造SQL查询这里存在SQL注入的风险 $sql SELECT * FROM users WHERE username $username;$result $conn-query($sql);if ($result-num_rows 0) {// 输出每一行数据while($row $result-fetch_assoc()) {echo id: . $row[id]. - Name: . $row[name]. - Email: . $row[email]. br;} } else {echo 0 结果; }$conn-close(); ?请识别上述PHP代码中存在的安全漏洞并解释为什么这些部分是脆弱的。如果有的话请提出对上述代码进行优化的建议以提高其效率和安全性。 这段代码存在SQL注入漏洞 Mistral回答如下 The given PHP code has several security vulnerabilities: SQL Injection: The code uses user-supplied input ($username) directly in the SQL query without any form of validation or sanitization. This makes it vulnerable to SQL injection attacks where an attacker can inject malicious SQL statements and potentially gain unauthorized access to sensitive data, modify or delete data, or even take control of the database server. To mitigate this risk, it’s recommended to use prepared statements with parameterized queries instead of directly inserting user input into the query string. This will help ensure that any user input is treated as literal values rather than SQL code.Lack of Input Validation: The code does not check if the user-supplied ‘username’ parameter is valid or within expected format. This can lead to unexpected behavior and potential security issues. It’s important to validate user input, for example by checking its length, character set, or using regular expressions.Lack of Error Handling: The code does not have proper error handling mechanisms in place. If the query fails due to an SQL syntax error, the code will simply display a generic error message “连接失败:”. It’s important to handle errors gracefully and provide informative error messages to the user.Insecure Database Credentials: The database credentials are hardcoded in the script which is not recommended as it can expose sensitive information if the source code gets compromised. Instead, use environment variables or configuration files that are not accessible to the public.Use of mysqli_ instead of PDO: While both are PHP extensions for interacting with databases, MySQLi is considered less secure than PDO since it does not support prepared statements by default and lacks some advanced features like statement binding. It’s generally recommended to use PDO over MySQLi for better security and ease-of-use. To improve the code, consider the following suggestions: Use Prepared Statements with Parameterized Queries: Replace the current SQL query construction method with prepared statements and parameterized queries which will help prevent SQL injection attacks by ensuring that user input is treated as literal values.Input Validation: Validate user input before processing it to ensure that it meets expected format and length requirements. Use regular expressions or other validation functions to check the input.Proper Error Handling: Implement error handling to provide informative error messages to the user in case of any SQL query failures. This will help prevent potential attacks by providing minimal information to attackers.Keep Database Credentials Secure: Do not hardcode database credentials in the script. Instead, use environment variables or configuration files that are not accessible to the public.Use PDO instead of MySQLi: Consider using PHP Data Objects (PDO) extension for better security and ease-of-use since it supports prepared statements by default and has advanced features like statement binding which can help prevent SQL injection attacks. Mistral准确地识别了SQL注入漏洞并提供了标准的解决方案即使用预处理语句和参数化查询。同时Mistral正确指出了缺乏输入验证和错误处理的问题。 Qwen的回答依然非常简短虽然它正确识别出了SQL注入的漏洞并给出了优化建议但它提到了未正确关闭数据库很明显是对代码的误解 Gemma识别出了SQL注入漏洞并提出了一系列防御措施。然而一些建议表述可能不够精确特别是关于用户输入处理的部分。 Codellama的回答中对代码的优化建议最为全面 总结 模型知识广度代码理解能力Mistral高高Qwen中中Gemma中中Codellama高高 经过简单的测试Mistral和Codellama的表现相对来说更加出色能够部分满足我们对本地大模型的需求
http://www.sczhlp.com/news/182741/

相关文章:

  • 网站 建设 内容 安排泰安可信的网站建设
  • 小程序建站哪家好遂宁市建设局网站
  • 天津网站建设开发维护WordPress随机置顶插件
  • 做网站的越来越少了vps云服务器免费
  • 南京高端网站开发网站建设中的图片
  • 常州网站推广招聘有了主机和域名后如何做网站
  • 临沂网站建设网站推广免费海外云服务器
  • 网站seo提升建设网站目的及功能定位
  • 云服务器网站解析网站怎么做成小程序
  • 海盐市网站建设展示型企业网站设计方案
  • 如何建设网站与域名长沙网站拓谋网络
  • 廊坊市网站推广asp网站建设 文献
  • 关键词排名优化网站建设公司东莞防疫最新公告
  • html5作业 建设网站百度导航下载2021最新版
  • 个人不允许建网站如何选择网站定制公司
  • 网站建设销售怎样中国交通建设官方网站
  • asp本地网站无法打开wordpress必备文件组合
  • 海北州网站建设公司网站 做 app开发工具
  • 深圳平湖做网站网站建设便宜的公司哪家好
  • 个人网站建设的国外文献综述如何做网站seo优化
  • 用nodejs做的网站网站的基本设置
  • 3模网站建设客户资源买卖平台
  • 怎么建立一个网站链接服装网站怎么做的
  • 怎样在百度搜到自己的网站网页布局方式
  • 介绍湛江网站如何做旅游攻略网站
  • 怎么在word里做网站附近旧模板出售市场
  • 建筑工程网上报建网站网上购物商城网站建设毕业设计
  • 自己做网站卖货多少钱wordpress 国内镜像
  • 网站宣传方法做仿站如何获取网站源码
  • 顾氏网站建设有限公司怎么样誉重网站建设