add iw took for recon
This commit is contained in:
parent
f41a632da1
commit
e6ef898467
@ -15,8 +15,7 @@ from langchain.tools import tool
|
|||||||
from tools import (
|
from tools import (
|
||||||
get_wireless_interface,
|
get_wireless_interface,
|
||||||
change_adapter_mode,
|
change_adapter_mode,
|
||||||
wifi_encryption_cracking,
|
wifi_network_reconnissance,
|
||||||
packet_capture_reconnaissance,
|
|
||||||
wifi_encryption_cracking,
|
wifi_encryption_cracking,
|
||||||
packet_frame_transmission,
|
packet_frame_transmission,
|
||||||
)
|
)
|
||||||
@ -37,8 +36,7 @@ tools.extend(
|
|||||||
[
|
[
|
||||||
get_wireless_interface,
|
get_wireless_interface,
|
||||||
change_adapter_mode,
|
change_adapter_mode,
|
||||||
wifi_encryption_cracking,
|
wifi_network_reconnissance,
|
||||||
packet_capture_reconnaissance,
|
|
||||||
wifi_encryption_cracking,
|
wifi_encryption_cracking,
|
||||||
packet_frame_transmission,
|
packet_frame_transmission,
|
||||||
]
|
]
|
||||||
@ -69,7 +67,7 @@ for tool in tools:
|
|||||||
while True:
|
while True:
|
||||||
line = input("llm>> ")
|
line = input("llm>> ")
|
||||||
if line:
|
if line:
|
||||||
result: Dict[str, any] = agent_executor.invoke({"input": line})
|
result = agent_executor.invoke({"input": line})
|
||||||
print(result["output"])
|
print(result["output"])
|
||||||
else:
|
else:
|
||||||
break
|
break
|
||||||
|
10
hw6/requirements.txt
Normal file
10
hw6/requirements.txt
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
langchain==0.2.0
|
||||||
|
langchain_community==0.2.0
|
||||||
|
langchain_core==0.2.1
|
||||||
|
langchain_openai==0.1.7
|
||||||
|
python-dotenv==1.0.1
|
||||||
|
Requests==2.32.2
|
||||||
|
langchain-experimental
|
||||||
|
langchainhub
|
||||||
|
|
||||||
|
|
35
hw6/tools.py
35
hw6/tools.py
@ -70,19 +70,38 @@ def packet_frame_transmission(params: str) -> str:
|
|||||||
return res
|
return res
|
||||||
|
|
||||||
|
|
||||||
class PacketCapture(BaseModel):
|
# class PacketCapture(BaseModel):
|
||||||
params: str = Field(
|
# params: str = Field(
|
||||||
description="Should be command line parameters to 'airodump-ng' to perform some kind of wifi reconnaissance or packet capture"
|
# description="Should be command line parameters to 'airodump-ng' to perform some kind of wifi reconnaissance or packet capture"
|
||||||
|
# )
|
||||||
|
|
||||||
|
# @tool(
|
||||||
|
# "Perform packet capture or wifi reconnaissance with airodump-ng",
|
||||||
|
# args_schema=PacketCapture,
|
||||||
|
# return_direct=False,
|
||||||
|
# )
|
||||||
|
# def packet_capture_reconnaissance(params: str) -> str:
|
||||||
|
# """Can pass parameters to airodump-ng to perform packet capture or wifi reconnaissance"""
|
||||||
|
# res = shell_tool.run({"commands": [f"sudo timeout 15s airodump-ng {params}"]})
|
||||||
|
# return res
|
||||||
|
|
||||||
|
class IwScan(BaseModel):
|
||||||
|
interface: str = Field(
|
||||||
|
description="Should be a wireless interface name, used as a paramater to 'iw' to scan for wifi networks"
|
||||||
|
)
|
||||||
|
|
||||||
|
network: str = Field(
|
||||||
|
description="Should be the name or SSID of the wifi network you are interested in"
|
||||||
)
|
)
|
||||||
|
|
||||||
@tool(
|
@tool(
|
||||||
"Perform packet capture or wifi reconnaissance with airodump-ng",
|
"Perform wifi scanning with iw",
|
||||||
args_schema=PacketCapture,
|
args_schema=IwScan,
|
||||||
return_direct=False,
|
return_direct=False,
|
||||||
)
|
)
|
||||||
def packet_capture_reconnaissance(params: str) -> str:
|
def wifi_network_reconnissance(interface: str, network: str) -> str:
|
||||||
"""Can pass parameters to airodump-ng to perform packet capture or wifi reconnaissance"""
|
"""Can pass a wireless interface name and wifi network name to return technical information about a wifi network"""
|
||||||
res = shell_tool.run({"commands": [f"sudo timeout -s SIGINT 15s airodump-ng {params}"]})
|
res = shell_tool.run({"commands": [f'sudo iw {interface} scan | grep -B 9 -A 206 "{network}"']})
|
||||||
return res
|
return res
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user