Imacros - Invitation code missing 3 letters/number

2019-08-05 09:05发布

IMACROS. I have to find out a invitation code to a site, it's a code that contains letters(a-z) and numbers(0-9). There are 3 missing, the XXX for exemple. But, how do I make a "for" to considerate letters and numbers on Imacros? I have to use javascript?

This is the code I have:

VERSION BUILD=8820413 RECORDER=FX
TAB T=1
TAB CLOSEALLOTHERS
URL GOTO=(url site)
TAG POS=1 TYPE=INPUT:TEXT FORM=ACTION:confirmcod.php ATTR=NAME:cod CONTENT=123XXXabc
TAG POS=1 TYPE=INPUT:SUBMIT FORM=ACTION:confirmcod.php ATTR=*

标签: imacros
1条回答
来,给爷笑一个
2楼-- · 2019-08-05 09:13

One way to do this without using Javascript is to preload a datasource with all of the possible combinations for the link. Iterate over this document until you find the proper link.

VERSION BUILD=8820413 RECORDER=FX
TAB T=1
TAB CLOSEALLOTHERS
SET !DATASOURCE c:\mysource 
SET !DATASOURCE_COLUMNS 1
SET !DATASOURCE_LINE {{!LOOP}}
URL GOTO=(url site)
TAG POS=1 TYPE=INPUT:TEXT FORM=ACTION:confirmcod.php ATTR=NAME:cod CONTENT={{!COL1}}
TAG POS=1 TYPE=INPUT:SUBMIT FORM=ACTION:confirmcod.php ATTR=*

Wiki page for iMacro Datasource.

If you want to use javascript you will need to use iimPlay to generate the macro code on the fly. The example below iterates checks a random strings until iMacros returns 1 or sOK.

// possible keys for the link
var keys = '0123456789abcdefghijklmnopqrstuvwxyz';
// array to store past keys
var keyArray = [];
var myKey = "";
var i, j, k = 0;
var pageNotFound = true;
var macro = "";
var retCode = 0;
var myURL = "http://www.google.com";
do
{
    i = keys.charAt(Math.floor(Math.random()*keys.length))
    j = keys.charAt(Math.floor(Math.random()*keys.length));
    k = keys.charAt(Math.floor(Math.random()*keys.length));
    myKey = i + j + k;
    if (keyArray.indexOf(myKey, 0) < 0)
    {
        keyArray.push(myKey);
        // run imacro code with this key
        macro = "CODE:";
        macro += "TAB T=1\n";
        macro += "TAB CLOSEALLOTHERS\n";

        macro += "URL GOTO=" + myURL + "\n";
        macro += "TAG POS=1 TYPE=INPUT:TEXT FORM=ID:gbqf ATTR=ID:gbqfq CONTENT=" + myKey + "\n";
        macro += "TAG POS=1 TYPE=BUTTON FORM=ID:gbqf ATTR=ID:gbqfb\n";
        retCode = iimPlay(macro);
        // check if the page is found
        if (retCode)
        {
            // if page is found set pageNotFound = false;
            pageNotFound = false;
        }
    } else {
        // key has been used already, try a different one.
    }
} while(pageNotFound);
查看更多
登录 后发表回答