-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
24 changed files
with
1,673 additions
and
2,402 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -48,3 +48,5 @@ Gemfile.lock | |
|
||
# unless supporting rvm < 1.11.0 or doing something fancy, ignore this: | ||
.rvmrc | ||
|
||
.rspec_status |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#!/usr/bin/env ruby | ||
# frozen_string_literal: true | ||
|
||
$LOAD_PATH.unshift("#{__dir__}/../lib") | ||
|
||
require "ryo" | ||
|
||
Ryo::CLI.start |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
# frozen_string_literal: true | ||
|
||
module Ryo | ||
class CLI < Thor | ||
desc "dir URL", "Discover directories and files belong to a given URL" | ||
def dir(url) | ||
hash = discover(url, dir: true) | ||
puts hash.to_json | ||
end | ||
|
||
desc "subdomain URL", "Discover subdomains of a given URL" | ||
def subdomain(url) | ||
hash = discover(url, subdomain: true) | ||
puts hash.to_json | ||
end | ||
|
||
desc "tech URL", "Discover used technolgies of a given URL" | ||
def tech(url) | ||
hash = discover(url, tech: true) | ||
puts hash.to_json | ||
end | ||
|
||
desc "all URL", "Run all discovery plugins against a given URL" | ||
def all(url) | ||
hash = discover(url, all: true) | ||
puts hash.to_json | ||
end | ||
|
||
no_commands do | ||
def discover(url, options) | ||
Ryo.discover url, options | ||
rescue StandardError => e | ||
{ error: "Warning: #{e}" } | ||
end | ||
end | ||
end | ||
end |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,45 @@ | ||
# frozen_string_literal: true | ||
|
||
require "ipaddr" | ||
|
||
module Ryo | ||
class Target | ||
attr_reader :uri, :domain | ||
def initialize(uri) | ||
@uri = URI.parse(uri) | ||
@domain = Domain.new(@uri.host) | ||
@domain = @uri.host | ||
end | ||
|
||
def fld | ||
@fld ||= String.new.tap do |out| | ||
removed_tlds_domain = domain.gsub(tlds_regexp, "") | ||
# test.com => ["test"] | ||
# dev.test.com => ["dev", "test"] | ||
parts = removed_tlds_domain.split(".") | ||
if parts.length == 1 || ip? | ||
out << domain | ||
else | ||
idx = domain.split(".").index(parts.last) | ||
out << domain.split(".")[idx..-1].join(".") | ||
end | ||
end | ||
end | ||
|
||
private | ||
|
||
def tlds | ||
File.readlines(File.expand_path("./aux/tlds.txt", __dir__)).map(&:chomp).compact | ||
end | ||
|
||
def tlds_regexp | ||
Regexp.new tlds.map { |domain| "#{domain.split('.').join('\\.')}$" }.join("|") | ||
end | ||
|
||
def ip? | ||
IPAddr.new(domain.to_s) | ||
true | ||
rescue IPAddr::InvalidAddressError => _ | ||
false | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.