ronin-web 1.0.0.beta3 → 1.0.0.beta4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4e36e87f767a665ff3dafb90022b8cb0b0d8d7d9ebc23255c873dcebde04d7b1
4
- data.tar.gz: af5f942251ddefcfd8940d2de5cc688edbd6e55ba96715d8798b0e85efff33f6
3
+ metadata.gz: 37043413378124ed9793dc5393fe121be29e770f55e0cf93db3bbf91b59927d0
4
+ data.tar.gz: 5a77f64778e370b2d8f8c0f2df6838aa62719551a2021c6a0bbd5a9a4ba15ef1
5
5
  SHA512:
6
- metadata.gz: 9e0bc704b1177e0f958c00a0f1f33d606258c78186dc2ac38de85d7188d29e9911aab5d337cb39a7e90798865841b947abd8c6e928325df2a394e7a61b6576a2
7
- data.tar.gz: c7dd821942055424f990ab2f5511252308d9b12bf3bdb2ccb07281d523d40066425989d1645a27f464321147973b1ff12410c6bcc79cece614d09efbaf730e57
6
+ metadata.gz: b03fec155874e2c399db5991d03089a15c1c2193c3af3ba7c501c1c26ccd48c8fc6baaa650cda1c53508e43c5bbaed757cc7223279d494e635553f369202777e
7
+ data.tar.gz: 1a163daa3263ef36c36baa1d867a7add8678742743fb5a830ba10cbfbfcb05bd9c18b97d186538220f599298bc81c3a0b7861dabb4f9a69c1813ca34b0701936
@@ -21,6 +21,7 @@ jobs:
21
21
  uses: ruby/setup-ruby@v1
22
22
  with:
23
23
  ruby-version: ${{ matrix.ruby }}
24
+ bundler-cache: true
24
25
  - name: Install dependencies
25
26
  run: bundle install --jobs 4 --retry 3
26
27
  - name: Run tests
data/README.md CHANGED
@@ -2,6 +2,7 @@
2
2
 
