Cleaned stuff up

This commit is contained in:
Taevas 2022-12-11 20:00:36 +01:00
parent 0613fb7fc4
commit a8bda4704a
14 changed files with 215 additions and 160 deletions

15
Ruby/README.md Normal file
View file

@ -0,0 +1,15 @@
# Website-Finder: Ruby
## REQUIREMENT
Ruby ([Windows Installer](https://rubyinstaller.org/downloads)) ([Snap Store for Linux](https://snapcraft.io/ruby))
## HOW TO RUN
```sh
$ ruby index.rb
```
## OTHER STUFF
More details are available on [the readme in the root folder](../README.md)

View file

@ -22,25 +22,25 @@ def main_loop
end
def url_generator()
result = MODE[rand(0...MODE.length)] + '://'
url_length = rand(MINI..MAXI)
result = PROTOCOLS[rand(0...PROTOCOLS.length)] + '://'
url_length = rand(MIN..MAX)
result += rand(36 ** url_length).to_s(36)
result += DOMAINS[rand(0...DOMAINS.length)] if rand(1...100) <= SECOND
result += DOMAINS[rand(0...DOMAINS.length)]
end
TIMES = ARGV.include?('-t') ? ARGV[ARGV.index('-t') + 1].to_i : 3000
PROTOCOLS = ARGV.include?('-p') ? ARGV[ARGV.index('-p') + 1].split(",") : ['http']
DOMAINS = ARGV.include?('-d') ? ARGV[ARGV.index('-d') + 1].split(",") : ['.co', '.com', '.net', '.edu', '.gov', '.cn', '.org', '.cc', '.us', '.mil', '.ac', '.it', '.de']
MODE = ARGV.include?('-m') ? ARGV[ARGV.index('-m') + 1].split(",") : ['http']
LOG = ARGV.index('-l').class == Integer
MINI = ARGV.include?('-MIN') ? ARGV[ARGV.index('-MIN') + 1].to_i : 2
MAXI = ARGV.include?('-MAX') ? ARGV[ARGV.index('-MAX') + 1].to_i : 50
SECOND = ARGV.include?('-s') ? ARGV[ARGV.index('-s') + 1].to_i : 1
LOG = ARGV.index('-l').class == Integer
MIN = ARGV.include?('-min') ? ARGV[ARGV.index('-max') + 1].to_i : 2
MAX = ARGV.include?('-min') ? ARGV[ARGV.index('-max') + 1].to_i : 50
REPORT_FILE = "RB_report_#{Time.new.day}#{Time.new.hour}#{Time.new.min}.json"
puts("\nI am going to look for websites through #{TIMES} random URLs (min length #{MINI} and max length #{MAXI}) with the following domains: #{DOMAINS}")
puts("These URLs will use the protocols #{MODE} and each of those URLs have #{SECOND} in 100 chance to have a second level domain.")
puts("\nI am going to look for websites through #{TIMES} random URLs (min length #{MIN} and max length #{MAX}) with the following domains: #{DOMAINS}")
puts("These URLs will use the protocols #{PROTOCOLS} and each of those URLs have #{SECOND} in 100 chance to have a second level domain.")
puts("Started at #{Time.new.hour}h#{Time.new.min}m\n")
File.open(REPORT_FILE, 'a+')