吾爱破解 - 52pojie.cn

 找回密码
 注册[Register]

QQ登录

只需一步,快速开始

查看: 1527|回复: 6
收起左侧

[讨论] 用Notion AI写的一段python代码思路

[复制链接]
top7777 发表于 2023-3-9 10:52
     今天有人推荐用Notion AI,注册没有啥大的限制,使用起来也蛮快的。以下是我的示例:
Me:Write a piece of python code for vulnerability finding
AI:
# Vulnerability Finding with Python
Python is a powerful language that can be used for a variety of tasks, including vulnerability finding. In this section, we will discuss how to use Python to find vulnerabilities in code.
## Importing Modules
To begin, we need to import the necessary modules such as `os`, `subprocess`, `re`, and `sys` which will enable us to interact with the system and access files, execute commands and parse strings.
```
import os
import subprocess
import re
import sys
```
## Searching for Vulnerabilities
We can use Python to search for vulnerabilities in code by analyzing the source code and identifying potential security flaws. We can use regular expressions to search for patterns and identify potential vulnerabilities.
```
def search_vulnerabilities(file_path):
    with open(file_path, 'r') as f:
        file_contents = f.read()
    #search for SQL injection vulnerabilities
    if re.search(r'select.+from.+where', file_contents, re.IGNORECASE):
        print('Potential SQL Injection Vulnerability Found')
    #search for cross-site scripting vulnerabilities
    if re.search(r'<script>.+</script>', file_contents, re.IGNORECASE):
        print('Potential Cross-Site Scripting Vulnerability Found')
```
In the code above, we define a function `search_vulnerabilities` which takes a file path as an argument. The function reads the contents of the file and searches for potential SQL injection and cross-site scripting vulnerabilities using regular expressions.
## Conclusion
Python can be a powerful tool for finding vulnerabilities in code. By using regular expressions, we can search for patterns and identify potential security flaws. However, it's important to keep in mind that vulnerability finding is a complex task that requires a deep understanding of security concepts and best practices.

还行,AI思路没啥问题。
Notion AI注册地址Notion AI(https://www.notion.so/product/ai)

发帖前要善用论坛搜索功能,那里可能会有你要找的答案或者已经有人发布过相同内容了,请勿重复发帖。

fmmhero 发表于 2023-3-9 11:15
想问一下,问话有固定的格式吗?必须用英文吗?问话是用口语自然语言可以达到大约多少成功率。
 楼主| top7777 发表于 2023-3-9 11:30
fmmhero 发表于 2023-3-9 11:15
想问一下,问话有固定的格式吗?必须用英文吗?问话是用口语自然语言可以达到大约多少成功率。

就是聊天的格式,和chatgpt差不多,你要先建个page和sub page,然后list add,就可以持续对话。我只测了英文,没试中文。
d199212 发表于 2023-3-9 14:24
薛定谔的猫0o0 发表于 2023-3-9 14:25
20条之后就要开会员了, 不如ChatGpt
jayway123 发表于 2023-3-9 14:28
notion ai确实很好用
shadmmd 发表于 2023-3-9 15:19
fmmhero 发表于 2023-3-9 11:15
想问一下,问话有固定的格式吗?必须用英文吗?问话是用口语自然语言可以达到大约多少成功率。

按空格,直接输入中文就行
您需要登录后才可以回帖 登录 | 注册[Register]

本版积分规则

返回列表

RSS订阅|小黑屋|处罚记录|联系我们|吾爱破解 - LCG - LSG ( 京ICP备16042023号 | 京公网安备 11010502030087号 )

GMT+8, 2024-11-25 03:02

Powered by Discuz!

Copyright © 2001-2020, Tencent Cloud.

快速回复 返回顶部 返回列表