Jump to content

WPI on drugs!


Recommended Posts

Your WPI is bored of checkbox?

It wants to experience something different? Something new? Something wizz?

Or is it introverted? Should it go ride higher in the sky with diamonds? Or maybe just see the things from a different POV?

Do you want to help it?

Well, you can't give it your coke nor your fanta, but you can still improve its creativity and make it feel powerful.

Just treat it with a special injection of yours. And see the result:

post-84897-1149982536_thumb.png

Look! Now it's displaying custom option's checkboxes, buttons, radio button choice, textfields, or whatever else it's triping on.

And all this without ANY modding of WPI. It is just your beloved vanilla WPI.

But it has been injected.

Don't worry, this has no side effect: if you remove the syringe from its config.js, it stops immediately.

WTF am I talking about?

'Injection' is well known in the security community as a way used by crackers to attack server sided databases (SQL injection is the most well know type) or applications. It works for example by 'injecting' some code in an otherwise inert form answer. On a server application with low security, the code processing the answer may also execute the injected code, giving the cracker a way to control the server.

Now in WPI things are different: we are the server, we already control everything and execute whatever code we want. So clearly WPI does not need to protect itself agains this thing.

Rest that the mechanism still works (in a slightly different way) and we can take benefit of it to improve WPI's functionality and interface.

Functionality & User Interface:

- I mention interface because many issue (such as the 'set default browser' option in the pic) can be dealed with using the existing WPI features (I could just have another prog running that command, dependant on the main setup) but the injection can bring more freedom as for how to display it.

So in this case, injecting the option is just another way to perform the task:

Having on the same line clearly links the option to the main setup.

- Same goes for radio options which could be solved by setting exclusions. But radios buttons are more user friendly for this. And they don't need any code to handle the exclusions.

- Now there is the case of buttons. The great improvement here is that they can allow the user to perform an action (answering a question, selecting a file, etc.) now, while the WPI window is displayed, and not wait for all the other progs to be installed before the selected one can ask what it needs.

In the example, the user can just select now the profile he wants to be restored, and don't wait for the restoring app's turn to run and ask him the question.

- Another great use, with Fx extensions as an example: the user can select which extension to install by clicking the button:

This will open ... another WPI with another config.js dedicated to the extensions.

When the user click 'Begin Install' in this one, for each selected extension, it run a prog which simply record the extension's name to a file.

The file will then be parsed by the extension installer of the main WPI in due time (after firefox and profile installation).

Again, I could probably stuff all the extensions in the 1st config.js and try to manage something with the exclusion (all vs some extensions). But a new dedicated WPI window is so much cleaner.

Ah, yes. I lied. For this last trick to work, you need to mod WPI:

In WPI.hta (open it with notepad) you have to change 'singleInstance' from 'yes' to 'no' on line 21. That's all.

But how the Duck Woes it Fork:

An example being better than a long explanation, have a look at the attached config.js (to be able to use the extension button change the command for running the second WPI to suit your case).

Simply put, it appends some HTML tags to the prog[pn]s.

- Since these prog[pn] are used (without further processing -here would go the protection against injection in a server application-) to build WPI's HTML interface, the HTML elements appears in it.

- The active ones (buttons, etc.) have their onclick() attribute set to the custom javascript code needed to perform the intended action (mainly modding the commands: cmd1[pn], etc.)

Done.

Issues:

Although very promizing, this is also very beta.

The main issue is about how to automate the tedious writting of the HTML and javascript that will be injected.

I'm working on a next version of my Prog Lists writing excel application which will be able to do it. Probably with easy functions (that you could use in excel's formulas) like:

injectCmdCheck(label, checked, cmdNum, CmdChecked, CmdUnchecked) to insert a checkbox altering the cmdx of the current prog.

Does it make sense?

There is also a small glitch with the tooltips as they also display some parts of the injections!

Enough for now.

Comments welcome!

