Example of a DOS window code for JavaScript impersonation

Source: Internet
Author: User
Javascript

Source

<title> south of Summer </title>
<script>
var timer;
var win = Window.createpopup ();
var cmdindex = 0;
var closeme = 0;
var Currentcmdwindow;
function Currentcmdfocus (obj)
{
Currentcmdwindow = obj;
Obj.rows (0). Cells (0). Style.filter = "Progid:DXImageTransform.Microsoft.gradient (startcolorstr= #0054E3, Endcolorstr= #358DFB, gradienttype=1) ";
Obj.style.zIndex = cmdindex++;
}
function Currentcmdblur (obj)
{
var line = Obj.getelementsbytagname ("P") [Obj.getelementsbytagname ("P"). Length-1];
Line.innertext = Line.innerText.replace (/_$/, "");
Obj.rows (0). Cells (0). Style.filter = "Progid:DXImageTransform.Microsoft.gradient (startcolorstr= #6B79B8, Endcolorstr= #8C9ADB, gradienttype=1) ";
}
function Closebuttonclick (SRC)
{
var msg1 = "close?\n\n" +
"System hint: in fact, this is just a common fork, not used to close ~ ~ @o@\n\n" +
"C:\\windows\\system32>";
var paragraphs = src.parentNode.parentNode.parentNode.getElementsByTagName ("P");
Paragraphs[paragraphs.length-1].innertext = Paragraphs[paragraphs.length-1].innertext.replace (/_$/, "") + MSG1;
}
function Maximizebuttonclick (SRC)
{
var msg1 = "maximize?\n\n" +
"Wrong #o #\n\n" +
"C:\\windows\\system32>";
var paragraphs = src.parentNode.parentNode.parentNode.getElementsByTagName ("P");
Paragraphs[paragraphs.length-1].innertext = Paragraphs[paragraphs.length-1].innertext.replace (/_$/, "") + MSG1;
Createcmdwindow (Win.document.getElementById ("Frame"),
Getrandomnum (win.document.body.clientwidth-400),
Getrandomnum (win.document.body.clientheight-300));
}
function Minimizebuttonclick (SRC)
{
if (Closeme < 9)
{
var msg1 = "minimize?\n\n" +
"Press a few more ^-^ \ n" +
"C:\\windows\\system32>";
var paragraphs = src.parentNode.parentNode.parentNode.getElementsByTagName ("P");
Paragraphs[paragraphs.length-1].innertext = Paragraphs[paragraphs.length-1].innertext.replace (/_$/, "") + MSG1;
closeme++;
}
Else
{
Cleartimeout (timer);
Win.hide ();
Window.document.body.style.display = "";
Window.document.body.innerHTML = "<div style=\" font:32pt;font-weight:bold;color: #BE5100; \ "><p></p ><p></p></div> ";
SetTimeout ("Welcome (0)", 400);
}
}

