forked from intrepidusgroup/imdmtools
-
Notifications
You must be signed in to change notification settings - Fork 150
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #11 from thrasr/master
Big fix, external js files, and other minor updates.
- Loading branch information
Showing
9 changed files
with
172 additions
and
221 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# Python related files | ||
server/*.pyc | ||
|
||
# Logs/storage with possible sensitive information | ||
server/xactn.log | ||
server/devicelist.pickle | ||
|
||
# Certs with sensitive information | ||
server/CA.crt | ||
server/Enroll.mobileconfig | ||
server/Identity.p12 | ||
server/PushCert.pem | ||
server/Server.* | ||
server/identity.crt | ||
|
||
# Custom payloads | ||
server/Manifest.plist | ||
server/MyApp.* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
$(document).ready(function(){ | ||
// Initial setup | ||
update_cmds() | ||
|
||
// Start polling | ||
populate_devices(); | ||
setInterval(populate_devices, 2000); | ||
|
||
// Check for device-specific content and enable if applicable | ||
if(checkDevice()){ | ||
document.getElementById("showEnroll").style.display="block"; | ||
document.getElementById("showCert").style.display="block"; | ||
} | ||
|
||
// Submit button functionality | ||
$("#submitcmd").click(function(event){ | ||
var checked_devices = []; | ||
|
||
// Get all selected devices | ||
$(".row_box").each(function(){ | ||
if(this.checked){ | ||
checked_devices.push($(this).closest(".panel").attr("id")); | ||
} | ||
}); | ||
|
||
// Input checking. | ||
if ($("#commands").val()==0){ | ||
alert("Please choose a command."); | ||
} | ||
else if (checked_devices.length==0){ | ||
alert("Please choose one or more devices."); | ||
} | ||
else{ | ||
// Send AJAX request | ||
// Variable to pass all necessary data to server | ||
var parameters = { | ||
"cmd":$("#commands").val(), | ||
"dev[]":checked_devices | ||
}; | ||
|
||
// Use stringify to fix odd error with passing just parameters | ||
$.post("/queue", JSON.stringify(parameters), function(){}); | ||
} | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
// Global variable to avoid changing device list if there are no changes to it | ||
var checksum = '' | ||
|
||
function populate_devices(){ | ||
// Populates device accordion using data from server | ||
$.post("/devices", function(raw){ | ||
|
||
// Check if any changes have been made | ||
if(checksum == JSON.stringify(raw)){ | ||
return; | ||
} | ||
else{ | ||
checksum = JSON.stringify(raw); | ||
} | ||
|
||
// Use mustache to populate the accordion | ||
$.get("devices.mustache.html", function(template){ | ||
var rendered = Mustache.render(template, jQuery.parseJSON(raw)); | ||
$('#accordion').html(rendered); | ||
|
||
// Set response button on click to update the modal | ||
$(".response-btn").click(function(event){ | ||
// Get device UDID and command UUID | ||
var udid = $(this).closest(".panel").attr("id"); | ||
var uuid = $(this).attr("id"); | ||
|
||
// Access /response to get the response string | ||
$.post("/response", JSON.stringify({"UDID":udid, "UUID":uuid}), function(data){ | ||
$("#modal_body").html(data); | ||
}); | ||
}); | ||
|
||
// Puts HTML content inside the popover | ||
$(".trigger").popover({ | ||
html: true, | ||
title: function () { | ||
return $(this).parent().find('.head').html(); | ||
}, | ||
content: function () { | ||
return $(this).parent().find('.content').html(); | ||
} | ||
}); | ||
|
||
// Submit input group when submit button clicked | ||
$('body').on('click', '.popover-submit', function(){ | ||
// Get UDID and form values | ||
var udid = $(this).attr("id"); | ||
var name = $(this).parent().find("#input-name").val(); | ||
var owner = $(this).parent().find("#owner-name").val(); | ||
var location = $(this).parent().find("#location-name").val(); | ||
|
||
// POST data to /metadata endpoint | ||
$.post("/metadata", JSON.stringify({"UDID":udid,"name":name,"owner":owner,"location":location}), function(){}); | ||
|
||
$("#metadatapopover".concat(udid)).popover("hide"); | ||
}); | ||
|
||
}); | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
function update_cmds(){ | ||
// Populate command list | ||
$.post("/getcommands", function(cmd_list){ | ||
cmds = JSON.parse(cmd_list); | ||
x = document.getElementById("commands"); | ||
x.options.length = 0 | ||
x.options[x.options.length] = new Option("Select Command", "", true, false); | ||
for(i=0;i<cmds.length;i++){ | ||
x.options[x.options.length] = new Option(cmds[i][0], cmds[i][1]); | ||
} | ||
}); | ||
} | ||
|
||
function checkDevice(){ | ||
// Returns true if site is accessed using an iDevice | ||
var agent = navigator.userAgent; | ||
if (agent.match(/(iPhone|iPod|iPad)/)){ | ||
return true; | ||
} | ||
return false; | ||
} |
Oops, something went wrong.