@@ -4,16 +4,16 @@ <h2>Exfilled Files</h2>
4
4
< p >
5
5
Exfilled files are uploaded from an agent on a host to the server during an operation are by default stored on the server at < span x-text ="exfilDir "> </ span > .
6
6
< br >
7
- You can view and download the files here.
7
+ If an operation has exfilled files, you can view and download the files here.
8
8
</ p >
9
9
</ div >
10
10
< hr >
11
11
< div >
12
12
< form >
13
- < div class ="field ">
14
- < label class ="label "> Select an operation</ label >
15
- < div class ="control ">
16
- < div class ="select is-small ">
13
+ < div id =" select-operation " class ="field has-addons ">
14
+ < label class ="label "> Select an operation </ label >
15
+ < div class ="control is-expanded ">
16
+ < div class ="select is-small is-fullwidth ">
17
17
< select x-on:change ="loadFiles() " x-model ="selectedOperationId ">
18
18
< option value ="" selected > (all)</ option >
19
19
< template x-for ="operation of operations " :key ="operation.id ">
@@ -24,7 +24,7 @@ <h2>Exfilled Files</h2>
24
24
</ div >
25
25
</ div >
26
26
</ form >
27
- < div class ="buttons ">
27
+ < div class ="buttons " x-show =" numFiles !== 0 " >
28
28
< button class ="button is-primary is-small " @click ="toggleAllFiles(selectedFiles.length < numFiles) ">
29
29
< span x-text ="selectedFiles.length < numFiles ? 'Select' : 'Unselect' "> </ span > All Files
30
30
</ button >
@@ -33,7 +33,10 @@ <h2>Exfilled Files</h2>
33
33
< span > Download</ span >
34
34
</ button >
35
35
</ div >
36
- < ul class ="tree " x-show ="files ">
36
+ < p x-show ="numFiles === 0 ">
37
+ The selected operation has exfilled files to show.
38
+ </ p >
39
+ < ul class ="tree " x-show ="numFiles !== 0 ">
37
40
< li class ="root ">
38
41
< span class ="icon is-small "> < i class ="far fa-folder-open "> </ i > </ span >
39
42
< span x-text ="exfilDir "> </ span >
@@ -52,6 +55,9 @@ <h2>Exfilled Files</h2>
52
55
</ label >
53
56
</ li >
54
57
</ template >
58
+ < li x-show ="!Object.keys(files[agentName]).length ">
59
+ (none)
60
+ </ li >
55
61
</ ul >
56
62
</ li >
57
63
</ template >
@@ -83,7 +89,7 @@ <h2>Exfilled Files</h2>
83
89
} ,
84
90
85
91
loadFiles ( ) {
86
- restRequest ( 'POST' , { ' index' : 'exfil_files' , ' operation_id' : this . selectedOperationId } , ( files ) => {
92
+ restRequest ( 'POST' , { index : 'exfil_files' , operation_id : this . selectedOperationId } , ( files ) => {
87
93
this . files = JSON . parse ( files ) ;
88
94
this . numFiles = 0 ;
89
95
if ( this . selectedOperationId ) {
@@ -109,7 +115,11 @@ <h2>Exfilled Files</h2>
109
115
110
116
toggleFile ( filePath ) {
111
117
let index = this . selectedFiles . indexOf ( filePath ) ;
112
- index >= 0 ? this . selectedFiles . splice ( index , 1 ) : this . selectedFiles . push ( filePath ) ;
118
+ if ( index >= 0 ) {
119
+ this . selectedFiles . splice ( index , 1 ) ;
120
+ } else {
121
+ this . selectedFiles . push ( filePath ) ;
122
+ }
113
123
} ,
114
124
115
125
isFileSelected ( filePath ) {
@@ -118,7 +128,8 @@ <h2>Exfilled Files</h2>
118
128
119
129
toggleAllFiles ( selectAll ) {
120
130
if ( ! selectAll ) {
121
- return this . selectedFiles = [ ] ;
131
+ this . selectedFiles = [ ] ;
132
+ return ;
122
133
}
123
134
124
135
Object . keys ( this . files ) . forEach ( ( agent ) => {
@@ -131,11 +142,11 @@ <h2>Exfilled Files</h2>
131
142
downloadFiles ( ) {
132
143
this . selectedFiles . forEach ( ( filePath ) => {
133
144
let filename = filePath . split ( / [ \/ \\ ] / ) ;
134
- filename = filename [ filename . length - 1 ] ;
135
- let uri = " /file/download_exfil?file=" + btoa ( filePath ) ;
145
+ filename = filename [ filename . length - 1 ] ;
146
+ let uri = ` /file/download_exfil?file=${ btoa ( filePath ) } ` ;
136
147
let downloadAnchorNode = document . createElement ( 'a' ) ;
137
- downloadAnchorNode . setAttribute ( " href" , uri ) ;
138
- downloadAnchorNode . setAttribute ( " download" , filename ) ;
148
+ downloadAnchorNode . setAttribute ( ' href' , uri ) ;
149
+ downloadAnchorNode . setAttribute ( ' download' , filename ) ;
139
150
document . body . appendChild ( downloadAnchorNode ) ;
140
151
downloadAnchorNode . click ( ) ;
141
152
downloadAnchorNode . remove ( ) ;
@@ -148,6 +159,11 @@ <h2>Exfilled Files</h2>
148
159
</ script >
149
160
150
161
< style scoped >
162
+ # select-operation {
163
+ max-width : 800px ;
164
+ margin : 0 auto;
165
+ }
166
+
151
167
ul .tree {
152
168
margin : 0px 0px 0px 20px ;
153
169
list-style : none !important ;
0 commit comments