How to use JavaScript injections: 9 Steps (with pictures)

Table of contents:

How to use JavaScript injections: 9 Steps (with pictures)
How to use JavaScript injections: 9 Steps (with pictures)
Anonim

JavaScript injections are processes in which you can insert and use your own JavaScript code on a page, either by entering the code in the address bar, or by finding the XSS vulnerability of a website. Note: changes can only be seen by you.

Steps

Use JavaScript Injections Step 1
Use JavaScript Injections Step 1

Step 1. You must enter the code in the address bar

Try these injections:

Use JavaScript Injections Step 2
Use JavaScript Injections Step 2

Step 2. javascript: alert ("Hello

");

  • For an alert window to appear saying “Hello !:

Step 3. javascript: alert ("Hello"); alert ("World");

Use JavaScript Injections Step 3
Use JavaScript Injections Step 3
  • For two alert windows to appear, one in front saying "Hello" and when you click Ok, another will appear that says "World":

Use JavaScript Injections Step 4
Use JavaScript Injections Step 4

Step 4. javascript: alert (document.forms [0].to.value = "something")

  • To change the value of the form [0] to something:

Use JavaScript Injections Step 5
Use JavaScript Injections Step 5

Step 5. javascript: void (document.bgColor = "blue")

  • To change the background color to blue. You can put any color:

Use JavaScript Injections Step 6
Use JavaScript Injections Step 6

Step 6. javascript: alert ("The current URL is:

"+ location.protocol +" "+ location.hostname +" / "+" The URL is: "+ location.href +" "+" If the server names are not the same, the page is a hoax. ");

  • To see the actual name of the website you are viewing. You should use it if you think what they show you is false:

Use JavaScript Injections Step 7
Use JavaScript Injections Step 7

Step 7. javascript: R = 0; x1 =.1; y1 =.05; x2 =.25; y2 =.24; x3 = 1.6; y3 =.24; x4 = 300; y4 = 200; x5 = 300; y5 = 200; DI = document.images; DIL = DI.length; function A () {for (i = 0; i-DIL; i ++) {DIS = DI [i].style; DIS.position = 'absolute'; DIS.left = Math.sin (R * x1 + i * x2 + x3) * x4 + x5; DIS.top = Math.cos (R * y1 + i * y2 + y3) * y4 + y5} R ++} setInterval ('A ()', 5); void (0);

  • So that the images move. Make sure to look for a site with a lot of images like Google Image (if you press the "Refresh" key, they move really fast, it may only be on MAC):

Use JavaScript Injections Step 8
Use JavaScript Injections Step 8

Step 8. javascript: R = 0; x1 =.1; y1 =.05; x2 =.25; y2 =.24; x3 = 1.6; y3 =.24; x4 = 300; y4 = 200; x5 = 300; y5 = 200; DI = document.images; DIL = DI.length; function A () {for (i = 0; i-DIL; i ++) {DIS = DI [i].style; DIS.position = 'absolute'; DIS.left = Math.cos (R * x1 + i * x1 + x2) * x4 + x5; DIS.top = Math.cos (R * y1 + i * y2 + y3) * y4 + y5} R ++} setInterval ('A ()', 5); void (0);

  • To make them go round in circles:

Use JavaScript Injections Step 9
Use JavaScript Injections Step 9

Step 9. javascript: document.body.contentEditable = 'true'; document.designMode = 'on'; void0

  • To move things on the web page:

Advice

  • If you are using a browser with an address bar that doubles as a search bar, make sure that after you type in the code, you select the address bar to process the code, not the search bar.

    Addressbar
    Addressbar
  • The changes are not permanent and only you can see them.
  • You can only change the background of pages that do not have a CSS background.

Popular by topic