Changeset 3432
- Timestamp:
- 08/14/08 17:01:25 (5 years ago)
- Location:
- branch/UmitWeb
- Files:
-
- 44 added
- 22 modified
-
share/umit/templates/compare_results.html (modified) (3 diffs)
-
share/umit/templates/html/index.html (modified) (1 diff)
-
share/umit/templates/index.html (modified) (2 diffs)
-
share/umit/umitweb_media/css/layout.css (modified) (1 diff)
-
share/umit/umitweb_media/js/command-wizard.js (modified) (18 diffs)
-
share/umit/umitweb_media/js/common.js (modified) (8 diffs)
-
share/umit/umitweb_media/js/compare_results.js (modified) (9 diffs)
-
share/umit/umitweb_media/js/dialog.js (modified) (3 diffs)
-
share/umit/umitweb_media/js/gecko (added)
-
share/umit/umitweb_media/js/gecko/command-wizard.js (added)
-
share/umit/umitweb_media/js/gecko/common.js (added)
-
share/umit/umitweb_media/js/gecko/compare_results.js (added)
-
share/umit/umitweb_media/js/gecko/permissions.js (added)
-
share/umit/umitweb_media/js/gecko/profile-editor.js (added)
-
share/umit/umitweb_media/js/gecko/roles.js (added)
-
share/umit/umitweb_media/js/gecko/scan-dialog.js (added)
-
share/umit/umitweb_media/js/gecko/scan.js (added)
-
share/umit/umitweb_media/js/gecko/scan_manager.js (added)
-
share/umit/umitweb_media/js/gecko/users.js (added)
-
share/umit/umitweb_media/js/ie (added)
-
share/umit/umitweb_media/js/ie/command-wizard.js (added)
-
share/umit/umitweb_media/js/ie/common.js (added)
-
share/umit/umitweb_media/js/ie/compare_results.js (added)
-
share/umit/umitweb_media/js/ie/permissions.js (added)
-
share/umit/umitweb_media/js/ie/profile-editor.js (added)
-
share/umit/umitweb_media/js/ie/roles.js (added)
-
share/umit/umitweb_media/js/ie/scan-dialog.js (added)
-
share/umit/umitweb_media/js/ie/scan.js (added)
-
share/umit/umitweb_media/js/ie/scan_manager.js (added)
-
share/umit/umitweb_media/js/ie/users.js (added)
-
share/umit/umitweb_media/js/index.js (modified) (4 diffs)
-
share/umit/umitweb_media/js/login.js (modified) (2 diffs)
-
share/umit/umitweb_media/js/mootools.v1.11-old.js (modified) (1 diff)
-
share/umit/umitweb_media/js/opera (added)
-
share/umit/umitweb_media/js/opera/command-wizard.js (added)
-
share/umit/umitweb_media/js/opera/common.js (added)
-
share/umit/umitweb_media/js/opera/compare_results.js (added)
-
share/umit/umitweb_media/js/opera/permissions.js (added)
-
share/umit/umitweb_media/js/opera/profile-editor.js (added)
-
share/umit/umitweb_media/js/opera/roles.js (added)
-
share/umit/umitweb_media/js/opera/scan-dialog.js (added)
-
share/umit/umitweb_media/js/opera/scan.js (added)
-
share/umit/umitweb_media/js/opera/scan_manager.js (added)
-
share/umit/umitweb_media/js/opera/users.js (added)
-
share/umit/umitweb_media/js/permissions.js (modified) (19 diffs)
-
share/umit/umitweb_media/js/profile-editor.js (modified) (12 diffs)
-
share/umit/umitweb_media/js/roles.js (modified) (21 diffs)
-
share/umit/umitweb_media/js/safari (added)
-
share/umit/umitweb_media/js/safari/command-wizard.js (added)
-
share/umit/umitweb_media/js/safari/common.js (added)
-
share/umit/umitweb_media/js/safari/compare_results.js (added)
-
share/umit/umitweb_media/js/safari/permissions.js (added)
-
share/umit/umitweb_media/js/safari/profile-editor.js (added)
-
share/umit/umitweb_media/js/safari/roles.js (added)
-
share/umit/umitweb_media/js/safari/scan-dialog.js (added)
-
share/umit/umitweb_media/js/safari/scan.js (added)
-
share/umit/umitweb_media/js/safari/scan_manager.js (added)
-
share/umit/umitweb_media/js/safari/users.js (added)
-
share/umit/umitweb_media/js/scan-dialog.js (modified) (6 diffs)
-
share/umit/umitweb_media/js/scan.js (modified) (12 diffs)
-
tests/browser_compability.txt (modified) (1 diff)
-
umitCore/Paths.py (modified) (2 diffs)
-
umitWeb/WebConf.py (modified) (1 diff)
-
umitWeb/views/compare_results.py (modified) (1 diff)
-
umitWeb/views/scan.py (modified) (4 diffs)
-
umitweb.py (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
branch/UmitWeb/share/umit/templates/compare_results.html
r1466 r3432 40 40 <a class="expander" href="javascript:void(null)"><h4 id="scan1-switch" class="sw-collapsed">Scan 1</h4></a> 41 41 <div class="frame-div hide code diff-text" id="scan1-detail"></div> 42 <span id="scan1-xml" class="hide" />42 <span id="scan1-xml" class="hide"></span> 43 43 </div> 44 44 <div id="result-right"> … … 57 57 <a class="expander" href="javascript:void(null)"><h4 id="scan2-switch" class="sw-collapsed">Scan 2</h4></a> 58 58 <div class="frame-div hide code diff-text" id="scan2-detail"></div> 59 <span id="scan2-xml" class="hide" />59 <span id="scan2-xml" class="hide"></span> 60 60 </div> 61 61 <div id="result-main"> … … 86 86 </div> 87 87 </div> 88 <div id="footer">Copyright (C) 200 5 Insecure.Com LLC. Sponsored by<a target="_blank" href="http://code.google.com/soc/"><img title="Sponsored by Google" alt="Sponsored by Google" src="/media/images/google-small-logo.png"/></a></div>88 <div id="footer">Copyright (C) 2007 Adriano Monteiro Marques.</div> 89 89 </div> 90 90 </body> -
branch/UmitWeb/share/umit/templates/html/index.html
r1212 r3432 5 5 <body> 6 6 <script type="text/javascript"> 7 if(window.gecko ){7 if(window.gecko || window.khtml || window.opera || window.ie){ 8 8 document.write("redirecting the page...") 9 9 document.close() -
branch/UmitWeb/share/umit/templates/index.html
r2871 r3432 10 10 <link rel="stylesheet" href="/media/css/tabber.css"/> 11 11 <link rel="icon" href="/favicon.ico" type="image/vnd.microsoft.icon"/> 12 <script type="text/javascript" src="/media/js/mootools.v1.11.js"></script> 12 <!-- <script type='text/javascript' 13 src='http://getfirebug.com/releases/lite/1.2/firebug-lite-compressed.js'></script> --> 14 <script type="text/javascript" src="/media/js/mootools.v1.11-old.js"></script> 13 15 <script type="text/javascript" src="/media/js/common.js"></script> 14 16 <script type="text/javascript" src="/media/js/dialog.js"></script> … … 145 147 </div> 146 148 </div> 147 <div id="footer">Copyright (C) 2007 Adriano Monteiro Marques.</ a></div>149 <div id="footer">Copyright (C) 2007 Adriano Monteiro Marques.</div> 148 150 </div> 149 151 </body> -
branch/UmitWeb/share/umit/umitweb_media/css/layout.css
r1466 r3432 120 120 height:350px; 121 121 } 122 123 .dialog{ 124 z-index: 500; 125 } -
branch/UmitWeb/share/umit/umitweb_media/js/command-wizard.js
r1256 r3432 11 11 this.options.content.empty(); 12 12 13 self = this;14 title = new Element("h3");15 commandConstructorDiv = new Element("div");16 lbl = new Element("label");13 var self = this; 14 var title = new Element("h3"); 15 var commandConstructorDiv = new Element("div"); 16 var lbl = new Element("label"); 17 17 lbl.setHTML("<strong>Command: </strong>"); 18 divCommandConstructor = new Element("input", {"id": "divCommandConstructor",18 var divCommandConstructor = new Element("input", {"id": "divCommandConstructor", 19 19 "style": "border:1px #DDD solid;margin: 5px;padding:4px; width: 95%;", "type": "text"}); 20 20 divCommandConstructor.value = "nmap <target>"; … … 23 23 24 24 title.setText("UMIT Command Constructor Wizard"); 25 tabber = new Element("div", {"class": "tabber", "id": "tabberCommand"});26 27 28 tabBegin = new Element("div", {class: "tabbertab", style: "height: 285px"});25 var tabber = new Element("div", {"class": "tabber", "id": "tabberCommand"}); 26 27 28 var tabBegin = new Element("div", {"class": "tabbertab", "style": "height: 285px"}); 29 29 tabBegin.setHTML("UMIT Allow user to construct powerful commands in two distinct ways:<p/>" + 30 30 "<input type='radio' id='novice' name='novice_expert' checked='checked'/><label for='novice'>Novice</label><p/>"+ … … 32 32 tabber.adopt(tabBegin); 33 33 34 tabSelectType = new Element("div", {class: "tabbertab", style: "height: 285px"});35 htext = "You wish to create a new profile, or just want to quickly create a command and run it once?<p/>";34 var tabSelectType = new Element("div", {"class": "tabbertab", "style": "height: 285px"}); 35 var htext = "You wish to create a new profile, or just want to quickly create a command and run it once?<p/>"; 36 36 htext += "<input type='radio' name='type' id='type_profile' checked='checked'/><label for='type_profile'>Profile</label><p/>"; 37 37 htext += "<input type='radio' name='type' id='type_command'/><label for='type_command'>Command</label><br/>"; … … 41 41 tabber.adopt(tabSelectType); 42 42 43 tabProfileDetails = new Element("div", {class: "tabbertab", style: "height: 285px;"});43 var tabProfileDetails = new Element("div", {"class": "tabbertab", "style": "height: 285px;"}); 44 44 tabProfileDetails.setText("Please, enter the profile name, " + 45 45 "and optionally, enter a hint, description and annotation for this " + 46 46 "new profile:"); 47 spnProfile = new Element("table"); 48 spnProfile.setHTML("<tr><td valign='top'><label for='pprofile_name'><strong>Profile Name:</strong> </label></td>" + 49 "<td><input type='text' id='pprofile_name' size='40'/></td></tr>" + 47 var spnProfile = new Element("table"); 48 tabProfileDetails.adopt(spnProfile); 49 addTableRow(spnProfile, [{'valign': 'top', 50 'value': "<label for='pprofile_name'><strong>Profile Name:</strong> </label>"}, 51 "<input type='text' id='pprofile_name' size='40'/>"]); 52 53 addTableRow(spnProfile, [{'valign': 'top', 54 'value': "<label for='pprofile_name'><strong>Profile Name:</strong> </label>"}, 55 "<input type='text' id='profile_hint' size='40'/>"]); 56 addTableRow(spnProfile, [{'valign': 'top', 57 'value': "<label for='profile_description'>Description: </label>"}, 58 "<textarea id='profile_description' rows='4' cols='37'></textarea>"]); 59 60 addTableRow(spnProfile, [{'valign': 'top', 61 'value': "<label for='profile_annotation'>Annotation: </label>"}, 62 "<textarea id='profile_annotation' rows='4' cols='37'></textarea>"]); 63 64 65 /*spnProfile.setHTML("<tbody><tr><td valign='top'><label for='pprofile_name'><strong>Profile Name:</strong> </label></td>" + 66 "<td><input type='text' id='pprofile_name' size='40'/></td></tr>" + 50 67 "<tr><td valign='top'><label for='profile_int'>Hint: </label></td>" + 51 "<td><input type='text' id='profile_hint' size='40'/></td></tr>" + 68 "<td><input type='text' id='profile_hint' size='40'/></td></tr>" + 52 69 "<tr><td valign='top'><label for='profile_description'>Description: </label></td>"+ 53 70 "<td><textarea id='profile_description' rows='4' cols='37'></textarea></td></tr>" + 71 54 72 "<tr><td valign='top'><label for='profile_annotation'>Annotation: </label></td>" + 55 "<td><textarea id='profile_annotation' rows='4' cols='37'></textarea></td></tr> ");56 tabProfileDetails.adopt(spnProfile);73 "<td><textarea id='profile_annotation' rows='4' cols='37'></textarea></td></tr></tbody>");*/ 74 57 75 tabber.adopt(tabProfileDetails); 58 76 59 77 new Json.Remote("/wizard/", {onComplete: function(sections){ 60 78 varData = sections; 61 for( k in sections){62 s = sections[k]63 tab = new Element("div", {class: "tabbertab", style: "height: 285px;"});79 for(var k in sections){ 80 var s = sections[k]; 81 var tab = new Element("div", {"class": "tabbertab", "style": "height: 285px;"}); 64 82 tab.setHTML("<b>" + s.label + "</b>"); 65 table = new Element("table", {width: "100%"});66 tableContent = "<tr>";83 var table = new Element("table", {"width": "100%"}); 84 67 85 s.options.each(function(op){ 86 var row = []; 68 87 if(op.type == "list"){ 69 tableContent += "<tr><td width='0'></td>" 70 tableContent += "<td><label for='" + op.label + "'>" + op.label + "</label></td>" 71 tableContent += "<td><select id='" + op.label + "'>" 72 for(y=0; y < op.options.length; y++){ 73 lbl = op.options[y]; 74 tableContent += "<option value='" + lbl.command + "'>" + ((lbl.name == "None")? "": lbl.name) + "</option>" 75 } 76 tableContent += "</select></td></tr>" 88 row.push({"width": "0", "value": ""}); 89 row.push("<label for='" + op.label + "'>" + op.label + "</label>"); 90 91 var selectTag = new Element("select", {"id": op.label}); 92 for(var y=0; y < op.options.length; y++){ 93 var lbl = op.options[y]; 94 var opt = new Element("option", {"value": lbl.command}); 95 opt.text = (lbl.name == "None")? "": lbl.name; 96 try{ 97 selectTag.add(opt, null); 98 }catch(e){ 99 // IE only 100 selectTag.add(opt); 101 } 102 } 103 row.push({"value": selectTag}); 104 addTableRow(table, row); 105 77 106 }else if(op.type == "check"){ 78 tableContent += "<tr><td width='0'><input type='checkbox' id='" + op.label + "' value='" + op.command + "'/></td>"79 tableContent += "<td><label for='" + op.label + "'>" + op.label + "</label></td>"107 row.push({"width": "0", "value": "input type='checkbox' id='" + op.label + "' value='" + op.command + "'/>"}); 108 row.push("<label for='" + op.label + "'>" + op.label + "</label>"); 80 109 if(op.arg_type){ 81 tableContent += "<td><input type='text' size='15' id='txt-" + op.label + "' class='wiz-input'/></td>"82 } 83 tableContent += "</tr>"110 row.push("<input type='text' size='15' id='txt-" + op.label + "' class='wiz-input'/>"); 111 } 112 addTableRow(table, row); 84 113 } 85 114 }); 86 tableContent += "</tr>"; 87 table.setHTML(tableContent); 115 88 116 tab.adopt(table); 89 117 tabber.adopt(tab); … … 92 120 tabber.getElements("select").each(function(el){ 93 121 el.addEvent("change", function(e){ 94 for( i = 0; i < this.length; i++){95 v = this[i].value;122 for(var i = 0; i < this.length; i++){ 123 var v = this[i].value; 96 124 if(i != this.selectedIndex){ 97 125 removeCommand(v); 98 126 } 99 127 } 100 v = this[this.selectedIndex].value;128 var v = this[this.selectedIndex].value; 101 129 updateCommand(v); 102 130 }); … … 106 134 tabber.getElements("input[type=checkbox]").each(function(el){ 107 135 el.addEvent("change", function(e){ 108 v = this.value;109 cmpl = ($defined($("txt-" + v.id)))? $("txt-" + v.id).value: "";136 var v = this.value; 137 var cmpl = ($defined($("txt-" + v.id)))? $("txt-" + v.id).value: ""; 110 138 if(this.checked){ 111 139 updateCommand(v, cmpl); … … 119 147 el.addEvent("focus", function(e){ 120 148 $(this.id.substring("txt-".length)).checked = true; 121 v = $(this.id.substring("txt-".length)).value122 cmpl = this.value;149 var v = $(this.id.substring("txt-".length)).value; 150 var cmpl = this.value; 123 151 updateCommand(v, cmpl); 124 152 }); 125 153 126 154 el.addEvent("keyup", function(e){ 127 v = $(this.id.substring("txt-".length)).value128 cmpl = this.value;155 var v = $(this.id.substring("txt-".length)).value; 156 var cmpl = this.value; 129 157 updateCommand(v, cmpl); 130 158 }); … … 132 160 } 133 161 134 tabFinish = new Element("div", {class: "tabbertab", style: "height: 285px;"});162 var tabFinish = new Element("div", {"class": "tabbertab", "style": "height: 285px;"}); 135 163 tabFinish.setHTML("UMIT generated the nmap command. Click Apply to finish this wizard."); 136 164 tabber.adopt(tabFinish); … … 146 174 }}).send(); 147 175 this.options.content.addClass("hide"); 148 to = tabberOptions;176 var to = tabberOptions; 149 177 this.options.content.adopt(title); 150 178 this.options.content.adopt(commandConstructorDiv); … … 152 180 this.options.content.setStyle("padding", "10px;"); 153 181 154 actionDiv = new Element("div", {style: "text-align: right"});155 btnNext = new Element("input", {type: "button", value:"Next"});156 btnPrevious = new Element("input", {type: "button", value:"Previous", style: "margin-right: 6px"});157 btnCancel = new Element("input", {type: "button", value:"Cancel", style: "margin-right: 20px"});182 var actionDiv = new Element("div", {"style": "text-align: right"}); 183 var btnNext = new Element("input", {"type": "button", "value":"Next"}); 184 var btnPrevious = new Element("input", {"type": "button", "value":"Previous", "style": "margin-right: 6px"}); 185 var btnCancel = new Element("input", {"type": "button", "value":"Cancel", "style": "margin-right: 20px"}); 158 186 159 187 actionDiv.adopt(btnCancel); … … 176 204 177 205 btnNext.addEvent("click", function(e){ 178 size = tabber.tabber.tabs.length-2;206 var size = tabber.tabber.tabs.length-2; 179 207 switch(tabber.tabberCount){ 180 208 case 0: … … 184 212 185 213 self.close(); 186 rs = new ProfileEditorDialog();214 var rs = new ProfileEditorDialog(); 187 215 rs.run(); 188 216 return; … … 205 233 case 2: 206 234 if($("pprofile_name").value.trim().length == 0){ 207 alert("Unnamed profile!\n ou must provide a name for this profile.");235 alert("Unnamed profile!\nYou must provide a name for this profile."); 208 236 return; 209 237 } … … 216 244 if($("type_command").checked){ 217 245 $("target").value = $("command_target").value; 218 lastHost = $("target").value;246 var lastHost = $("target").value; 219 247 runScan(e); 220 248 self.close(); 221 249 }else if($("type_profile").checked){ 222 args = {250 var args = { 223 251 name: $("pprofile_name").value, 224 252 command: divCommandConstructor.value, … … 228 256 } 229 257 230 xhr = new XHR({method: "post",258 var xhr = new XHR({method: "post", 231 259 onSuccess: function(req){ 232 260 alert("Profile saved succefull!"); … … 247 275 248 276 btnPrevious.addEvent("click", function(e){ 249 size = tabber.tabber.tabs.length-2;277 var size = tabber.tabber.tabs.length-2; 250 278 switch(tabber.tabberCount){ 251 279 default: … … 264 292 btnNext.disabled = false; 265 293 }); 266 divLoading = new Element("div", { class: 'ajax-loading', style: "float: left; width: 100%"});294 divLoading = new Element("div", {"class": 'ajax-loading', "style": "float: left; width: 100%"}); 267 295 this.window.adopt(divLoading); 268 296 } … … 271 299 272 300 function updateCommand(value, complement){ 273 commandLine = $("divCommandConstructor"); 301 var commandLine = $("divCommandConstructor"); 302 var target = ""; 274 303 if($("type_command").checked){ 275 target = $("command_target").value.trim() 304 target = $("command_target").value.trim(); 276 305 }else{ 277 target = "<target>" 306 target = "<target>"; 278 307 } 279 308 280 309 commandLine.value = commandLine.value.replace(" " + target, ""); 281 oldValue = commandLine.value;282 283 regex = new RegExp(value.replace(" ", "[ ]+").replace("%s", "[^ ^$]*"));284 310 var oldValue = commandLine.value; 311 312 var regex = new RegExp(value.replace(" ", "[ ]+").replace("%s", "[^ ^$]*")); 313 var newValue = ""; 285 314 if($defined(complement)){ 286 315 newValue = value.replace("%s", complement); -
branch/UmitWeb/share/umit/umitweb_media/js/common.js
r1466 r3432 1 last_host_scanned = "<target>" 2 var slides = {} 1 var last_host_scanned = "<target>"; 2 var slides = {}; 3 3 4 4 fillCommand = function(value){ 5 $('command').value = $('command').value.replace(last_host_scanned, value) 6 last_host_scanned = value 5 $('command').value = $('command').value.replace(last_host_scanned, value); 6 last_host_scanned = value; 7 7 } 8 8 … … 17 17 18 18 function toggle(target){ 19 tgDiv = $(target + "-detail")19 var tgDiv = $(target + "-detail") 20 20 21 tgSwitcher = $(target + "-switch")21 var tgSwitcher = $(target + "-switch") 22 22 23 23 tgDiv.toggleClass("hide"); … … 74 74 75 75 function addTableRow(table, row, lineAttrs){ 76 tr = new Element("tr");76 var tr = new Element("tr"); 77 77 if(lineAttrs){ 78 for( attr in lineAttrs){78 for(var attr in lineAttrs){ 79 79 tr[attr] = lineAttrs[attr]; 80 80 } 81 81 } 82 for( i = 0; i < row.length; i++){83 td = new Element("td")82 for(var i = 0; i < row.length; i++){ 83 var td = new Element("td") 84 84 if($type(row[i]) == "string"){ 85 85 td.setHTML(row[i]); … … 87 87 td.adopt(row[i]); 88 88 }else{ 89 for(attr in row[i].attrs){90 td[attr] = row[i].attrs[attr]91 }92 if($type(row[i].value) == "string"){93 td.setHTML(row[i].value);94 }else{95 td.adopt(row[i].value);96 }89 for(var attr in row[i].attrs){ 90 td[attr] = row[i].attrs[attr] 91 } 92 if($type(row[i].value) == "string"){ 93 td.setHTML(row[i].value); 94 }else{ 95 td.adopt(row[i].value); 96 } 97 97 } 98 98 tr.adopt(td) 99 99 } 100 100 table.adopt(tr) 101 return tr;101 return tr; 102 102 } 103 103 104 104 function showError(req, target){ 105 messages = {105 var messages = { 106 106 403: {"title": "Access Denied", 107 107 "description": "Your access has been " + … … 112 112 "access to access this page."} 113 113 } 114 div = new Element("div", {'class': "error"})114 var div = new Element("div", {'class': "error"}) 115 115 if(messages[req.status]){ 116 116 div.setHTML(messages[req.status]["description"]); 117 header = new Element("h3", {styles: {"display": "block", "color": "red"}});117 var header = new Element("h3", {styles: {"display": "block", "color": "red"}}); 118 118 header.setText(messages[req.status]['title']); 119 119 $(target).empty().adopt(div); 120 120 header.injectBefore(div); 121 121 }else{ 122 regexp = /.*Message:((.*[\r]?[\n]?)*)/g123 txt = req.responseText.match(regexp)[0]122 var regexp = /.*Message:((.*[\r]?[\n]?)*)/g 123 var txt = req.responseText.match(regexp)[0] 124 124 //txt = req.responseText 125 header = new Element("h3", {styles: {"display": "block", "color": "red"}});125 var header = new Element("h3", {styles: {"display": "block", "color": "red"}}); 126 126 header.setText("Response Code:" + req.status) 127 127 $(target).empty().adopt(div); … … 133 133 function removeCommand(value){ 134 134 commandLine = $("divCommandConstructor"); 135 oldValue = commandLine.value;136 regex = new RegExp(value.replace(" ", "[ ]+").replace("%s", "[^ ^$]*"));135 var oldValue = commandLine.value; 136 var regex = new RegExp(value.replace(" ", "[ ]+").replace("%s", "[^ ^$]*")); 137 137 138 138 if(oldValue.match(regex)){ … … 143 143 144 144 function updateProfiles(){ 145 new Json.Remote("/scan/profiles/", {onComplete: function(result){146 $("profiles").empty();147 for( i = 0; i < result.length; i++){148 opt = new Element("option", {"value": result[i][1]})145 new Json.Remote("/scan/profiles/", {onComplete: function(result){ 146 $("profiles").empty(); 147 for(var i = 0; i < result.length; i++){ 148 var opt = new Element("option", {"value": result[i][1]}) 149 149 opt.setText(result[i][0]); 150 150 $("profiles").adopt(opt); 151 151 } 152 cmd = $("profiles").options[0].value;152 var cmd = $("profiles").options[0].value; 153 153 if($("target").value != ""){ 154 154 cmd = cmd.replace("<target>", $("target").value); … … 158 158 } 159 159 160 function emptyTBody(tbody){ 161 for(var i = 0; i < tbody.rows.length; i++){ 162 tbody.deleteRow(0); 163 } 164 } 165 160 166 window.addEvent("domready", function(){ 161 167 setInputStyles(); 162 size = getViewportSize();168 var size = getViewportSize(); 163 169 $$("div[class='tab-placeholder']").each(function(div){ 164 div.style.height = (size[1]-271) + "px";170 div.style.height = (size[1]-271) + "px"; 165 171 }); 166 172 167 173 if($defined($("hosts"))) 168 $("hosts").style.height = (size[1]-220) + "px"174 $("hosts").style.height = (size[1]-220) + "px"; 169 175 if($defined($("services"))) 170 $("services").style.height = (size[1]-220) + "px"176 $("services").style.height = (size[1]-220) + "px"; 171 177 172 178 if($defined($("body"))){ 173 $("body").setStyle("width", (size[0]) + "px");179 $("body").setStyle("width", (size[0]) + "px"); 174 180 $("umit-title").setStyle("width", size[0]-60 + "px"); 175 181 } -
branch/UmitWeb/share/umit/umitweb_media/js/compare_results.js
r1476 r3432 1 1 var varData = null; 2 var handler = null; 2 3 3 4 DiffHandler = new Class({ 4 5 "color": function(){ 5 6 if(diff_text != null){ 6 last_tag = null;7 new_text = [];8 removed = /^-.*/;9 styles = {7 var last_tag = null; 8 var new_text = []; 9 var removed = /^-.*/; 10 var styles = { 10 11 added: {"style": "background-color:" + diff_colors.added, 11 12 "regex": /^\+.*/}, … … 13 14 "regex": /^-.*/} 14 15 }; 15 new_lines = [];16 for( i = 0; i < diff_text.length; i++){17 found = false;18 line = diff_text[i];16 var new_lines = []; 17 for(var i = 0; i < diff_text.length; i++){ 18 var found = false; 19 var line = diff_text[i]; 19 20 for(k in styles){ 20 21 if(line.match(styles[k].regex)){ … … 36 37 }, 37 38 "showCompareTable": function(childs, color, spaces, classLine){ 38 tbl = $("compare-table").getElement("tbody");39 self = this;39 var tbl = $("compare-table").getElement("tbody"); 40 var self = this; 40 41 41 42 if(spaces == null){ … … 44 45 45 46 childs.each(function(c){ 46 spn1rstCell = new Element("span");47 var spn1rstCell = new Element("span"); 47 48 spn1rstCell.setHTML("<span>" + spaces + "</span>"); 48 lnk = new Element("a", {"href": "javascript:void(null)", "styles": {"display": "inline"}});49 var lnk = new Element("a", {"href": "javascript:void(null)", "styles": {"display": "inline"}}); 49 50 lnk.adopt(new Element("img", {"src": "/media/images/plus.png", "styles": {"display": "inline"}})); 50 51 spn1rstCell.appendText(c.state); 51 52 spn1rstCell.setStyle("margin:0"); 52 53 spn1rstCell.setStyle("padding:0"); 53 tr = addTableRow(tbl, [{"value": spn1rstCell, "attrs": {"padding": "0"}},54 var tr = addTableRow(tbl, [{"value": spn1rstCell, "attrs": {"padding": "0"}}, 54 55 {"value": c.section, "attrs": {"styles": {"white-space": "nowrap", "padding": "0"}}}, 55 56 {"value": c.property, "attrs": {"styles": {"white-space": "nowrap", "padding": "0"}}}, … … 140 141 new Json.Remote("/scans/", { 141 142 onComplete: function(scans){ 142 D = scans;143 var D = scans; 143 144 scans.each(function(scan){ 144 145 $$($("s1-result"), $("s2-result")).each(function(el){ … … 182 183 function makeDiff(){ 183 184 if($("scan1-detail").getText().length > 0 && $("scan2-detail").getText().length > 0){ 184 args = {185 var args = { 185 186 "scan1": $("scan1-detail").getText(), 186 187 "scan2": $("scan2-detail").getText(), … … 191 192 method: "post", 192 193 onSuccess: function(response){ 193 result = Json.evaluate(response);194 var result = Json.evaluate(response); 194 195 diff_text = result.text; 195 196 diff_compare = result.compare; … … 205 206 206 207 function viewHTMLDiff(){ 207 args = {208 var args = { 208 209 scan1: $("scan1-detail").getText(), 209 210 scan2: $("scan2-detail").getText() … … 214 215 onSuccess: function(response){ 215 216 w = window.open("", "_blank"); 216 w.document.write(response); 217 w.document.close(); 217 if(w == null){ 218 alert("Oops! UmitWeb has encountered a pop-pup blocker! please, allow UmitWeb to open pop-up windows."); 219 }else{ 220 w.document.write(response); 221 w.document.close(); 222 } 218 223 } 219 224 }).send("make_html_diff/", Object.toQueryString(args)); -
branch/UmitWeb/share/umit/umitweb_media/js/dialog.js
r1263 r3432 8 8 }, 9 9 initialize: function(options){ 10 self = this;10 var self = this; 11 11 this.options = $merge(this.options, options || {}); 12 12 this.window = new Element("div", {"class": "dialog"}); 13 header = new Element("h2"); 14 d = new Drag.Move(this.window, {handle: header}); 15 lblTitle = new Element("label"); 13 var thisHeader = new Element("h2"); 14 var lblTitle = new Element("label"); 16 15 lblTitle.setText(this.options.title); 17 header.adopt(lblTitle);18 lnk = new Element("a", {"href": "javascript: void(null)"});16 thisHeader.adopt(lblTitle); 17 var lnk = new Element("a", {"href": "javascript: void(null)"}); 19 18 lnk.setText("X"); 20 19 lnk.setStyle("position", "absolute"); … … 25 24 self.close(); 26 25 }); 27 header.adopt(lnk);26 thisHeader.adopt(lnk); 28 27 29 28 this.window.setStyle("position", "absolute"); … … 32 31 this.window.setStyle("width", this.options.width); 33 32 this.window.setStyle("height", this.options.height); 33 this.window.setStyle("zIndex", "101") 34 34 35 this.window.adopt( header);35 this.window.adopt(thisHeader); 36 36 this.window.adopt(this.options.content); 37 var d = new Drag.Move(this.window, {'handle': thisHeader}); 38 39 if(window.ie){ 40 var iFrame = new Element("iframe"); 41 iFrame.src = "javascript:false"; 42 iFrame.scrolling = "no"; 43 iFrame.frameBorder = "0"; 44 iFrame.setStyle("width", this.options.width); 45 iFrame.setStyle("height", this.options.height); 46 iFrame.style.zIndex = "-1"; 47 iFrame.setStyle("position", "absolute"); 48 iFrame.injectBefore(thisHeader); 49 } 37 50 }, 38 51 -
branch/UmitWeb/share/umit/umitweb_media/js/index.js
r1257 r3432 1 var varData = "" 1 var varData = ""; 2 2 3 scanLock = false;3 var scanLock = false; 4 4 5 lastHost = null;6 lastService = null;5 var lastHost = null; 6 var lastService = null; 7 7 var scanEvent = null; 8 8 var scanId = null; … … 11 11 var sSlide; 12 12 var hSlide; 13 var rs; // Instance of a Dialog 13 14 14 15 function openScan(){ 15 isToRun = true;16 var isToRun = true; 16 17 if(saved == false && scanId != null){ 17 18 text = "The given scan has unsaved changes!\n" + … … 56 57 window.addEvent("domready", function(){ 57 58 if($defined($("frmScan"))){ 58 $("frmScan").addEvent("submit", runScan);59 $("frmScan").addEvent("submit", runScan); 59 60 60 $("toggleHosts").addEvent("click", function(e){61 if(!this.hasClass("active")){62 ts = $("toggleServices");63 this.addClass("active");64 ts.removeClass("active");65 $("hosts").setStyle("display", "block");66 $("services").setStyle("display", "none");67 }68 new Event(e).stop();69 });61 $("toggleHosts").addEvent("click", function(e){ 62 if(!this.hasClass("active")){ 63 var ts = $("toggleServices"); 64 this.addClass("active"); 65 ts.removeClass("active"); 66 $("hosts").setStyle("display", "block"); 67 $("services").setStyle("display", "none"); 68 } 69 new Event(e).stop(); 70 }); 70 71 71 $("toggleServices").addEvent("click", function(e){ 72 if(!this.hasClass("active")){ 73 th = $("toggleHosts"); 74 this.addClass("active"); 75 th.removeClass("active"); 76 $("hosts").setStyle("display", "none"); 77 $("services").setStyle("display", "block"); 78 } 79 new Event(e).stop(); 80 }); 72 $("toggleServices").addEvent("click", function(e){ 73 if(!this.hasClass("active")){ 74 var th = $("toggleHosts"); 75 this.addClass("active"); 76 th.removeClass("active"); 77 $("hosts").setStyle("display", "none"); 78 $("services").setStyle("display", "block"); 79 } 80 new Event(e).stop(); 81 }); 82 83 $("toggleHosts").addClass("active"); 84 $("services").setStyle("display", "none"); 81 85 82 $("toggleHosts").addClass("active"); 83 $("services").setStyle("display", "none"); 86 updateProfiles(); 84 87 85 updateProfiles(); 86 87 $("profiles").addEvent("change", function(event){ 88 cmd = this.options[this.selectedIndex].value; 89 if($("target").value != ""){ 90 cmd = cmd.replace("<target>", $("target").value); 91 } 92 $("command").value = cmd; 93 new Event(event).stop(); 94 }); 88 $("profiles").addEvent("change", function(event){ 89 var cmd = this.options[this.selectedIndex].value; 90 if($("target").value != ""){ 91 cmd = cmd.replace("<target>", $("target").value); 92 } 93 $("command").value = cmd; 94 new Event(event).stop(); 95 }); 95 96 $("divSpinner").addClass("hide"); 96 97 $("body").removeClass("hide"); … … 98 99 99 100 $("highlight_out").addEvent("change", function(e){ 100 new Event(e).stop();101 if(!nmapOutput || nmapOutput.trim().length == 0){ return }102 if(this.checked){103 $("nmap-output").setHTML(formatNmapOutput(nmapOutput));104 }else{105 $("nmap-output").setText(nmapOutput);106 }101 new Event(e).stop(); 102 if(!nmapOutput || nmapOutput.trim().length == 0){ return } 103 if(this.checked){ 104 $("nmap-output").setHTML(formatNmapOutput(nmapOutput)); 105 }else{ 106 $("nmap-output").setText(nmapOutput); 107 } 107 108 }); 108 109 }); -
branch/UmitWeb/share/umit/umitweb_media/js/login.js
r1299 r3432 1 1 doLogin = function(e){ 2 try{ 2 3 new Event(e).stop(); 3 4 $("spinner").removeClass("hide"); … … 5 6 $("spacer").addClass("hide"); 6 7 processResult = function(result){ 7 if(result == "OK"){8 location.href = "/"9 }else{8 if(result == "OK"){ 9 location.href = "/" 10 }else{ 10 11 $("spinner").addClass("hide"); 11 $("error").empty().removeClass("hide").setText("Incorrect username or password")12 }12 $("error").empty().removeClass("hide").setText("Incorrect username or password") 13 } 13 14 } 14 15 this.send({onComplete: processResult}); 16 }catch(e){ 17 alert(e); 18 } 15 19 return false; 16 20 } -
branch/UmitWeb/share/umit/umitweb_media/js/mootools.v1.11-old.js
r907 r3432 2450 2450 2451 2451 setHTML: function(){ 2452 this.innerHTML = $A(arguments).join(''); 2452 if($A(arguments)){ 2453 this.innerHTML = $A(arguments).join(''); 2454 } 2453 2455 return this; 2454 2456 }, -
branch/UmitWeb/share/umit/umitweb_media/js/permissions.js
r1466 r3432 1 currentConstraints = []; 2 1 3 PermissionDialog = Dialog.extend({ 2 4 options: { … … 10 12 this.options.content.empty(); 11 13 12 self = this;13 tabber = new Element("div", {"class": "tabber", "id": "tabberPermission"});14 15 tabMain = new Element("div", {class: "tabbertab", style: "height: 175px;", title: "Main Information"});14 var self = this; 15 var tabber = new Element("div", {"class": "tabber", "id": "tabberPermission"}); 16 17 var tabMain = new Element("div", {class: "tabbertab", style: "height: 175px;", title: "Main Information"}); 16 18 tabber.adopt(tabMain); 17 tabConstraints = new Element("div", {class: "tabbertab", style: "height: 175px;", title: "Constraints"});19 var tabConstraints = new Element("div", {class: "tabbertab", style: "height: 175px;", title: "Constraints"}); 18 20 tabber.adopt(tabConstraints); 19 21 20 tbl = new Element("table");22 var tbl = new Element("table"); 21 23 tabMain.adopt(tbl); 22 divType = new Element("span");24 var divType = new Element("span"); 23 25 divType.setText("Base Type:* "); 24 selectPermType = new Element("select");25 opt1 = new Element("option", {"value": "allow"});26 var selectPermType = new Element("select"); 27 var opt1 = new Element("option", {"value": "allow"}); 26 28 opt1.setText("Allow"); 27 opt2 = new Element("option", {"value": "deny"});29 var opt2 = new Element("option", {"value": "deny"}); 28 30 opt2.setText("Deny"); 29 31 selectPermType.adopt(opt1); 30 32 selectPermType.adopt(opt2); 31 33 divType.adopt(selectPermType); 32 inputId = new Element("input", {"size": "30", "type": "text", "style": "margin-right:10px;"});33 txtDescription = new Element("textarea", {"style": "width: 435px; height: 115px;"});34 fsDescription = new Element("fieldset", {"style": "padding:0;margin:0"});35 legend = new Element("legend");34 var inputId = new Element("input", {"size": "30", "type": "text", "style": "margin-right:10px;"}); 35 var txtDescription = new Element("textarea", {"style": "width: 435px; height: 115px;"}); 36 var fsDescription = new Element("fieldset", {"style": "padding:0;margin:0"}); 37 var legend = new Element("legend"); 36 38 legend.setText("Description"); 37 39 fsDescription.adopt(legend); … … 40 42 currentConstraints = []; 41 43 42 tblContents = new Element("table");43 dvConstraints = new Element("div", {"styles": {"height": "167px", "width": "415px", "border": "#CCC 1px solid", "overflow": "auto"}});44 tblConstraints = new Element("table", {"id": "constraints_table", "class": "std_table"});44 var tblContents = new Element("table"); 45 var dvConstraints = new Element("div", {"styles": {"height": "167px", "width": "415px", "border": "#CCC 1px solid", "overflow": "auto"}}); 46 var tblConstraints = new Element("table", {"id": "constraints_table", "class": "std_table"}); 45 47 dvConstraints.adopt(tblConstraints); 46 48 47 lnkMoveUp = new Element("a", {"href": "javascript:void(null)"});48 imgMoveUp = new Element("img", {"src": "/media/images/up.png", "alt":"Move constraint up", "title":"Move constraint up"});49 var lnkMoveUp = new Element("a", {"href": "javascript:void(null)"}); 50 var imgMoveUp = new Element("img", {"src": "/media/images/up.png", "alt":"Move constraint up", "title":"Move constraint up"}); 49 51 lnkMoveUp.adopt(imgMoveUp); 50 52 lnkMoveUp.addEvent("click", function(e){ 51 for( j = 1; j < currentConstraints.length; j++){53 for(var j = 1; j < currentConstraints.length; j++){ 52 54 if(currentConstraints[j]["check"].checked){ 53 aux = currentConstraints[j-1];55 var aux = currentConstraints[j-1]; 54 56 currentConstraints[j-1] = currentConstraints[j]; 55 57 currentConstraints[j] = aux; … … 60 62 }); 61 63 62 lnkMoveDown = new Element("a", {"href": "javascript:void(null)"});63 imgMoveDown = new Element("img", {"src": "/media/images/down.png", "alt":"Move constraint down", "title":"Move constraint down"});64 var lnkMoveDown = new Element("a", {"href": "javascript:void(null)"}); 65 var imgMoveDown = new Element("img", {"src": "/media/images/down.png", "alt":"Move constraint down", "title":"Move constraint down"}); 64 66 lnkMoveDown.adopt(imgMoveDown); 65 67 lnkMoveDown.addEvent("click", function(e){ 66 for( j = currentConstraints.length - 2; j >= 0; j--){68 for(var j = currentConstraints.length - 2; j >= 0; j--){ 67 69 if(currentConstraints[j]["check"].checked){ 68 aux = currentConstraints[j+1];70 var aux = currentConstraints[j+1]; 69 71 currentConstraints[j+1] = currentConstraints[j]; 70 72 currentConstraints[j] = aux; … … 75 77 }); 76 78 77 lnkAdd = new Element("a", {"href": "javascript:void(null)"});78 imgAdd = new Element("img", {"src": "/media/images/plus.png", "alt":"Add new constraint", "title":"Add new constraint"});79 var lnkAdd = new Element("a", {"href": "javascript:void(null)"}); 80 var imgAdd = new Element("img", {"src": "/media/images/plus.png", "alt":"Add new constraint", "title":"Add new constraint"}); 79 81 lnkAdd.adopt(imgAdd); 80 82 lnkAdd.addEvent("click", function(e){ … … 82 84 }); 83 85 84 lnkRemove = new Element("a", {"href": "javascript:void(null)"});85 imgRemove = new Element("img", {"src": "/media/images/minus.png", "alt":"Remove constraint", "title":"Remove constraint"});86 var lnkRemove = new Element("a", {"href": "javascript:void(null)"}); 87 var imgRemove = new Element("img", {"src": "/media/images/minus.png", "alt":"Remove constraint", "title":"Remove constraint"}); 86 88 lnkRemove.adopt(imgRemove); 87 89 lnkRemove.addEvent("click", function(e){ 88 for( j = 0; j < currentConstraints.length; j++){90 for(var j = 0; j < currentConstraints.length; j++){ 89 91 if(currentConstraints[j]["check"].checked){ 90 92 if(j > 0){ … … 95 97 } 96 98 } 97 cc = [];99 var cc = []; 98 100 currentConstraints.each(function(c){ 99 101 if(typeof c != "undefined"){ … … 113 115 114 116 if(self.options.data){ 115 d = self.options.data;117 var d = self.options.data; 116 118 inputId.value = d.id; 117 119 txtDescription.value = d.description; … … 142 144 143 145 btnOK.addEvent("click", function(e){ 144 reqFields = [inputId]145 saveURL = "add/"146 var reqFields = [inputId] 147 var saveURL = "add/" 146 148 if(self.options.data){ 147 149 saveURL = "edit/" + self.options.data.id + "/" 148 150 } 149 151 150 for( k = 0; k < reqFields.length; k++){152 for(var k = 0; k < reqFields.length; k++){ 151 153 if(reqFields[k].value.trim().length == 0){ 152 154 alert("Please, fill all the entries marked with a '*'."); … … 156 158 } 157 159 158 constraint_types = []159 constraints = []160 var constraint_types = [] 161 var constraints = [] 160 162 currentConstraints.each(function(c){ 161 163 constraint_types.extend([c["type"].value]); … … 169 171 } 170 172 171 args = {173 var args = { 172 174 id: inputId.value, 173 175 type: selectPermType[selectPermType.selectedIndex].value, … … 177 179 } 178 180 179 xhr = new XHR({method: "post",181 var xhr = new XHR({method: "post", 180 182 onSuccess: function(req){ 181 183 try{ 182 response = null;184 var response = null; 183 185 eval('response = ' + req); 184 186 varData = req … … 206 208 this.options.content.adopt(tabber); 207 209 this.options.content.adopt(actionDiv); 208 to = {210 var to = { 209 211 "div": tabber 210 212 } 211 213 tabber.tabber = new tabberObj(to); 212 214 if(self.options.data){ 213 d = self.options.data;215 var d = self.options.data; 214 216 d.constraints.each(function(constraint){ 215 217 addPermissionRow(constraint.type, constraint.content, constraint, tblConstraints); … … 219 221 }); 220 222 223 224 // Helper functions 221 225 function fillTableData(permissions){ 222 t = $("permissions_table").getElement("tbody").empty();223 224 for( index = 0; index < permissions.length; index++){225 p = permissions[index];226 var t = $("permissions_table").getElement("tbody").empty(); 227 228 for(var index = 0; index < permissions.length; index++){ 229 var p = permissions[index]; 226 230 if(p.id != "allow-all" && p.id != "deny-all"){ 227 ch = new Element("input", {"type": "checkbox", "id": "chk-" + p.id});228 lnkEdit = new Element("a", {"href": "javascript:void(null)", "id": "" + p.id});231 var ch = new Element("input", {"type": "checkbox", "id": "chk-" + p.id}); 232 var lnkEdit = new Element("a", {"href": "javascript:void(null)", "id": "" + p.id}); 229 233 lnkEdit.setText(p.id); 230 234 lnkEdit.addEvent("click", function(e){ … … 233 237 }); 234 238 235 constraints = [];236 for( j = 0; j < p.constraints.length; j++){237 c = p.constraints[j];239 var constraints = []; 240 for(var j = 0; j < p.constraints.length; j++){ 241 var c = p.constraints[j]; 238 242 constraints.include(c["content"] + " <span style='color:#505050'><i>(" + c["type"] + ")</i></span>"); 239 243 } 240 imgType = new Element("img", {"src": "/media/images/" + (p.type=="allow"? "open": "closed") + ".png",244 var imgType = new Element("img", {"src": "/media/images/" + (p.type=="allow"? "open": "closed") + ".png", 241 245 "title": p.type, "alt": p.type}); 242 line = [ch, lnkEdit, {"value": imgType, "attrs": {"align": "center"}}, p.description, constraints.join("<br/>")]243 className = (index % 2 == 0)? "light": "dark";246 var line = [ch, lnkEdit, {"value": imgType, "attrs": {"align": "center"}}, p.description, constraints.join("<br/>")] 247 var className = (index % 2 == 0)? "light": "dark"; 244 248 tr = addTableRow(t, line); 245 249 tr.addClass(className); … … 248 252 } 249 253 250 var currentConstraints = []; 254 251 255 252 256 function fillConstraintTable(tbl){ 253 t = tbl==null? $("constraints_table").empty(): tbl;254 for( j = 0; j < currentConstraints.length; j++){255 c = currentConstraints[j];256 args = {};257 var t = tbl==null? $("constraints_table").empty(): tbl; 258 for(var j = 0; j < currentConstraints.length; j++){ 259 var c = currentConstraints[j]; 260 var args = {}; 257 261 addTableRow(t, [c["check"], "Type: ", c["type"], "Content: ", c["content"]]); 258 262 … … 280 284 type = (type)? type: ""; 281 285 content = (content)? content: ""; 282 inputCheck = new Element("input", {"type": "radio", "name": "current"});286 var inputCheck = new Element("input", {"type": "radio", "name": "current"}); 283 287 inputCheck.checked = true; 284 selectType = new Element("select");285 optCommand = new Element("option");288 var selectType = new Element("select"); 289 var optCommand = new Element("option"); 286 290 optCommand.setText("command"); 287 291 selectType.add(optCommand, null); 288 inputContent = new Element("input", {"type": "text"});292 var inputContent = new Element("input", {"type": "text"}); 289 293 if(data){ 290 294 inputContent.value = data["content"]; … … 303 307 onComplete: fillTableData, 304 308 onFailure: function(req){ 305 t = $("permissions_table").getElement("tbody").empty();309 var t = $("permissions_table").getElement("tbody").empty(); 306 310 addTableRow(t, [{"value": "Error loading data. Please see umitweb.log for details.", "attrs": {"colSpan": "4"}}], {"class": "error"}); 307 311 } … … 365 369 }, 366 370 onFailure: function(req){ 367 t = $("permissions_table").getElement("tbody").empty();371 var t = $("permissions_table").getElement("tbody").empty(); 368 372 addTableRow(t, [{"value": "Error loading data. Please see umitweb.log for details.", "attrs": {"colSpan": "5"}} ], {"class": "error"}); 369 373 }}); -
branch/UmitWeb/share/umit/umitweb_media/js/profile-editor.js
r1256 r3432 10 10 this.options.content.empty(); 11 11 12 self = this;13 title = new Element("h3");14 commandConstructorDiv = new Element("div");15 lbl = new Element("label");12 var self = this; 13 var title = new Element("h3"); 14 var commandConstructorDiv = new Element("div"); 15 var lbl = new Element("label"); 16 16 lbl.setHTML("<strong>Command: </strong>"); 17 17 divCommandConstructor = new Element("input", {"id": "divCommandConstructor", … … 22 22 23 23 title.setText("UMIT Profile Editor"); 24 tabber = new Element("div", {"class": "tabber", "id": "tabberCommand"}); 25 26 tabProfileDetails = new Element("div", {class: "tabbertab", style: "height: 305px;", title: "Profile"}); 24 var tabber = new Element("div", {"class": "tabber", "id": "tabberCommand"}); 25 26 var tabProfileDetails = new Element("div", {'class': "tabbertab", 'style': "height: 305px;", 'title': "Profile"}); 27 27 28 tabProfileDetails.setHTML("<b>Profile Information</b><p/>Please, enter the profile name, " + 28 29 "and optionally, enter a hint, description and annotation for this " + 29 30 "new profile:"); 30 spnProfile = new Element("table");31 var spnProfile = new Element("table"); 31 32 spnProfile.setHTML("<tr><td valign='top'><label for='pprofile_name'><strong>Profile Name:</strong> </label></td>" + 32 33 "<td><input type='text' id='pprofile_name' size='40'/></td></tr>" + … … 42 43 new Json.Remote("/profile_editor/", {onComplete: function(sections){ 43 44 varData = sections; 44 for(k in sections){ 45 s = sections[k] 46 tab = new Element("div", {class: "tabbertab", title: k, styles: {"overflow": "auto", "height": "305px"}}); 47 tab.setHTML("<b>" + s.label + "</b>"); 48 table = new Element("table", {width: "100%"}); 49 tableContent = "<tr>"; 45 46 for(var k in sections){ 47 var s = sections[k]; 48 var tab = new Element("div"); 49 tab.addClass("tabbertab"); 50 tab.title = k; 51 tab.setStyle({"overflow": "auto", "height": "305px"}); 52 53 //tab.setHTML("<b>" + s.label + "</b>"); 54 55 var table = new Element("table", {width: "100%"}); 56 var tableContent = "<tr>"; 50 57 s.options.each(function(op){ 51 58 if(op.type == "list"){ … … 75 82 tabber.getElements("select").each(function(el){ 76 83 el.addEvent("change", function(e){ 77 for( i = 0; i < this.length; i++){78 v = this[i].value;84 for(var i = 0; i < this.length; i++){ 85 var v = this[i].value; 79 86 if(i != this.selectedIndex){ 80 87 removeCommand(v); 81 88 } 82 89 } 83 v = this[this.selectedIndex].value;90 var v = this[this.selectedIndex].value; 84 91 updateProfile(v); 85 92 }); … … 89 96 tabber.getElements("input[type=checkbox]").each(function(el){ 90 97 el.addEvent("change", function(e){ 91 v = this.value;92 cmpl = ($defined($("txt-" + v.id)))? $("txt-" + v.id).value: "";98 var v = this.value; 99 var cmpl = ($defined($("txt-" + v.id)))? $("txt-" + v.id).value: ""; 93 100 if(this.checked){ 94 101 updateProfile(v, cmpl); … … 102 109 el.addEvent("focus", function(e){ 103 110 $(this.id.substring("txt-".length)).checked = true; 104 v = $(this.id.substring("txt-".length)).value105 cmpl = this.value;111 var v = $(this.id.substring("txt-".length)).value 112 var cmpl = this.value; 106 113 updateProfile(v, cmpl); 107 114 }); 108 115 109 116 el.addEvent("keyup", function(e){ 110 v = $(this.id.substring("txt-".length)).value111 cmpl = this.value;117 var v = $(this.id.substring("txt-".length)).value 118 var cmpl = this.value; 112 119 updateProfile(v, cmpl); 113 120 }); … … 116 123 117 124 self.options.content.removeClass("hide"); 118 to = {};125 var to = {}; 119 126 to.div = tabber; 120 127 tabber.tabber = new tabberObj(to); … … 133 140 this.options.content.setStyle("padding", "10px;"); 134 141 135 actionDiv = new Element("div", {style: "text-align: right"});136 btnOK = new Element("input", {type: "button", value:"OK", styles: {"width": "80px;"}});137 btnCancel = new Element("input", {type: "button", value:"Cancel", style: "margin-right: 20px"});142 var actionDiv = new Element("div", {style: "text-align: right"}); 143 var btnOK = new Element("input", {type: "button", value:"OK", styles: {"width": "80px;"}}); 144 var btnCancel = new Element("input", {type: "button", value:"Cancel", style: "margin-right: 20px"}); 138 145 139 146 actionDiv.adopt(btnCancel); … … 149 156 return; 150 157 } 151 args = {158 var args = { 152 159 name: $("pprofile_name").value, 153 160 command: divCommandConstructor.value, … … 157 164 } 158 165 159 xhr = new XHR({method: "post",166 var xhr = new XHR({method: "post", 160 167 onSuccess: function(req){ 161 168 alert("Profile saved succefully!"); … … 171 178 this.options.content.adopt(tabber); 172 179 this.options.content.adopt(actionDiv); 173 divLoading = new Element("div", {class: 'ajax-loading', style: "float: left; width: 100%"}); 180 var divLoading = new Element("div"); 181 divLoading.addClass('ajax-loading'); 182 divLoading.setStyle({"float": "left", "width": "100%"}); 174 183 this.window.adopt(divLoading); 175 184 … … 178 187 179 188 function updateProfile(value, complement){ 180 commandLine = $("divCommandConstructor");181 182 target = "<target>"189 var commandLine = $("divCommandConstructor"); 190 191 var target = "<target>" 183 192 184 193 commandLine.value = commandLine.value.replace(" " + target, ""); 185 oldValue = commandLine.value;194 var oldValue = commandLine.value; 186 195 187 regex = new RegExp(value.replace(" ", "[ ]+").replace("%s", "[^ ^$]*")); 188 196 var regex = new RegExp(value.replace(" ", "[ ]+").replace("%s", "[^ ^$]*")); 197 198 var newValue = null; 189 199 if($defined(complement)){ 190 200 newValue = value.replace("%s", complement); -
branch/UmitWeb/share/umit/umitweb_media/js/roles.js
r1276 r3432 10 10 this.options.content.empty(); 11 11 12 self = this;13 tabber = new Element("div", {"class": "tabber", "id": "tabberRole"});14 15 tabMain = new Element("div", {class: "tabbertab", style: "height: 175px;", title: "Main Information"});12 var self = this; 13 var tabber = new Element("div", {"class": "tabber", "id": "tabberRole"}); 14 15 var tabMain = new Element("div", {class: "tabbertab", style: "height: 175px;", title: "Main Information"}); 16 16 tabber.adopt(tabMain); 17 17 tabPermissions = new Element("div", {class: "tabbertab", style: "height: 175px;", title: "Permissions"}); 18 18 tabber.adopt(tabPermissions); 19 19 20 tbl = new Element("table");20 var tbl = new Element("table"); 21 21 tabMain.adopt(tbl); 22 inputId = new Element("input", {"size": "30", "type": "text"});23 txtDescription = new Element("textarea", {"style": "width: 385px; height: 110px;"});24 fsDescription = new Element("fieldset", {"style": "padding:0;margin:0"});25 legend = new Element("legend");22 var inputId = new Element("input", {"size": "30", "type": "text"}); 23 var txtDescription = new Element("textarea", {"style": "width: 385px; height: 110px;"}); 24 var fsDescription = new Element("fieldset", {"style": "padding:0;margin:0"}); 25 var legend = new Element("legend"); 26 26 legend.setText("Description"); 27 27 fsDescription.adopt(legend); … … 29 29 30 30 if(self.options.data){ 31 d = self.options.data;31 var d = self.options.data; 32 32 inputId.value = d.id; 33 33 txtDescription.value = d.description; … … 49 49 lbl.addClass("hint"); 50 50 51 for( k=0; k < permissions.length; k++){52 p = permissions[k];51 for(var k=0; k < permissions.length; k++){ 52 var p = permissions[k]; 53 53 if(p != "allow-all" && p != "deny-all"){ 54 opt = new Element("option", {"value": p});54 var opt = new Element("option", {"value": p}); 55 55 opt.setText(p); 56 56 selectPermissions.add(opt, null); … … 58 58 } 59 59 60 imgBtnMoveUp = new Element("img", {"src": "/media/images/up.png"});61 btnMoveUp = new Element("a", {"href": "javascript:void(null)"});60 var imgBtnMoveUp = new Element("img", {"src": "/media/images/up.png"}); 61 var btnMoveUp = new Element("a", {"href": "javascript:void(null)"}); 62 62 btnMoveUp.adopt(imgBtnMoveUp); 63 63 btnMoveUp.addEvent("click", function(e){ 64 for( j = 1; j < selectedPermissions.length; j++){64 for(var j = 1; j < selectedPermissions.length; j++){ 65 65 if(selectedPermissions[j].selected){ 66 opt = selectedPermissions[j];67 optBefore = selectedPermissions[j-1];66 var opt = selectedPermissions[j]; 67 var optBefore = selectedPermissions[j-1]; 68 68 selectedPermissions.add(opt, optBefore); 69 69 } … … 71 71 }); 72 72 73 imgBtnMoveDown = new Element("img", {"src": "/media/images/down.png"});74 btnMoveDown = new Element("a", {"href": "javascript:void(null)"});73 var imgBtnMoveDown = new Element("img", {"src": "/media/images/down.png"}); 74 var btnMoveDown = new Element("a", {"href": "javascript:void(null)"}); 75 75 btnMoveDown.adopt(imgBtnMoveDown); 76 76 btnMoveDown.addEvent("click", function(e){ 77 for( j = selectedPermissions.length-2; j >=0; j--){77 for(var j = selectedPermissions.length-2; j >=0; j--){ 78 78 if(selectedPermissions[j].selected){ 79 opt = selectedPermissions[j];80 optBefore = selectedPermissions[j+1];79 var opt = selectedPermissions[j]; 80 var optBefore = selectedPermissions[j+1]; 81 81 opt.injectAfter(optBefore); 82 82 } … … 84 84 }); 85 85 86 imgBtnIn = new Element("img", {"src": "/media/images/right.png"});87 btnIn = new Element("a", {"href": "javascript:void(null)"});86 var imgBtnIn = new Element("img", {"src": "/media/images/right.png"}); 87 var btnIn = new Element("a", {"href": "javascript:void(null)"}); 88 88 btnIn.adopt(imgBtnIn); 89 89 btnIn.addEvent("click", function(e){ 90 options = []91 for( j = 0; j < selectPermissions.length; j++){90 var options = [] 91 for(var j = 0; j < selectPermissions.length; j++){ 92 92 if(selectPermissions[j].selected){ 93 93 options.include(selectPermissions[j]); 94 94 } 95 95 } 96 for( j = 0; j < options.length; j++){96 for(var j = 0; j < options.length; j++){ 97 97 selectedPermissions.add(options[j], null); 98 98 } 99 99 }); 100 100 101 imgBtnOut = new Element("img", {"src": "/media/images/left.png"});102 btnOut = new Element("a", {"href": "javascript:void(null)"});101 var imgBtnOut = new Element("img", {"src": "/media/images/left.png"}); 102 var btnOut = new Element("a", {"href": "javascript:void(null)"}); 103 103 btnOut.adopt(imgBtnOut); 104 104 btnOut.addEvent("click", function(e){ 105 options = []106 for( j = 0; j < selectedPermissions.length; j++){105 var options = [] 106 for(var j = 0; j < selectedPermissions.length; j++){ 107 107 if(selectedPermissions[j].selected){ 108 108 options.include(selectedPermissions[j]); 109 109 } 110 110 } 111 for( j = 0; j < options.length; j++){111 for(var j = 0; j < options.length; j++){ 112 112 selectPermissions.add(options[j], null); 113 113 } 114 114 }); 115 115 116 fsSelectPermissions = new Element("fieldset", {"style": "padding: 0"});116 var fsSelectPermissions = new Element("fieldset", {"style": "padding: 0"}); 117 117 fsSelectPermissions.setHTML("<legend>Available Permissions</legend>"); 118 fsSelectedPermissions = new Element("fieldset", {"style": "padding: 0"});118 var fsSelectedPermissions = new Element("fieldset", {"style": "padding: 0"}); 119 119 fsSelectedPermissions.setHTML("<legend>Selected Permissions</legend>"); 120 120 … … 122 122 fsSelectedPermissions.adopt(selectedPermissions); 123 123 124 selectPermissionsTable = new Element("table");125 lines = [124 var selectPermissionsTable = new Element("table"); 125 var lines = [ 126 126 {"value": fsSelectPermissions, "attrs": {"rowSpan": "2"}}, 127 127 {"value": btnIn, "attrs": {"valign": "bottom"}}, … … 132 132 addTableRow(selectPermissionsTable, [{"value": btnOut, "attrs": {"valign": "top"}}, 133 133 {"value": btnMoveDown, "attrs": {"valign": "top"}}]); 134 lblLast = new Element("label");134 var lblLast = new Element("label"); 135 135 lblLast.setText("Last Rule:"); 136 selectLast = new Element("select");137 optDeny = new Element("option", {"value": "deny-all"});138 optAllow = new Element("option", {"value": "allow-all"});136 var selectLast = new Element("select"); 137 var optDeny = new Element("option", {"value": "deny-all"}); 138 var optAllow = new Element("option", {"value": "allow-all"}); 139 139 optDeny.setText("Deny all commands"); 140 140 optAllow.setText("Allow all commands"); … … 147 147 148 148 self.options.content.removeClass("hide"); 149 to = {};149 var to = {}; 150 150 to.div = tabber; 151 151 tabber.tabber = new tabberObj(to); … … 155 155 setInputStyles(); 156 156 if(self.options.data){ 157 for( j = 0; j < self.options.data.permissions.length - 1; j++){158 opt = $$("option[value=" + self.options.data.permissions[j] + "]")[0];157 for(var j = 0; j < self.options.data.permissions.length - 1; j++){ 158 var opt = $$("option[value=" + self.options.data.permissions[j] + "]")[0]; 159 159 selectedPermissions.add(opt, null); 160 160 } … … 174 174 this.options.content.setStyle("padding", "10px;"); 175 175 176 actionDiv = new Element("div", {style: "text-align: right"});177 btnOK = new Element("input", {type: "button", value:"OK", styles: {"width": "80px;"}});178 btnCancel = new Element("input", {type: "button", value:"Cancel", style: "margin-right: 20px"});176 var actionDiv = new Element("div", {style: "text-align: right"}); 177 var btnOK = new Element("input", {type: "button", value:"OK", styles: {"width": "80px;"}}); 178 var btnCancel = new Element("input", {type: "button", value:"Cancel", style: "margin-right: 20px"}); 179 179 180 180 actionDiv.adopt(btnCancel); … … 186 186 187 187 btnOK.addEvent("click", function(e){ 188 reqFields = [inputId]189 saveURL = "add/"188 var reqFields = [inputId] 189 var saveURL = "add/" 190 190 if(self.options.data){ 191 191 saveURL = "edit/" + self.options.data.id + "/" 192 192 } 193 193 194 for( k = 0; k < reqFields.length; k++){194 for(var k = 0; k < reqFields.length; k++){ 195 195 if(reqFields[k].value.trim().length == 0){ 196 196 alert("Please, fill all the entries marked with a '*'."); … … 201 201 202 202 203 selectedOptions = []204 for( k = 0; k < selectedPermissions.length; k++){205 opt = selectedPermissions[k];203 var selectedOptions = [] 204 for(var k = 0; k < selectedPermissions.length; k++){ 205 var opt = selectedPermissions[k]; 206 206 selectedOptions.include(opt.value); 207 207 } … … 214 214 } 215 215 216 args = {216 var args = { 217 217 id: inputId.value, 218 218 description: txtDescription.value.trim(), … … 220 220 } 221 221 222 xhr = new XHR({method: "post",222 var xhr = new XHR({method: "post", 223 223 onSuccess: function(req){ 224 224 try{ … … 256 256 257 257 function fillTableData(roles){ 258 t = $("roles_table").getElement("tbody").empty();259 260 for( index = 0; index < roles.length; index++){261 r = roles[index];262 ch = new Element("input", {"type": "checkbox", "id": "chk-" + r.id});263 lnkEdit = new Element("a", {"href": "javascript:void(null)", "id": "" + r.id});258 var t = $("roles_table").getElement("tbody").empty(); 259 260 for(var index = 0; index < roles.length; index++){ 261 var r = roles[index]; 262 var ch = new Element("input", {"type": "checkbox", "id": "chk-" + r.id}); 263 var lnkEdit = new Element("a", {"href": "javascript:void(null)", "id": "" + r.id}); 264 264 lnkEdit.setText(r.id); 265 265 lnkEdit.addEvent("click", function(e){ … … 267 267 openRoleDialog(this.id); 268 268 }); 269 line = [ch, lnkEdit, r.description, r.permissions.join(", ")]270 className = (index % 2 == 0)? "light": "dark";271 tr = addTableRow(t, line);269 var line = [ch, lnkEdit, r.description, r.permissions.join(", ")] 270 var className = (index % 2 == 0)? "light": "dark"; 271 var tr = addTableRow(t, line); 272 272 tr.addClass(className); 273 273 } … … 278 278 onComplete: fillTableData, 279 279 onFailure: function(req){ 280 t = $("roles_table").getElement("tbody").empty(); 280 var t = $("roles_table").getElement("tbody"); 281 emptyTBody(t); 281 282 addTableRow(t, [{"value": "Error loading data. Please see umitweb.log for details.", "attrs": {"colSpan": "4"}}], {"class": "error"}); 282 283 } … … 311 312 $("delete-role").addEvent("click", function(e){ 312 313 new Event(e).stop(); 313 ids = [];314 var ids = []; 314 315 $$("input[type=checkbox]").each(function(inp){ 315 316 if(inp.checked){ … … 331 332 new Event(e).stop(); 332 333 this.send({onComplete: function(req){ 333 roles = null;334 var roles = null; 334 335 eval("roles = " + req); 335 336 if(roles.length == 0){ … … 340 341 }, 341 342 onFailure: function(req){ 342 t = $("roles_table").getElement("tbody").empty();343 var t = $("roles_table").getElement("tbody").empty(); 343 344 addTableRow(t, [{"value": "Error loading data. Please see umitweb.log for details.", "attrs": {"colSpan": "5"}} ], {"class": "error"}); 344 345 }}); -
branch/UmitWeb/share/umit/umitweb_media/js/scan-dialog.js
r1408 r3432 30 30 selectScan = new Element("select", {"name": "scanId"}); 31 31 selectScan.setStyle("width", "60px"); 32 opt = new Element("option"); 33 opt.setText("--- Select a saved scan ---"); 34 opt.value = "0"; 35 selectScan.add(opt, null); 36 selectScan.setStyle("width", "300px;"); 32 opt = new Element("option", {"value": "0"}); 33 opt.text = "--- Select a saved scan ---"; 34 try{ 35 selectScan.add(opt, null); 36 }catch(e){ 37 //IE only 38 selectScan.add(opt); 39 } 40 try{ 41 selectScan.setStyle("width", "300px;"); 42 }catch(e){ 43 // IE doesn't support <select> resizing 44 } 37 45 selectScan.addEvent("focus", function(e){ 38 46 rdDatabase.checked = true; … … 42 50 scans.each(function(s){ 43 51 opt = new Element("option", {"value": s.id}); 44 opt.setText(s.name + " (" + s.date + ")"); 45 selectScan.add(opt, null); 52 opt.text = s.name + " (" + s.date + ")"; 53 try{ 54 selectScan.add(opt, null); 55 }catch(e){ 56 selectScan.add(opt); 57 } 46 58 }); 47 59 } … … 60 72 frm.adopt(fieldSetDatabase); 61 73 frm.adopt(btnSubmit); 62 self = this74 var thisDialog = this; 63 75 frm.addEvent("submit", function(e){ 64 76 iFrame.addEvent("load", function(e2){ 77 var txt = null; 78 79 if(window.ie){ 80 txt = this.contentWindow.document.getElementsByTagName("pre")[0].innerText; 81 }else{ 82 txt = this.contentDocument.getElementsByTagName("pre")[0].textContent; 83 } 84 65 85 try{ 66 result = Json.evaluate(t his.contentDocument.getElementsByTagName("pre")[0].textContent);86 result = Json.evaluate(txt); 67 87 if(result.result == "OK" && $defined(result.output.full)){ 68 88 varData = result.output.full; … … 80 100 } 81 101 }catch(e){ 82 $("nmap-output").setText(t his.contentDocument.getElementsByTagName("pre")[0].textContent);102 $("nmap-output").setText(txt); 83 103 } 84 104 }); … … 143 163 this.options.content.adopt(iFrame); 144 164 this.options.content.adopt(frm); 145 self= this;165 var thisDialog = this; 146 166 frm.addEvent("submit", function(e){ 147 167 … … 165 185 if(response.result == "OK"){ 166 186 alert("Scan saved succefully!"); 167 self.close();187 thisDialog.close(); 168 188 }else{ 169 189 alert("Error loading data. Check umitweb.log for details."); -
branch/UmitWeb/share/umit/umitweb_media/js/scan.js
r3191 r3432 1 var h; 2 1 3 function loadHosts(hosts){ 2 tbHosts = $("hosts_table").getElement("tbody").empty(); 3 for(iH = 0; iH < hosts.length; iH++){ 4 h = hosts[iH] 4 var tbHosts = $("hosts_table").getElement("tbody"); 5 emptyTBody(tbHosts); 6 for(var iH = 0; iH < hosts.length; iH++){ 7 h = hosts[iH]; 8 var txt = ""; 5 9 if(h.hostnames.length > 0){ 6 txt = h.hostnames[0].hostname 10 txt = h.hostnames[0].hostname; 7 11 }else{ 8 txt = h.ip.addr 9 } 10 11 img_src = '/media/images/unknown_24.png';12 txt = h.ip.addr; 13 } 14 15 var img_src = '/media/images/unknown_24.png'; 12 16 if($defined(h.osmatch.name) && h.osmatch.name != ""){ 13 oses = {"irix": "irix",17 var oses = {"irix": "irix", 14 18 "solaris": "solaris", 15 19 "linux": "linux", 16 20 "freebsd": "freebsd", 17 "mac os x": "macosx",21 "mac os x": "macosx", 18 22 "openbsd": "openbsd", 19 23 "windows": "win", … … 21 25 "red hat": "redhat"} 22 26 img_src = "/media/images/default_24.png" 23 for( k in oses){27 for(var k in oses){ 24 28 if(h.osmatch.name.toLowerCase().contains(k)){ 25 img_src = "/media/images/" + oses[k] + "_24.png" 29 img_src = "/media/images/" + oses[k] + "_24.png"; 30 break; 26 31 } 27 32 } 28 33 } 29 img = new Element("img", {'src': img_src});30 31 lnk = new Element("a", {'href': 'javascript:void(null)'});32 v X = iH34 var img = new Element("img", {'src': img_src}); 35 36 var lnk = new Element("a", {'href': 'javascript:void(null)'}); 37 var vX = iH 33 38 lnk.addEvent("click", function(e){ 34 39 e = new Event(e); 35 pId = this.parentNode.parentNode.getAttribute("id").substr("host-".length);40 var pId = this.parentNode.parentNode.getAttribute("id").substr("host-".length); 36 41 selectHost(e, hosts, pId); 37 42 }); … … 115 120 116 121 function loadPortsTab(pHosts){ 117 tbody = $("ports_table").getElement("tbody").empty(); 118 lines = new Array(); 119 count = 0; 120 for(k = 0; k < pHosts.length; k++){ 121 for(i = 0; i < pHosts[k].ports.length; i++){ 122 for(j = 0; j < pHosts[k].ports[i].port.length; j++){ 123 port = pHosts[k].ports[i].port[j]; 124 img = new Element("img"); 122 var tbody = $("ports_table").getElement("tbody"); 123 emptyTBody(tbody); 124 var lines = new Array(); 125 var count = 0; 126 for(var k = 0; k < pHosts.length; k++){ 127 for(var i = 0; i < pHosts[k].ports.length; i++){ 128 for(var j = 0; j < pHosts[k].ports[i].port.length; j++){ 129 var port = pHosts[k].ports[i].port[j]; 130 var img = new Element("img"); 125 131 img.src = "/media/images/" + ((port.port_state == "open")? "open": "closed") + ".png"; 126 132 if(port.port_state == "open"){ 127 133 img.src = "/media/images/open.png"; 128 134 }else{ 129 img135 130 136 } 131 found = false;137 var found = false; 132 138 for(m = 0; m < lines.length; m++){ 133 139 if(lines[m][1] == port.portid){ … … 145 151 } 146 152 for(k = 0; k < lines.length; k++){ 147 addTableRow(tbody, lines[k]) 153 addTableRow(tbody, lines[k]); 148 154 } 149 155 } … … 196 202 tbl = new Element("table"); 197 203 198 img_src = "/media/images/unknown_48.png"204 var img_src = "/media/images/unknown_48.png"; 199 205 if($defined(h.osmatch.name) && h.osmatch.name != ""){ 200 206 oses = {"irix": "irix", … … 208 214 "red hat": "redhat"} 209 215 img_src = "/media/images/default_48.png"; 210 for( k in oses){216 for(var k in oses){ 211 217 if(h.osmatch.name.toLowerCase().contains(k)){ 212 218 img_src = "/media/images/" + oses[k] + "_48.png" 219 break; 213 220 } 214 221 } … … 548 555 }); 549 556 550 st = $("hosts_s_table").getElement("tbody").empty(); 557 st = $("hosts_s_table").getElement("tbody") 558 emptyTBody(st); 551 559 $("hosts_s_table_placeholder").setStyle("display", "block"); 552 560 $("ports_table_placeholder").setStyle("display", "none"); … … 575 583 ports = scan.list_port; 576 584 if(ports){ 577 services = new Array(); 585 586 resultServices = []; 578 587 ports.each(function(port){ 579 st = $("services_table").getElement("tbody"); 580 lnk = new Element("a", {"href": "javascript:void(null)"}); 588 var st = $("services_table").getElement("tbody"); 589 590 var lnk = new Element("a", {"href": "javascript:void(null)"}); 581 591 lnk.setText(port.service_name); 582 592 lnk.addEvent("click", function(e){ … … 584 594 selectService(scan, port.service_name, e); 585 595 }); 586 if(!services.contains(port.service_name)){587 services.include(port.service_name);588 addTableRow(st, [lnk], {"id": "service-" + port.service_name});589 }590 }) 596 if(!resultServices.contains(port.service_name)){ 597 resultServices.include(port.service_name); 598 addTableRow(st, [lnk], {"id": "service-" + port.service_name}); 599 } 600 }); 591 601 } 592 602 } … … 704 714 onFailure: function(req){ 705 715 $("nmap-output").removeClass("ajax-loading"); 706 $("hosts_table").getElement("tbody").empty(); 716 emptyTBody($("hosts_table").getElement("tbody")); 717 707 718 if(req.status == 200){ 708 719 $("nmap-output").setHTML(req.responseText); … … 732 743 result_box.empty().addClass("ajax-loading"); 733 744 tbHosts = $("hosts_table").getElement("tbody"); 734 tbHosts.empty();745 emptyTBody(tbHosts); 735 746 tr = new Element("tr"); 736 747 td1 = new Element("td"); … … 743 754 //tr2 = tr.cloneNode(); 744 755 745 $("ports_table").getElement("tbody").empty();756 emptyTBody($("ports_table").getElement("tbody")); 746 757 $("hosts_tab").empty(); 747 758 $("scan_details").empty(); 748 759 $("tabber-result").tabber.tabShow(1); 749 $("services_table").getElement("tbody").empty(); 750 $("profile_name").value = $("profiles")[$("profiles").selectedIndex].textContent 751 752 /*reqObj = $("frmScan").send({onComplete: function(tResult){ 753 result = Json.evaluate(tResult); 754 if(result.result == "OK"){ 755 checkScanStatus(result.id) 756 }else{ 757 result_box.removeClass("ajax-loading").addClass("ajax-error"); 758 result_box.setText(result.status); 759 } 760 }, 761 onFailure: function(req){ 762 result_box.removeClass("ajax-loading"); 763 $("hosts_table").getElement("tbody").empty(); 764 if(req.status == 200){ 765 $("nmap-output").setHTML(req.responseText); 766 }else{ 767 showError(req, "nmap-output"); 768 } 769 scanLock = false; 770 } 771 }); 772 reqObj.$events.onStateChange = [function(req){ 773 alert(req.readyState); 774 request = req; 775 if(req.readyState == 3){ 776 checkIfFinished(); 777 } 778 }]*/ 760 emptyTBody($("services_table").getElement("tbody")); 761 var txtContent = $("profiles")[$("profiles").selectedIndex].textContent; 762 $("profile_name").value = txtContent; 779 763 780 764 args = { -
branch/UmitWeb/tests/browser_compability.txt
r989 r3432 5 5 | output highlight | * | * | * | * | * | 6 6 |-------------------|----------------------|---------------------|-------|---------|--------| 7 | hosts panel | * | * | * | * | |7 | hosts panel | * | * | * | * | x | 8 8 |-------------------|----------------------|---------------------|-------|---------|--------| 9 | services panel | * | * | * | * | |9 | services panel | * | * | * | * | x | 10 10 |-------------------|----------------------|---------------------|-------|---------|--------| 11 | sw hosts/services | | * | * | * ||11 | sw hosts/services | x | * | * | * | x | 12 12 |-------------------|----------------------|---------------------|-------|---------|--------| 13 | foldings | | | * | * | * | 13 | foldings | x | x | * | * | * | 14 |-------------------|----------------------|---------------------|-------|---------|--------| 15 | dialogs | x | x | - | * | * | 16 |-------------------|----------------------|---------------------|-------|---------|--------| 14 17 |___________________|______________________|_____________________|_______|_________|________| 18 19 * working 20 x not working 21 - partially working 22 23 Notes: 24 25 Opera: 26 - Dialog opens, but it closes the whole browser window when you click on the 'X' button -
branch/UmitWeb/umitCore/Paths.py
r3232 r3432 24 24 from os.path import exists, join, split, abspath 25 25 import sys 26 27 from types import StringTypes 26 28 27 29 from umitCore.UmitLogging import log … … 33 35 from umitCore.BasePaths import ICONS_DIR, PIXMAPS_DIR, DOCS_DIR 34 36 35 UMIT_ICON = join( main_dir,"share", "icons", "umit_48.ico")37 UMIT_ICON = join("share", "icons", "umit_48.ico") 36 38 37 39 -
branch/UmitWeb/umitWeb/WebConf.py
r3191 r3432 23 23 from umitWeb.WebLogger import getLogger 24 24 25 class JsOutputHighlight(NmapOutputHighlight , object):25 class JsOutputHighlight(NmapOutputHighlight): 26 26 logger = getLogger("JsOutputHighlight") 27 27 28 28 def __init__(self, *args): 29 29 NmapOutputHighlight.__init__(self, *args) 30 self. read(Path.webconfig_file)30 self.parser.read(Path.webconfig_file) -
branch/UmitWeb/umitWeb/views/compare_results.py
r2779 r3432 64 64 data.append("'modified': '#%s%s%s'" % tuple(map(toHex, dc.modified))) 65 65 data.append("'not_present': '#%s%s%s'" % tuple(map(toHex, dc.not_present))) 66 response.write(" diff_colors = {%s}" % ",".join(data))66 response.write("var diff_colors = {%s}" % ",".join(data)) 67 67 return response 68 68 -
branch/UmitWeb/umitWeb/views/scan.py
r3191 r3432 136 136 parser.set_xml_file(req.FILES['scan_result']['temp_file']) 137 137 parser.parse() 138 parsed_scan = __scan_to_json(parser)138 parsed_scan = ScanJsonParser(parser).parse() 139 139 junk = r"odpojfsdkjfpisudŕij208u-0w9rsdnfkdfçwrtwqr/fsasd~/???çds" 140 140 key = md5.new(str(random.randint(0, sys.maxint-1)) \ … … 143 143 req.session['scan_result_' + key] = open(req.FILES['scan_result']['temp_name'], 'r').read() 144 144 text_out = parser.nmap_output.replace("'", "\\'").replace("\r", "").replace("\n", "\\n' + \n'") 145 parsed_scan = str(parsed_scan).replace("\n", "\\n' + \n'")145 parsed_scan = parsed_scan.replace("\n", "\\n' + \n'") 146 146 return HttpResponse(("{'result': 'OK', 'id': '%s', 'output': " + \ 147 147 "{'plain': '%s', 'full': %s}}") % \ … … 164 164 (parser.get_nmap_output().replace("'", "\\'").\ 165 165 replace("\r", "").replace("\n", "\\n' + \n'"), 166 str(__scan_to_json(parser))),166 ScanJsonParser(parser).parse()), 167 167 "text/plain") 168 168 else: … … 171 171 @authenticate(ERROR) 172 172 def save_result(req, scan_id): 173 print req.POST174 173 if req.POST: 175 174 scan = req.session.get("scan_result_" + scan_id, None) -
branch/UmitWeb/umitweb.py
r1513 r3432 40 40 41 41 def main(): 42 if sys.platform .startswith("linux"):42 if sys.platform in ["linux" "darwin"]: 43 43 if os.getuid() != 0: 44 44 raise Exception, "Server MUST run as root."