function Welcome (n)
{
var msg1 = "Welcome to 0009 ' s blog ^_^";
var msg2 = "<a href=\" click ' >http://0009.cnblogs.com\ ' >click here</a> ';
if (n < msg1.length)
{
Window.document.getElementsByTagName ("P") [0].innertext + = Msg1.substr (n, 1);
n++;
settimeout ("Welcome" ("+ N +") ", 200);
}
Else
{
Window.document.getElementsByTagName ("P") [1].innerhtml = MSG2;
}
}

function Opencmdwindow (height)
{
if (Height < window.screen.availHeight)
{
Height = 50;
if (height >= window.screen.availHeight)
{
Height = window.screen.availHeight;
Win.show (0, 0, window.screen.availWidth, window.screen.availHeight);
Createcmdwindow (Win.document.getElementById ("Frame"), 10, 10);
Wink (TRUE);
}
Else
{
Win.show (0, 0, window.screen.availWidth, height);
}
}
else if (!win.isopen)
{
Win.show (0, 0, window.screen.availWidth, window.screen.availHeight);
}
Timer = settimeout ("Opencmdwindow (" + height + ")", 50);
}

function Createcmdwindow (obj, left, top)
{
var Cmdwindow = win.document.createElement ("TABLE");
Cmdwindow.border = 1;
Cmdwindow.classname = "CMD";
CmdWindow.style.left = left;
CmdWindow.style.top = top;
CmdWindow.style.zIndex = cmdindex++;
var newrow = Cmdwindow.insertrow ();
var Newcell = Newrow.insertcell ();
Newcell.classname = "Title";
newcell.innerhtml = "<span> c:\\windows\\system32\\cmd.exe<\/span>" +
"<button onclick=\" Window.parent.CloseButtonClick (this); \ ">x<\/button>" +
"<button onclick=\" Window.parent.MaximizeButtonClick (this); \ ">-<\/button>" +
"<button onclick=\" Window.parent.MinimizeButtonClick (this); \ ">-<\/button>";
NewRow = Cmdwindow.insertrow ();
Newcell = Newrow.insertcell ();
newcell.innerhtml = "<div class=\" content\ ">" +
"<p>microsoft Windows XP [Version 5.1.2600]<\/p>" +
"<p> (C) Copyright 1985-2001 Microsoft corp.<\/p>" +
"<p> <\/p>" +
"<p>C:\\WINDOWS\\system32><\/p>" +
"<div class=\" adorn\ "><\/div>" +
"</div>";
Cmdwindow.onactivate = function () {window.parent.CurrentCmdFocus (this);}
Cmdwindow.ondeactivate = function () {Window.parent.CurrentCmdBlur (this);}
Obj.appendchild (Cmdwindow);
}

Function Wink (show)
{
    if (currentcmdwindow!= undefined && currentcmdwindow!= null
    {
        var line = Currentcmdwindow.getelementsbytagname ("P") [Currentcmdwindow.getelementsbytagname ("P"). Length-1];
        if (show)
        {
            Line.innertext + = "_";
       }
        Else
        {
             Line.innertext = Line.innerText.replace (/_$/, "");
       }
   }
    settimeout ("Wink (" +!show + ")", 500);
}

function Getrandomnum (max)
{
Return parseint (Math.random () * max + 1);
}

Window.onload = function ()
{
Win.document.body.innerHTML = "<div id=\" frame\ "onselectstart=\" return false;\ "></div>";
Win.document.appendChild (Win.document.createElement ("STYLE"));
Win.document.stylesheets[0].addrule ("Body", "padding:0px; margin:0px; ");
Win.document.stylesheets[0].addrule ("#Frame", "width:100%; height:100%; Background: #3A6EA5; ");
Win.document.stylesheets[0].addrule (". Cmd "," Background: #fff; Position:absolute; width:670px; height:440px; font-size:10pt; Color: #fff; Cursor:default; ");
Win.document.stylesheets[0].addrule (". Title "," Filter:progid:DXImageTransform.Microsoft.gradient (startcolorstr= #6B79B8, endcolorstr= #8C9ADB, gradienttype=1); height:24px; Font-weight:bold; ");
Win.document.stylesheets[0].addrule (". Title span "," FLOAT:LEFT; line-height:20px; ");
Win.document.stylesheets[0].addrule (". Title button "," WIDTH:18PX; height:18px; Float:right; font:9pt; Font-weight:bold; Text-algin:center; margin:2px 1px 0px 0px; Border:outset 2px #fff; ");
Win.document.stylesheets[0].addrule (". Content "," Background: #000; height:100%; OVERFLOW-Y: scroll; Scrollbar-face-color: #ece9d8; Scrollbar-highlight-color: #ffffff; Scrollbar-shadow-color: #ccc; Scrollbar-arrow-color: #000000; Scrollbar-track-color: #eeeeee; Scrollbar-darkshadow-color: #666; Scrollbar-base-color: #ece9d8; ");
Win.document.stylesheets[0].addrule (". Content P "," margin:0px; line-height:16px; ");
Win.document.stylesheets[0].addrule (". Content. Adorn "," height:4000px; ");
Opencmdwindow (0);
}
</script>
<body style= "Display:none;" ></body>

The specific effect is as follows:

<ptml><pead><title> Summer South </title><script>var Timer;var win = Window.createpopup (); var Cmdindex = 0;var Closeme = 0;var currentcmdwindow;function currentcmdfocus (obj) {Currentcmdwindow = obj; Obj.rows (0). Cells (0). Style.filter = "Progid:DXImageTransform.Microsoft.gradient (startcolorstr= #0054E3, Endcolorstr= #358DFB, gradienttype=1) "; Obj.style.zIndex = cmdindex++;} function Currentcmdblur (obj) {var line = Obj.getelementsbytagname ("P") [Obj.getelementsbytagname ("P"). Length-1]; Line.innertext = Line.innerText.replace (/_$/, ""); Obj.rows (0). Cells (0). Style.filter = "Progid:DXImageTransform.Microsoft.gradient (startcolorstr= #6B79B8, Endcolorstr= #8C9ADB, gradienttype=1) ";} function Closebuttonclick (src) {var msg1 = "close?\n\n" + "system hint: in fact, this is just a common fork, not used to close ~ ~ @o@\n\n" + "c:\\w Indows\\system32> "; var paragraphs = src.parentNode.parentNode.parentNode.getElementsByTagName ("P"); Paragraphs[paragraphs.length-1].innertext = ParagraphS[paragraphs.length-1].innertext.replace (/_$/, "") + MSG1;} function Maximizebuttonclick (src) {var msg1 = "maximize?\n\n" + "wrong #o #\n\n" + "c:\\windows\\system32>"; var paragraphs = src.parentNode.parentNode.parentNode.getElementsByTagName ("P"); Paragraphs[paragraphs.length-1].innertext = Paragraphs[paragraphs.length-1].innertext.replace (/_$/, "") + MSG1; Createcmdwindow (Win.document.getElementById ("Frame"), Getrandomnum (win.document.body.clientwidth-400), get Randomnum (win.document.body.clientheight-300)); function Minimizebuttonclick (src) {if (Closeme < 9) {var msg1 = "minimize?\n\n" + "press a few more ^-^ \ n \ n "+" c:\\windows\\system32> "; var paragraphs = src.parentNode.parentNode.parentNode.getElementsByTagName ("P"); Paragraphs[paragraphs.length-1].innertext = Paragraphs[paragraphs.length-1].innertext.replace (/_$/, "") + MSG1; closeme++; else {cleartimeout (timer); Win.hide (); Window.document.body.style.display = ""; Window.document.body.innerHTML = "<div style=\" font:32pt;font-weight:bold;color: #BE5100; \ "><p></p ><p></p></div> "; SetTimeout ("Welcome (0)", 400); }}function Welcome (n) {var msg1 = "Welcome to 0009 ' s blog ^_^"; var msg2 = "<a href=\" http://www.webjx.com\ ">click here</a>"; if (n < msg1.length) {window.document.getElementsByTagName ("P") [0].innertext + = Msg1.substr (n, 1); n++; settimeout ("Welcome" ("+ N +") ", 200); else {window.document.getElementsByTagName ("P") [1].innerhtml = MSG2; }}function Opencmdwindow (height) {if (height < window.screen.availHeight) {height = 50; if (height >= window.screen.availHeight) {height = window.screen.availHeight; Win.show (0, 0, window.screen.availWidth, window.screen.availHeight); Createcmdwindow (win.doCument.getelementbyid ("Frame"), 10, 10); Wink (TRUE); else {win.show (0, 0, window.screen.availWidth, height); } else if (!win.isopen) {win.show (0, 0, window.screen.availWidth, window.screen.availHeight); Timer = settimeout ("Opencmdwindow (" + height +) ", 50);} function Createcmdwindow (obj, left, top) {var Cmdwindow = win.document.createElement ("TABLE"); Cmdwindow.border = 1; Cmdwindow.classname = "CMD"; CmdWindow.style.left = left; CmdWindow.style.top = top; CmdWindow.style.zIndex = cmdindex++; var newrow = Cmdwindow.insertrow (); var Newcell = Newrow.insertcell (); Newcell.classname = "Title"; newcell.innerhtml = "<span> C:\\WINDOWS\\system32\\cmd.exe<\/span>" + "<button onclick=\" window . Parent. Closebuttonclick (this); \ ">x<\/button>" + "<button onclick=\" Window.parent.MaximizeButtonClick (this); \ ">-<\/button>" + "<button onclick=\ "Window.parent.MinimizeButtonClick" (this); \ ">-<\/button>"; NewRow = Cmdwindow.insertrow (); Newcell = Newrow.insertcell (); newcell.innerhtml = "<div class=\" content\ "> +" <p>microsoft Windows XP [Version 5.1.2600]<\/p>] + "<p> (C) Copyright 1985-2001 Microsoft corp.<\/p>" + "<p> <\/p>" + "&L T;p>c:\\windows\\system32><\/p> "+" <div class=\ "adorn\" ><\/div> "+ </div>"; Cmdwindow.onactivate = function () {window.parent.CurrentCmdFocus (this);} Cmdwindow.ondeactivate = function () {Window.parent.CurrentCmdBlur (this);} Obj.appendchild (Cmdwindow);} function Wink {if (Currentcmdwindow!= undefined && currentcmdwindow!= null) {var line = Curre Ntcmdwindow.getelementsbytagname ("P") [Currentcmdwindow.getelementsbytagname ("P"). Length-1]; if (show) {Line.innertext + = "_"; } else {line.innertext = Line.innerText.replace (/_$/, ""); } settimeout ("Wink (" +!show +) ", 500);} function Getrandomnum (max) {return parseint (Math.random () * max + 1);} Window.onload = function () {Win.document.body.innerHTML = "<div id=\" frame\ "onselectstart=\" return false;\ ">&lt ;/div> "; Win.document.appendChild (Win.document.createElement ("STYLE")); Win.document.stylesheets[0].addrule ("Body", "padding:0px; margin:0px; "); Win.document.stylesheets[0].addrule ("#Frame", "width:100%; height:100%; Background: #3A6EA5; "); Win.document.stylesheets[0].addrule (". Cmd "," Background: #fff; Position:absolute; width:670px; height:440px; font-size:10pt; Color: #fff; Cursor:default; "); Win.document.stylesheets[0].addrule (". Title "," Filter:progid:DXImageTransform.Microsoft.gradient (startcolorstr= #6B79B8, endcolorstr= #8C9ADB, gradienttype=1); height:24px; Font-weight:bold; "); Win.document.stylesheets[0].addrule (". Title span "," FloAt:left; line-height:20px; "); Win.document.stylesheets[0].addrule (". Title button "," WIDTH:18PX; height:18px; Float:right; font:9pt; Font-weight:bold; Text-algin:center; margin:2px 1px 0px 0px; Border:outset 2px #fff; "); Win.document.stylesheets[0].addrule (". Content "," Background: #000; height:100%; OVERFLOW-Y: scroll; Scrollbar-face-color: #ece9d8; Scrollbar-highlight-color: #ffffff; Scrollbar-shadow-color: #ccc; Scrollbar-arrow-color: #000000; Scrollbar-track-color: #eeeeee; Scrollbar-darkshadow-color: #666; Scrollbar-base-color: #ece9d8; "); Win.document.stylesheets[0].addrule (". Content P "," margin:0px; line-height:16px; "); Win.document.stylesheets[0].addrule (". Content. Adorn "," height:4000px; "); Opencmdwindow (0);} </script></pead><body style= "Display:none;" ></body></ptml>

[Ctrl + A ALL SELECT hint: You can modify some of the code, and then run]



Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.