Create an account

Very important

  • To access the important data of the forums, you must be active in each forum and especially in the leaks and database leaks section, send data and after sending the data and activity, data and important content will be opened and visible for you.
  • You will only see chat messages from people who are at or below your level.
  • More than 500,000 database leaks and millions of account leaks are waiting for you, so access and view with more activity.
  • Many important data are inactive and inaccessible for you, so open them with activity. (This will be done automatically)


Thread Rating:
  • 846 Vote(s) - 3.39 Average
  • 1
  • 2
  • 3
  • 4
  • 5
WSH (JScript) pass CLI arguments to another script that is activated internally

#1
So I have my `JScript` script `s1.js`

var objArgs = WScript.Arguments;
WScript.Echo(objArgs.length)

when `s1.js` is run using [WSH](

[To see links please register here]

)
I get the expected`WScript.Arguments`.

It gets tricky however when I run `s1.js` internally. Say I have another script `s2.js`:

var F = new Function(strScript); // strScript is the content of s1.js
(F)("test");

When running `s2.js`, with whatever CLI argument, `var objArgs = WScript.Arguments` defined in `s1.js` get the same arguments I passed to `s2.js`.

This does not surprise me since I assume `var objArgs = WScript.Arguments` is global and set by `WSH`.

## Question
1. How do I activate `s1.js` (internally in `s2.js`) and pass CLI params to it?
2. How do `s1.js` can distinguish between the two different ways of running it and read its arguments properly?
Reply

#2
I'm not sure about WScript, but it seems like it's a global member among all Js snippets. I've done some basic tests and in-fact, WScript.Arguments is identical among all instances. The root for your problems lays within the new Function() call, As the first N-1 parameters declare the template for parameters, and the last one function's body.

Here's the answer that helped me -> [response][1]

[1]:

[To see links please register here]

Reply



Forum Jump:


Users browsing this thread:
1 Guest(s)

©0Day  2016 - 2023 | All Rights Reserved.  Made with    for the community. Connected through