mirror of
https://github.com/SunZhimin2021/AIPentest.git
synced 2025-06-21 02:10:48 +00:00
40 lines
770 B
Python
40 lines
770 B
Python
import asyncio
|
||
import os
|
||
|
||
from dotenv import load_dotenv
|
||
from langchain_openai import ChatOpenAI
|
||
from pydantic import SecretStr
|
||
|
||
from browser_use import Agent
|
||
|
||
# dotenv
|
||
load_dotenv()
|
||
|
||
api_key = os.getenv('api_key', '')
|
||
if not api_key:
|
||
raise ValueError('DEEPSEEK_API_KEY is not set')
|
||
|
||
|
||
async def run_search():
|
||
agent = Agent(
|
||
task=(
|
||
'1. 连接http://192.168.3.93/dvwa/index.php '
|
||
'2. 这是一个DVWA的靶机,使用默认密码登录'
|
||
'3. 登录后选择Sql Injecttion,给出解法并实现,所有描述请使用中文'
|
||
|
||
|
||
),
|
||
llm=ChatOpenAI(
|
||
base_url='https://api.deepseek.com/v1',
|
||
model='deepseek-chat',
|
||
api_key=SecretStr(api_key),
|
||
),
|
||
use_vision=False,
|
||
)
|
||
|
||
await agent.run()
|
||
|
||
|
||
if __name__ == '__main__':
|
||
asyncio.run(run_search())
|