You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

52 lines
1.7 KiB

# This is a sample Python script.
# Press Shift+F10 to execute it or replace it with your mycode.
# Press Double Shift to search everywhere for classes, files, tool windows, actions, and settings.
import os
from openai import OpenAI
import TaskManager
def LLMtest():
client = OpenAI(
# 请用知识引擎原子能力API Key将下行替换为:api_key="sk-xxx",
api_key="sk-fGBYaQLHykBOQsFwVrQdIFTsYr8YDtDVDQWFU41mFsmvfNPc",
base_url="https://api.lkeap.cloud.tencent.com/v1",
)
completion = client.chat.completions.create(
model="deepseek-v3", # 此处以 deepseek-r1 为例,可按需更换模型名称。
messages=[
{'role': 'user', 'content': '你是一个渗透测试专家,正在对IP58.216.217.70进行渗透测试。当前阶段是[信息收集]。请生成下一步的指令。'}
],
)
# 通过reasoning_content字段打印思考过程
# print("思考过程:")
# print(completion.choices[0].message.reasoning_content)
# 通过content字段打印最终答案
print("最终答案:")
print(completion.choices[0].message.content)
print("\n" + "=" * 20 + "Token 使用情况" + "=" * 20 + "\n")
print(completion.usage)
def print_hi(name):
# Use a breakpoint in the mycode line below to debug your script.
print(f'Hi, {name}') # Press Ctrl+F8 to toggle the breakpoint.
#对某个目标进行测试
def startWork(targets):
TaskM = TaskManager()
tlist = targets.split(',')
for target in tlist:
TaskM.start_task(target)
# Press the green button in the gutter to run the script.
if __name__ == '__main__':
print_hi('PyCharm')
LLMtest()
# See PyCharm help at https://www.jetbrains.com/help/pycharm/