inspectors/BytecodeCleaner/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 - Bytecode cleaner</title>
<!-- styles -->
<!--## pages/inc/tpl_css.html ##-->
<!-- 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 class="dxc-dark">
<!-- Navigation -->
<!--## pages/inc/menu.html ##-->
<div id="page-wrapper" class="dxc-dark">
<!--<div class="row">
<div class="col-lg-12">
<h1 class="page-header" style="font-size:1em">Probe logs</h1>
</div>
</div>-->
<div class="row">
<div class="col-lg-12">
<h1 class="page-header">Bytecode Cleaner inspector</h1>
</div>
</div>
<div class="row">
<div class="col-lg-10 dxc-description">
<p>
This <b>inspector</b> offers several tools to clean-up the application bytecode. The purpose of these tools is to help reverse engineering by transforming bytecode
into a cleaner version - by removing useless goto, renaming symbols, and so. Tampering of the application bytecode done by this inspector don't impacts future runs,
because the application running on the device is not patched.
<i style="color:red">Be aware only new aliases are saved. Any bytcode changes are not saved.</i>
</p>
</div>
</div>
<!--<div class="col-lg-4">
<button class="btn btn-danger probe-restart">
<i class="fa fa-refresh"></i> Relaunch
</button> 
<button class="btn btn-primary refresh">
<i class="fa fa-refresh"></i> Refresh
</button>
</div>-->
<div class="card">
<div class="card-header">
<div class="row">
<div class="col-lg-7" style="font-size:1.5em">Remove NOP</div>
<div class="col-lg-3" style="font-size:1.5em; color:gray" id="nopCounter"></div>
</div>
</div>
<div class="card-body">
<div class="row">
<div class="col-md-10">
The aim of the NOP remover is to remove the NOP instruction from the model. <br>
It will produce more clean smali. <b style="color:red">Be aware this action cannot be undone.</b>
This action will not modify the files content.
</div>
<div class="col-md-2">
<h6>Actions :</h6>
<button class="btn btn-success nop-count">
Count
</button>
<button class="btn btn-danger nop-clean">
<i class="fa fa-refresh"></i> Clean
</button>
</div>
</div>
</div>
</div>
<div class="card">
<h5 class="card-header">
Remove useless Goto
</h5>
<div class="card-body">
<div class="row">
<div class="col-md-10">
The aim of the GoTo remover is to simply the bytecode by replacing GoTo trigged from a single point. <br>
It will produce more clean smali. <b style="color:red">Be aware this action cannot be undone.</b>
This action will not modify the files content.<br>
<input type="checkbox" name="nocleanif" id="nocleanif" value=1 checked><label>Not clean methods containing conditonnal basic blocks (if-*, try/ctach/throw)</label><br>
</div>
<div class="col-md-2">
<h6>Actions :</h6>
<button class="btn btn-danger goto-clean">
<i class="fa fa-refresh"></i> Clean
</button>
</div>
</div>
</div>
</div>
<div class="card">
<h5 class="card-header">
Find & rename wrapped methods
</h5>
<div class="card-body">
<div class="row">
<div class="col-lg-10">
The aim of this action is to detect wrappers and to rename it with the class/method name of the wrapped function.
<br>
<fieldset>
<legend>Methods cleaned</legend>
<b>Double static</b>:<span id="wrappedDoubleStatic"></span><br>
<b>Static interface</b>:<span id="wrappedStaticInterface"></span><br>
</fieldset>
</div>
<div class="col-lg-2">
<h6>Actions :</h6>
<button class="btn btn-danger wrapped-clean">
<i class="fa fa-refresh"></i> rename
</button>
</div>
</div>
</div>
</div>
<!--
<div class="panel panel-info">
<div class="panel-heading">
<div class="row">
<div class="col-lg-10" style="font-size:1.5em">Find & replace duplicated functions</div>
<div class="col-lg-2">
<button class="btn btn-danger duplicate-clean">
<i class="fa fa-refresh"></i> Clean
</button>
</div>
</div>
</div>
<div class="panel-body">
</div>
</div>
-->
<!--
<table width="100%" class="table table-sm-4" id="tabProbeLogs">
<thead>
<tr>
<th>Device</th>
<th>Type</th>
<th>Method</th>
<th>Relevant arguments/subject</th>
<th>Action</th>
</tr>
</thead>
<tbody>
</tbody>
</table>-->
<!--<div class="modal modal-default">
<div class="modal-heading">
<div class="row">
<div class="col-lg-10" style="font-size:1.5em">Probe logs</div>
<div class="col-lg-2">
<button class="btn btn-danger probe-restart">
<i class="fa fa-refresh"></i> Relaunch
</button>
</div>
</div>
</div>
<div class="modal-body" id="probelogs" style="background-color:#fff;font-family: 'Courier New', Courier, monospace">
</div>
</div> -->
</div>
<!-- /#page-wrapper -->
<!--## pages/inc/tpl_js_end.html ##-->
<script>
$(document).ready(function() {
$(".nop-clean").click(function(e){
$.ajax("/api/inspectors/BytecodeCleaner", {
method: "get",
data: {
action: "nop_clean"
},
statusCode: {
200: function(data,err){
// do popup
alert("Success");
}
}
})
});
$(".nop-count").click(function(e){
$.ajax("/api/inspectors/BytecodeCleaner", {
method: "get",
data: {
action: "nop_count"
},
statusCode: {
200: function(data,err){
let pct = Math.round((data.nop/data.any)*100,2);
$("#nopCounter").html(data.nop+" NOPs / "+data.any+" ("+pct+"%)");
},
}
})
});
$(".goto-clean").click(function(e){
$.ajax("/api/inspectors/BytecodeCleaner", {
method: "get",
data: {
action: "goto_clean",
cleanif: $("#nocleanif").val()
},
statusCode: {
200: function(data,err){
alert("Success");
},
404: function(data,err){
alert("An remote error occured.");
}
}
})
});
$(".wrapped-clean").click(function(e){
$.ajax("/api/inspectors/BytecodeCleaner", {
method: "get",
data: {
action: "wrap_clean"
},
statusCode: {
200: function(data,err){
alert("Success");
$("#wrappedDoubleStatic").html(data.counter.doubleStatic);
$("#wrappedStaticInterface").html(data.counter.staticInterface);
},
404: function(data,err){
alert("An remote error occured.");
}
}
})
});
});
</script>
</body>
</html>