CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In
rapid7

Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.

GitHub Repository: rapid7/metasploit-framework
Path: blob/master/lib/anemone/cli/count.rb
Views: 11623
1
require 'anemone'
2
3
begin
4
# make sure that the first option is a URL we can crawl
5
url = URI(ARGV[0])
6
rescue
7
puts <<-INFO
8
Usage:
9
anemone count <url>
10
11
Synopsis:
12
Crawls a site starting at the given URL and outputs the total number
13
of unique pages on the site.
14
INFO
15
exit(0)
16
end
17
18
Anemone.crawl(url) do |anemone|
19
anemone.after_crawl do |pages|
20
puts pages.uniq!.size
21
end
22
end
23
24