[Disclaimers]

1- If ever you took it otherwise, the drug 'apology' at the beginning of the post is fully ironic. It is only there for humor and literary purpose (although if you have no humor, I may advice some *** !). Here is my -non humorous- position about drugs: Drugs make you stupid ('soft' drugs do, 'hard' ones usually kill you before they can).

2- If you're a script kid and your brain is striked by the idea of trying this injection thing on a server that you don't own, you're running -very fast- into deep s***. Not only well designed applications are protected against this kind of things, but admins have tools to detect it and to hunt you down. This is sooo outdated. Now go back finish your homeworks.

config.js

Edited by Djé
Link to comment
Share on other sites

  • 4 weeks later...

The mix is ready. Here's a glance at my full psychedelic hallucinations:

post-84897-1152353996_thumb.png

This was achieved very easily using the injection functions in my Excel Progs Lists Manager, which is designed to maintain and write WPI's config.js files as well as progs lists in other formats (RunOnceEx, kTool, WIHU, XPLODE).

The last version of the manager is geared toward WPI (v5.1), with easy managment of Exclusions & Dependancies, UserOptions, Default Selection ... and Injection!

In the ProgsList Manager, for documentation about the injection functions, look at the textbox at the bottom of the "Djé's" Progs List.

The issues mentioned in the previous post are solved. Of course. And the functions' syntax is easier than what was expected at that time.

Edited by Djé
Link to comment
Share on other sites

nice

too bad there isn't a easy import function, or ability to click on config button in wpi.

but very nice indeed :)

Thank you very much :hello:

What do you have in mind, precisely? Maybe a solution is not that far...

Link to comment
Share on other sites

Since WPI has gone into dev overload recently (thankfully) may be you should speak to Kel and mritter about adding these options in to WPI permenantly. This is good stuff. :thumbup

I have to say I love the radials, they work so much better than the current exclusion does.

Link to comment
Share on other sites

just to be able to import my current config.js, is too big to redo it all :)

Oh, I see. Import your config.js into the Progs List Manager.

Well, cleverly using word's Replace function(with the 'plus' options), it shouldn't prove too difficult, however big is your config.js.

For example you could open it in Word and then 'Replace All' the following couples (have the 'generic characters' checked, order is important):

//*^13 by nothing -> commented lines

[a-z1-6]@\[pn\]=\['(*)'\];^13 by \1^t -> quoted values

[a-z1-6]@\[pn\]=\[(*)\];^13 by \1^t -> unquoted values

^tpn++;^13 by nothing -> index incrementer

Then untick the 'generic characters' checkbox and replace the following:

\' by ' -> escaped single quotes

\\ by \ -> escaped slashes

Remove also the remaining 'pn=1;' line at the top.

Select all and copy it.

Paste it in a new datasheet in Excel. If you have the default settings for the import wizard (field separated by tabs), all the fields should go to different columns. Otherwise use the data/convert command.

(Almost) done: you just have to tweak the progs with missing fields or multiple commands so that all the fields are well aligned.

When your 'table' is square enough copy/paste it in a Progs List Datasheet and tune it to your needs.

You will also have to break your commands into path/file/args. This can't be so much automated but here is how I'd do:

Copy the column containing the commands and paste it into a new Word Document.

Go down the list, inserting tabulations before and after (if there are any argument) file names.

Replace all the 'tab+space' (between filename and arguments) by 'tab' only. (use the ^t special character for tab).

Select all and copy the text.

In your Excel's Progs List, have the 3 columns for path/file/args empty, select the top left cell of these 3 columns and paste your word text.

Et Voilà!

Since WPI has gone into dev overload recently (thankfully) may be you should speak to Kel and mritter about adding these options in to WPI permenantly. This is good stuff. :thumbup

I have to say I love the radials, they work so much better than the current exclusion does.

Thank you very much.

I'm already speaking a lot with mritter ;)

