Skip to content

Commit

Permalink
versão para apresentação
Browse files Browse the repository at this point in the history
  • Loading branch information
lucascarvalhoroncoroni committed Jun 20, 2017
1 parent 046dc2b commit d2ea1c3
Show file tree
Hide file tree
Showing 5 changed files with 63 additions and 53 deletions.
Binary file not shown.
Binary file modified mainProject/SFAnalytics/__pycache__/views.cpython-36.pyc
Binary file not shown.
23 changes: 7 additions & 16 deletions mainProject/SFAnalytics/static/css/malwareResultStyle.css
Original file line number Diff line number Diff line change
@@ -1,14 +1,10 @@
.jumbo-color {
background-color: #3399ff;
position: absolute;
width: 100%;
height: 40%;
}

/*This defines the header font collor*/
#Header{
height: 100px;
color: black;
color: white;
}

/*This defines the body font collor*/
Expand All @@ -31,25 +27,20 @@
}

#opcodeTable{
width:300px;
overflow: auto;
overflow-y: auto;
overflow-x: hidden;
height: 150px;
position: absolute;
margin-left: 2%;
}

#stringTable{
width:300px;
overflow: auto;
overflow-y: auto;
overflow-x: hidden;
height: 150px;
position: absolute;
margin-left: 36%;
}

#dllTable{
width:300px;
overflow: auto;
overflow-y: auto;
overflow-x: hidden;
height: 150px;
position: absolute;
margin-left: 70%;
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,69 +15,76 @@
</ul>
</div>
<!--This is the Header section, it uses a jumbotron with a blue backgroud(jumbo-color) at uploadStyle.css-->
<div id="Header">
<div class="jumbotron jumbo-color">
<div id="opcodeTable" class="container panel">
<table class="table table-striped">
<div id="Header" class="jumbotron jumbo-color">
<div class="container page-header">
<h1>{{fileAnalysed.name}}</h1>
<p><small>Data Section Entropy: {{fileAnalysed.dataSectionEntropy}}</small></p>
<p><small>Text Section Entropy: {{fileAnalysed.textSectionEntropy}}</small></p>
</div>
</div>
<div id="Body" class="container-fluid">
<div class="row">
<div id="opcodeTable" class="col-sm-3">
<table class="container-fluid table-bordered table-striped">
<thead>
<tr>
<th>Opcode</th>
<th>Porcentage</th>
<th>Index</th>
<tr class="row">
<th class="col-sm-6">Opcode</th>
<th class="col-sm-3">Porcentage</th>
<th class="col-sm-3">Index</th>
</tr>
</thead>
<tbody>
{% for opcode in opcodes %}
<tr>
<td>{{opcode.name}}</td>
<td>{{opcode.porcentage}}%</td>
<td>{{opcode.index}}</td>
<tr class="row">
<td class="col-sm-6">{{opcode.name}}</td>
<td class="col-sm-3">{{opcode.porcentage}}%</td>
<td class="col-sm-3">{{opcode.index}}</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
<div id="stringTable" class="container panel">
<table class="table table-striped">
</div>
<!--This give a space between the tables-->

<div id="stringTable" class="col-sm-6">
<table class="container-fluid table-bordered table-striped">
<thead>
<tr>
<th>String</th>
<th>Index</th>
<tr class="row">
<th class="col-sm-10">String</th>
<th class="col-sm-2">Index</th>
</tr>
</thead>
<tbody>
{% for string in strings %}
<tr>
<td>{{string.string}}</td>
<td>{{string.index}}</td>
<tr class="row">
<td class="col-sm-10">{{string.string}}</td>
<td class="col-sm-2">{{string.index}}</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
<div id="dllTable" class="container panel">
<table class="table table-striped">
</div>
<!--This give a space between the tables-->

<div id="dllTable" class="col-sm-3">
<table class="container-fluid table-bordered table-striped">
<thead>
<tr>
<th>Dll</th>
<th>Index</th>
<tr class="row">
<th class="col-sm-9">Dll</th>
<th class="col-sm-3">Index</th>
</tr>
</thead>
<tbody>
{% for dll in dlls %}
<tr>
<td>{{dll.name}}</td>
<td>{{dll.index}}</td>
<tr class="row">
<td class="col-sm-9">{{dll.name}}</td>
<td class="col-sm-3">{{dll.index}}</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
</div>
</div>
<div id="Body" class="container">


</div>
<script src="{% static 'js/jquery.min.js' %}"></script>
<script src="{% static 'js/bootstrap.min.js' %}"></script>
Expand Down
16 changes: 14 additions & 2 deletions mainProject/SFAnalytics/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,14 @@ def getDataSectionEntropy(self):
def getDllListView(self):
return self.dllListView

#class to handle additional information of a fileUpload
class AnalysedFile(object):
def __init__(self, fileName, dataEntropy, textEntropy, isMalware):
self.name = fileName
self.dataSectionEntropy = dataEntropy
self.textSectionEntropy = textEntropy
self.isMalware = isMalware

#view from upload template
def uploadView(request):
if request.method == 'POST':
Expand All @@ -127,12 +135,16 @@ def malwareResultView(request):
# Retriaving file uploaded
uploadedFile = filesList[0]
path = './SFAnalytics/DataBase/Uploads/{}'.format(uploadedFile)
dlls = DllView(path).getDllListView()
#This is to hold in the future the value of the classification
isMalware = False
handlePE = DllView(path)
dlls = handlePE.getDllListView()
fileHashs = HashTable(path)
fileAnalysed = AnalysedFile(uploadedFile, handlePE.getDataSectionEntropy(), handlePE.getTextSectionEntropy(), isMalware)
opcodes = OpCodeView(path).getOpcodeListView()
strings = StringView(path).getStringListView()
#os.remove(path)
return render(request, 'SFAnalytics/malwareResultTemplate.html', {'opcodes' : opcodes, 'strings' : strings, 'dlls' : dlls})
return render(request, 'SFAnalytics/malwareResultTemplate.html', {'opcodes' : opcodes, 'strings' : strings, 'dlls' : dlls, 'fileAnalysed' : fileAnalysed})

def uploadDataBaseView(request):
if request.method == 'POST':
Expand Down

0 comments on commit d2ea1c3

Please sign in to comment.