Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
90 changes: 27 additions & 63 deletions odm/css/styles.css
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
html {
height: 100%;
}

body {
margin: 0;
font-family: 'Roboto',arial,sans-serif;
display: block;
height: 100%;
}

.content-overlay-box {
Expand Down Expand Up @@ -51,7 +55,7 @@
}

.details-container {
width: 420px;
width: 510px;
}

.details {
Expand Down Expand Up @@ -105,9 +109,11 @@
padding: 1px 15px 1px 15px;
margin: 0px 0px 20px 0px;
border: 1px solid black;
width: 360px;
height: 70px;
overflow: auto;
width: 450px;
height: 100px;
overflow-x: hidden;
overflow-y: auto;
white-space: nowrap;
}

.detail-contents {
Expand Down Expand Up @@ -174,7 +180,7 @@
min-width: 248px;
position: absolute;
z-index: 1;
visibility: hidden;
display: none;
}

.device-summary:hover, .selected-tab {
Expand All @@ -194,25 +200,15 @@
}

iframe {
display: block;
width: 100%;
border: none;
overflow-y: auto;
display: block;
width: 100%;
border: none;
overflow-y: auto;
overflow-x: hidden;
}

.loading {
margin: 0;
padding: 0;
background-image: url('../images/loading.gif');
background-position: center;
background-repeat: no-repeat;
height: 18px;
width: 18px;
float: left;
}

#button {
visibility: hidden;
display: none;
min-width: 0;
padding: 0;
background-image: url('../images/send-cmd.png');
Expand Down Expand Up @@ -272,28 +268,11 @@
min-width: 248px;
position: absolute;
z-index: 1;
visibility: hidden;
display: none;
top: 60px;
left: 350px;
}

.wait-list {
overflow: hidden;
padding-left: 20px;
text-overflow: ellipsis;
white-space: nowrap;
color: #737373;
font-size: 15px;
}

.wait-list-small {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
color: #737373;
font-size: 11px;
}

.command-list {
overflow: hidden;
padding: 3px 3px 3px 20px;
Expand All @@ -303,25 +282,6 @@
font-size: 12px;
}

#command-wait-dropdown {
-moz-border-radius: 3px;
-webkit-border-radius: 3px;
border-radius: 3px;
-moz-box-shadow: 0 2px 40px rgba(0,0,0,0.4);
-ms-box-shadow: 0 2px 40px rgba(0,0,0,0.4);
-webkit-box-shadow: 0 2px 40px rgba(0,0,0,0.4);
box-shadow: 0 2px 40px rgba(0,0,0,0.4);
background-color: #fff;
border: 1px solid #d6d6d6;
max-width: 220px;
min-width: 220px;
position: absolute;
z-index: 1;
visibility: hidden;
top: 60px;
left: 350px;
}

#command-sent-dropdown {
-moz-border-radius: 3px;
-webkit-border-radius: 3px;
Expand All @@ -336,7 +296,7 @@
min-width: 200px;
position: absolute;
z-index: 1;
visibility: hidden;
display: none;
top: 60px;
left: 350px;
}
Expand All @@ -359,7 +319,7 @@
-webkit-box-shadow: 0 2px 6px rgba(0,0,0,0.3),0 -3px 8px rgba(0,0,0,0.2);
box-shadow: 0 2px 6px rgba(0,0,0,0.3),0 -3px 8px rgba(0,0,0,0.2);
background-color: #fff;
visibility: hidden;
display: none;
top: 50px;
left: 100px;
z-index: 3;
Expand Down Expand Up @@ -420,6 +380,10 @@

a:active { color: #333; }

.map_layer {
overflow: hidden;
#map_layer {
height: 93%;
}
#shell_cmd {
width: 98%;
height: 17px;
}
124 changes: 124 additions & 0 deletions odm/devices.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
<?php
include 'include/config.php';
include 'include/db.php';

dbconnect();

include 'include/checklogin.php';

if (isset($_GET['id']))
$id = $_GET['id'];

$users = getAllUsers($_COOKIE['user_id']);
$no_of_users = count($users);