But I'm not sure if this is easy and/or a good thing to implement in WPI (it may get bloated).

Anyway, the users should decide. If there's a demand (yours is maybe enough?), we'll see.

Link to comment
Share on other sites

looks great! What about uploading your config.js? It interesting how its done.

Thank you. :hello:

You can generate my own config.js by yourself!

Just get my Excel Progs Lists Manager.

In the form appearing when you click the yellow button, just select Djé's for the Progs List and WPI for the output format, and click the Write the Script button. Et voilà!

Moreover, if you tick the Use the 'Now' variables values checkbox and if the path to WPI is properly set in the SETTINGS datasheet, you will be able to run WPI with that config.js so you can actually see it working* in real situation, directly from the Progs Lists Manager (RUN button in the OUTPUT datasheet).

I think that this way you will have better insight in what is actually done: The config.js may look somewhat cryptic but looking at the Djé's Progs List and comparing it to the config.js and to the result will explain things much better.

Feel free also to look at the code (ALT+F11 in Excel) if you wish.

And of course, you're welcome to ask for further explanations here.

*As mentionned in the first post, if you want to be able to run a second WPI from a RunButton injection, you will have to mod WPI.hta (~ line 21) to make it able of multiple instances (singleInstance = 'no').

Obviously you will have to have the config.js files used by these new instances ready as well. In my example with the Firefox or Thunderbird extensions, generate the one from the Mozilla Progs List (Use filters for Fx or Tb).

Link to comment
Share on other sites

Hello

sorry I have no Micr&%$§ Excel. Only Open Office, and your file doesent work with it. Can you explain the different injection methods, or load up a config.js? This would be great! Bye

Link to comment
Share on other sites

sorry I have no Micr&%$§ Excel. Only Open Office, and your file doesent work with it. Can you explain the different injection methods, or load up a config.js? This would be great! Bye

Oops, my bad. I shouldn't assume that everybody is using M$.

T_D has tried to convert my file to Open Office but I think it will require some work because of the code being in VBA. BTW, what scripting language is OOo using?

I may try myself to do the conversion (if ever I find the time) as I'd prefer an open solution.

Anyway, attached is my 'config.js' which is actually named 'ProgsForRunOnceEx.js'. To use it, you can (beside renaming it) either put it in your WPIScripts folder and call it using WPI.hta config=ProgsForRunOnceEx.js, or put it wherever you want and feed its full path to WPI (WPI.hta config="C:\path to\ProgsForRunOnceEx.js").

ProgsForRunOnceEx.js

Here are also my mozilla's config files, for if you want to click on the 'Select...' buttons:

FxExtensions_config.jsTbExtensions_config.jsRemember to mod your WPI.hta.

Also adapt the commands calling them (in the 'onclick' attributes of the buttons) to the location where they are.

Compared to a 'normal' config.js, mine has the following modifications:

- At the top are the variables normally defined in useroptions.js (only the ones having different values from the default ones). This is not related to injection. It is just like I've merged the 2 files, for ease of use.

- Then comes the 'normal' config.js' progs definitions.

. Only necessary fields are presents.

. Some progs have injected HTML & javascript code in the
prog[pn]
field:
prog[pn][0]+=...

. Also note that I've commented out the
pn=1;
line. That way I can merge several config.js files into one before running WPI, but I'll talk about this somewhere else.

- At the bottom are the injected functions and styles which are necessary for the injection to work properly:

. A theme file patcher function to remove the
.txt
class from WPI.htm (in order to have all the edit buttons aligned, I needed this class to be used only for the progs labels).

. A custom function to manage the injected Radio Options. This is not necessary if you do your injection by hand, but it greatly helps when doing it programmatically.

. A custom <style> element with all the styles used by the injection, plus the moded
.txt
style.

Because of all these modifications, it is not possible to edit this file inside the config wizard. But that is not the goal anyway.

As for the injections themselves, here is how it works:

