1- import { Component , OnInit , OnDestroy } from " @angular/core" ;
2- import { SortService , ColumnSortedEvent } from " ../../services/sort.service" ;
3- import { ApiService } from " ../../services/api.service" ;
4- import { Host } from " ../../models/host" ;
5- import { OmniBarService } from " ../../services/omnibar.service" ;
6- import { ClipboardService } from " ../../services/clipboard.service" ;
7- import ipaddr from " ipaddr.js" ;
8- import isIpInRange from " ip-range-check" ;
1+ import { Component , OnInit , OnDestroy } from ' @angular/core' ;
2+ import { SortService , ColumnSortedEvent } from ' ../../services/sort.service' ;
3+ import { ApiService } from ' ../../services/api.service' ;
4+ import { Host } from ' ../../models/host' ;
5+ import { OmniBarService } from ' ../../services/omnibar.service' ;
6+ import { ClipboardService } from ' ../../services/clipboard.service' ;
7+ import ipaddr from ' ipaddr.js' ;
8+ import isIpInRange from ' ip-range-check' ;
99
1010declare var $ : any ;
1111
1212@Component ( {
13- selector : " ui-lan-table" ,
14- templateUrl : " ./lan-table.component.html" ,
15- styleUrls : [ " ./lan-table.component.scss" ] ,
13+ selector : ' ui-lan-table' ,
14+ templateUrl : ' ./lan-table.component.html' ,
15+ styleUrls : [ ' ./lan-table.component.scss' ] ,
1616} )
1717export class LanTableComponent implements OnInit , OnDestroy {
1818 hosts : Host [ ] = [ ] ;
@@ -21,8 +21,8 @@ export class LanTableComponent implements OnInit, OnDestroy {
2121 viewSpoof : boolean = false ;
2222 spoofList : any = { } ;
2323 spoofOpts : any = {
24- targets : "" ,
25- whitelist : "" ,
24+ targets : '' ,
25+ whitelist : '' ,
2626 fullduplex : false ,
2727 internal : false ,
2828 ban : false ,
@@ -47,7 +47,7 @@ export class LanTableComponent implements OnInit, OnDestroy {
4747 public omnibar : OmniBarService ,
4848 public clipboard : ClipboardService
4949 ) {
50- this . sort = { field : " ipv4" , type : "ip" , direction : " desc" } ;
50+ this . sort = { field : ' ipv4' , type : 'ip' , direction : ' desc' } ;
5151 this . update ( this . api . session ) ;
5252 }
5353
@@ -68,7 +68,7 @@ export class LanTableComponent implements OnInit, OnDestroy {
6868
6969 isSpoofed ( host : any ) : boolean {
7070 const whitelistedTargets = this . spoofOpts . whitelist
71- . split ( "," )
71+ . split ( ',' )
7272 . map ( ( s ) => s . trim ( ) )
7373 . filter ( ( s ) => s . length ) ;
7474
@@ -84,18 +84,18 @@ export class LanTableComponent implements OnInit, OnDestroy {
8484 }
8585
8686 private updateSpoofOpts ( ) {
87- this . spoofOpts . targets = Object . keys ( this . spoofList ) . join ( ", " ) ;
87+ this . spoofOpts . targets = Object . keys ( this . spoofList ) . join ( ', ' ) ;
8888 }
8989
9090 private resetSpoofOpts ( ) {
9191 this . spoofOpts = {
92- targets : this . api . session . env . data [ " arp.spoof.targets" ] ,
93- whitelist : this . api . session . env . data [ " arp.spoof.whitelist" ] ,
92+ targets : this . api . session . env . data [ ' arp.spoof.targets' ] ,
93+ whitelist : this . api . session . env . data [ ' arp.spoof.whitelist' ] ,
9494 fullduplex :
95- this . api . session . env . data [ " arp.spoof.fullduplex" ] . toLowerCase ( ) ==
96- " true" ,
95+ this . api . session . env . data [ ' arp.spoof.fullduplex' ] . toLowerCase ( ) ==
96+ ' true' ,
9797 internal :
98- this . api . session . env . data [ " arp.spoof.internal" ] . toLowerCase ( ) == " true" ,
98+ this . api . session . env . data [ ' arp.spoof.internal' ] . toLowerCase ( ) == ' true' ,
9999 ban : false ,
100100 } ;
101101 }
@@ -117,10 +117,10 @@ export class LanTableComponent implements OnInit, OnDestroy {
117117 updateSpoofingList ( ) {
118118 let newSpoofList = this . spoofList ;
119119
120- $ ( " .spoof-toggle" ) . each ( ( i , toggle ) => {
120+ $ ( ' .spoof-toggle' ) . each ( ( i , toggle ) => {
121121 let $toggle = $ ( toggle ) ;
122- let ip = $toggle . attr ( " data-ip" ) ;
123- if ( $toggle . is ( " :checked" ) ) {
122+ let ip = $toggle . attr ( ' data-ip' ) ;
123+ if ( $toggle . is ( ' :checked' ) ) {
124124 newSpoofList [ ip ] = true ;
125125 } else {
126126 delete newSpoofList [ ip ] ;
@@ -135,12 +135,12 @@ export class LanTableComponent implements OnInit, OnDestroy {
135135 if (
136136 this . isSpoofing &&
137137 ! confirm (
138- " This will unspoof the current targets, set the new parameters and restart the module. Continue?"
138+ ' This will unspoof the current targets, set the new parameters and restart the module. Continue?'
139139 )
140140 )
141141 return ;
142142
143- this . api . cmd (
143+ this . api . cmd (
144144 "set arp.spoof.targets " +
145145 ( this . spoofOpts . targets == "" ? '""' : this . spoofOpts . targets )
146146 ) ;
@@ -151,10 +151,10 @@ export class LanTableComponent implements OnInit, OnDestroy {
151151 this . api . cmd ( "set arp.spoof.fullduplex " + this . spoofOpts . fullduplex ) ;
152152 this . api . cmd ( "set arp.spoof.internal " + this . spoofOpts . internal ) ;
153153
154- let onCmd = this . spoofOpts . ban ? " arp.ban on" : " arp.spoof on" ;
154+ let onCmd = this . spoofOpts . ban ? ' arp.ban on' : ' arp.spoof on' ;
155155
156156 if ( this . isSpoofing ) {
157- this . api . cmd ( " arp.spoof off; " + onCmd ) ;
157+ this . api . cmd ( ' arp.spoof off; ' + onCmd ) ;
158158 } else {
159159 this . api . cmd ( onCmd ) ;
160160 }
@@ -164,18 +164,18 @@ export class LanTableComponent implements OnInit, OnDestroy {
164164 }
165165
166166 private update ( session ) {
167- let spoofing = this . api . session . env . data [ " arp.spoof.targets" ]
167+ let spoofing = this . api . session . env . data [ ' arp.spoof.targets' ]
168168 // split by comma and trim spaces
169- . split ( "," )
169+ . split ( ',' )
170170 . map ( ( s ) => s . trim ( ) )
171171 // remove empty elements
172172 . filter ( ( s ) => s . length ) ;
173173
174- this . isSpoofing = this . api . module ( " arp.spoof" ) . running ;
175- this . scanState = this . api . module ( " syn.scan" ) . state ;
174+ this . isSpoofing = this . api . module ( ' arp.spoof' ) . running ;
175+ this . scanState = this . api . module ( ' syn.scan' ) . state ;
176176
177177 // freeze the interface while the user is doing something
178- if ( this . viewSpoof || $ ( " .menu-dropdown" ) . is ( " :visible" ) ) return ;
178+ if ( this . viewSpoof || $ ( ' .menu-dropdown' ) . is ( ' :visible' ) ) return ;
179179
180180 this . resetSpoofOpts ( ) ;
181181 this . spoofList = { } ;
@@ -199,8 +199,8 @@ export class LanTableComponent implements OnInit, OnDestroy {
199199 // if we `this.hosts` = session.lan['hosts'], pushing
200200 // to this.hosts will also push to the session object
201201 // duplicating the iface and gateway.
202- for ( var i = 0 ; i < session . lan [ " hosts" ] . length ; i ++ ) {
203- let host = session . lan [ " hosts" ] [ i ] ;
202+ for ( var i = 0 ; i < session . lan [ ' hosts' ] . length ; i ++ ) {
203+ let host = session . lan [ ' hosts' ] [ i ] ;
204204 // get traffic details for this host
205205 let sent = 0 ,
206206 received = 0 ;
@@ -227,43 +227,43 @@ export class LanTableComponent implements OnInit, OnDestroy {
227227 }
228228
229229 setAlias ( host ) {
230- $ ( " #in" ) . val ( host . alias ) ;
231- $ ( " #inhost" ) . val ( host . mac ) ;
232- $ ( " #inputModalTitle" ) . html ( " Set alias for " + host . mac ) ;
233- $ ( " #inputModal" ) . modal ( " show" ) ;
230+ $ ( ' #in' ) . val ( host . alias ) ;
231+ $ ( ' #inhost' ) . val ( host . mac ) ;
232+ $ ( ' #inputModalTitle' ) . html ( ' Set alias for ' + host . mac ) ;
233+ $ ( ' #inputModal' ) . modal ( ' show' ) ;
234234 }
235235
236236 doSetAlias ( ) {
237- $ ( " #inputModal" ) . modal ( " hide" ) ;
237+ $ ( ' #inputModal' ) . modal ( ' hide' ) ;
238238
239- let mac = $ ( " #inhost" ) . val ( ) ;
240- let alias = $ ( " #in" ) . val ( ) ;
239+ let mac = $ ( ' #inhost' ) . val ( ) ;
240+ let alias = $ ( ' #in' ) . val ( ) ;
241241
242- if ( alias . trim ( ) == "" ) alias = '""' ;
242+ if ( alias . trim ( ) == '' ) alias = '""' ;
243243
244- this . api . cmd ( " alias " + mac + " " + alias ) ;
244+ this . api . cmd ( ' alias ' + mac + ' ' + alias ) ;
245245 }
246246
247247 showScannerModal ( host ) {
248- $ ( " #scanIP" ) . val ( host . ipv4 ) ;
249- $ ( " #startPort" ) . val ( "1" ) ;
250- $ ( " #endPort" ) . val ( " 10000" ) ;
251- $ ( " #scannerModal" ) . modal ( " show" ) ;
248+ $ ( ' #scanIP' ) . val ( host . ipv4 ) ;
249+ $ ( ' #startPort' ) . val ( '1' ) ;
250+ $ ( ' #endPort' ) . val ( ' 10000' ) ;
251+ $ ( ' #scannerModal' ) . modal ( ' show' ) ;
252252 }
253253
254254 doPortScan ( ) {
255- let ip = $ ( " #scanIP" ) . val ( ) ;
256- let startPort = $ ( " #startPort" ) . val ( ) ;
257- let endPort = $ ( " #endPort" ) . val ( ) ;
258- $ ( " #scannerModal" ) . modal ( " hide" ) ;
255+ let ip = $ ( ' #scanIP' ) . val ( ) ;
256+ let startPort = $ ( ' #startPort' ) . val ( ) ;
257+ let endPort = $ ( ' #endPort' ) . val ( ) ;
258+ $ ( ' #scannerModal' ) . modal ( ' hide' ) ;
259259
260- this . api . cmd ( " syn.scan " + ip + " " + startPort + " " + endPort ) ;
260+ this . api . cmd ( ' syn.scan ' + ip + ' ' + startPort + ' ' + endPort ) ;
261261 }
262262
263263 groupMetas ( metas ) {
264264 let grouped = { } ;
265265 for ( let name in metas ) {
266- let parts = name . split ( ":" ) ,
266+ let parts = name . split ( ':' ) ,
267267 group = parts [ 0 ] . toUpperCase ( ) ,
268268 sub = parts [ 1 ] ;
269269
0 commit comments