ronin-support 0.4.0.rc1 → 0.4.0.rc2
Sign up to get free protection for your applications and to get access to all the features.
- data/.yardopts +1 -0
- data/ChangeLog.md +10 -0
- data/Gemfile +1 -1
- data/README.md +1 -1
- data/Rakefile +8 -0
- data/gemspec.yml +2 -1
- data/lib/ronin/extensions.rb +1 -1
- data/lib/ronin/extensions/enumerable.rb +1 -1
- data/lib/ronin/extensions/file.rb +1 -1
- data/lib/ronin/extensions/ip_addr.rb +1 -1
- data/lib/ronin/extensions/kernel.rb +1 -1
- data/lib/ronin/extensions/meta.rb +1 -1
- data/lib/ronin/extensions/regexp.rb +1 -1
- data/lib/ronin/extensions/resolv.rb +1 -1
- data/lib/ronin/extensions/string.rb +1 -1
- data/lib/ronin/formatting.rb +1 -1
- data/lib/ronin/formatting/binary.rb +1 -1
- data/lib/ronin/formatting/digest.rb +1 -1
- data/lib/ronin/formatting/extensions.rb +1 -1
- data/lib/ronin/formatting/extensions/binary.rb +1 -1
- data/lib/ronin/formatting/extensions/binary/file.rb +1 -1
- data/lib/ronin/formatting/extensions/binary/integer.rb +1 -1
- data/lib/ronin/formatting/extensions/binary/string.rb +1 -1
- data/lib/ronin/formatting/extensions/digest.rb +1 -1
- data/lib/ronin/formatting/extensions/digest/file.rb +1 -1
- data/lib/ronin/formatting/extensions/digest/string.rb +1 -1
- data/lib/ronin/formatting/extensions/html.rb +1 -1
- data/lib/ronin/formatting/extensions/html/integer.rb +1 -1
- data/lib/ronin/formatting/extensions/html/string.rb +1 -1
- data/lib/ronin/formatting/extensions/http.rb +1 -1
- data/lib/ronin/formatting/extensions/http/integer.rb +1 -1
- data/lib/ronin/formatting/extensions/http/string.rb +1 -1
- data/lib/ronin/formatting/extensions/sql.rb +1 -1
- data/lib/ronin/formatting/extensions/sql/string.rb +1 -1
- data/lib/ronin/formatting/extensions/text.rb +1 -1
- data/lib/ronin/formatting/extensions/text/array.rb +1 -1
- data/lib/ronin/formatting/extensions/text/string.rb +1 -1
- data/lib/ronin/formatting/html.rb +1 -1
- data/lib/ronin/formatting/http.rb +1 -1
- data/lib/ronin/formatting/sql.rb +1 -1
- data/lib/ronin/formatting/text.rb +1 -1
- data/lib/ronin/fuzzing.rb +1 -1
- data/lib/ronin/fuzzing/extensions.rb +1 -1
- data/lib/ronin/fuzzing/extensions/string.rb +1 -1
- data/lib/ronin/fuzzing/fuzzing.rb +1 -1
- data/lib/ronin/mixin.rb +1 -1
- data/lib/ronin/network.rb +1 -1
- data/lib/ronin/network/esmtp.rb +1 -1
- data/lib/ronin/network/extensions.rb +1 -1
- data/lib/ronin/network/extensions/esmtp.rb +1 -1
- data/lib/ronin/network/extensions/esmtp/net.rb +1 -1
- data/lib/ronin/network/extensions/http.rb +1 -1
- data/lib/ronin/network/extensions/http/net.rb +1 -1
- data/lib/ronin/network/extensions/http/uri/http.rb +1 -1
- data/lib/ronin/network/extensions/imap.rb +1 -1
- data/lib/ronin/network/extensions/imap/net.rb +1 -1
- data/lib/ronin/network/extensions/pop3.rb +1 -1
- data/lib/ronin/network/extensions/pop3/net.rb +1 -1
- data/lib/ronin/network/extensions/smtp.rb +1 -1
- data/lib/ronin/network/extensions/smtp/net.rb +1 -1
- data/lib/ronin/network/extensions/ssl.rb +1 -1
- data/lib/ronin/network/extensions/ssl/net.rb +1 -1
- data/lib/ronin/network/extensions/tcp.rb +1 -1
- data/lib/ronin/network/extensions/tcp/net.rb +1 -1
- data/lib/ronin/network/extensions/telnet.rb +1 -1
- data/lib/ronin/network/extensions/telnet/net.rb +1 -1
- data/lib/ronin/network/extensions/udp.rb +1 -1
- data/lib/ronin/network/extensions/udp/net.rb +1 -1
- data/lib/ronin/network/http.rb +1 -1
- data/lib/ronin/network/http/exceptions.rb +1 -1
- data/lib/ronin/network/http/exceptions/unknown_request.rb +1 -1
- data/lib/ronin/network/http/http.rb +103 -72
- data/lib/ronin/network/http/proxy.rb +1 -1
- data/lib/ronin/network/imap.rb +1 -1
- data/lib/ronin/network/mixins.rb +1 -1
- data/lib/ronin/network/mixins/esmtp.rb +1 -1
- data/lib/ronin/network/mixins/http.rb +3 -3
- data/lib/ronin/network/mixins/imap.rb +1 -1
- data/lib/ronin/network/mixins/mixin.rb +1 -1
- data/lib/ronin/network/mixins/pop3.rb +1 -1
- data/lib/ronin/network/mixins/smtp.rb +1 -1
- data/lib/ronin/network/mixins/ssl.rb +144 -0
- data/lib/ronin/network/mixins/tcp.rb +6 -5
- data/lib/ronin/network/mixins/telnet.rb +1 -1
- data/lib/ronin/network/mixins/udp.rb +29 -3
- data/lib/ronin/network/network.rb +1 -1
- data/lib/ronin/network/pop3.rb +1 -1
- data/lib/ronin/network/smtp.rb +1 -1
- data/lib/ronin/network/smtp/email.rb +1 -1
- data/lib/ronin/network/smtp/smtp.rb +1 -1
- data/lib/ronin/network/ssl.rb +3 -6
- data/lib/ronin/network/tcp.rb +27 -28
- data/lib/ronin/network/telnet.rb +1 -1
- data/lib/ronin/network/udp.rb +56 -19
- data/lib/ronin/path.rb +1 -1
- data/lib/ronin/spec/ui/output.rb +1 -1
- data/lib/ronin/support.rb +1 -1
- data/lib/ronin/support/inflector.rb +1 -1
- data/lib/ronin/support/support.rb +1 -1
- data/lib/ronin/support/version.rb +2 -2
- data/lib/ronin/templates.rb +1 -1
- data/lib/ronin/templates/erb.rb +1 -1
- data/lib/ronin/templates/template.rb +1 -1
- data/lib/ronin/ui/output.rb +1 -1
- data/lib/ronin/ui/output/helpers.rb +1 -1
- data/lib/ronin/ui/output/output.rb +1 -1
- data/lib/ronin/ui/output/terminal.rb +1 -1
- data/lib/ronin/ui/output/terminal/color.rb +1 -1
- data/lib/ronin/ui/output/terminal/raw.rb +1 -1
- data/lib/ronin/ui/shell.rb +67 -7
- data/lib/ronin/wordlist.rb +51 -1
- data/spec/extensions/ip_addr_spec.rb +1 -1
- data/spec/network/http/http_spec.rb +193 -0
- data/spec/network/tcp_spec.rb +244 -0
- data/spec/network/udp_spec.rb +245 -0
- data/spec/spec_helper.rb +5 -0
- data/spec/ui/shell_spec.rb +7 -3
- data/spec/wordlist_spec.rb +25 -0
- metadata +35 -19
data/lib/ronin/network/http.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
#
|
2
|
-
# Copyright (c) 2006-
|
2
|
+
# Copyright (c) 2006-2012 Hal Brodigan (postmodern.mod3 at gmail.com)
|
3
3
|
#
|
4
4
|
# This file is part of Ronin Support.
|
5
5
|
#
|
@@ -129,7 +129,7 @@ module Ronin
|
|
129
129
|
new_options[:host] = url.host
|
130
130
|
new_options[:port] = url.port
|
131
131
|
|
132
|
-
new_options[:user]
|
132
|
+
new_options[:user] = url.user if url.user
|
133
133
|
new_options[:password] = url.password if url.password
|
134
134
|
|
135
135
|
new_options[:path] = unless url.path.empty?
|
@@ -137,7 +137,7 @@ module Ronin
|
|
137
137
|
else
|
138
138
|
'/'
|
139
139
|
end
|
140
|
-
new_options[:path] += "?#{url.query}" if url.query
|
140
|
+
new_options[:path] += "?#{URI.escape(url.query)}" if url.query
|
141
141
|
|
142
142
|
return new_options
|
143
143
|
end
|
@@ -256,6 +256,12 @@ module Ronin
|
|
256
256
|
# @option options [String] :path ('/')
|
257
257
|
# The path to request.
|
258
258
|
#
|
259
|
+
# @option options [String] :query
|
260
|
+
# The query-string to append to the request path.
|
261
|
+
#
|
262
|
+
# @option options [String] :query_params
|
263
|
+
# The query-params to append to the request path.
|
264
|
+
#
|
259
265
|
# @option options [String] :body
|
260
266
|
# The body of the request.
|
261
267
|
#
|
@@ -297,7 +303,21 @@ module Ronin
|
|
297
303
|
end
|
298
304
|
|
299
305
|
headers = HTTP.headers(options[:headers])
|
300
|
-
path
|
306
|
+
path = (options[:path] || '/').to_s
|
307
|
+
query = if options[:query]
|
308
|
+
URI.escape(options[:query])
|
309
|
+
elsif options[:query_params]
|
310
|
+
URI::QueryParams.dump(options[:query_params])
|
311
|
+
end
|
312
|
+
|
313
|
+
if query
|
314
|
+
# append the query-string onto the path
|
315
|
+
path += if path.include?('?')
|
316
|
+
"&#{query}"
|
317
|
+
else
|
318
|
+
"?#{query}"
|
319
|
+
end
|
320
|
+
end
|
301
321
|
|
302
322
|
request = Net::HTTP.const_get(name).new(path,headers)
|
303
323
|
|
@@ -309,12 +329,11 @@ module Ronin
|
|
309
329
|
end
|
310
330
|
end
|
311
331
|
|
312
|
-
if
|
313
|
-
user
|
314
|
-
|
315
|
-
|
316
|
-
|
317
|
-
end
|
332
|
+
if options[:user]
|
333
|
+
user = options[:user].to_s
|
334
|
+
password = if options[:password]
|
335
|
+
options[:password].to_s
|
336
|
+
end
|
318
337
|
|
319
338
|
request.basic_auth(user,password)
|
320
339
|
end
|
@@ -352,11 +371,11 @@ module Ronin
|
|
352
371
|
# @option :ssl [Symbol] :verify
|
353
372
|
# Specifies the SSL certificate verification mode.
|
354
373
|
#
|
355
|
-
# @yield [
|
374
|
+
# @yield [http]
|
356
375
|
# If a block is given, it will be passed the newly created HTTP
|
357
376
|
# session object.
|
358
377
|
#
|
359
|
-
# @yieldparam [Net::HTTP]
|
378
|
+
# @yieldparam [Net::HTTP] http
|
360
379
|
# The newly created HTTP session.
|
361
380
|
#
|
362
381
|
# @return [Net::HTTP]
|
@@ -367,36 +386,36 @@ module Ronin
|
|
367
386
|
def http_connect(options={},&block)
|
368
387
|
options = HTTP.expand_options(options)
|
369
388
|
|
370
|
-
host
|
371
|
-
port
|
389
|
+
host = options[:host].to_s
|
390
|
+
port = options[:port]
|
372
391
|
proxy = options[:proxy]
|
373
392
|
proxy_host = if (proxy && proxy[:host])
|
374
393
|
proxy[:host].to_s
|
375
394
|
end
|
376
395
|
|
377
|
-
|
396
|
+
http = Net::HTTP::Proxy(
|
378
397
|
proxy_host,
|
379
398
|
proxy[:port],
|
380
399
|
proxy[:user],
|
381
400
|
proxy[:password]
|
382
|
-
).new(host
|
401
|
+
).new(host,port)
|
383
402
|
|
384
403
|
if options[:ssl]
|
385
|
-
|
386
|
-
|
404
|
+
http.use_ssl = true
|
405
|
+
http.verify_mode = SSL::VERIFY[options[:ssl][:verify]]
|
387
406
|
end
|
388
407
|
|
389
|
-
|
408
|
+
http.start()
|
390
409
|
|
391
410
|
if block
|
392
411
|
if block.arity == 2
|
393
|
-
block.call(
|
412
|
+
block.call(http,options)
|
394
413
|
else
|
395
|
-
block.call(
|
414
|
+
block.call(http)
|
396
415
|
end
|
397
416
|
end
|
398
417
|
|
399
|
-
return
|
418
|
+
return http
|
400
419
|
end
|
401
420
|
|
402
421
|
#
|
@@ -429,11 +448,11 @@ module Ronin
|
|
429
448
|
# @option :ssl [Symbol] :verify
|
430
449
|
# Specifies the SSL certificate verification mode.
|
431
450
|
#
|
432
|
-
# @yield [
|
451
|
+
# @yield [http]
|
433
452
|
# If a block is given, it will be passed the newly created HTTP
|
434
453
|
# session object.
|
435
454
|
#
|
436
|
-
# @yieldparam [Net::HTTP]
|
455
|
+
# @yieldparam [Net::HTTP] http
|
437
456
|
# The newly created HTTP session.
|
438
457
|
#
|
439
458
|
# @return [nil]
|
@@ -443,16 +462,16 @@ module Ronin
|
|
443
462
|
# @api public
|
444
463
|
#
|
445
464
|
def http_session(options={},&block)
|
446
|
-
http_connect(options) do |
|
465
|
+
http_connect(options) do |http,expanded_options|
|
447
466
|
if block
|
448
467
|
if block.arity == 2
|
449
|
-
block.call(
|
468
|
+
block.call(http,expanded_options)
|
450
469
|
else
|
451
|
-
block.call(
|
470
|
+
block.call(http)
|
452
471
|
end
|
453
472
|
end
|
454
473
|
|
455
|
-
|
474
|
+
http.finish
|
456
475
|
end
|
457
476
|
|
458
477
|
return nil
|
@@ -499,7 +518,7 @@ module Ronin
|
|
499
518
|
# @api public
|
500
519
|
#
|
501
520
|
def http_request(options={},&block)
|
502
|
-
|
521
|
+
response = nil
|
503
522
|
|
504
523
|
http_session(options) do |http,expanded_options|
|
505
524
|
req = HTTP.request(expanded_options)
|
@@ -512,10 +531,10 @@ module Ronin
|
|
512
531
|
end
|
513
532
|
end
|
514
533
|
|
515
|
-
|
534
|
+
response = http.request(req)
|
516
535
|
end
|
517
536
|
|
518
|
-
return
|
537
|
+
return response
|
519
538
|
end
|
520
539
|
|
521
540
|
#
|
@@ -627,10 +646,10 @@ module Ronin
|
|
627
646
|
# @api public
|
628
647
|
#
|
629
648
|
def http_copy(options={})
|
630
|
-
|
649
|
+
response = http_request(options.merge(:method => :copy))
|
631
650
|
|
632
|
-
yield
|
633
|
-
return
|
651
|
+
yield response if block_given?
|
652
|
+
return response
|
634
653
|
end
|
635
654
|
|
636
655
|
#
|
@@ -663,10 +682,10 @@ module Ronin
|
|
663
682
|
options[:header].merge!(original_headers)
|
664
683
|
end
|
665
684
|
|
666
|
-
|
685
|
+
response = http_request(options.merge(:method => :delete))
|
667
686
|
|
668
|
-
yield
|
669
|
-
return
|
687
|
+
yield response if block_given?
|
688
|
+
return response
|
670
689
|
end
|
671
690
|
|
672
691
|
#
|
@@ -690,10 +709,10 @@ module Ronin
|
|
690
709
|
# @api public
|
691
710
|
#
|
692
711
|
def http_get(options={},&block)
|
693
|
-
|
712
|
+
response = http_request(options.merge(:method => :get))
|
694
713
|
|
695
|
-
yield
|
696
|
-
return
|
714
|
+
yield response if block_given?
|
715
|
+
return response
|
697
716
|
end
|
698
717
|
|
699
718
|
#
|
@@ -712,7 +731,13 @@ module Ronin
|
|
712
731
|
# @api public
|
713
732
|
#
|
714
733
|
def http_get_headers(options={})
|
715
|
-
|
734
|
+
headers = {}
|
735
|
+
|
736
|
+
http_get(options).each_header do |name,value|
|
737
|
+
headers[HTTP.header_name(name)] = value
|
738
|
+
end
|
739
|
+
|
740
|
+
return headers
|
716
741
|
end
|
717
742
|
|
718
743
|
#
|
@@ -753,10 +778,10 @@ module Ronin
|
|
753
778
|
# @api public
|
754
779
|
#
|
755
780
|
def http_head(options={},&block)
|
756
|
-
|
781
|
+
response = http_request(options.merge(:method => :head))
|
757
782
|
|
758
|
-
yield
|
759
|
-
return
|
783
|
+
yield response if block_given?
|
784
|
+
return response
|
760
785
|
end
|
761
786
|
|
762
787
|
#
|
@@ -780,10 +805,10 @@ module Ronin
|
|
780
805
|
# @api public
|
781
806
|
#
|
782
807
|
def http_lock(options={},&block)
|
783
|
-
|
808
|
+
response = http_request(options.merge(:method => :lock))
|
784
809
|
|
785
|
-
yield
|
786
|
-
return
|
810
|
+
yield response if block_given?
|
811
|
+
return response
|
787
812
|
end
|
788
813
|
|
789
814
|
#
|
@@ -807,10 +832,10 @@ module Ronin
|
|
807
832
|
# @api public
|
808
833
|
#
|
809
834
|
def http_mkcol(options={},&block)
|
810
|
-
|
835
|
+
response = http_request(options.merge(:method => :mkcol))
|
811
836
|
|
812
|
-
yield
|
813
|
-
return
|
837
|
+
yield response if block_given?
|
838
|
+
return response
|
814
839
|
end
|
815
840
|
|
816
841
|
#
|
@@ -834,10 +859,10 @@ module Ronin
|
|
834
859
|
# @api public
|
835
860
|
#
|
836
861
|
def http_move(options={},&block)
|
837
|
-
|
862
|
+
response = http_request(options.merge(:method => :move))
|
838
863
|
|
839
|
-
yield
|
840
|
-
return
|
864
|
+
yield response if block_given?
|
865
|
+
return response
|
841
866
|
end
|
842
867
|
|
843
868
|
#
|
@@ -861,10 +886,10 @@ module Ronin
|
|
861
886
|
# @api public
|
862
887
|
#
|
863
888
|
def http_options(options={},&block)
|
864
|
-
|
889
|
+
response = http_request(options.merge(:method => :options))
|
865
890
|
|
866
|
-
yield
|
867
|
-
return
|
891
|
+
yield response if block_given?
|
892
|
+
return response
|
868
893
|
end
|
869
894
|
|
870
895
|
#
|
@@ -891,10 +916,10 @@ module Ronin
|
|
891
916
|
# @api public
|
892
917
|
#
|
893
918
|
def http_post(options={},&block)
|
894
|
-
|
919
|
+
response = http_request(options.merge(:method => :post))
|
895
920
|
|
896
|
-
yield
|
897
|
-
return
|
921
|
+
yield response if block_given?
|
922
|
+
return response
|
898
923
|
end
|
899
924
|
|
900
925
|
#
|
@@ -916,7 +941,13 @@ module Ronin
|
|
916
941
|
# @api public
|
917
942
|
#
|
918
943
|
def http_post_headers(options={})
|
919
|
-
|
944
|
+
headers = {}
|
945
|
+
|
946
|
+
http_post(options).each_header do |name,value|
|
947
|
+
headers[HTTP.header_name(name)] = value
|
948
|
+
end
|
949
|
+
|
950
|
+
return headers
|
920
951
|
end
|
921
952
|
|
922
953
|
#
|
@@ -969,10 +1000,10 @@ module Ronin
|
|
969
1000
|
options[:header].merge!(original_headers)
|
970
1001
|
end
|
971
1002
|
|
972
|
-
|
1003
|
+
response = http_request(options.merge(:method => :propfind))
|
973
1004
|
|
974
|
-
yield
|
975
|
-
return
|
1005
|
+
yield response if block_given?
|
1006
|
+
return response
|
976
1007
|
end
|
977
1008
|
|
978
1009
|
#
|
@@ -996,10 +1027,10 @@ module Ronin
|
|
996
1027
|
# @api public
|
997
1028
|
#
|
998
1029
|
def http_prop_patch(options={},&block)
|
999
|
-
|
1030
|
+
response = http_request(options.merge(:method => :proppatch))
|
1000
1031
|
|
1001
|
-
yield
|
1002
|
-
return
|
1032
|
+
yield response if block_given?
|
1033
|
+
return response
|
1003
1034
|
end
|
1004
1035
|
|
1005
1036
|
#
|
@@ -1023,10 +1054,10 @@ module Ronin
|
|
1023
1054
|
# @api public
|
1024
1055
|
#
|
1025
1056
|
def http_trace(options={},&block)
|
1026
|
-
|
1057
|
+
response = http_request(options.merge(:method => :trace))
|
1027
1058
|
|
1028
|
-
yield
|
1029
|
-
return
|
1059
|
+
yield response if block_given?
|
1060
|
+
return response
|
1030
1061
|
end
|
1031
1062
|
|
1032
1063
|
#
|
@@ -1050,10 +1081,10 @@ module Ronin
|
|
1050
1081
|
# @api public
|
1051
1082
|
#
|
1052
1083
|
def http_unlock(options={},&block)
|
1053
|
-
|
1084
|
+
response = http_request(options.merge(:method => :unlock))
|
1054
1085
|
|
1055
|
-
yield
|
1056
|
-
return
|
1086
|
+
yield response if block_given?
|
1087
|
+
return response
|
1057
1088
|
end
|
1058
1089
|
end
|
1059
1090
|
end
|