Hackvertor

You are not logged in. You can still view everyone's public tags but you need to register to create tags and save urls.

Help

List of special HV commands

  1. code
  2. params
  3. HV
  4. getPipe
  5. log
  6. execLanguage
  7. outputHTML

Creating tags

All tags in Hackvertor are written in JavaScript. Each tag can have upto 3 params, these params are defined in your tag when a user selects it. The defaults are placed from each of the input boxes you add param1, param2 etc.

Every tag has two special variables code and params. Code refers to the current input of your tag so for example a tag named abc wrapped around some text "test" would look like the following: <@abc_0>test<@/abc_0>

So the sample above "code" inside your script would automatically refer to "test".

Once you have defined your params they can be referred by using the in-built params array. Look at the sample below:

<@abc_0(1,2,3)>test<@/abc_0>

Here the abc tag has 3 params which can be obtained using the params array like so:-

param1 = params[0];param2 = params[1];param3 = params[2];

Each param will become either a string or number depending on the user data entered. You should account for this.

Extending prototypes

When you create a new tag the Object.prototype is automatically extended. This allows you to use the special tags syntax to call other tags. For example take the following code:-

'abc'.HV('reverse').HV('base64',Array('encode'))

Here we use the special HV method which is a container for all tags. It's worth remembering that you need to handle the correct type in your code.

Getting external input with Yahoo Pipes

Hackvertor has a in-built global function to obtain external input from Yahoo pipes. It works by fetching a pipe id and output specified in the parameters.

getPipe("_id=YOUR_PIPE_ID&_render=json")

The pipe will return it's ouput as a string, you can then use the ouput to perform more operations or maybe eval it in the sandbox as a JSON string. Like below:-

eval("("+getPipe("_id=YOUR_PIPE_ID&_render=json")+")")

Logging inpecting output

You can send external ouput to the built in inspector via the special command "log". Log supports two parameters the first is a JSON string, the second is optional and specifies if to run the inspector in compact mode.

Both parameters are displayed below

log('{"In":{"inspection":"mode"}}') log('{"a":"","b":"","c":""}',true)

Testing tags

Hackvertor includes a in-built tag tester. The userinput box is to simulate tag text, each param can be defined as if a user entered it. The "test tag" button will show you what happens when the tag is executed inside Hackvertor.

Any JavaScript syntax errors will be displayed as you type and the test tag button will show you can conversion errors whilst using the sandbox.

Sandbox syntax

Although JavaScript is supported in Hackvertor it uses the JSReg sandbox to safely run user defined code. As a result you should not have access to the document or real window objects. This doesn't mean you can't execute window.alert or window.escape but remember these aren't the real window.

Current limitations of the sandbox include array literals. In order to use arrays you must first either set a empty one first or use the Array() constructor. This is because the current sandbox system will rewrite array literals to protect them from running harmful code. Two example below show how to use arrays in the sandbox:-

someArray = [];//set the array first
someArray[0] = 123//now we can use it
someArray = Array(1,2,3);
//creates an array with 1,2,3 use instead of [1,2,3]

Exporting your tags

You can export your sandboxed tags or from another user by clicking on your name in the right hand corner of the home screen and then clicking Export HV.

A basic API sample is available on screen before you click export. You can use the Hackvertor API to add your own debugger interface or insert your own objects

Executing other languages

Hackvertor supports other programming languages via Ideone API. This allows you to use many languages in Hackvertor tags including Perl, Ruby, JS Rhino, C, C++ and Bash. A full list can be found on the FAQ.

To use other programming languages you can use the in-built execLanguage call but be aware the result won't be instant. execLangauge supports the following arguments:- [code], [std input], [language (int)].

Here is how to execute perl:-

<@execjs_0>execLanguage('print "A" x 100;','',3);<@/execjs_0>

Outputting HTML

Hackvertor contains a special function to create some sandboxed HTML

outputHTML('<b>Some sandboxed html</b>')

Source

HTML preview