3
3
  [![CI](https://github.com/ronin-rb/ronin-web/actions/workflows/ruby.yml/badge.svg)](https://github.com/ronin-rb/ronin-web/actions/workflows/ruby.yml)
4
4
  [![Code Climate](https://codeclimate.com/github/ronin-rb/ronin-web.svg)](https://codeclimate.com/github/ronin-rb/ronin-web)
5
+ [![Gem Version](https://badge.fury.io/rb/ronin-web.svg)](https://badge.fury.io/rb/ronin-web)
5
6
 
6
7
  * [Source](https://github.com/ronin-rb/ronin-web)
7
8
  * [Issues](https://github.com/ronin-rb/ronin-web/issues)
@@ -83,6 +83,7 @@ module Ronin
83
83
  # --print-status Print the status codes for each URL
84
84
  # --print-headers Print response headers for each URL
85
85
  # --print-header NAME Prints a specific header
86
+ # --history FILE The history file
86
87
  # --archive DIR Archive every visited page to the DIR
87
88
  # --git-archive DIR Archive every visited page to the git repository
88
89
  # -X, --xpath XPATH Evaluates the XPath on each HTML page
@@ -390,7 +391,7 @@ module Ronin
390
391
  },
391
392
  desc: 'Spiders the website, starting at the URL'
392
393
 
393
- option :print_verbose, desc: 'Print the status codes for each URL'
394
+ option :print_stauts, desc: 'Print the status codes for each URL'
394
395
 
395
396
  option :print_headers, desc: 'Print response headers for each URL'
396
397
 
@@ -400,6 +401,12 @@ module Ronin
400
401
  },
401
402
  desc: 'Prints a specific header'
402
403
 
404
+ option :history, value: {
405
+ type: String,
406
+ usage: 'FILE'
407
+ },
408
+ desc: 'The history file'
409
+
403
410
  option :archive, value: {
404
411
  type: String,
405
412
  usage: 'DIR'
@@ -552,6 +559,10 @@ module Ronin
552
559
  Web::Spider::GitArchive.open(options[:git_archive])
553
560
  end
554
561
 
562
+ history_file = if options[:history]
563
+ File.open(options[:history],'w')
564
+ end
565
+
555
566
  agent = new_agent do |agent|
556
567
  agent.every_page do |page|
557
568
  print_page(page)
@@ -561,39 +572,12 @@ module Ronin
561
572
  print_verbose "failed to request #{url}"
562
573
  end
563
574
 
564
- if options[:print_hosts]
565
- agent.every_host do |host|
566
- print_verbose "spidering new host #{host}"
567
- end
568
- end
569
-
570
- if options[:print_certs]
571
- agent.every_cert do |cert|
572
- print_verbose "encountered new certificate for #{cert.subject.common_name}"
573
- end
574
- end
575
-
576
- if options[:print_js_strings]
577
- agent.every_js_string do |string|
578
- print_content string
579
- end
580
- end
581
-
582
- if options[:print_html_comments]
583
- agent.every_html_comment do |comment|
584
- print_content comment
585
- end
586
- end
575
+ define_printing_callbacks(agent)
587
576
 
588
- if options[:print_js_comments]
589
- agent.every_js_comment do |comment|
590
- print_content comment
591
- end
592
- end
593
-
594
- if options[:print_comments]
595
- agent.every_comment do |comment|
596
- print_content comment
577
+ if history_file
578
+ agent.every_page do |page|
579
+ history_file.puts(page.url)
580
+ history_file.flush
597
581
  end
598
582
  end
599
583
 
@@ -630,6 +614,54 @@ module Ronin
630
614
  puts
631
615
  end
632
616
  end
617
+ ensure
618
+ if options[:history]
619
+ history_file.close
620
+ end
621
+ end
622
+
623
+ #
624
+ # Defines callbacks that print information.
625
+ #
626
+ # @param [Ronin::Web::Spider::Agent] agent
627
+ # The newly created agent.
628
+ #
629
+ def define_printing_callbacks(agent)
630
+ if options[:print_hosts]
631
+ agent.every_host do |host|
632
+ print_verbose "spidering new host #{host}"
633
+ end
634
+ end
635
+
636
+ if options[:print_certs]
637
+ agent.every_cert do |cert|
638
+ print_verbose "encountered new certificate for #{cert.subject.common_name}"
639
+ end
640
+ end
641
+
642
+ if options[:print_js_strings]
643
+ agent.every_js_string do |string|
644
+ print_content string
645
+ end
646
+ end
647
+
648
+ if options[:print_html_comments]
649
+ agent.every_html_comment do |comment|
650
+ print_content comment
651
+ end
652
+ end
653
+
654
+ if options[:print_js_comments]
655
+ agent.every_js_comment do |comment|
656
+ print_content comment
657
+ end
658
+ end
659
+
660
+ if options[:print_comments]
661
+ agent.every_comment do |comment|
662
+ print_content comment
663
+ end
664
+ end
633
665
  end
634
666
 
635
667
  #
@@ -717,7 +749,7 @@ module Ronin
717
749
  # @param [Spidr::Page] page
718
750
  # A spidered page.
719
751
  #
720
- def print_verbose(page)
752
+ def print_status(page)
721
753
  if page.code < 300
722
754
  print "#{colors.bright_green(page.code)} "
723
755
  elsif page.code < 400
@@ -754,7 +786,7 @@ module Ronin
754
786
  # A spidered page.
755
787
  #
756
788
  def print_page(page)
757
- print_verbose(page) if options[:print_verbose]
789
+ print_status(page) if options[:print_status]
758
790
  print_url(page)
759
791
 
760
792
  if options[:print_headers]
@@ -20,6 +20,6 @@
20
20
  module Ronin
21
21
  module Web
22
22
  # ronin-web Version
23
- VERSION = '1.0.0.beta3'
23
+ VERSION = '1.0.0.beta4'
24
24
  end
25
25
  end
data/lib/ronin/web.rb CHANGED
@@ -240,7 +240,7 @@ module Ronin
240
240
  # @param [Array, Hash] parameters
241
241
  # Additional parameters for the GET request.
242
242
  #
243
- # param [Hash] headers
243
+ # @param [Hash] headers
244
244
  # Additional headers for the GET request.
245
245
  #
246
246
  # @yield [page]
@@ -282,7 +282,7 @@ module Ronin
282
282
  # @param [Array, Hash] parameters
283
283
  # Additional parameters for the GET request.
284
284
  #
285
- # param [Hash] headers
285
+ # @param [Hash] headers
286
286
  # Additional headers for the GET request.
287
287
  #
288
288
  # @yield [body]
@@ -22,7 +22,7 @@ The project directory to create\.
22
22
  .LP
23
23
  .TP
24
24
  \fB--port\fR \fIPORT\fP
25
- The port the webpp will listen on by default\. Defaults to \fB3000\fR\.
25
+ The port the webapp will listen on by default\. Defaults to \fB3000\fR\.
26
26
  .LP
27
27
  .TP
28
28
  \fB--ruby-version\fR \fIVERSION\fP
@@ -16,7 +16,7 @@ Generates a new `ronin-web-server` based webapp.
16
16
  ## OPTIONS
17
17
 
18
18
  `--port` *PORT*
19
- The port the webpp will listen on by default. Defaults to `3000`.
19
+ The port the webapp will listen on by default. Defaults to `3000`.
20
20
 
21
21
  `--ruby-version` *VERSION*
22
22
  The desired ruby version for the project Defaults to the current ruby version.
@@ -179,6 +179,10 @@ Print response headers for each URL\.
179
179
  Prints a specific header\.
180
180
  .LP
181
181
  .TP
182
+ \fB--history\fR \fIFILE\fP
183
+ Sets the history file to write every visited URL to\.
184
+ .LP
185
+ .TP
182
186
  \fB--archive\fR \fIDIR\fP
183
187
  Archive every visited page to the \fIDIR\fP\.
184
188
  .LP
@@ -133,6 +133,9 @@ Spiders a website.
133
133
  `--print-header` *NAME*
134
134
  Prints a specific header.
135
135
 
136
+ `--history` *FILE*
137
+ Sets the history file to write every visited URL to.
138
+
136
139
  `--archive` *DIR*
137
140
  Archive every visited page to the *DIR*.
138
141
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ronin-web
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0.beta3
4
+ version: 1.0.0.beta4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Postmodern
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-01-14 00:00:00.000000000 Z
11
+ date: 2023-01-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: nokogiri