inspectors/ApplicationTopography/web/main.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="">
<meta name="author" content="">
<title>Dexcalibur - Application topography</title>
<!-- styles -->
<!--## pages/inc/tpl_css.html ##-->
<!--## pages/inc/tpl_js_d3.html ##-->
<script type="text/javascript" src="../js/d3.geom.js"></script>
<style type="text/css">
.apptopo-vtn {
margin-top: 0px;
margin-left: 0px;
}
#ctn-permissions {
padding-top:0px
}
#ctn-permissions table {
color: #FFF;
}
#ctn-permissions table tbody tr:first td {
border-top: none;
}
#ctn-activities {
padding:0px;
}
#ctn-activities > div.row {
padding:0px;
}
#ctn-manifest div:first {
padding:5px;
}
body {
background-color:#272822;
}
#dataTables-activities {
margin-top:0px;
}
.apptopo-vmenu-disabled {
color: grey;
cursor: crosshair;
}
.first-vtn-col {
border-right: 1px solid #000;
padding-right: 0px;
background-color:#272822;
}
.apptopo-vmenu {
padding: 0px;
margin:0px;
font-size:1.5em;
border-right: 1px solid #000;
color:#FFF;
}
.apptopo-vmenu ul {
padding: 0px;
}
.apptopo-vmenu li {
list-style: none;
padding-top: 1em;
padding-bottom: 1em;
margin: 0px;
padding-left: 10px;
}
.apptopo-vmenu li > span {
padding-right: 1em;
}
.apptopo-vmenu li:hover {
color: #FFF;
background-color: #000;
cursor: pointer;
}
.apptopo-vmenu li.active {
color: #FFF;
background-color: #000;
}
#landing {
font-size:3em;
text-align: center;
color:honeydew;
}
.odd {
color: #FFF;
background-color:#4e5043;
}
.even {
color: #FFF;
background-color:#33332c;
}
.datatable-dark thead tr th {
background-color: #94a546;
}
.datatable-dark,
.datatable-dark tbody,
.datatable-dark tbody > tr,
.datatable-dark tbody > tr > td {
border-color: #94a546;
}
.datatable-dark tbody > tr:hover > td {
background-color:#6f7260;
cursor: pointer;
}
.datatable-dark tbody > tr > td > a.badge {
font-size:1em
}
</style>
<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
<script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
<![endif]-->
</head>
<body>
<div id="wrapper">
<!-- Navigation -->
<!--## pages/inc/menu.html ##-->
<div id="page-wrapper" style="border-width:0px;background-color:#272822;">
<div class="row" style="background-color:#272822;font-size:0.8em">
<div class="col-sm-2 col-lg-2 apptopo-vmenu">
<ul>
<li id="vmenu-manifest"><span class="fa fa-file"></span>Manifest</li>
<li id="vmenu-permissions"><span class="fa fa-key"></span>Permissions <span class="badge badge-success" id="permissions-count"></a></li>
<li id="vmenu-overview"><span class="fa fa-folder"></span>Overview</li>
<li id="vmenu-activities"><span class="fa fa-folder"></span>Activities <a class="badge badge-success" id="activity-nb">-</a></li>
<li id="vmenu-services"><span class="fa fa-folder"></span>Services <a class="badge badge-success" id="service-nb">-</a></li>
<li id="vmenu-providers"><span class="fa fa-folder"></span>Providers <a class="badge badge-success" id="provider-nb">-</a></li>
<li id="vmenu-receivers"><span class="fa fa-folder"></span>Receivers <a class="badge badge-success" id="receiver-nb">-</a></li>
<li id="vmenu-intent"><span class="fa fa-message"></span>Intent </li>
<li id="vmenu-tools"><span class="fa fa-wrench"></span>Tools </li>
</ul>
<!--
<div class="panel panel-default panel-appcmp-ppts">
<div class="panel-heading">
<b>Permissions</b>
<a class="badge badge-success" id="permissions-count">-</a>
</div>
<div class="panel-body table-responsive" style="padding:0px">
<table class="table table-sm-3 table-stripped overflow-auto" style="overflow:scroll">
<tbody id="permissions-list">
</tbody>
</table>
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading">
Properties
</div>
<div class="panel-body">
-
</div>
</div>-->
</div>
<div class="col-sm-10 col-lg-10 apptopo-vtn" id="landing">
<span class="fa fa-arrow-left"></span> Pick an action into the left menu
<!-- <div class="alert alert-warning" role="alert" style="position:absolute;font-size:1em;top:20%;left:40%;z-index:2000;">
<span class="fa fa-arrow-left"></span> Pick an action into the left menu
</div> -->
</div>
<div class="col-sm-10 col-lg-10 apptopo-vtn" id="ctn-permissions" style="display:none">
<div class="row">
<div class="col-lg-6 table-responsive first-vtn-col" style="height:60em">
<table class="table table-stripped overflow-auto" style="overflow:scroll;">
<tbody id="permissions-list">
</tbody>
</table>
</div>
<div class="col-lg-6" id="ctn-permission-detail" style="display:none">
<h2 id="perm-detail-title"></h2>
<div class="row">
<div class="col-lg-8">Protection Level</div>
<div class="col-lg-4" id="perm-protection-lvl">-</div>
</div>
<div class="row">
<div class="col-lg-8">Protection Group</div>
<div class="col-lg-4" id="perm-group">-</div>
</div>
<div class="row">
<div class="col-lg-8">Added in API level</div>
<div class="col-lg-4" id="perm-api">-</div>
</div>
<fieldset>
<legend>Description</legend>
<p id="perm-description"></p>
</fieldset>
<table class="table table-bordered table-hover datatable-dark">
<thead>
<th class="col-lg-8">Control</th>
<th class="col-lg-4">Action</th>
</thead>
<tbody>
<tr>
<td>TODO : available soon</td>
<td>-</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<div class="col-sm-10 col-lg-10 apptopo-vtn" id="ctn-manifest" style="display:none">
<!-- <div class="row" style="padding:5px">
<a class="badge badge-primary" id="ctn-manifest-save"><span class="fa fa-file"></span> save</a>
<a class="badge badge-warning" id="ctn-manifest-restore"><span class="fa fa-refresh"></span> restore</a>
</div> -->
<div class="row ctn-manifest-body">
<div class="col-lg-12 first-vtn-col" id="code-manifest"></div>
</div>
</div>
<div class="col-sm-8 col-lg-8 apptopo-vtn" id="ctn-overview" style="display:none">
<div class="row" id="row-cmp-1" style="margin-top:20px"></div>
</div>
<div class="col-sm-10 col-lg-10 apptopo-vtn" id="ctn-activities" style="display:none">
<div class="row">
<div class="col-sm-8 col-lg-8 first-vtn-col">
<table width="100%" class="table table-bordered table-hover datatable-dark" id="dataTables-activities">
<thead>
<tr>
<th class="col-lg-6">Name</th>
<th class="col-lg-2">Intent filters</th>
<th class="col-lg-2">Tags</th>
<th class="col-lg-2">Action</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
</div>
<!--<div class="col-sm-6 col-lg-6" id="ctn-activity-detail" style="display:none">
<h2 style="color:#FFF" id="act-detail-title"> </h2>
<div id="act-detail-tag"> </div>
<div class="panel panel-info">
<div class="panel-heading" style="font-size:1.2em">
<div class="row">
<div class="col-lg-4">Attributes</div>
<div class="col-lg-8">
<a class="badge badge-pink seeClass" id="act-detail-impl" href="" target="blank">See associated class</a>
<button class="badge badge-danger startActivity">Start activity</button>
</div>
</div>
</div>
<div class="panel-body" style="padding:0px">
<table width="100%" class="table table-striped table-bordered table-hover" style="margin-bottom: 0px" id="act-detail-attr-tab">
<tbody>
</tbody>
</table>
</div>
</div>
<div class="panel panel-info">
<div class="panel-heading" style="font-size:1.2em">
Intent Filters
</div>
<div class="panel-body" style="padding:0px">
<table width="100%" class="table table-striped table-bordered table-hover" style="margin-bottom: 0px" id="act-detail-intent-tab">
<thead>
<th class="col-lg-1">-</th>
<th class="col-lg-5">Category</th>
<th class="col-lg-6">Action</th>
</thead>
<tbody></tbody>
</table>
</div>
</div>
<div class="panel panel-info">
<div class="panel-heading">
<div class="row">
Android internals invoked
</div>
</div>
<div class="panel-body" style="padding:0px">
<table width="100%" class="table table-striped table-bordered table-hover" style="margin-bottom: 0px" id="act-detail-intern-tab">
<thead>
<th>Class</th>
<th>Method</th>
</thead>
<tbody></tbody>
</table>
<div class="row"><div class="col-lg-2 col-lg-offset-5" style="text-align: center">scroll</div></div>
</div>
</div>
</div>-->
</div>
</div>
<div class="col-sm-10 col-lg-10 apptopo-vtn" id="ctn-services" style="display:none">
<div class="row">
<div class="col-sm-8 col-lg-8 first-vtn-col">
<table width="100%" class="table table-bordered table-hover datatable-dark" id="dataTables-services">
<thead>
<tr>
<th class="col-lg-6">Name</th>
<th class="col-lg-2">Intent filters</th>
<th class="col-lg-2">Tags</th>
<th class="col-lg-2">Action</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
</div>
</div>
</div>
<div class="col-sm-10 col-lg-10 apptopo-vtn" id="ctn-receivers" style="display:none">
<div class="row">
<div class="col-sm-8 col-lg-8 first-vtn-col">
<table width="100%" class="table table-bordered table-hover datatable-dark" id="dataTables-receivers">
<thead>
<tr>
<th class="col-lg-6">Name</th>
<th class="col-lg-2">Intent filters</th>
<th class="col-lg-2">Tags</th>
<th class="col-lg-2">Action</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
</div>
</div>
</div>
<div class="col-sm-10 col-lg-10 apptopo-vtn" id="ctn-providers" style="display:none">
<div class="row">
<div class="col-sm-8 col-lg-8 first-vtn-col">
<table width="100%" class="table table-bordered table-hover datatable-dark" id="dataTables-providers">
<thead>
<tr>
<th class="col-lg-6">Name</th>
<th class="col-lg-2">Intent filters</th>
<th class="col-lg-2">Tags</th>
<th class="col-lg-2">Action</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
</div>
</div>
</div>
<!--<div class="col-sm-4 col-lg-4 second-vtn-col" id="act-detail-panel" style="display:none">
<div class="row">
<div class="col-lg-10" id="act-detail-title">
</div>
<div class="col-lg-2">
<span class="badge badge-success">probe</span>
</div>
</div>
</div>-->
</div>
<!-- /.col-lg-12 -->
</div>
</div>
<!-- /#page-wrapper -->
<div class="modal fade" id="activityModal" tabindex="-1" role="dialog" aria-labelledby="activityModalLabel" aria-hidden="true" style="font-size:0.8em;">
<div class="modal-dialog modal-lg" role="document">
<div class="modal-content">
<div class="modal-header">
<span style="font-size:1.3em" class="modal-title" id="act-detail-title">-</span> <span id="act-detail-tag"> </span>
</div>
<div class="modal-body" id="confirm-text">
<div class="row">
<div class="col-lg-5">
<div class="card">
<h5 class="card-header">Attributes</h5>
<ul class="list-group list-group-flush">
<li class="list-group-item">
<a class="badge badge-pink seeClass" id="act-detail-impl" href="" target="blank">See associated class</a>
</li>
<li class="list-group-item">
<button class="badge badge-danger startActivity">Start activity</button>
</li>
</ul>
<div class="card-body" style="padding:0px">
<table width="100%" class="table table-striped table-bordered table-hover" style="margin-bottom: 0px" id="act-detail-attr-tab">
<tbody>
</tbody>
</table>
</div>
</div>
</div>
<div class="col-lg-7">
<div class="card">
<h5 class="card-header"> Intent Filters
</h5>
<div class="card-body" style="padding:0px">
<table width="100%" class="table table-striped table-bordered table-hover overflow-auto" style="margin-bottom:0px;overflow:scroll" id="act-detail-intent-tab">
<thead>
<th class="col-lg-1">-</th>
<th class="col-lg-5">Category</th>
<th class="col-lg-6">Action</th>
</thead>
<tbody></tbody>
</table>
</div>
</div>
</div>
</div>
<div class="card">
<div class="card-header" style="font-size:1.2em">
Android internals invoked
</div>
<div class="card-body" style="padding:0px">
<table width="100%" class="table table-striped table-bordered table-hover" style="margin-bottom: 0px" id="act-detail-intern-tab">
<thead>
<th>Class</th>
<th>Method</th>
</thead>
<tbody><!--
<tr><td class="col-lg-8" >DexClassLoader.load</td><td class="col-lg-4 col-threat-score" style="color:orange">3/5</td></tr>
<tr><td class="col-lg-8" >Runtime.exec</td><td class="col-lg-4 col-threat-score" style="color: orangered">5/5</td></tr>
--></tbody>
</table>
</div>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-danger" id="confirm-btn-abort" data-dismiss="modal">Abort</button>
<button type="button" class="btn btn-success confirm" id="confirm-btn-ok">Confirm</button>
</div>
</div>
</div>
</div>
<div class="modal fade" id="serviceModal" tabindex="-1" role="dialog" aria-labelledby="serviceModalLabel" aria-hidden="true">
<div class="modal-dialog modal-lg" style="width:80%" role="document">
<div class="modal-content">
<div class="modal-header">
<span style="font-size:1.8em" class="modal-title" id="srv-detail-title">-</span> <span id="srv-detail-tag"> </span>
</div>
<div class="modal-body" id="confirm-text">
<div class="row">
<div class="col-lg-5">
<div class="card">
<div class="card-header" style="font-size:1.2em">
<div class="row">
<div class="col-lg-4">Attributes</div>
<div class="col-lg-8">
<a class="badge badge-pink seeClass" id="srv-detail-impl" href="" target="blank">See associated class</a>
<button class="badge badge-secondary startActivity">Start activity</button>
</div>
</div>
</div>
<div class="panel-body" style="padding:0px">
<table width="100%" class="table table-striped table-bordered table-hover" style="margin-bottom: 0px" id="srv-detail-attr-tab">
<tbody>
</tbody>
</table>
</div>
</div>
</div>
<div class="col-lg-7">
<div class="panel panel-info">
<div class="panel-heading" style="font-size:1.2em">
Intent Filters
</div>
<div class="panel-body" style="padding:0px">
<table width="100%" class="table table-striped table-bordered table-hover overflow-auto" style="margin-bottom:0px;overflow:scroll" id="srv-detail-intent-tab">
<thead>
<th class="col-lg-1">-</th>
<th class="col-lg-5">Category</th>
<th class="col-lg-6">Action</th>
</thead>
<tbody></tbody>
</table>
</div>
</div>
</div>
</div>
<div class="panel panel-info">
<div class="panel-heading" style="font-size:1.2em">
Android internals invoked
</div>
<div class="panel-body" style="padding:0px">
<table width="100%" class="table table-striped table-bordered table-hover" style="margin-bottom: 0px" id="srv-detail-intern-tab">
<thead>
<th>Class</th>
<th>Method</th>
</thead>
<tbody><!--
<tr><td class="col-lg-8" >DexClassLoader.load</td><td class="col-lg-4 col-threat-score" style="color:orange">3/5</td></tr>
<tr><td class="col-lg-8" >Runtime.exec</td><td class="col-lg-4 col-threat-score" style="color: orangered">5/5</td></tr>
--></tbody>
</table>
</div>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
<div class="modal fade" id="providerModal" tabindex="-1" role="dialog" aria-labelledby="providerModalLabel" aria-hidden="true">
<div class="modal-dialog modal-lg" style="width:80%" role="document">
<div class="modal-content">
<div class="modal-header">
<span style="font-size:1.8em" class="modal-title" id="prv-detail-title">-</span> <span id="prv-detail-tag"> </span>
</div>
<div class="modal-body" id="confirm-text">
<div class="row">
<div class="col-lg-5">
<div class="panel panel-info">
<div class="panel-heading" style="font-size:1.2em">
<div class="row">
<div class="col-lg-4">Attributes</div>
<div class="col-lg-8">
<a class="badge badge-pink seeClass" id="prv-detail-impl" href="" target="blank">See associated class</a>
<button class="badge badge-danger startActivity">Start activity</button>
</div>
</div>
</div>
<div class="panel-body" style="padding:0px">
<table width="100%" class="table table-striped table-bordered table-hover" style="margin-bottom: 0px" id="prv-detail-attr-tab">
<tbody>
</tbody>
</table>
</div>
</div>
</div>
<div class="col-lg-7">
<div class="panel panel-info">
<div class="panel-heading" style="font-size:1.2em">
Intent Filters
</div>
<div class="panel-body" style="padding:0px">
<table width="100%" class="table table-striped table-bordered table-hover overflow-auto" style="margin-bottom:0px;overflow:scroll" id="prv-detail-intent-tab">
<thead>
<th class="col-lg-1">-</th>
<th class="col-lg-5">Category</th>
<th class="col-lg-6">Action</th>
</thead>
<tbody></tbody>
</table>
</div>
</div>
</div>
</div>
<div class="panel panel-info">
<div class="panel-heading" style="font-size:1.2em">
Android internals invoked
</div>
<div class="panel-body" style="padding:0px">
<table width="100%" class="table table-striped table-bordered table-hover" style="margin-bottom: 0px" id="prv-detail-intern-tab">
<thead>
<th>Class</th>
<th>Method</th>
</thead>
<tbody><!--
<tr><td class="col-lg-8" >DexClassLoader.load</td><td class="col-lg-4 col-threat-score" style="color:orange">3/5</td></tr>
<tr><td class="col-lg-8" >Runtime.exec</td><td class="col-lg-4 col-threat-score" style="color: orangered">5/5</td></tr>
--></tbody>
</table>
</div>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">Abort</button>
</div>
</div>
</div>
</div>
<div class="modal fade" id="receiverModal" tabindex="-1" role="dialog" aria-labelledby="receiverModalLabel" aria-hidden="true">
<div class="modal-dialog modal-lg" style="width:80%" role="document">
<div class="modal-content">
<div class="modal-header">
<span style="font-size:1.8em" class="modal-title" id="rcv-detail-title">-</span> <span id="rcv-detail-tag"> </span>
</div>
<div class="modal-body" id="confirm-text">
<div class="row">
<div class="col-lg-5">
<div class="panel panel-info">
<div class="panel-heading" style="font-size:1.2em">
<div class="row">
<div class="col-lg-4">Attributes</div>
<div class="col-lg-8">
<a class="badge badge-pink seeClass" id="rcv-detail-impl" href="" target="blank">See associated class</a>
<button class="badge badge-danger startActivity">Start activity</button>
</div>
</div>
</div>
<div class="panel-body" style="padding:0px">
<table width="100%" class="table table-striped table-bordered table-hover" style="margin-bottom: 0px" id="rcv-detail-attr-tab">
<tbody>
</tbody>
</table>
</div>
</div>
</div>
<div class="col-lg-7">
<div class="panel panel-info">
<div class="panel-heading" style="font-size:1.2em">
Intent Filters
</div>
<div class="panel-body" style="padding:0px">
<table width="100%" class="table table-striped table-bordered table-hover overflow-auto" style="margin-bottom:0px;overflow:scroll" id="rcv-detail-intent-tab">
<thead>
<th class="col-lg-1">-</th>
<th class="col-lg-5">Category</th>
<th class="col-lg-6">Action</th>
</thead>
<tbody></tbody>
</table>
</div>
</div>
</div>
</div>
<div class="panel panel-info">
<div class="panel-heading" style="font-size:1.2em">
Android internals invoked
</div>
<div class="panel-body" style="padding:0px">
<table width="100%" class="table table-striped table-bordered table-hover" style="margin-bottom: 0px" id="rcv-detail-intern-tab">
<thead>
<th>Class</th>
<th>Method</th>
</thead>
<tbody><!--
<tr><td class="col-lg-8" >DexClassLoader.load</td><td class="col-lg-4 col-threat-score" style="color:orange">3/5</td></tr>
<tr><td class="col-lg-8" >Runtime.exec</td><td class="col-lg-4 col-threat-score" style="color: orangered">5/5</td></tr>
--></tbody>
</table>
</div>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">Abort</button>
</div>
</div>
</div>
</div>
<div class="modal fade" id="confirmModal" tabindex="-1" role="dialog" aria-labelledby="confirmModalLabel" aria-hidden="true">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h3 class="modal-title" id="confirm-title">Confirmation</h3>
</div>
<div class="modal-body" id="confirm-text">
</div>
<div class="modal-footer">
<button type="button" class="btn btn-danger" id="confirm-btn-abort" data-dismiss="modal">Abort</button>
<button type="button" class="btn btn-success confirm" id="confirm-btn-ok">Confirm</button>
</div>
</div>
</div>
</div>
</div>
<!-- /#wrapper -->
<!--## pages/inc/tpl_js_end.html ##-->
<!--## pages/inc/tpl_ace_js.html ##-->
<!-- Page-Level Demo Scripts - Tables - Use for reference -->
<script src="/js/wexcalibur.js"></script>
<script>
let TAGS_COLOR = {
MAIN: "success",
BROWSABLE: "danger",
EXPOSED: "danger",
BOOT_COMPLETED: "purple",
SMS: "info",
PHONE: "info"
};
function renderPermissionDetail(permission)
{
$("#perm-protection-lvl").html(
permission.protectionLevel!=null?
DexcaliburAPI.manifest.permissions.ui.protectionBadge[permission.protectionLevel]:"-"
);
$("#perm-detail-title").html(
DexcaliburAPI.ui.htmlEncode(permission.name)
);
$("#perm-description").html(
DexcaliburAPI.ui.htmlEncode(permission.description)
);
$("#perm-api").html(
DexcaliburAPI.ui.htmlEncode(permission.apiVersion)
);
$("#perm-group").html(
permission.permissionGroup!=null?
('<a class="perm-group-link" permGroup="'+btoa(permission.permissionGroup)+'">'+DexcaliburAPI.ui.htmlEncode(permission.permissionGroup)+'</a>'):"-"
);
$("#ctn-permission-detail").css("display","block");
}
function makeActivityBlock(obj){
let i= obj.name.lastIndexOf('.');
let package = (i>-1? DexcaliburAPI.ui.htmlEncode(obj.name.substr(0,i))+"<br>" : '');
let an = DexcaliburAPI.ui.htmlEncode( i>-1? obj.name.substr(i+1) : obj.name );
let tags = "";
if((obj.__tag instanceof Array) && (obj.__tag.length > 0)){
obj.__tag.map(t => {
if(TAGS_COLOR[t] != null)
tags += DexcaliburAPI.ui.badge.make(TAGS_COLOR[t],t);
else
tags += DexcaliburAPI.ui.badge.make('info',t);
});
}
if(tags.length==0){
tags = "-";
}
let body = `
<div class="col-lg-3">
<div class="card card-activity panel-appcmp-orange" activityName="${obj.name}">
<div class="card-body" style="text-align:center">
<span class="activity-name">${an}</span><br>
${tags}
</div>
</div>
</div>
`;
return body;
}
function appendToGrid(el, type, obj, config){
confi
}
function makeProviderBlock(obj){
let i= obj.name.lastIndexOf('.');
let package = (i>-1? DexcaliburAPI.ui.htmlEncode(obj.name.substr(0,i))+"<br>" : '');
let an = DexcaliburAPI.ui.htmlEncode( i>-1? obj.name.substr(i+1) : obj.name );
let tags = "";
if((obj.__tag instanceof Array) && (obj.__tag.length > 0)){
obj.__tag.map(t => {
if(TAGS_COLOR[t] != null)
tags += DexcaliburAPI.ui.badge.make(TAGS_COLOR[t],t);
else
tags += DexcaliburAPI.ui.badge.make('info',t);
});
}
if(tags.length==0){
tags = "-";
}
let body = `
<div class="col-lg-3">
<div class="card card-provider panel-appcmp-blue" providerName="${obj.name}">
<div class="card-body" style="text-align:center">
<span class="provider-name">${an}</span><br>
${tags}
</div>
</div>
</div>
`;
return body;
}
function makeServiceBlock(obj){
let i= obj.name.lastIndexOf('.');
let package = (i>-1? DexcaliburAPI.ui.htmlEncode(obj.name.substr(0,i))+"<br>" : '');
let an = DexcaliburAPI.ui.htmlEncode( i>-1? obj.name.substr(i+1) : obj.name );
let tags = "";
if((obj.__tag instanceof Array) && (obj.__tag.length > 0)){
obj.__tag.map(t => {
if(TAGS_COLOR[t] != null)
tags += DexcaliburAPI.ui.badge.make(TAGS_COLOR[t],t);
else
tags += DexcaliburAPI.ui.badge.make('info',t);
});
}
if(tags.length==0){
tags = "-";
}
let body = `
<div class="col-lg-3">
<div class="card card-service panel-appcmp-grey" serviceName="${obj.name}">
<div class="card-body" style="text-align:center">
<span class="service-name">${an}</span><br>
${tags}
</div>
</div>
</div>
`;
return body;
}
function makeReceiverBlock(obj){
let i= obj.name.lastIndexOf('.');
let package = (i>-1? DexcaliburAPI.ui.htmlEncode(obj.name.substr(0,i))+"<br>" : '');
let an = DexcaliburAPI.ui.htmlEncode( i>-1? obj.name.substr(i+1) : obj.name );
let tags = "";
if((obj.__tag instanceof Array) && (obj.__tag.length > 0)){
obj.__tag.map(t => {
if(TAGS_COLOR[t] != null)
tags += DexcaliburAPI.ui.badge.make(TAGS_COLOR[t],t);
else
tags += DexcaliburAPI.ui.badge.make('info',t);
});
}
if(tags.length==0){
tags = "-";
}
let body = `
<div class="col-lg-3">
<div class="card card-receiver panel-appcmp-green" receiverName="${obj.name}">
<div class="card-body" style="text-align:center">
<span class="receiver-name">${an}</span><br>
${tags}
</div>
</div>
</div>
`;
return body;
}
function makeProtectionLevelBadge(type){
const styles = {
dangerous: "<a class='badge badge-danger' data-toggle='tooltip' data-placement='bottom' title='dangerous'>!</a>",
special: "<a class='badge badge-warning' data-toggle='tooltip' data-placement='bottom' title='special'>!</a>",
signature: "<a class='badge badge-info' data-toggle='tooltip' data-placement='bottom' title='signature'>!</a>",
normal: "<a class='badge badge-secondary' data-toggle='tooltip' data-placement='bottom' title='normal'><span class='fa fa-info'></span></a>",
};
return styles[type];
}
function prepareActivityModal(activity){
//$("#actMod")
console.log(DexcaliburAPI.search.makeClassLink(activity.__impl));
$("#actModImplementedBy").html(
DexcaliburAPI.search.makeClassLink(activity.__impl)
);
activity.__tag.map(t => {
$("#actModTags").append(DexcaliburAPI.ui.badge.make('success',t));
});
$("#actModName").html(DexcaliburAPI.ui.htmlEncode(activity.name));
}
function makeRow(type, data){
let row=$('tr');
let col="";
let body="";
if(type=="act"){
col = $('td');
col.append( DexcaliburAPI.ui.htmlEncode(data.name));
row.append(col);
col = $('td');
col.append( (data.intentFilters.length > 0)? 'YES' : '');
row.append(col);
body="";
if(data.__tag != null){
data.__tag.map(x => {
if(body.length > 0) body +="<br>";
if(TAGS_COLOR[x]!=null)
body += DexcaliburAPI.ui.badge.make(TAGS_COLOR[x],x);
else
body += DexcaliburAPI.ui.badge.make('secondary',x);
});
}
col.append(body);
row.append(col);
col = $('td');
col.append(`
<a class="btn btn-primary btn-sm" href="/inspectors/ApplicationTopography/activity.html?id=`+
DexcaliburAPI.util.encodeLocationAction(row.name)
+`" data-toggle="tooltip" data-placement="bottom" title="Show activity details">Info</button>
`);
row.append(col);
return row;
}
}
// Menu inlighting (active button)
var ApptoVmenuActive = {
menu: null,
ctn: "landing"
};
$(document).ready(function() {
DexcaliburAPI.manifest.getContent({
200: function(data){
let d = JSON.parse(data);
let body = "";
d = d.data.split("\n");
d.map(x => {
//console.log(x);
//if(x[0]=='<') body += "\t";
body += DexcaliburAPI.ui.htmlEncode(x)+"\n";
});
$("#code-manifest").html(body);
DexcaliburAPI.editor.newCodeEditor("code-manifest","ace/mode/xml");
//setupAceEditor("code-manifest");
}
});
$("#ctn-manifest-save").click(x => {
let data = DexcaliburAPI.editor.getContentOf("code-manifest");
$("#confirm-text").html("Are you sure to save changes ?");
$("#confirm-btn-ok").click(function(a){
DexcaliburAPI.manifest.updateContent(data,{
200: function(x){
alert("Manifest saved");
}
});
});
$("#confirmModal").modal();
});
// -- Permissions --
DexcaliburAPI.manifest.permissions.list({
200: function(data){
let body = "";
let perms = JSON.parse(data);
let p, n, j;
for(let i=0; i<perms.data.length; i++){
j = perms.data[i].name.lastIndexOf(".");
n = perms.data[i].name.substr(j+1);
p = perms.data[i].name.substr(0,j);
f = " - ";
if(perms.data[i].protectionLevel!=null){
f = makeProtectionLevelBadge(perms.data[i].protectionLevel);
}
body += "<tr><td><div class='row'><div class='col-lg-1'>"
+f
+"</div><div class='col-lg-8'>"
+DexcaliburAPI.ui.htmlEncode(p)+"<br>"
+DexcaliburAPI.ui.htmlEncode(n)
+"</div><div class='col-lg-3' style='font-size:1.5em'>"
+"<a class='badge badge-purple btn-permission-detail' perm='"+perms.data[i].name+"'>info</a>"
+"</div></td></tr>";
}
$('#permissions-list').html(body);
$('#permissions-count').html(perms.data.length);
}
});
$('#permissions-list').on('click', '.btn-permission-detail', function (e) {
console.log(e.currentTarget.getAttribute("perm"));
DexcaliburAPI.manifest.permissions.get(
btoa(e.currentTarget.getAttribute("perm")), {
200: function(data){
// let perm = JSON.parse(data);
renderPermissionDetail(data);
console.log(e);
}
});
});
// Activities
DexcaliburAPI.manifest.activities.list({
200: function(data){
let body = "";
let act = JSON.parse(data);
act.data.map(x=>{
$('#row-cmp-1').append(makeActivityBlock(x));
/*$('#dataTables-activities tbody').append(
makeRow("act", data)
);*/
});
$('#activity-nb').html(act.data.length);
}
});
DexcaliburAPI.manifest.providers.list({
200: function(data){
let body = "";
let act = JSON.parse(data);
$('#provider-nb').html(act.data.length);
act.data.map(x=>{
$('#row-cmp-1').append(makeProviderBlock(x));
});
}
});
DexcaliburAPI.manifest.services.list({
200: function(data){
let body = "";
let act = JSON.parse(data);
$('#service-nb').html(act.data.length);
act.data.map(x=>{
$('#row-cmp-1').append(makeServiceBlock(x));
});
}
});
DexcaliburAPI.manifest.receivers.list({
200: function(data){
let body = "";
let act = JSON.parse(data);
$('#receiver-nb').html(act.data.length);
act.data.map(x=>{
$('#row-cmp-1').append(makeReceiverBlock(x));
});
}
});
$(function () {
$('[data-toggle="tooltip"]').tooltip()
});
$("#row-cmp-1").on('click','.card-activity',function(x){
DexcaliburAPI.manifest.activities.get(
x.currentTarget.getAttribute("activityName"), {
200: function(data){
let act = JSON.parse(data);
prepareActivityModal(act.data);
$('#activityModal').modal();
}
});
});
$('.apptopo-vmenu > ul > li').click(x => {
$('#'+ApptoVmenuActive.ctn).css("display","none");
if(ApptoVmenuActive.menu != null){
$('#'+ApptoVmenuActive.menu).removeClass("active");
}
ApptoVmenuActive.menu = x.currentTarget.attributes.id.nodeValue;
ApptoVmenuActive.ctn = "ctn-"+ApptoVmenuActive.menu.substr(6);
$('#'+ApptoVmenuActive.menu).addClass("active");
$('#'+ApptoVmenuActive.ctn).css('display','block');
});
let actTable = $('#dataTables-activities').DataTable({
paging: false,
ordering: false,
info: false,
searching: false,
ajax: DexcaliburAPI.manifest.activities.URI.list,
columns: [
{ data: 'name' },
{
render: function(data, type, row, meta ){
return (row.intentFilters.length > 0)? 'YES' : '';
}
},
{
render: function(data, type, row, meta){
let body = "";
if(row.__tag != null){
row.__tag.map(x => {
if(body.length > 0) body +="<br>";
if(TAGS_COLOR[x]!=null)
body += DexcaliburAPI.ui.badge.make(TAGS_COLOR[x],x);
else
body += DexcaliburAPI.ui.badge.make('secondary',x);
});
}
return body;
}
},
{
render: function(data, type, row, meta ){
// <button class="btn btn-info runscan" style="height:1.5em;padding-top:0px;padding-bottom:0px;" scanner="`+btoa(row.id)+`">Run</button>
return `
<a class="badge badge-primary" href="/inspectors/ApplicationTopography/activity.html?id=`+
DexcaliburAPI.util.encodeLocationAction(row.name)
+`" data-toggle="tooltip" data-placement="bottom" title="Show activity details">Info</button>
`;
}
}
],
responsive: true
});
let srvTable = $('#dataTables-services').DataTable({
paging: false,
ordering: false,
info: false,
searching: false,
ajax: DexcaliburAPI.manifest.services.URI.list,
columns: [
{ data: 'name' },
{
render: function(data, type, row, meta ){
return (row.intentFilters.length > 0)? 'YES' : '';
}
},
{
render: function(data, type, row, meta){
let body = "";
if(row.__tag != null){
row.__tag.map(x => {
if(body.length > 0) body +="<br>";
if(TAGS_COLOR[x]!=null)
body += DexcaliburAPI.ui.badge.make(TAGS_COLOR[x],x);
else
body += DexcaliburAPI.ui.badge.make('secondary',x);
});
}
return body;
}
},
{
render: function(data, type, row, meta ){
// <button class="btn btn-info runscan" style="height:1.5em;padding-top:0px;padding-bottom:0px;" scanner="`+btoa(row.id)+`">Run</button>
/*return `
<a style="height:1.5em;" class="badge badge-primary btn-service-detail" service="`+btoa(row.name)+`" data-toggle="tooltip" data-placement="bottom" title="Show service details">Info</button>
`;*/
return `
<a class="badge badge-primary" href="/inspectors/ApplicationTopography/service.html?id=`+
DexcaliburAPI.util.encodeLocationAction(row.name)
+`" data-toggle="tooltip" data-placement="bottom" title="Show service details">Info</button>
`;
}
}
],
responsive: true
});
let recvTable = $('#dataTables-receivers').DataTable({
paging: false,
ordering: false,
info: false,
searching: false,
ajax: DexcaliburAPI.manifest.receivers.URI.list,
columns: [
{ data: 'name' },
{
render: function(data, type, row, meta ){
return (row.intentFilters.length > 0)? 'YES' : '';
}
},
{
render: function(data, type, row, meta){
let body = "";
if(row.__tag != null){
row.__tag.map(x => {
if(body.length > 0) body +="<br>";
if(TAGS_COLOR[x]!=null)
body += DexcaliburAPI.ui.badge.make(TAGS_COLOR[x],x);
else
body += DexcaliburAPI.ui.badge.make('secondary',x);
});
}
return body;
}
},
{
render: function(data, type, row, meta ){
// <button class="btn btn-info runscan" style="height:1.5em;padding-top:0px;padding-bottom:0px;" scanner="`+btoa(row.id)+`">Run</button>
/*return `
<a style="height:1.5em;" class="badge badge-primary btn-receiver-detail" receiver="`+btoa(row.name)+`" data-toggle="tooltip" data-placement="bottom" title="Show receiver details">Info</button>
`;*/
return `
<a class="badge badge-primary" href="/inspectors/ApplicationTopography/receiver.html?id=`+
DexcaliburAPI.util.encodeLocationAction(row.name)
+`" data-toggle="tooltip" data-placement="bottom" title="Show receiver details">Info</button>
`;
}
}
],
responsive: true
});
let prvTable = $('#dataTables-providers').DataTable({
paging: false,
ordering: false,
info: false,
searching: false,
ajax: DexcaliburAPI.manifest.providers.URI.list,
columns: [
{ data: 'name' },
{
render: function(data, type, row, meta ){
return (row.intentFilters.length > 0)? 'YES' : '';
}
},
{
render: function(data, type, row, meta){
let body = "";
if(row.__tag != null){
row.__tag.map(x => {
if(body.length > 0) body +="<br>";
if(TAGS_COLOR[x]!=null)
body += DexcaliburAPI.ui.badge.make(TAGS_COLOR[x],x);
else
body += DexcaliburAPI.ui.badge.make('secondary',x);
});
}
return body;
}
},
{
render: function(data, type, row, meta ){
// <button class="btn btn-info runscan" style="height:1.5em;padding-top:0px;padding-bottom:0px;" scanner="`+btoa(row.id)+`">Run</button>
/* return `
<a style="height:1.5em;" class="badge badge-primary btn-provider-detail" provider="`+btoa(row.name)+`" data-toggle="tooltip" data-placement="bottom" title="Show provider details">Info</button>
`; */
return `
<a class="badge badge-primary" href="/inspectors/ApplicationTopography/provider.html?id=`+
DexcaliburAPI.util.encodeLocationAction(row.name)
+`" data-toggle="tooltip" data-placement="bottom" title="Show provider details">Info</button>
`;
}
}
],
responsive: true
});
$('#dataTables-activities tbody').on('click', '.btn-activity-detail', function (e) {
console.log(e.currentTarget.getAttribute("activity"));
DexcaliburAPI.manifest.activities.get(
e.currentTarget.getAttribute("activity"), {
200: function(data){
let act = JSON.parse(data);
renderActivityDetail(act.data);
console.log(act.data);
}
});
});
$('#dataTables-providers tbody').on('click', '.btn-provider-detail', function (e) {
console.log(e.currentTarget.getAttribute("provider"));
DexcaliburAPI.manifest.providers.get(
e.currentTarget.getAttribute("provider"), {
200: function(data){
let prv = JSON.parse(data);
renderProviderDetail(prv.data);
console.log(prv.data);
}
});
});
$('#dataTables-services tbody').on('click', '.btn-service-detail', function (e) {
console.log(e.currentTarget.getAttribute("service"));
DexcaliburAPI.manifest.providers.get(
e.currentTarget.getAttribute("service"), {
200: function(data){
let prv = JSON.parse(data);
renderServiceDetail(prv.data);
console.log(prv.data);
}
});
});
$('#dataTables-receivers tbody').on('click', '.btn-receiver-detail', function (e) {
console.log(e,e.currentTarget.getAttribute("receiver"));
DexcaliburAPI.manifest.receivers.get(
e.currentTarget.getAttribute("receiver"), {
200: function(data){
let o = JSON.parse(data);
renderReceiverDetail(o.data);
console.log(o.data);
}
});
});
});
</script>
</body>
</html>