foops.hta

<html>
<head><title>Foops</title>
<HTA:APPLICATION ID="oHTA" APPLICATIONNAME="myApp" BORDER="thin"
   BORDERSTYLE="normal" CAPTION="yes" ICON="logo.ico"
   MAXIMIZEBUTTON="no" MINIMIZEBUTTON="yes" SHOWINTASKBAR="yes"
   SINGLEINSTANCE="yes"
   SYSMENU="yes"
   VERSION="1.0"
   WINDOWSTATE="normal"
   >
<meta http-equiv="Content-Type" content="text/html;charset=gb2312">
<meta name="author" content="Who?Who?Who?">
<meta name="email" content="What?What?What?">
<style type="text/css">
.button {
 width: 65px;
 font-size: 9pt;
}
.text {
 width: 440px;
}
label {
 font-size: 9pt;
}
</style>
<script>
function SaveXML() {
 var rdr = new ActiveXObject("MSXML2.SAXXMLReader");
 var wrt = new ActiveXObject("MSXML2.MXXMLWriter");
 wrt.indent = true;
 rdr.contentHandler = wrt;
 rdr.parse(xmldoc);

 xmldoc.loadXML(wrt.output);
 var rootXML=xmldoc.documentElement;
 xmldoc.loadXML('<?xml version="1.0" encoding="gb2312"?>' + rootXML.xml);
 xmldoc.save(URL);
}
function Feed()
{
    this.id  = null;
    this.cms = null;
    this.tar = null;
    this.ref = null;
}
function Foops() {
    var Url, Ref, Flags, TargetFrameName, Headers, PostData;
    var Index = parseInt(urls.options[urls.selectedIndex].value);
    Url = aryFeeds[Index].tar;
    Ref = aryFeeds[Index].ref;
    Flags = 1;
    TargetFrameName = "";
    PostData = "";
    Headers = "Referer:" + Ref + String.fromCharCode(13) + String.fromCharCode(10);
    var WebBrowser = new ActiveXObject("InternetExplorer.Application");
    WebBrowser.Navigate(Url, Flags, TargetFrameName, PostData, Headers);
    //WebBrowser.Quit();
}
var xmldoc = new ActiveXObject('Microsoft.XMLDOM');
var aryFeeds = new Array();
var curFeedID = "0";
var URL = "foops.xml";