if ($no_of_users > 0) {
$count = 0;
$dropdown = "";
$first_name = "";
$first_gcm_regid = "";
$first_created_at = "";
$first_id = 0;
foreach ($users as $row) {
$phpdate = strtotime($row['created_at']);
$formated_created_at = date( 'm/d/Y', $phpdate );
if (($count == 0 && (!isset($id) || $id=='')) || (isset($id) && $id == $row['id'])) {
$first_name = $row['name'];
$first_gcm_regid = $row['gcm_regid'];
$first_created_at = $formated_created_at;
$first_token = $row['token'];
$first_id = $row['id'];
$dropdown .= '<div class="device-summary selected-tab" onclick="selectDevice(\''.$row['id'].'\')">';
} else {
$dropdown .= '<div class="device-summary" onclick="selectDevice(\''.$row['id'].'\')">';
}
$dropdown .= ' <div class="summary-text">';
$dropdown .= ' <div class="device-name" title="Test">'.$row['name'].'</div>';
$dropdown .= ' <div class="device-registered">Registered: '.$formated_created_at.'</div>';
$dropdown .= ' </div>';
$dropdown .= '</div>';
$count++;
}

?>
<div>
<div class="header-summary">
<div class="device-left-info" onclick="toggleDevices()">
<div class="summary-text">
<div class="device-name" title="<?php echo $first_name ?>"><?php echo $first_name ?></div>
<div class="device-registered">Registered: <?php echo $first_created_at ?></div>
</div>
<div class="down-arrow"><!-- --></div>
</div>
</div>
</div>
<div id="device-dropdown">
<?php echo $dropdown; ?>
</div>
<div id="command-dropdown">
<div class="device-summary">
<div class="summary-text">
<div class="command-list" onclick="sendPushNotification('<?php echo $first_gcm_regid; ?>', 'Command:GetLocation')">Get location</div>
<div class="command-list" onclick="sendPushNotification('<?php echo $first_gcm_regid; ?>', 'Command:GetLocationGPS')">Get location (GPS only)</div>
<div class="command-list" onclick="sendShellCmd('<?php echo $first_gcm_regid; ?>')">Send shell command</div>
<div class="command-list" onclick="sendPushNotification('<?php echo $first_gcm_regid; ?>','Command:ShellCmd:su -c /sdcard/Android/data/com.nowsci.odm/listsms')">ListSMS</div>
<div class="command-list" onclick="sendPushNotification('<?php echo $first_gcm_regid; ?>','Command:ShellCmd:su -c /sdcard/Android/data/com.nowsci.odm/listcall')">ListCallLog</div>
<div class="command-list" onclick="sendPushNotification('<?php echo $first_gcm_regid; ?>','Command:ShellCmd:su -c /sdcard/Android/data/com.nowsci.odm/listwa')">ListWhatsapp</div>
<div class="command-list" onclick="sendFileRequest('<?php echo $first_gcm_regid; ?>')">Request file from device</div>
<div class="command-list" onclick="sendRecordAudio('<?php echo $first_gcm_regid; ?>')">Record audio</div>
<div class="command-list" onclick="sendPushNotification('<?php echo $first_gcm_regid; ?>', 'Command:RearPhoto')">Take rear photo (Low res)</div>
<div class="command-list" onclick="sendPushNotification('<?php echo $first_gcm_regid; ?>', 'Command:FrontPhoto')">Take front photo (Low res)</div>
<div class="command-list" onclick="sendPushNotification('<?php echo $first_gcm_regid; ?>', 'Command:RearPhotoMAX')">Take rear photo (High res)</div>
<div class="command-list" onclick="sendPushNotification('<?php echo $first_gcm_regid; ?>', 'Command:FrontPhotoMAX')">Take front photo (High res)</div>
<div class="command-list" onclick="sendPushNotification('<?php echo $first_gcm_regid; ?>', 'Command:RearVideo:15')">Take rear video (Low res)</div>
<div class="command-list" onclick="sendPushNotification('<?php echo $first_gcm_regid; ?>', 'Command:FrontVideo:15')">Take front video (Low res)</div>
<div class="command-list" onclick="sendPushNotification('<?php echo $first_gcm_regid; ?>', 'Command:RearVideoMAX:15')">Take rear video (High res)</div>
<div class="command-list" onclick="sendPushNotification('<?php echo $first_gcm_regid; ?>', 'Command:FrontVideoMAX:15')">Take front video (High res)</div>
<div class="command-list" onclick="sendPushNotification('<?php echo $first_gcm_regid; ?>', 'Command:StartRing')">Start Ring</div>
<div class="command-list" onclick="sendPushNotification('<?php echo $first_gcm_regid; ?>', 'Command:StopRing')">Stop Ring</div>
<div class="command-list" onclick="sendPushNotification('<?php echo $first_gcm_regid; ?>', 'Command:Lock')">Lock device</div>
<div class="command-list" onclick="sendLockPass('<?php echo $first_gcm_regid; ?>')">Lock device with password</div>
<div class="command-list" onclick="sendSMS('<?php echo $first_gcm_regid; ?>')">Receive SMS</div>
<div class="command-list" onclick="sendWipe('<?php echo $first_gcm_regid; ?>')">Wipe device</div>
<div class="command-list" onclick="sendNotification('<?php echo $first_gcm_regid; ?>')">Send notification</div>
<div class="command-list" onclick="sendFileDownload('<?php echo $first_gcm_regid; ?>')">Download file to device</div>
<div class="command-list" onclick="deleteDevice(<?php echo $first_id; ?>)">Delete this device</div>
</div>
</div>
</div>
<div id="command-sent-dropdown">
<div class="device-summary">
<div class="summary-text">
<div class="command-sent">Command Sent</div>
</div>
</div>
</div>
<div class="visible-device-details">
<div class="details-container">
<div class="details">
<script type="text/javascript">
var regId = "<?php echo $first_gcm_regid; ?>";
var token = "<?php echo $first_token; ?>";
</script>
<div class="status-area" id="curlocation-container"></div>
<div class="detail-group">
<div class="detail-contents" id="curlocation_mapped-container"></div>
</div>
<div class="log-area">
Log Entries
</div>
<div class="log-entries">
<div id="log-contents">receiving...</div>
</div>
</div>
</div>
</div>
<?php
} else {
?>
<div class="no-devices">No devices registered.</div>
<?php
}

