tansaku 1.3.0 → 1.4.0

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: e7814e8eceaa52875d651e478c0e5fa000248441158ef3f59dda8a851c02d4bc
4
- data.tar.gz: be7b44389bcf0cf1208336075dd5feaeecc11b88d1d8ffe3efb5f552206baa70
3
+ metadata.gz: 8c2340e0208f4ecb9fbbff0d1a866c1e8a5031d0e15f85afafa6ff8c933aa7ba
4
+ data.tar.gz: d0a4fc5f183f6a51f7a1784afe2b3a5e898383cb8084997d2d4243a594dbe608
5
5
  SHA512:
6
- metadata.gz: 36a13143014938b72714acaa0a103ba4eee8c040597297082f44062356ea3e9aa037fa547dd5d60461aaf1017e45b7727ec50eccc16c768ef39cb579c39eaf2a
7
- data.tar.gz: bb4e92fa7b71ebb6878ae1a6bf4c28401ce0ac05d8a13626459e34f6f5a597c5108079c0141bc15ec759d430abb1e2c403986377d37131ce122fa9cb28a2074d
6
+ metadata.gz: 74cf25e1e3a0553e55627fe26d6c62c1a20d13c2390d1c652a576432673b3fee4cf81f2a0f59c98142ea82679a6ab8c3b8b1e0c3737edaf1d77dad6dfd9e70ce
7
+ data.tar.gz: 52e4d995e93768c3f3ae6ac892c9c04ecb17215795fbf4897d3b70d02836688b5b70f9e06dd2adc86974eb3891c00080813b96b8b281b861d776285229fa3907
data/README.md CHANGED
@@ -2,7 +2,6 @@
2
2
 
3
3
  [![Gem Version](https://badge.fury.io/rb/tansaku.svg)](https://badge.fury.io/rb/tansaku)
4
4
  [![Build Status](https://travis-ci.com/ninoseki/tansaku.svg?branch=master)](https://travis-ci.com/ninoseki/tansaku)
5
- [![Codacy Badge](https://api.codacy.com/project/badge/Grade/b8c176423480493182a6d52e56f6fd35)](https://www.codacy.com/app/ninoseki/tansaku)
6
5
  [![Coverage Status](https://coveralls.io/repos/github/ninoseki/tansaku/badge.svg?branch=master)](https://coveralls.io/github/ninoseki/tansaku?branch=master)
7
6
 
8
7
  Tansaku is a yet another dirbuster tool.
@@ -58,8 +57,10 @@ See [/lib/tansaku/lists/](https://github.com/ninoseki/tansaku/blob/master/lib/ta
58
57
 
59
58
  ## Alternatives
60
59
 
61
- - [davidtavarez/weblocator](https://github.com/davidtavarez/weblocator)
62
- - [maurosoria/dirsearch](https://github.com/maurosoria/dirsearch)
60
+ - [maurosoria/dirsearch](https://github.com/maurosoria/dirsearch): Web path scanner
61
+ - [evilsocket/dirsearch](https://github.com/evilsocket/dirsearch): A Go implementation of dirsearch.
62
+ - [davidtavarez/weblocator](https://github.com/davidtavarez/weblocator): Just a better dirbuster
63
+ - [stefanoj3/dirstalk](https://github.com/stefanoj3/dirstalk): Modern alternative to dirbuster/dirb
63
64
 
64
65
  ## License
65
66
 
@@ -11,7 +11,7 @@ require "tansaku/monkey_patch"
11
11
 
12
12
  module Tansaku
13
13
  class Crawler
14
- DEFAULT_USER_AGENT = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.116 Safari/537.36"
14
+ DEFAULT_USER_AGENT = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/99.0.4844.51 Safari/537.36"
15
15
 
16
16
  # @return [String]
17
17
  attr_reader :base_uri
@@ -51,7 +51,7 @@ module Tansaku
51
51
  raise ArgumentError, "Invalid URI" unless valid_uri?
52
52
 
53
53
  @additional_list = additional_list
54
- raise ArgumentError, "Invalid path" if !additional_list.nil? && !valid_path?
54
+ raise ArgumentError, "Invalid path" unless valid_additional_path?
55
55
 
56
56
  @method = method.upcase
57
57
  raise ArgumentError, "Invalid HTTP method" unless valid_method?
@@ -71,6 +71,8 @@ module Tansaku
71
71
  def crawl
72
72
  results = {}
73
73
 
74
+ log_conditions
75
+
74
76
  Async do |task|
75
77
  barrier = Async::Barrier.new
76
78
  semaphore = Async::Semaphore.new(max_concurrent_requests, parent: barrier)
@@ -99,6 +101,17 @@ module Tansaku
99
101
 
100
102
  private
101
103
 
104
+ def log_conditions
105
+ Tansaku.logger.info("Start crawling with the following conditions:")
106
+ Tansaku.logger.info("URLs: #{paths.length} URLs to crawl")
107
+ Tansaku.logger.info("Method: #{method}")
108
+ Tansaku.logger.info("Timeout: #{timeout || "nil"}")
109
+ Tansaku.logger.info("Headers: #{request_headers}")
110
+ Tansaku.logger.info("Body: #{body}")
111
+ Tansaku.logger.info("Ignore certificate errors: #{ignore_certificate_errors}")
112
+ Tansaku.logger.info("Concurrency: #{max_concurrent_requests} requests at max")
113
+ end
114
+
102
115
  def online?(status)
103
116
  [200, 204, 301, 302, 307, 401, 403].include? status.to_i
104
117
  end
@@ -107,7 +120,9 @@ module Tansaku
107
120
  ["http", "https"].include? base_uri.scheme
108
121
  end
109
122
 
110
- def valid_path?
123
+ def valid_additional_path?
124
+ return true if additional_list.nil?
125
+
111
126
  File.exist?(additional_list)
112
127
  end
113
128
 
@@ -116,9 +131,11 @@ module Tansaku
116
131
  end
117
132
 
118
133
  def paths
119
- paths = Path.get_by_type(type)
120
- paths += File.readlines(File.expand_path(additional_list, __dir__)) if additional_list
121
- paths.filter_map(&:chomp)
134
+ @paths ||= [].tap do |out|
135
+ paths = Path.get_by_type(type)
136
+ paths += File.readlines(additional_list) if additional_list
137
+ out << paths.filter_map(&:chomp)
138
+ end.flatten.uniq
122
139
  end
123
140
 
124
141
  def url_for(path)
File without changes
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Tansaku
4
- VERSION = "1.3.0"
4
+ VERSION = "1.4.0"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tansaku
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.0
4
+ version: 1.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Manabu Niseki
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-03-13 00:00:00.000000000 Z
11
+ date: 2022-03-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -220,6 +220,7 @@ files:
220
220
  - lib/tansaku/lists/database.txt
221
221
  - lib/tansaku/lists/etc.txt
222
222
  - lib/tansaku/lists/log.txt
223
+ - lib/tansaku/lists/none.txt
223
224
  - lib/tansaku/monkey_patch.rb
224
225
  - lib/tansaku/path.rb
225
226
  - lib/tansaku/version.rb