-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathscopecreep.html
1260 lines (1178 loc) · 57.3 KB
/
scopecreep.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<!DOCTYPE html>
<html>
<head>
<title>Scope Creep</title>
<script type="text/javascript" src="./scripts/jquery.min.js"></script>
<script type="text/javascript" src="./scripts/jquery.cookie.js"></script>
<script type="text/javascript" src="./scripts/vivagraph.min.js"></script>
<script type="text/javascript" src="./scripts/socket.io.js"></script>
<style>
html, body {margin: 0; height: 100%; overflow: hidden}
tr:hover {
background-color: #0ff;
}
.warning {
background-color: rgba(255, 0, 0, 0.3);
}
.ratelimit {
background-color: rgba(255, 255, 0, 0.3);
}
.benign {
background-color: rgba(0, 255, 0, 0.3);
}
/* The switch - the box around the slider */
.switch {
position: relative;
display: inline-block;
width: 40px;
height: 20px;
}
/* Hide default HTML checkbox */
.switch input {
opacity: 0;
width: 0;
height: 0;
}
/* The slider */
.slider {
position: absolute;
cursor: pointer;
top: 0;
left: 0;
right: 0;
bottom: 0;
background-color: #db2b2b;
-webkit-transition: .4s;
transition: .4s;
}
.slider:before {
position: absolute;
content: "";
height: 16px;
width: 16px;
left: 2px;
bottom: 2px;
background-color: white;
-webkit-transition: .4s;
transition: .4s;
}
input:checked + .slider {
background-color: #2196F3;
}
input:focus + .slider {
box-shadow: 0 0 1px #2196F3;
}
input:checked + .slider:before {
-webkit-transform: translateX(20px);
-ms-transform: translateX(20px);
transform: translateX(20px);
}
/* Rounded sliders */
.slider.round {
border-radius: 20px;
}
.slider.round:before {
border-radius: 50%;
}
</style>
<script type="text/javascript">
link_switch = false;
function main () {
// This demo shows how to create an SVG node which is a bit more complex
// than single image. Do accomplish this we use 'g' element and
// compose group of elements to represent a node.
var graph = Viva.Graph.graph();
var graphics = Viva.Graph.View.svgGraphics(),
nodeSize = 24;
//test nodes
//graph.addNode('anvaka', '91bad8ceeec43ae303790f8fe238164b');
//graph.addNode('indexzero', 'd43e8ea63b61e7669ded5b9d3c2e980f');
//graph.addLink('anvaka', 'indexzero');
graphics.node(function(node) {
// This time it's a group of elements: http://www.w3.org/TR/SVG/struct.html#Groups
var ui = Viva.Graph.svg('g'),
// Create SVG text element with user id as content
svgText = Viva.Graph.svg('text')
.attr('y', '-4px')
.text(node.id)
.attr("class", "node")
.attr("id", node.id),
img = Viva.Graph.svg('image')
.attr('width', nodeSize)
.attr('height', nodeSize)
//.link('https://secure.gravatar.com/avatar/' + node.data);
.link('./images/' + node.data);
ui.append(svgText);
ui.append(img);
return ui;
}).placeNode(function(nodeUI, pos) {
// 'g' element doesn't have convenient (x,y) attributes, instead
// we have to deal with transforms: http://www.w3.org/TR/SVG/coords.html#SVGGlobalTransformAttribute
nodeUI.attr('transform',
'translate(' +
(pos.x - nodeSize/2) + ',' + (pos.y - nodeSize/2) +
')');
});
var layout = Viva.Graph.Layout.forceDirected(graph, {
springLength : 200,
springCoeff : 0.0005,
dragCoeff : 0.03,
gravity : -1.2,
theta : 0.08
});
// Render the graph
var renderer = Viva.Graph.View.renderer(graph, {
graphics : graphics,
layout : layout
});
renderer.run();
return graph;
}
$(document).ready(function() {
//create an abstract object that will track connections so we can restore deleted nodes based on what they were connected to
all_connections = {}
try{
if($.cookie('shodan_api_key_cookie') !== ""){
$("#shodan_api_key").val($.cookie('shodan_api_key_cookie'))
}
if($.cookie('linkedin_cookie') !== ""){
$("#linkedin_cookie").val($.cookie('linkedin_cookie'))
}
if($.cookie('hunter_api_key_cookie') !== ""){
$("#hunter_api_key").val($.cookie('hunter_api_key_cookie'))
}
if($.cookie('whoxy_api_key_cookie') !== ""){
$("#whoxy_api_key").val($.cookie('whoxy_api_key_cookie'))
}
if($.cookie('port_list') !== ""){
$("#port_list").val($.cookie('port_list'))
}
if($.cookie('settings_visible') == "false"){
$("#settings").hide()
}
if($.cookie('stats_visible') == "false"){
$("#stats_table").hide()
}
}catch(err){
console.log("problem setting cookies")
}
$("#node_name").focusout(function(){
$(".node").attr("class", "node")
$(".node").attr("fill", "black")
//try to make a guess about what type of node is being added
if($("#node_name").val() == ""){
return
}
if($("#node_name").val().indexOf('/') > -1){
node = mygraph.addNode($("#node_name").val(), 'cidr')
}else if ($("#node_name").val().indexOf('.') > -1){
if($("#node_name").val().split('.').length == 2){
node = mygraph.addNode($("#node_name").val(), 'network')
}else{
node = mygraph.addNode($("#node_name").val(), 'subdomain')
}
}else{
node = mygraph.addNode($("#node_name").val(), 'organization')
}
//create a placeholder hash for them in the connections object
if((typeof all_connections[$("#node_name").val()]) == 'undefined'){
all_connections[$("#node_name").val()] = {}
}
node_element = $('#' + node.id.toString())
//have to escape the . and spaces in the selector for domains so they don't look like css
$('#' + node.id.replace(/[!"#$%&'()*+,.\/:;<=>?@[\\\]^`{|}~]/g, "\\$&") ).attr("fill", "green")
$('#' + node.id.replace(/[!"#$%&'()*+,.\/:;<=>?@[\\\]^`{|}~]/g, "\\$&") ).attr("class", "node selected")
$("#node_name").val("Add Node (a)")
//need to re-bind every time we add a node so it applies to the new DOM elements
bind_node_click()
})
$("#search_field").focusout(function(){
$("#search_field").val("Find Node (f)")
})
$("#shodan_api_key").focusout(function(){
document.cookie = "shodan_api_key_cookie=" + $("#shodan_api_key").val()
})
$("#linkedin_cookie").focusout(function(){
document.cookie = "linkedin_cookie=" + $("#linkedin_cookie").val()
})
$("#hunter_api_key").focusout(function(){
document.cookie = "hunter_api_key_cookie=" + $("#hunter_api_key").val()
})
$("#whoxy_api_key").focusout(function(){
document.cookie = "whoxy_api_key_cookie=" + $("#whoxy_api_key").val()
})
$("#port_list").focusout(function(){
document.cookie = "port_list=" + $("#port_list").val()
})
$("#search_field").keyup(function(){
search_string = $("#search_field").val()
regex = new RegExp( search_string, 'i' );
$(".node").each(function(index){
if(regex.test(this.id)){
this.attr("fill", "green")
this.attr("class", "node selected")
}else{
this.attr("fill", "black")
this.attr("class", "node")
}
});
})
$("tr.stat").click(function(){
node_type = this.children[1].id.split("_")[0]
$(".node").each(function(index){
if(mygraph.getNode(this.id).data == node_type){
this.attr("fill", "green")
this.attr("class", "node selected")
}else{
this.attr("fill", "black")
this.attr("class", "node")
}
});
})
$(document).keydown(function(e){
//select all nodes connected to selected nodes
if (e.keyCode==38){
$("#select_first_connections").click()
}
});
$(document).keypress(function(e){
if ($('#node_name').is(':focus')){
//let the user type if we are in the node creation field
if (e.keyCode==13){
$("#node_name").trigger("blur")
}
}else if ($('#search_field').is(':focus')){
//let the user type if we are in the search field
if (e.keyCode==13){
$("#search_field").trigger("blur")
}
}else{
//select the node input field when the 'a' key is pressed
//console.log(e.keyCode)
if (e.keyCode==97){
$("#node_name").select()
setTimeout(function(){$("#node_name").val("")}, 10);
}
//ASN search
if (e.keyCode==65){
$("#asn_search").click()
}
if (e.keyCode==70 || e.keyCode==102){
$("#search_field").select()
setTimeout(function(){$("#search_field").val("")}, 10);
}
//hide stats with 'H'
if (e.keyCode==72){
if($("#stats_table").is(":hidden")){
$("#stats_table").show()
document.cookie = 'stats_visible=true'
}else{
$("#stats_table").hide()
document.cookie = 'stats_visible=false'
}
}
//hide settings with 'h'
if (e.keyCode==104){
$("#hide_settings").click()
}
//connect two nodes... if the user goofed then they can press 'c' again to turn it off
if (e.keyCode==99){
if (link_switch){
$("#connect_nodes").css("background-color", "rgba(0, 255, 0, 0.3)")
link_switch = false;
}else{
$("#connect_nodes").click()
}
}
//convert ip range to CIDR node
if (e.keyCode==67){
$("#convert_to_cidr").click()
}
//delete a node with the 'd' key
if (e.keyCode==100){
$("#delete_node").click()
}
//delete unselected nodes with the 'D' key
if (e.keyCode==68){
$("#delete_unselected").click()
}
//undo node deletion with 'u' key
if (e.keyCode==117){
$("#regenerate_neighbors").click()
}
//change node type with 'U' key
if (e.keyCode==85){
$("#change_node_type").click()
}
//whois lookup with 'w' key
if (e.keyCode==119){
$("#whois_lookup").click()
}
//whoxy lookup with 'W' key
if (e.keyCode==87){
$("#whoxy_search").click()
}
//mx query with 'm' key
if (e.keyCode==109){
$("#mx_query").click()
}
//DNS A record query with 'i' key
if (e.keyCode==105){
$("#ip_query").click()
}
//MASS DNS A record query with 'I' key
if (e.keyCode==73){
mygraph.forEachNode(function(node){
is_target = false
//if YOLO mode
if(!$("#safety_mode").is(":checked")){
is_target = ((node.data == 'network') || (node.data == 'subdomain') || (node.data == 'mail') || (node.data == 'nameserver') || (node.data == 'cidr'))
}else{
is_target = ((node.data == 'network') || (node.data == 'subdomain') || (node.data == 'mail') || (node.data == 'nameserver'))
}
if(is_target){
query_object = {}
query_object.node_id = node.id
query_object.node_type = node.data
socket.emit('ip_lookup', query_object)
}
})
}
//DNS reverse lookup with 'r' key
if (e.keyCode==114){
$("#reverse_lookup").click()
}
//MASS DNS reverse lookup with 'R' key
if (e.keyCode==82){
mygraph.forEachNode(function(node){
is_target = false
//if YOLO mode
if(!$("#safety_mode").is(":checked")){
is_target = ((node.data == 'server') || (node.data == 'cidr'))
}else{
is_target = (node.data == 'server')
}
if(is_target){
query_object = {}
query_object.node_id = node.id
query_object.node_type = node.data
socket.emit('reverse_lookup', query_object)
}
})
}
//DNS TXT records with 't' key
if (e.keyCode==116){
$("#txt_records").click()
}
//MASS TXT records with 'T' key
if (e.keyCode==84){
mygraph.forEachNode(function(node){
if(node.data == 'network'){
socket.emit('txt_records', node.id)
}
})
}
//DNS NS records with 'n' key
if (e.keyCode==78 || e.keyCode==110){
$("#nameservers").click()
}
//DoxNS lookup with 'x' key
if (e.keyCode==120){
$("#dox_ns").click()
}
//Reverse DoxNS lookup with 'X' key
if (e.keyCode==88){
$("#reverse_dox_ns").click()
}
//subdomain lookup with 's' key
if (e.keyCode==115){
$("#subdomain_lookup").click()
}
//Crt.sh lookup with 'S' key
if (e.keyCode==83){
$("#crtsh_lookup").click()
}
//bruteforce subdomains with 'b' key
if (e.keyCode==66 || e.keyCode==98){
$("#bruteforce_subdomains").click()
}
//query shodan with 'q' key
if (e.keyCode==81 || e.keyCode==113){
$("#query_shodan").click()
}
//linkedin search with 'l' key
if (e.keyCode==108){
$("#linkedin_search").click()
}
//email search with 'M' key
if (e.keyCode==77){
$("#email_search").click()
}
//Location search with 'L' key
if (e.keyCode==76){
$("#location_search").click()
}
//port scan with 'p' key
if (e.keyCode==112){
$("#port_scan").click()
}
//MASS port scan with 'P' key. Let's get crazy!
if (e.keyCode==80){
if($("#safety_mode").is(":checked")){
alert("Port scans are not allowed in safety mode")
}else{
mygraph.forEachNode(function(node){
is_target = (node.data == 'server')
if(is_target){
query_object = {}
query_object.node_id = node.id
query_object.node_type = node.data
query_object.port_list = $("#port_list").val()
socket.emit('port_scan', query_object)
}
})
}
}
//view website with 'v' key
if (e.keyCode==118){
$("#view_website").click()
}
//MASS view subdomains with 'V' key
if (e.keyCode==86){
protocol = prompt("Please enter the protocol to use:\n\nh) HTTP (default)\ns) HTTPS\nf) FTP", "");
if(protocol == null){return;}
mygraph.forEachNode(function(node){
if(node.data == 'subdomain'){
host = node.id
if(protocol == "s"){
url_string = "https://"+host
}else if(protocol == "f"){
url_string = "ftp://"+host
}else{
url_string = "http://"+host
}
var win = window.open(url_string, '_blank');
}
})
}
//yank contents to clipboard with 'y'
if (e.keyCode==89 || e.keyCode==121){
$("#copy_node_content").click()
}
//select nodes based on number of connections with '0-9' key
if ((e.keyCode>47)&(e.keyCode<58)){
number_of_connections = e.keyCode - 48
mygraph.forEachNode(function(node){
mylinks = mygraph.getLinks(node.id)
if((mylinks == null) & (number_of_connections == 0)){
$('#' + node.id.replace(/[!"#$%&'()*+,.\/:;<=>?@[\\\]^`{|}~]/g, "\\$&") ).attr("fill", "green")
$('#' + node.id.replace(/[!"#$%&'()*+,.\/:;<=>?@[\\\]^`{|}~]/g, "\\$&") ).attr("class", "node selected")
}else{
try{
if(mylinks.length == number_of_connections){
$('#' + node.id.replace(/[!"#$%&'()*+,.\/:;<=>?@[\\\]^`{|}~]/g, "\\$&") ).attr("fill", "green")
$('#' + node.id.replace(/[!"#$%&'()*+,.\/:;<=>?@[\\\]^`{|}~]/g, "\\$&") ).attr("class", "node selected")
}
}catch(err){
console.log(err)
}
}
});
}
//Zone transfer with 'Z' key
if (e.keyCode==90){
$("#zone_transfer").click()
}
//export graph object with 'e' key
if (e.keyCode==101){
$("#export_graph").click()
}
//export graph to file with 'E' key
if (e.keyCode==69){
query_object = {}
query_object.export_type = "graph"
query_object.file_name = prompt("Enter a file base name to export the graph to:","")
if(query_object.file_name == null){return;}
query_object.graph_object = {}
query_object.graph_object.nodes = []
query_object.graph_object.links = []
mygraph.forEachNode(function(node){
query_object.graph_object.nodes.push({"id": node.id, "type": node.data})
});
mygraph.forEachLink(function(mylink){
query_object.graph_object.links.push({"from": mylink.fromId, "to": mylink.toId})
});
socket.emit('export_graph', query_object)
}
//open scope file with 'o'
if (e.keyCode==111){
$("#open_file").click()
}
//open existing graph with 'O'
if (e.keyCode==79){
$("#open_graph").click()
}
//generate emails with 'g'
if (e.keyCode==103){
$("#generate_emails").click()
}
//generate phishmonger target csv with 'G'
if (e.keyCode==71){
$("#generate_targets").click()
}
}
});
function bind_node_click(){
$(".node").on("click", function(){
if(link_switch){
selected = $(".selected")[0].id
mygraph.addLink(selected, this.id)
all_connections[selected][this.id] = mygraph.getNode(this.id).data
all_connections[this.id][selected] = mygraph.getNode(selected).data
$("#connect_nodes").css("background-color", "rgba(0, 255, 0, 0.3)")
link_switch = false;
}else{
$(".node").attr("fill", "black")
$(".node").attr("class", "node")
this.attr("fill", "green")
this.attr("class", "node selected")
}
})
}
$("#connect_nodes").click(function(){
$("#connect_nodes").css("background-color", "Aqua")
$("#connect_nodes").trigger("blur")
//flip the semaphore
link_switch = true;
})
$("#hide_settings").click(function(){
if($("#settings").is(":hidden")){
$("#settings").show()
document.cookie = 'settings_visible=true'
}else{
$("#settings").hide()
document.cookie = 'settings_visible=false'
}
})
$("#delete_unselected").click(function(){
selected = $(".node:not(.selected)").each(function(index){
mygraph.removeNode(this.id)
});
$("#delete_unselected").trigger("blur")
})
$("#delete_node").click(function(){
selected = $(".selected").each(function(index){
mygraph.removeNode(this.id)
});
$("#delete_node").trigger("blur")
})
$("#regenerate_neighbors").click(function(){
selected = $(".selected").each(function(index){
for (var key in all_connections[this.id]){
new_node = {"id": key, "node_type":all_connections[this.id][key], "parent": this.id}
add_node(new_node)
}
});
$("#regenerate_neighbors").trigger("blur")
})
$("#change_node_type").click(function(){
selected = $(".selected")[0].id
var new_type = prompt("Please enter a node type:\n\ni) ip/server\nn) network/domain\ns) subdomain\nc) CIDR Range\no) organization\np) Person", "");
if(new_type == null){return;}
if(new_type == "i"){
type_string = "server"
}else if(new_type == "n"){
type_string = "network"
}else if(new_type == "s"){
type_string = "subdomain"
}else if(new_type == "c"){
type_string = "cidr"
}else if(new_type == "o"){
type_string = "organization"
}else if(new_type == "p"){
type_string = "person"
}else{
//otherwise change it to itself
type_string = mygraph.getNode($(".selected")[0].id).data
}
//mod the data on the node
mygraph.getNode($(".selected")[0].id).data = type_string
//mod the actual ui image
svg_image = $(".selected").next()[0].href
svg_image.animVal = './images/' + type_string
svg_image.baseVal = './images/' + type_string
$("#change_node_type").trigger("blur")
})
$("#whois_lookup").click(function(){
selected = $(".selected").each(function(index){
socket.emit('whois_lookup', this.id)
});
$("#whois_lookup").trigger("blur")
})
$("#whoxy_search").click(function(){
node_type = mygraph.getNode($(".selected")[0].id).data
if(!(node_type.match(/^(organization|email|network)$/))){
alert("Whoxy search must be performed on an organization or email node. Don't waste valuable API calls!")
}else{
query_object = {}
let selection = prompt("Select a search method:\na) Company (sase sensitive)(default)\nb) Email\nc) Keyword (match start of domain name)")
if(selection == 'b'){
query_object.search_method = 'email'
}else if(selection == 'c'){
query_object.search_method = 'keyword'
}else{
query_object.search_method = 'organization'
}
let page_number = prompt("Results Page Number (default 1)")
if(page_number == ''){
page_number = 1
}
query_object.page_number = page_number
query_object.node_id = $(".selected")[0].id
query_object.whoxy_api_key = $("#whoxy_api_key").val()
socket.emit('whoxy_search', query_object)
$("#whoxy_search").trigger("blur")
}
})
$("#mx_query").click(function(){
selected = $(".selected").each(function(index){
socket.emit('mx_query', this.id)
});
$("#mx_query").trigger("blur")
})
$("#ip_query").click(function(){
selected = $(".selected").each(function(index){
if(($("#safety_mode").is(":checked")) && (mygraph.getNode(this.id).data == 'cidr')){
alert("Ping sweeps are not allowed in safety mode")
}else{
query_object = {}
query_object.node_id = this.id
query_object.node_type = mygraph.getNode(this.id).data
socket.emit('ip_lookup', query_object)
}
});
$("#ip_query").trigger("blur")
})
$("#reverse_lookup").click(function(){
selected = $(".selected").each(function(index){
query_object = {}
query_object.node_id = this.id
query_object.node_type = mygraph.getNode(this.id).data
socket.emit('reverse_lookup', query_object)
});
$("#reverse_lookup").trigger("blur")
})
$("#txt_records").click(function(){
selected = $(".selected").each(function(index){
socket.emit('txt_records', this.id)
});
$("#txt_records").trigger("blur")
})
$("#nameservers").click(function(){
selected = $(".selected").each(function(index){
socket.emit('nameservers', this.id)
});
$("#nameservers").trigger("blur")
})
$("#asn_search").click(function(){
selected = $(".selected").each(function(index){
query_object = {}
query_object.node_id = this.id
query_object.node_type = mygraph.getNode(this.id).data
socket.emit('asn_search', query_object)
});
$("#asn_search").trigger("blur")
})
$("#dox_ns").click(function(){
selected = $(".selected").each(function(index){
socket.emit('dox_ns', this.id)
});
$("#dox_ns").trigger("blur")
})
$("#reverse_dox_ns").click(function(){
selected = $(".selected").each(function(index){
socket.emit('reverse_dox_ns', this.id)
});
$("#reverse_dox_ns").trigger("blur")
})
$("#subdomain_lookup").click(function(){
selected = $(".selected")[0].id
socket.emit('subdomain_lookup', selected)
$("#subdomain_lookup").trigger("blur")
})
$("#crtsh_lookup").click(function(){
selected = $(".selected")[0].id
socket.emit('crtsh_lookup', selected)
$("#crtsh_lookup").trigger("blur")
})
$("#bruteforce_subdomains").click(function(){
selected = $(".selected")[0].id
socket.emit('bruteforce_subdomains', selected)
$("#bruteforce_subdomains").trigger("blur")
})
$("#linkedin_search").click(function(){
query_object = {}
query_object.node_id = $(".selected")[0].id
query_object.linkedin_cookie = $("#linkedin_cookie").val()
query_object.org_id = prompt("Please enter the LinkedIn Org ID", "");
if(query_object.org_id == null){return;}
query_object.start_page = prompt("Please enter the pages number to start mining on:", "");
if(query_object.start_page == null){return;}
query_object.end_page = prompt("Please enter the page number to stop mining on:", "");
if(query_object.end_page == null){return;}
socket.emit('linkedin_search', query_object)
$("#linkedin_search").trigger("blur")
})
$("#email_search").click(function(){
node_type = mygraph.getNode($(".selected")[0].id).data
if(node_type != 'network'){
alert("Email search must be performed on a 'domain/network' node. Don't waste valuable API calls!")
}else{
query_object = {}
query_object.node_id = $(".selected")[0].id
query_object.hunter_api_key = $("#hunter_api_key").val()
socket.emit('email_search', query_object)
$("#email_search").trigger("blur")
}
})
$("#port_scan").click(function(){
if($("#safety_mode").is(":checked")){
alert("Port scans are not allowed in safety mode")
}else{
selected = $(".selected").each(function(index){
query_object = {}
query_object.node_id = this.id
query_object.node_type = mygraph.getNode(this.id).data
query_object.port_list = $("#port_list").val()
socket.emit('port_scan', query_object)
});
}
$("#port_scan").trigger("blur")
})
$("#query_shodan").click(function(){
query_object = {}
query_object.node_id = $(".selected")[0].id
query_object.node_type = mygraph.getNode($(".selected")[0].id).data
query_object.api_key = $("#shodan_api_key").val()
socket.emit('query_shodan', query_object)
$("#query_shodan").trigger("blur")
})
$("#copy_node_content").click(function(){
export_list = ""
selected = $(".selected").each(function(index){
if(index == 0){
export_list += this.id
}else{
export_list += "\n" + this.id
}
});
copy_to_clipboard(export_list)
$("#copy_node_content").trigger("blur")
})
$("#select_first_connections").click(function(){
selected = $(".selected").each(function(index){
$(mygraph.getLinks(this.id)).each(function(connection){
$('#' + this.toId.replace(/[!"#$%&'()*+,.\/:;<=>?@[\\\]^`{|}~ ]/g, "\\$&") ).attr("fill", "green")
$('#' + this.toId.replace(/[!"#$%&'()*+,.\/:;<=>?@[\\\]^`{|}~ ]/g, "\\$&") ).attr("class", "node selected")
$('#' + this.fromId.replace(/[!"#$%&'()*+,.\/:;<=>?@[\\\]^`{|}~ ]/g, "\\$&") ).attr("fill", "green")
$('#' + this.fromId.replace(/[!"#$%&'()*+,.\/:;<=>?@[\\\]^`{|}~ ]/g, "\\$&") ).attr("class", "node selected")
});
});
$("#select_first_connections").trigger("blur")
})
$("#export_graph").click(function(){
query_object = {}
query_object.export_list = ""
query_object.export_type = "list"
query_object.file_name = prompt("Enter a file name to save the list of selected nodes:","")
if(query_object.file_name == null){return;}
if(query_object.file_name.indexOf("finding") !== -1){
selected = $(".selected").each(function(index){
pieces = this.id.split(":")
query_object.export_list += pieces[0] + "\t" + pieces[0] + "\ttcp\t" + pieces[1] + "\n"
});
}else{
selected = $(".selected").each(function(index){
query_object.export_list += this.id + "\n"
});
}
socket.emit('export_graph', query_object)
$("#export_graph").trigger("blur")
})
$("#open_file").click(function(){
$("#open_file").trigger("blur")
query_object = {}
query_object.file_path = prompt("Please enter the graph file path:", "");
query_object.parent_node = $(".selected")[0].id
if(query_object.file_path == null){return;}
socket.emit('open_file', query_object)
})
$("#open_graph").click(function(){
$("#open_graph").trigger("blur")
graph_path = prompt("Please enter the graph file path:", "");
if(graph_path == null){return;}
socket.emit('open_graph', graph_path)
})
$("#hunter_api_check").click(function(){
hunter_api_key = $("#hunter_api_key").val()
socket.emit('hunter_api_check', hunter_api_key)
})
$("#whoxy_api_check").click(function(){
whoxy_api_key = $("#whoxy_api_key").val()
socket.emit('whoxy_api_check', whoxy_api_key)
})
$("#generate_emails").click(function(){
email_format = prompt("Please select an email format:\na) john.smith (default)\nb) jsmith\nc) johns\nd) john\ne) j.smith\nf) john.s\ng) smithj","")
if(email_format == null){return;}
domain = prompt("Please enter the domain name:","")
if(domain !== ''){
domain = '@' + domain
}
$(".node").each(function(index){
if(mygraph.getNode(this.id).data == "person"){
name = this.id.split(',')[0]
first_name = name.split(' ')[0]
last_name = name.split(' ')[name.split(' ').length - 1]
if(email_format == 'b'){
email_address = first_name[0] + last_name + domain
}else if(email_format == 'c'){
email_address = first_name + last_name[0] + domain
}else if(email_format == 'd'){
email_address = first_name + domain
}else if(email_format == 'e'){
email_address = first_name[0] + '.' + last_name + domain
}else if(email_format == 'f'){
email_address = first_name + '.' + last_name[0] + domain
}else if(email_format == 'g'){
email_address = last_name + first_name[0] + domain
}else{
email_address = first_name + '.' + last_name + domain
}
new_node = mygraph.addNode(email_address, 'email')
//only add connections placeholder if the node didn't exist
if((typeof all_connections[email_address]) == 'undefined'){
all_connections[email_address] = {}
}
//only make the link if it doesn't exist yet
if((mygraph.getLink(email_address, this.id) == null) && (mygraph.getLink(this.id, email_address) == null)){
mygraph.addLink(email_address, this.id)
all_connections[email_address][this.id] = 'person'
all_connections[this.id][email_address] = 'email'
}
bind_node_click()
}
});
})
$("#generate_targets").click(function(){
let output = ""
$(".node").each(function(index){
if(mygraph.getNode(this.id).data == "email"){
let email = this.id
let first_name = ''
let last_name = ''
let position = ''
let custom = ''
$.each(all_connections[this.id], function(key,val){
if(val == 'person'){
let name_hash = key.split(' ')
first_name = name_hash.shift().replace(/,/g,'')
last_name = name_hash.join(' ').replace(/,/g,'')
//grap position in the case of a linkedin mined account
$.each(all_connections[key], function(key2,val2){
if(val2 == 'position'){
position = key2.replace(/,/g,'')
}
})
}else if(val == 'position'){
position = key.replace(/,/g,'')
}else if(val == 'phone'){
custom = key.replace(/,/g,'')
}
})
output += (`${this.id},${first_name},${last_name},${position},${custom}\n`)
}
});
copy_to_clipboard(output)
alert("Phishmonger Targets .csv Copied to Clipboard")
})
$("#convert_to_cidr").click(function(){
selected = $(".selected").each(function(index){
socket.emit('convert_to_cidr', this.id)
});
$("#convert_to_cidr").trigger("blur")
})
$("#location_search").click(function(){
selected = $(".selected").each(function(index){
socket.emit('location_search', this.id)
});
$("#location_search").trigger("blur")
})
$("#zone_transfer").click(function(){
selected = $(".selected").each(function(index){
socket.emit('zone_transfer', this.id)
});
$("#zone_transfer").trigger("blur")
})
$("#view_website").click(function(){
selected = $(".selected").each(function(index){
if(mygraph.getNode(this.id).data == "location"){
url_string = "https://www.google.com/maps?q=" + this.id.split(":")[0] + "," + this.id.split(":")[1]
var win = window.open(url_string, '_blank');
return
}else if(mygraph.getNode(this.id).data == "info"){
try{
url_regex = new RegExp('(https?://.+)','i')
url_string = url_regex.exec(this.id)[1]
var win = window.open(url_string, '_blank');
return
}catch(err){
return
}
}else{
host = this.id
if(host.match(/:80/)){
url_string = "http://"+host
}else{