-
Notifications
You must be signed in to change notification settings - Fork 32
Expand file tree
/
Copy pathmain.py
More file actions
279 lines (238 loc) · 6.58 KB
/
main.py
File metadata and controls
279 lines (238 loc) · 6.58 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
import random
import subprocess
import json
from typing import List, Optional
import requests
from mcp.server.fastmcp import FastMCP
from tools.nuclei import run_nuclei
from tools.ffuf import run_ffuf
from tools.wfuzz import run_wfuzz
from tools.sqlmap import run_sqlmap
from tools.nmap import run_nmap
from tools.hashcat import run_hashcat
from tools.httpx import run_httpx
from tools.subfinder import run_subfinder
from tools.tlsx import run_tlsx
from tools.xsstrike import run_xsstrike
from tools.ipinfo import run_ipinfo
from tools.amass import amass_wrapper
from tools.dirsearch import dirsearch_wrapper
from tools.gospider import gospider_wrapper, gospider_crawl_with_filter
from tools.arjun import arjun_wrapper, arjun_bulk_scan, arjun_with_custom_payloads
# Create server
mcp = FastMCP(name="secops-mcp",
version="1.0.0"
)
@mcp.tool()
def nuclei_scan_wrapper(
target: str,
templates: Optional[List[str]] = None,
severity: Optional[str] = None,
output_format: str = "json",
) -> str:
"""Wrapper for running a Nuclei security scan."""
return run_nuclei(target, templates, severity, output_format)
@mcp.tool()
def ffuf_wrapper(
url: str,
wordlist: str,
filter_code: Optional[str] = "404",
) -> str:
"""Wrapper for running ffuf fuzzing."""
return run_ffuf(url, wordlist, filter_code)
@mcp.tool()
def wfuzz_wrapper(
url: str,
wordlist: str,
filter_code: Optional[str] = "404",
) -> str:
"""Wrapper for running wfuzz fuzzing."""
return run_wfuzz(url, wordlist, filter_code)
@mcp.tool()
def sqlmap_wrapper(
url: str,
risk: Optional[int] = 1,
level: Optional[int] = 1,
) -> str:
"""Wrapper for running SQLMap scan."""
return run_sqlmap(url, risk, level)
@mcp.tool()
def nmap_wrapper(
target: str,
ports: Optional[str] = None,
scan_type: Optional[str] = "sV",
) -> str:
"""Wrapper for running Nmap scan."""
return run_nmap(target, ports, scan_type)
@mcp.tool()
def hashcat_wrapper(
hash_file: str,
wordlist: str,
hash_type: str,
) -> str:
"""Wrapper for running Hashcat password cracking."""
return run_hashcat(hash_file, wordlist, hash_type)
@mcp.tool()
def httpx_wrapper(
urls: List[str],
status_codes: Optional[List[int]] = None,
) -> str:
"""Wrapper for running HTTPX scan."""
return run_httpx(urls, status_codes)
@mcp.tool()
def subfinder_wrapper(
domain: str,
recursive: bool = False,
) -> str:
"""Wrapper for running Subfinder subdomain enumeration."""
return run_subfinder(domain, recursive)
@mcp.tool()
def tlsx_wrapper(
host: str,
port: Optional[int] = 443,
) -> str:
"""Wrapper for running TLSX scan."""
return run_tlsx(host, port)
@mcp.tool()
def xsstrike_wrapper(
url: str,
crawl: bool = False,
) -> str:
"""Wrapper for running XSStrike scan."""
return run_xsstrike(url, crawl)
@mcp.tool()
def ipinfo_wrapper(
ip: Optional[str] = None,
) -> str:
"""Wrapper for getting IP information using ipinfo.io."""
return run_ipinfo(ip)
@mcp.tool()
def amass_wrapper(
domain: str,
passive: bool = True,
) -> str:
"""Wrapper for running Amass subdomain enumeration."""
return amass_wrapper(domain, passive)
@mcp.tool()
def dirsearch_wrapper(
url: str,
extensions: Optional[List[str]] = None,
wordlist: Optional[str] = None,
) -> str:
"""Wrapper for running Dirsearch directory brute forcing."""
return dirsearch_wrapper(url, extensions, wordlist)
@mcp.tool()
def gospider_scan(
target: str,
depth: int = 3,
concurrent: int = 10,
timeout: int = 10,
user_agent: Optional[str] = None,
headers: Optional[List[str]] = None,
include_subs: bool = False,
include_other_source: bool = False,
output_format: str = "json"
) -> str:
"""Wrapper for running Gospider web crawling."""
result = gospider_wrapper(
target=target,
depth=depth,
concurrent=concurrent,
timeout=timeout,
user_agent=user_agent,
headers=headers,
include_subs=include_subs,
include_other_source=include_other_source,
output_format=output_format
)
return json.dumps(result, indent=2)
@mcp.tool()
def gospider_filtered_scan(
target: str,
extensions: Optional[List[str]] = None,
exclude_extensions: Optional[List[str]] = None,
filter_length: Optional[int] = None,
depth: int = 3,
concurrent: int = 10,
timeout: int = 10,
include_subs: bool = False
) -> str:
"""Wrapper for running Gospider web crawling with filtering capabilities."""
result = gospider_crawl_with_filter(
target=target,
extensions=extensions,
exclude_extensions=exclude_extensions,
filter_length=filter_length,
depth=depth,
concurrent=concurrent,
timeout=timeout,
include_subs=include_subs
)
return json.dumps(result, indent=2)
@mcp.tool()
def arjun_scan(
url: str,
method: str = "GET",
wordlist: Optional[str] = None,
headers: Optional[List[str]] = None,
data: Optional[str] = None,
delay: int = 0,
timeout: int = 10,
threads: int = 25,
stable: bool = False,
output_format: str = "json"
) -> str:
"""Wrapper for running Arjun HTTP parameter discovery."""
result = arjun_wrapper(
url=url,
method=method,
wordlist=wordlist,
headers=headers,
data=data,
delay=delay,
timeout=timeout,
threads=threads,
stable=stable,
output_format=output_format
)
return json.dumps(result, indent=2)
@mcp.tool()
def arjun_bulk_parameter_scan(
urls: List[str],
method: str = "GET",
wordlist: Optional[str] = None,
threads: int = 25,
stable: bool = False
) -> str:
"""Wrapper for running Arjun parameter discovery on multiple URLs."""
result = arjun_bulk_scan(
urls=urls,
method=method,
wordlist=wordlist,
threads=threads,
stable=stable
)
return json.dumps(result, indent=2)
@mcp.tool()
def arjun_custom_parameter_scan(
url: str,
method: str = "GET",
custom_params: Optional[List[str]] = None,
wordlist: Optional[str] = None,
timeout: int = 10,
threads: int = 25,
stable: bool = False
) -> str:
"""Wrapper for running Arjun with custom parameter testing."""
result = arjun_with_custom_payloads(
url=url,
method=method,
custom_params=custom_params,
wordlist=wordlist,
timeout=timeout,
threads=threads,
stable=stable
)
return json.dumps(result, indent=2)
if __name__ == "__main__":
mcp.run(transport="stdio")