Skip to content

Commit 52062a3

Browse files
committed
v1.0.1 - better nmap scanning and a simple credentials changing + saving of credentials
1 parent 3789df5 commit 52062a3

File tree

20 files changed

+139
-28
lines changed

20 files changed

+139
-28
lines changed

MSploit/Controllers/BasicController.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,10 +62,13 @@ public ActionResult<Settings> settings()
6262
}
6363

6464
[HttpGet("server/settings/set")]
65-
public ActionResult setSettings(string pyInterp)
65+
public ActionResult setSettings(string pyInterp, string nmapPath, string userName, string password)
6666
{
6767
if (!util.checkSession(Request)) return new UnauthorizedResult();
6868
Settings.settings.pyInterp = pyInterp;
69+
Settings.settings.nmap = nmapPath;
70+
Settings.settings.userName = userName;
71+
Settings.settings.password = password;
6972
return new RedirectResult("/");
7073
}
7174

MSploit/Controllers/HostsController.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,14 +29,13 @@ public IActionResult addHost(String? host)
2929
}
3030

3131
[HttpGet("hosts/new/scan")]
32-
public IActionResult scanHost(String host, String? scanType, String? fast, String? ver, String? aggr, String? osd)
32+
public IActionResult scanHost(String host, String? scanType, String? fast, String? ver, String? osd, String? online, String? con, int portcount, String? customArgs, String? scanSpeed)
3333
{
3434
if (!util.checkSession(Request)) return new UnauthorizedResult();
3535
string dir = $"{Directory.GetCurrentDirectory()}\\scans\\{host}.xml";
3636
Notification.add("Nmap scan started!", $"Target: {host}");
37-
String command = $"{host} {scanType} {fast} {ver} {aggr} {osd} -oX \"{dir}\"";
37+
String command = $"{host} {scanType} {fast} {ver} {osd} {online} {con} --top-ports {portcount} {scanSpeed} {customArgs} -oX \"{dir}\"";
3838
Console.WriteLine($"Running nmap.exe {command}");
39-
//TODO: scan through nmap
4039
new Thread(() =>
4140
{
4241
Directory.CreateDirectory($"{Directory.GetCurrentDirectory()}\\scans");

MSploit/Controllers/NormalPagesController.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,14 @@
66
using Microsoft.AspNetCore.Http;
77
using Microsoft.AspNetCore.Mvc;
88
using MSploit;
9+
using MSploit.Objects;
910

1011
[ApiController]
1112
public class NormalPagesController : ControllerBase
1213
{
1314
//basic credentials for now
14-
private string login => "user";
15-
private string password => "lkJSV@OiHF#OLJ@$#HJBCDVop";
15+
private string login => Settings.settings.userName;
16+
private string password => Settings.settings.password;
1617
public static List<string> validAuth = new ();
1718

1819
[HttpGet("")]

MSploit/Objects/Settings.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ public class Settings
77
public static Settings settings = new();
88

99
public String pyInterp { get; set; } = "python";
10+
public String nmap { get; set; } = "nmap";
11+
public String userName { get; set; } = "user";
12+
public String password { get; set; } = "lkJSV@OiHF#OLJ@$#HJBCDVop";
1013
public Settings()
1114
{
1215

MSploit/WebPage/index.html

Lines changed: 62 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -99,11 +99,29 @@ <h5 class="modal-title" id="exampleModalLabel">Settings</h5>
9999
<div class="tab-content" id="pills-tabContent">
100100
<div class="tab-pane fade show active" id="pills-general" role="tabpanel" aria-labelledby="pills-general-tab">
101101
<div class="form-group">
102-
<label for="pyInterp">Python Interpreter</label>
102+
<label for="pyInterp">Python interpreter</label>
103103
<input type="text" class="form-control bg-dark text-white" name="pyInterp" id="pyInterp" aria-describedby="pythonInterp"
104104
placeholder="">
105105
<small id="pythonInterp" class="form-text text-muted">The command to run to run the python interpreter</small>
106106
</div>
107+
<div class="form-group">
108+
<label for="nmapPath">Nmap command</label>
109+
<input type="text" class="form-control bg-dark text-white" name="nmapPath" id="nmapPath" aria-describedby="nmapPatha"
110+
placeholder="">
111+
<small id="nmapPatha" class="form-text text-muted">The command to run to run nmap</small>
112+
</div>
113+
<div class="form-group">
114+
<label for="userName">Username</label>
115+
<input type="text" class="form-control bg-dark text-white" name="userName" id="userName" aria-describedby="userNamea"
116+
placeholder="">
117+
<small id="userNamea" class="form-text text-muted">Change the username</small>
118+
</div>
119+
<div class="form-group">
120+
<label for="password">Password</label>
121+
<input type="password" class="form-control bg-dark text-white" name="password" id="password" aria-describedby="passworda"
122+
placeholder="">
123+
<small id="passworda" class="form-text text-muted">Change the password</small>
124+
</div>
107125
</div>
108126
<div class="tab-pane fade" id="pills-connections" role="tabpanel" aria-labelledby="pills-connections-tab">
109127
<div class="card bg-dark text-white" style="height: 300px;width: 100%;border-color: black;overflow: auto">
@@ -168,6 +186,9 @@ <h3>No plugins yet...</h3>
168186
$.get("/server/settings")
169187
.done(function (data){
170188
document.getElementById("pyInterp").value = data.pyInterp
189+
document.getElementById("nmapPath").value = data.nmapPath
190+
document.getElementById("userName").value = data.userName
191+
document.getElementById("password").value = data.password
171192
})
172193
})
173194
</script>
@@ -184,7 +205,7 @@ <h5 class="modal-title">Add Host</h5>
184205
<div class="modal-body bg-dark">
185206
<div class="form-group">
186207
<label for="ipfield">Ip:</label>
187-
<input type="text" class="form-control" name="host" id="ipfield" aria-describedby="helpId"
208+
<input type="text" class="form-control bg-dark text-white" name="host" id="ipfield" aria-describedby="helpId"
188209
placeholder="xxx.xxx.xxx.xxx">
189210
</div>
190211
</div>
@@ -210,12 +231,12 @@ <h5 class="modal-title">Scan</h5>
210231
<div class="modal-body bg-dark">
211232
<div class="form-group">
212233
<label for="ipScanField">Ip:</label>
213-
<input type="text" class="form-control" name="host" id="ipScanField" aria-describedby="helpId"
234+
<input type="text" class="form-control bg-dark text-white" name="host" id="ipScanField" aria-describedby="helpId"
214235
placeholder="xxx.xxx.xxx.xxx">
215236
</div>
216237
<div class="form-group">
217238
<label for="scanType">Scan Type</label>
218-
<select class="form-control" name="scanType" id="scanType">
239+
<select class="form-control bg-dark text-white" name="scanType" id="scanType">
219240
<option value="">Pick an option</option>
220241
<option value="-sT">TCP</option>
221242
<option value="-sU">UDP</option>
@@ -226,28 +247,58 @@ <h5 class="modal-title">Scan</h5>
226247
</div>
227248
<div class="form-check">
228249
<label class="form-check-label">
229-
<input type="checkbox" class="form-check-input" name="fast" value="-F">
230-
Fast port scan
250+
<input type="checkbox" class="form-check-input bg-dark" name="fast" value="-F">
251+
Fast mode - Scan fewer ports than the default scan
231252
</label>
232253
</div>
233254
<div class="form-check">
234255
<label class="form-check-label">
235-
<input type="checkbox" class="form-check-input" name="ver" value="-sV" checked>
256+
<input type="checkbox" class="form-check-input bg-dark" name="ver" value="-sV" checked>
236257
Service version detection
237258
</label>
238259
</div>
239260
<div class="form-check">
240261
<label class="form-check-label">
241-
<input type="checkbox" class="form-check-input" name="aggr" value="-A">
242-
Agressive Scan
262+
<input type="checkbox" class="form-check-input bg-dark" name="osd" value="-O" checked>
263+
Enable OS detection
243264
</label>
244265
</div>
245266
<div class="form-check">
246267
<label class="form-check-label">
247-
<input type="checkbox" class="form-check-input" name="osd" value="-O" checked>
248-
OS detect
268+
<input type="checkbox" class="form-check-input bg-dark" name="online" value="-Pn">
269+
Treat host as online - skip host discovery
249270
</label>
250271
</div>
272+
<div class="form-check">
273+
<label class="form-check-label">
274+
<input type="checkbox" class="form-check-input bg-dark" name="con" value="-r">
275+
Scan ports consecutively - don't randomize
276+
</label>
277+
</div>
278+
<div style="width: 100%" class="form-group">
279+
<label style="width: 100%" class="form-label">
280+
<div id="portcountlabel">Scan 1000 most common ports</div><br>
281+
<input style="width: 100%" class="form-range" type="range" defaultValue="1000" min="0" max="65535" name="portcount" onchange="document.getElementById('portcountlabel').innerText = `Scan ${value} most common ports`">
282+
</label>
283+
</div>
284+
<div class="form-group">
285+
<label for="scanSpeed">Scan Speed</label>
286+
<select class="form-control bg-dark text-white" name="scanSpeed" id="scanSpeed">
287+
<option value="">Pick an option</option>
288+
<option value="-T0">0: paranoid IDS evasion</option>
289+
<option value="-T1">1: sneaky IDS evasion</option>
290+
<option value="-T2">2: polite IDS evasion</option>
291+
<option value="-T3">3: normal IDS evasion</option>
292+
<option value="-T4">4: aggressive speed scan</option>
293+
<option value="-T5">5: insane speed scan</option>
294+
</select>
295+
</div>
296+
<div class="form-group">
297+
<label for="ipScanField">Custom args:</label>
298+
<input type="text" class="form-control bg-dark text-white" name="customArgs" id="customArgs" aria-describedby="customArgsa"
299+
placeholder="-g 22...">
300+
<small id="customArgsa">Custom arguments to put in nmap scan command</small>
301+
</div>
251302
</div>
252303
<div class="modal-footer bg-dark">
253304
<button type="submit" class="btn btn-primary">Scan</button>

MSploit/bin/Debug/net6.0/MSploit.dll

512 Bytes
Binary file not shown.

MSploit/bin/Debug/net6.0/MSploit.pdb

196 Bytes
Binary file not shown.
512 Bytes
Binary file not shown.
512 Bytes
Binary file not shown.
200 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)