function objSort() {
    var temp;
    for(var i=0; i<aryFeeds.length-1; i++) {
 for(var j=i+1; j<aryFeeds.length; j++) {
     if (aryFeeds[i].cms > aryFeeds[j].cms) {
  temp = aryFeeds[i];
  aryFeeds[i] = aryFeeds[j];
  aryFeeds[j] = temp;
     }
 }
    }
}
function SetFeedCollect() {
    var xmlFeeds = xmldoc.selectNodes('/feeds/feed');
    aryFeeds.length = 0;
    for(var i=0; i<xmlFeeds.length; i++) {
 aryFeeds[aryFeeds.length] = new Feed();
 aryFeeds[aryFeeds.length - 1].id  = xmlFeeds[i].getAttribute('id');
 aryFeeds[aryFeeds.length - 1].cms = xmlFeeds[i].getAttribute('cms');
 aryFeeds[aryFeeds.length - 1].tar = xmlFeeds[i].getAttribute('tar');
 aryFeeds[aryFeeds.length - 1].ref = xmlFeeds[i].getAttribute('ref');
    }
}
function ShowFeedCollect() {
    urls.length = 0;
    for (var i=0; i<aryFeeds.length; i++) {
 var o = new Option();
 o.value = i;
 o.innerText  = aryFeeds[i].cms;
 if (aryFeeds[i].id == curFeedID) o.selected = true;
 urls.appendChild(o);
    }
}
function getMaxFeedID() {
    var root = xmldoc.documentElement;
    var id;
    if (root.lastChild) id = parseInt(root.lastChild.getAttribute('id'));
    else id = 0;
    return id;
}
function ChangeButtonStatus() {
    if (aryFeeds.length == 0) {
 DisabledButton(true);
 $('btnAdd').disabled = false;
    } else {
 DisabledButton(false);
    }
}
function ShowResults() {
    SetFeedCollect();
    objSort();
    ShowFeedCollect();
    ChangeButtonStatus();
}
function Init() {
    ShrinkWindow();
    $('btnSpoof').disabled = true;
    if (xmldoc) {
 Loading(URL);
    } else {
 alert("Can't create XMLDOM Object!");
    }
    $('btnAdd').onclick = Add_Click;
    $('btnEdit').onclick = Edit_Click;
    $('btnDelete').onclick = Delete_Click;
    $('btnFind').onclick = Find_Click;
    $('btnExit').onclick = function() { SaveXML(); window.close(); };
    window.onunload = SaveXML;
}
function Loading(url) {
    xmldoc.async = false;
    xmldoc.onreadystatechange = OnReadyStateChange;
    var boolStatus = xmldoc.load(url);
    if (boolStatus) ShowResults();
    else {
 var xml = '<?xml version="1.0" encoding="gb2312"?><feeds></feeds>';
 xmldoc.loadXML(xml);
 DisabledButton(true);
 $('btnAdd').disabled = false;
    }
}
function OnReadyStateChange() {
    if (xmldoc.readyState == 4) {
    }
}
function $(id) {
    return (id.constructor == String) ? document.getElementById(id) : id;
}
function ExtendWindow() {
    window.resizeTo(500, 330);
}
function ShrinkWindow() {
    window.resizeTo(500, 100);
}
function Add_Click() {
    ExtendWindow();
    SetFormHtml('Add Item');
    DisabledButton(true);
    $('btnCancel').onclick = Cancel_Click;
    $('btnOK').onclick = Add_OK_Click;
}
function Edit_Click() {
    ExtendWindow();
    SetFormHtml('Edit Item');
    DisabledButton(true);
    var Index = parseInt(urls.options[urls.selectedIndex].value);
    $('txtDescription').value = aryFeeds[Index].cms;
    $('txtReferer').value = aryFeeds[Index].ref;
    $('txtTarget').value = aryFeeds[Index].tar;
    $('btnCancel').onclick = Cancel_Click;
    $('btnOK').onclick = Edit_OK_Click;
}
function Delete_Click() {
    var Index = parseInt(urls.options[urls.selectedIndex].value);
    var Node = xmldoc.selectSingleNode('/feeds/feed[@id="' + aryFeeds[Index].id + '"]');
    if (urls.length == 1) curFeedID = "0";
    else {
 var tempIndex = urls.selectedIndex + 1;
 if (tempIndex < urls.length) {
     var Index2 = parseInt(urls.options[tempIndex].value);
     curFeedID = aryFeeds[Index2].id;
        } else {
     tempIndex = urls.selectedIndex - 1;
     var Index2 = parseInt(urls.options[tempIndex].value);
     curFeedID = aryFeeds[Index2].id;
        }
    }
    Node.parentNode.removeChild(Node);
    ShowResults();
}
function Find_Click() {
}
function Cancel_Click() {
    $('ActiveArea').innerHTML = '';
    ChangeButtonStatus();
    ShrinkWindow();
}
function CheckFeed() {
    var flag = true;
    var description = $('txtDescription').value;
    var referer = $('txtReferer').value;
    var target = $('txtTarget').value;
    if (description == "" || referer == "" || target == "") flag = false;
    if (referer.substr(0,7) != "http://") flag = false;
    if (target.substr(0,7) != "http://") flag = false;
    return flag;
}
function AppendXmlNode() {
    var root = xmldoc.documentElement;
    var Node = xmldoc.createElement('feed');
    var id = getMaxFeedID() + 1;
    curFeedID = id;
    Node.setAttribute('id', getMaxFeedID() + 1);
    Node.setAttribute('cms', $('txtDescription').value);
    Node.setAttribute('tar', $('txtTarget').value);
    Node.setAttribute('ref', $('txtReferer').value);
    root.appendChild(Node);
}
function Add_OK_Click() {
    if (CheckFeed()) {
 AppendXmlNode();
 ShowResults();
    }
    $('ActiveArea').innerHTML = '';
    ChangeButtonStatus();
    ShrinkWindow();
}
function UpdateXmlNode(Node) {
    Node.setAttribute('cms', $('txtDescription').value);
    Node.setAttribute('tar', $('txtTarget').value);
    Node.setAttribute('ref', $('txtReferer').value);
}
function Edit_OK_Click() {
    var Index = parseInt(urls.options[urls.selectedIndex].value);
    var Node = xmldoc.selectSingleNode('/feeds/feed[@id="' + aryFeeds[Index].id + '"]');
    if (CheckFeed()) {
 curFeedID = aryFeeds[Index].id;
 UpdateXmlNode(Node);
 ShowResults();
    }
    $('ActiveArea').innerHTML = '';
    ChangeButtonStatus();
    ShrinkWindow();
}
function DisabledButton(boolValue) {
    $('urls').disabled = boolValue;
    $('btnAdd').disabled = boolValue;
    $('btnEdit').disabled = boolValue;
    $('btnDelete').disabled = boolValue;
    $('btnFind').disabled = boolValue;
    $('btnSpoof').disabled = boolValue;
}