- In WPI, the prog[pn] field is used 'as is' inside a <label> html element. So the 1st injected thing is a closing tag for this element: </label> ... and the last one will be an opening tag to match the closing one inside WPI!

- In between them, we can now inject whatever we want.

- Injected html elements have 'onclick' or 'onchange' events which modify the commands (cmd1, etc.) for the prog.

- Although one could inject manually a lot of things, I've limited myself to inject:

. checkboxes: set or unset a
command
,

. radioOptions: give a choice for a
command
,

. 'edit' buttons: edit the file of the
command
,

. textboxes: give some arguments to the
command
,

. custom 'file' input: give a file argument to the
command
(or unset it),

. 'run' buttons: run something (usually different from a prog's
command
) '
now
' (don't wait for the installer to run it).

- These injections have their own labels. But, as we don't want the texts of these labels to be displayed inside the tooltips headers, I've put them into textboxes.

- Combinations of the injections are also possible.

That's it!

Feel free to inquire for deeper explanations.

Link to comment
Share on other sites

  • 4 months later...
  • 4 months later...

@Dje /@ll:

I made some Checkbox-Injections to my config.js. Now my problem is that I would like to use one/more conditions (cond[pn]=['FileExists("...")']) to an injected Checkbox. Like: Show injected Checkbox only if condtion is met...Is that possible?

Let me try to do a example:

prog[pn]=['Cherry Keyman 3.0']
uid[pn]=['CHERRY']
desc[pn]=['Install Cherry Keyboard- & Mouse Software.']
ordr[pn]=[260]
cond[pn]=['FileExists("%CDROM%\\WPI\\Install\\Cherry\\SetupKeyManDesktop30_DE.exe")']
cmd1[pn]=['%CDROM%\\WPI\\Install\\Cherry\\SetupKeyManDesktop30_DE.exe /quiet /norestart']
prog[pn][0]+='</label><BR />      ';
prog[pn][0]+='<input type="checkbox" id="dope19" checked value="1" onClick="';
prog[pn][0]+=' var pn = findProgByUID(\'CHERRY\');';
prog[pn][0]+=' cmd2[pn]=(!document.getElementById(\'dope19\').checked)? [\'\'] : ';
prog[pn][0]+=' [\'%CDROM%\\\\WPI\\\\Install\\\\Cherry\\\\KeymanConfig.cmd\'];">';
prog[pn][0]+='<label for="dope19"';
prog[pn][0]+='><input type="text" readonly class="injectedLabel" value="Configuration">';
prog[pn][0]+='</label><label>';
prog[pn][0]+='</label><BR />      ';
prog[pn][0]+='<input type="checkbox" id="dope20" checked value="1" onClick="';
prog[pn][0]+=' var pn = findProgByUID(\'CHERRY\');';
prog[pn][0]+=' cmd3[pn]=(!document.getElementById(\'dope20\').checked)? [\'\'] : ';
prog[pn][0]+=' [\'REGEDIT /S %CDROM%\\\\WPI\\\\Install\\\\Cherry\\\\QuickDropOff.reg\'];">';
prog[pn][0]+='<label for="dope20"';
prog[pn][0]+='><input type="text" readonly class="injectedLabel" value="Hide Quickdrop-Icon">';
prog[pn][0]+='</label><label>';
dflt[pn]=['yes']
configs[pn]=['admin,user,system']
cat[pn]=['Hardware']
pn++

Ok, as u can see the Main-Program is the Software for my Keyboard/Mouse.

The Second Injection is an option that I always want to be displayed for every User.

But the first Injection is my Private Configuration-File, and i would like this Checkbox to be displayed only when a special Condition is met. e.g. A special Tag-File is found (FileExists("%systemdrive%\\Tagfile.tag"))

Is that possible?

Please help me...

Edited by AlienMacHine
Link to comment
Share on other sites

  • 1 year later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...