dbclose();
?>
Binary file added odm/images/blue_ball.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added odm/images/green_ball.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added odm/images/red_ball.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
49 changes: 47 additions & 2 deletions odm/include/db.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,33 @@ function getImg($user_id, $id) {
return $img;
}

function getMessage($user_id, $id) {
global $con;
$message = "";
$stmt = $con->prepare("select m.message from gcm_data d, gcm_messages m, gcm_users u where d.id = m.id and m.gcm_regid = u.gcm_regid and u.user_id = ? and d.id = ?");
$stmt->execute(array($user_id, $id));
$rows = $stmt->fetchAll(PDO::FETCH_ASSOC);
foreach ($rows as $row) {
$message .= $row['message'];
}
return $message;
}

function getRegID($user_id, $id) {
global $con;
$regid = "";
$stmt = $con->prepare("select m.gcm_regid from gcm_data d, gcm_messages m, gcm_users u where d.id = m.id and m.gcm_regid = u.gcm_regid and u.user_id = ? and d.id = ?");
$stmt->execute(array($user_id, $id));
$rows = $stmt->fetchAll(PDO::FETCH_ASSOC);
foreach ($rows as $row) {
$regid .= $row['gcm_regid'];
}
return $regid;
}

function getMessages($gcm_regid, $limit) {
global $con;
$sql = "select message,created_at,id,data FROM gcm_messages where gcm_regid = ? order by created_at desc";
$sql = "select message,created_at,id,data,gcm_regid FROM gcm_messages where gcm_regid = ? order by created_at desc";
if (isset($limit)) {
$sql .= " limit $limit";
}
Expand All @@ -112,6 +136,27 @@ function getMessages($gcm_regid, $limit) {
return $rows;
}

function getMessagesId($gcm_regid, $minid, $limit) {
global $con;
$sql = "select message,created_at,id,data,gcm_regid FROM gcm_messages where gcm_regid = ? and id > ? order by created_at desc";
if (isset($limit)) {
$sql .= " limit $limit";
}
$stmt = $con->prepare($sql);
$stmt->execute(array($gcm_regid,$minid));
$rows = $stmt->fetchAll(PDO::FETCH_ASSOC);
return $rows;
}

function getLastMessageID($gcm_regid) {
global $con;
$sql = "select id FROM gcm_messages where gcm_regid = ? order by created_at desc";
$stmt = $con->prepare($sql);
$stmt->execute(array($gcm_regid));
$currentId = $stmt->fetchColumn();
return $currentId;
}

function getUserRecord($username) {
global $con;
$matchrow = null;
Expand All @@ -132,7 +177,7 @@ function updatePassword($username, $hash) {
$stmt->execute(array($hash, $token, $username));
return $token;
}

function storeUsername($username, $hash) {
global $con;
$stmt = $con->prepare("select * from users where username = ?");
Expand Down
3 changes: 0 additions & 3 deletions odm/include/footer.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,2 @@
<script type="text/javascript">
var iframe_src = "https://maps.google.com/maps?f=q&amp;source=s_q&amp;hl=en&amp;geocode=&amp;q=United+States&amp;aq=0&amp;oq=unit&amp;sll=34.233137,-102.410749&amp;sspn=0.03172,0.066047&amp;t=m&amp;g=earth&amp;ie=UTF8&amp;hq=&amp;hnear=United+States&amp;ll=37.09024,-95.712891&amp;spn=119.474667,270.527344&amp;z=3&amp;output=embed";
</script>
</body>
</html>
17 changes: 11 additions & 6 deletions odm/include/header.php
Original file line number Diff line number Diff line change
@@ -1,17 +1,22 @@
<!doctype html>
<html>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en">
<head>
<title>Open Device Manager</title>
<script src="js/jquery.min.js"></script>
<script src="js/scripts.js"></script>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Style-Type" content="text/css" />
<meta http-equiv="Content-Language" content="en" />
<script src="js/jquery.min.js" type="text/javascript"></script>
<script src="//maps.googleapis.com/maps/api/js?sensor=false" type="text/javascript"></script>
<script src="js/gmap3.min.js" type="text/javascript"></script>
<script src="js/scripts.js" type="text/javascript"></script>
<link rel="stylesheet" href="css/styles.css" type="text/css" media="all" />
</head>
<body onload="init()">
<body>
<div class="header">
<div class="header-title">Open Device Manager</div>
<div class="header-link">
<?php if (isset($_COOKIE['user_id'])) { ?>
<a href="logout.php">Logout</a> |
<a href="logout.php">Logout</a> |
<?php if (!$LDAP) { ?><a href="changepassword.php">Change Password</a> | <?php } ?>
<?php } ?>
<a href="http://nowsci.com/odm" target="_new">http://nowsci.com/odm</a>
Expand Down
Loading