function SetFormHtml(caption) {
    var htmlTable = '<table cellspacing=0 cellpadding=0><tr><td colspan=2>';
 htmlTable += '<fieldset style="padding:8px;width:465;border:2px groove transparent; color:#000000; line-height:2.0; font-size:12px;"><legend>' + caption + '</legend>';
 htmlTable += '<table>';
 htmlTable += '<tr><td><label>Description</label></td></tr>';
 htmlTable += '<tr><td><input id="txtDescription" type="text" class="text"></td></tr>';
 htmlTable += '<tr><td><label>Referer</label></td></tr>';
 htmlTable += '<tr><td><input id="txtReferer" type="text" class="text"></td></tr>';
 htmlTable += '<tr><td><label>Target</label></td></tr>';
 htmlTable += '<tr><td><input id="txtTarget" type="text" class="text"></td></tr>';
 htmlTable += '</table>';
 htmlTable += '</fieldset>';
 htmlTable += '</td></tr>';
 htmlTable += '<tr>';
 htmlTable += '<td align="left"><input type="button" value="OK" id="btnOK" class="button"></td>';
 htmlTable += '<td align="right"><input type="button" value="Cancel" id="btnCancel" class="button"></td>';
 htmlTable += '</tr></table>';
 $('ActiveArea').innerHTML = htmlTable;
}
</script>
</head>
<body οnlοad="Init()" scroll="no" οncοntextmenu="if(event.srcElement.tagName!='INPUT')return false" onselectstart="if(event.srcElement.tagName!='INPUT')return false" bgcolor="buttonface" topmargin=8 bottommargin=0>
<table border=0 cellspacing=0 cellpadding=2>
<tr><td><select name="urls" id="urls" style="width:400"></select></td><td><input type="button" id="btnSpoof" οnclick="Foops()" class="button" value="Spoof" title="click this button to spoof"></td></tr>
<tr><td>
<input type="button" AccessKey="A" value="Add" id="btnAdd" class="button">
<input type="button" value="Edit" id="btnEdit" class="button">
<input type="button" value="Delete" id="btnDelete" class="button">
<input type="button" value="Find" id="btnFind" class="button">
</td>
<td align="right">
<input type="button" value="Exit" id="btnExit" class="button">
</td>
</tr>
<tr>
<td colspan=2 id="ActiveArea"></td>
</tr>
</table>
</body>
</html> 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值