I want to be able to format my string and replicate the same code (not for an attack, but for a demo):
window.onload = function() {
alert("hello Silly");
var attack = [
'window.onload = function() {',
' alert("hello Silly");',
' var attack = [',
' ];',
' var profile = new String();',
' for (var i = 0; i < attack.length; i++) {',
' profile += attack[i];',
' }',
' console.log(profile);',
'}'
];
var profile = new String();
for (var i = 0; i < 3; i++) {
profile += attack[i];
}
for (var i = 0; i < attack.length; i++) {
profile += attack[i];
}
for (var i = 4; i < attack.length; i++) {
profile += attack[i];
}
console.log(profile);
}
The idea is to make the script recursively able to execute itself, at an injection for example ... However I'm afraid I'm missing the recursive step in the replication ...
** Edit **
As per suggestion, I added most of the code, however I still missing the recursive step ... how can I replicate the attack
to the attack
string?