mirror of https://github.com/aliasrobotics/cai.git
Merge branch 'organize_tools' into 'main'
Organize tools - rm empty files add .gitkeep and fill in some tools @Mery-Sanz See merge request aliasrobotics/alias_research/cai!5
This commit is contained in:
commit
de7cc9ba26
|
|
@ -1,6 +0,0 @@
|
|||
# ReverseShellTool
|
||||
# ReverseShellSession
|
||||
# ReverseShellManager
|
||||
# ShellCommandExecutor
|
||||
# SessionManager
|
||||
# UploadReverseShellTool
|
||||
|
|
@ -1 +1,19 @@
|
|||
#curl
|
||||
"""
|
||||
Here are the curl tools.
|
||||
"""
|
||||
from cai.tools.common import run_command # pylint: disable=import-error
|
||||
|
||||
|
||||
def curl(args: str = "", target: str = "", ctf=None) -> str:
|
||||
"""
|
||||
A simple curl tool to make HTTP requests to a specified target.
|
||||
|
||||
Args:
|
||||
args: Additional arguments to pass to the curl command
|
||||
target: The target URL to request
|
||||
|
||||
Returns:
|
||||
str: The output of running the curl command
|
||||
"""
|
||||
command = f'curl {args} {target}'
|
||||
return run_command(command, ctf=ctf)
|
||||
|
|
|
|||
|
|
@ -1 +0,0 @@
|
|||
# DirbScanTool
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
"""
|
||||
This is used to create a generic linux command.
|
||||
"""
|
||||
from cai.tools.common import run_command # pylint: disable=import-error
|
||||
|
||||
|
||||
def generic_linux_command(command: str = "", args: str = "", ctf=None) -> str:
|
||||
"""
|
||||
A simple tool to do a linux command.
|
||||
|
||||
Args:
|
||||
command: The name of the command
|
||||
args: Additional arguments to pass to the command
|
||||
|
||||
Returns:
|
||||
str: The output of running the linux command
|
||||
"""
|
||||
command = f'{command} {args}'
|
||||
return run_command(command, ctf=ctf)
|
||||
|
|
@ -1 +1,17 @@
|
|||
#NetworkConnectionstool in exploitFlow
|
||||
# NetworkConnectionstool in exploitFlow
|
||||
"""
|
||||
Netstat tool
|
||||
"""
|
||||
from cai.tools.common import run_command # pylint: disable=import-error
|
||||
|
||||
|
||||
def netstat(args: str = '', ctf=None) -> str:
|
||||
"""
|
||||
netstat tool to list all listening ports and their associated programs.
|
||||
Args:
|
||||
args: Additional arguments to pass to the netstat command
|
||||
Returns:
|
||||
str: The output of running the netstat command
|
||||
"""
|
||||
command = f'netstat -tuln {args}'
|
||||
return run_command(command, ctf=ctf)
|
||||
|
|
|
|||
|
|
@ -1,3 +0,0 @@
|
|||
# ProcessListTool
|
||||
# EnvironmentVariablesTool
|
||||
# SystemInformationTool
|
||||
|
|
@ -1 +1,19 @@
|
|||
#FileDownloadTool in exploitFlow
|
||||
#FileDownloadTool in exploitFlow
|
||||
|
||||
"""
|
||||
Wget tool
|
||||
"""
|
||||
from cai.tools.common import run_command # pylint: disable=import-error
|
||||
|
||||
def wget(url: str, args: str = '', ctf=None) -> str:
|
||||
"""
|
||||
Wget tool to download files from the web.
|
||||
Args:
|
||||
url: The URL of the file to download
|
||||
args: Additional arguments to pass to the wget command
|
||||
|
||||
Returns:
|
||||
str: The output of running the wget command
|
||||
"""
|
||||
command = f'wget {args} {url}'
|
||||
return run_command(command, ctf=ctf)
|
||||
|
|
@ -13,16 +13,16 @@ import os
|
|||
# 2. Init the CTF environment
|
||||
ctf = ptt.ctf(
|
||||
"picoctf_reversing_python",
|
||||
subnet="192.168.9.0/24",
|
||||
subnet="192.168.2.0/24",
|
||||
container_name="ancient",
|
||||
ip_address="192.168.9.52"
|
||||
ip_address="192.168.2.52"
|
||||
)
|
||||
ctf.start_ctf()
|
||||
challenges = list(ctf.get_challenges().keys())
|
||||
challenge = challenges[0]
|
||||
|
||||
# 3. Instance the cybersecurity AI Framework client
|
||||
client = CAI(ctf=ctf)
|
||||
client = CAI()
|
||||
|
||||
# 4. Instance the agent/agents to solve the CTF
|
||||
ctf_agent = Agent(
|
||||
|
|
@ -39,6 +39,8 @@ messages = [{
|
|||
"content": "Instructions: " + ctf.get_instructions() +
|
||||
"\nChallenge: " + ctf.get_challenges()[challenge] +
|
||||
"\nTechniques: " + ctf.get_techniques() +
|
||||
"\nTarget IP: " + ctf.get_ip() +
|
||||
"\nTarget Port: 5555"
|
||||
"\nExtract and return only the flag"
|
||||
"\nYOU MUST RETURN THE FLAG IN PLAIN TEXT"
|
||||
}]
|
||||
|
|
|
|||
Loading…
Reference in New Issue