w4b-file 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/README.md +86 -0
- data/bin/w4b-file +5 -0
- data/lib/w4b-file/cli.rb +90 -0
- data/lib/w4b-file/scanner.rb +40 -0
- data/lib/w4b-file/version.rb +3 -0
- data/w4b-file.gemspec +20 -0
- metadata +98 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: da5651afceb70d38d2d4eb87e320c251bbe6712400ac53ca83d85bf06078a647
|
4
|
+
data.tar.gz: 308135bd32cef25667211de403f5a180beb3276e61411c22cac32bd7b9c3971f
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 5b4d6a968375942d59534e2bcff56f4a1fa5b017ea52fd147904e1c1b6026968ef5143ccd9889448b4fbda702fbfd7f2aa66b9e19ad7ed72db987048f3a70ddc
|
7
|
+
data.tar.gz: 74ce8f7d1e46055264ee8c4bab03a7f75f1c11dec615eddd4cabacd769623101d37354cc18b7496c53392a4d7d61063feae63f5b6c3229ed46dc04f895fa4873
|
data/README.md
ADDED
@@ -0,0 +1,86 @@
|
|
1
|
+
# WebFile Analyzer (w4b-file)
|
2
|
+
|
3
|
+
WebFile Analyzer is an advanced command-line utility meticulously crafted for web developers, security professionals, and researchers. This tool provides a comprehensive solution to efficiently scan websites for diverse file types, elevating the process of file discovery, security analysis, and content audits.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
```bash
|
8
|
+
gem install w4b-file
|
9
|
+
```
|
10
|
+
|
11
|
+
Execute WebFile Analyzer:
|
12
|
+
|
13
|
+
```
|
14
|
+
w4b-file
|
15
|
+
```
|
16
|
+
|
17
|
+
|
18
|
+
### Options:
|
19
|
+
|
20
|
+
`<website_url> The URL of the website to scan for files.`
|
21
|
+
|
22
|
+
`<website_url> <file_type> Specify the type of files to check (pdf, image, video, php, zip, doc)`
|
23
|
+
|
24
|
+
### Examples:
|
25
|
+
|
26
|
+
```
|
27
|
+
w4b-file https://example-url.co.vias --check pdf # Check all PDF files on the website.
|
28
|
+
```
|
29
|
+
|
30
|
+
```
|
31
|
+
w4b-file https://example-url.co.vias --check image # Check all image files on the website.
|
32
|
+
```
|
33
|
+
|
34
|
+
```
|
35
|
+
w4b-file https://example-url.co.vias --check zip # Check all ZIP files on the website.
|
36
|
+
```
|
37
|
+
|
38
|
+
```
|
39
|
+
w4b-file https://example-url.co.vias --check document # Check all document files on the website.
|
40
|
+
```
|
41
|
+
|
42
|
+
```
|
43
|
+
w4b-file https://example-url.co.vias --check videos # Check Video files on the website.
|
44
|
+
```
|
45
|
+
|
46
|
+
## Key Features
|
47
|
+
|
48
|
+
- **File Type Identification**: Swiftly pinpoint various file types, including images, videos, PDFs, documents, and more.
|
49
|
+
|
50
|
+
- **Link Verification**: Identify broken links and missing resources, ensuring a seamless user experience for website administrators.
|
51
|
+
|
52
|
+
- **Concealed File Detection**: Unearth hidden files that may contain sensitive information or indicate potential security vulnerabilities.
|
53
|
+
|
54
|
+
- **Automated Insights**: Seamlessly integrate WebFile Analyzer into automated testing workflows for continual file integrity checks and content audits.
|
55
|
+
|
56
|
+
## Advantages
|
57
|
+
|
58
|
+
- **Website Maintenance**: Regular scans with WebFile Analyzer contribute to maintaining a polished and user-friendly online presence by identifying missing or outdated files.
|
59
|
+
|
60
|
+
- **Content Strategy Optimization**: Evaluate your content strategy by analyzing the distribution of various file types, enabling informed decisions about file prioritization.
|
61
|
+
|
62
|
+
- **Security Enhancement**: Identify hidden files that could pose security risks or inadvertently expose sensitive information.
|
63
|
+
|
64
|
+
- **Competitor Analysis**: Study file types on competitor websites to gain insights into their content focus and potentially identify gaps in your own strategy.
|
65
|
+
|
66
|
+
- **Research and Analysis**: WebFile Analyzer extends beyond your websites. Utilize it for research by analyzing trends in file types across multiple websites.
|
67
|
+
|
68
|
+
## Security Details
|
69
|
+
|
70
|
+
- **HTTPS Support**: WebFile Analyzer supports scanning websites with secure HTTPS connections for a comprehensive analysis.
|
71
|
+
|
72
|
+
- **Security Protocol Compliance**: The tool adheres to security protocols, ensuring reliable scans while respecting website security measures.
|
73
|
+
|
74
|
+
- **Robust File Encryption Handling**: WebFile Analyzer appropriately handles encrypted files, maintaining the integrity of the scanning process.
|
75
|
+
|
76
|
+
## Disadvantages
|
77
|
+
|
78
|
+
- **Limited Scanning on Highly Secure Websites**: Some highly secure websites may restrict access, preventing complete scans of all files and resources.
|
79
|
+
|
80
|
+
- **Image and File Encryption Challenges**: Encrypted images and files may pose challenges in terms of analysis and may not be fully accessible.
|
81
|
+
|
82
|
+
- **Dependency on Website Permissions**: The effectiveness of the tool is subject to the permissions granted by the website, impacting the extent of the scan.
|
83
|
+
|
84
|
+
```
|
85
|
+
WebFile Analyzer (w4b-file) is a tool designed for educational purposes, catering to web developers, security professionals, and researchers. It is essential to emphasize responsible use, and the developers are not liable for any misuse or issues that may arise. This tool is intended for educational exploration, promoting a better understanding of website file scanning without endorsing any unauthorized activities. Users are urged to exercise caution, adhere to ethical guidelines, and respect legal boundaries when utilizing this tool. The developers disclaim responsibility for any unintended consequences resulting from the tool's usage.
|
86
|
+
```
|
data/bin/w4b-file
ADDED
data/lib/w4b-file/cli.rb
ADDED
@@ -0,0 +1,90 @@
|
|
1
|
+
require 'optparse'
|
2
|
+
require_relative 'scanner'
|
3
|
+
|
4
|
+
module W4bFile
|
5
|
+
class CLI
|
6
|
+
def self.start
|
7
|
+
options = {}
|
8
|
+
OptionParser.new do |opts|
|
9
|
+
opts.banner = "Usage: w4b-file <website_url> [--check <file_type>]"
|
10
|
+
|
11
|
+
opts.on("--check TYPE", "Specify the type of files to check") do |type|
|
12
|
+
options[:check_type] = type
|
13
|
+
end
|
14
|
+
|
15
|
+
opts.on("--check all", "Check and display all files on the website") do
|
16
|
+
options[:check_all] = true
|
17
|
+
end
|
18
|
+
|
19
|
+
opts.on("--check hidden", "Scan for hidden files on the website") do
|
20
|
+
options[:check_hidden] = true
|
21
|
+
end
|
22
|
+
end.parse!
|
23
|
+
|
24
|
+
website_url = ARGV[0]
|
25
|
+
check_type = options[:check_type]
|
26
|
+
|
27
|
+
if website_url.nil?
|
28
|
+
puts "Usage: w4b-file <website_url> [--check <file_type>]"
|
29
|
+
exit 1
|
30
|
+
end
|
31
|
+
|
32
|
+
scanner = Scanner.new(website_url)
|
33
|
+
|
34
|
+
if options[:check_hidden]
|
35
|
+
hidden_files = scanner.scan_hidden_files
|
36
|
+
display_files(hidden_files, "Hidden", website_url) unless hidden_files.empty?
|
37
|
+
elsif options[:check_all]
|
38
|
+
resources = scanner.scan_website
|
39
|
+
display_files(resources, "All", website_url) unless resources.empty?
|
40
|
+
elsif check_type
|
41
|
+
run_checks(check_type, scanner, website_url)
|
42
|
+
else
|
43
|
+
puts "Invalid option. Please specify a valid option."
|
44
|
+
exit 1
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
def self.run_checks(check_type, scanner, website_url)
|
49
|
+
case check_type
|
50
|
+
when "videos"
|
51
|
+
files_found = check_files("mp4|avi", scanner, website_url)
|
52
|
+
display_files(files_found, "Video", website_url) if !files_found.empty?
|
53
|
+
when "images"
|
54
|
+
files_found = check_files("jpg|jpeg|png", scanner, website_url)
|
55
|
+
display_files(files_found, "Image", website_url) if !files_found.empty?
|
56
|
+
when "zip"
|
57
|
+
files_found = check_files("zip", scanner, website_url)
|
58
|
+
display_files(files_found, "ZIP", website_url) if !files_found.empty?
|
59
|
+
when "pdf"
|
60
|
+
files_found = check_files("pdf", scanner, website_url)
|
61
|
+
display_files(files_found, "PDF", website_url) if !files_found.empty?
|
62
|
+
when "document"
|
63
|
+
files_found = check_files("doc|docx|txt", scanner, website_url)
|
64
|
+
display_files(files_found, "Document", website_url) if !files_found.empty?
|
65
|
+
else
|
66
|
+
puts "Invalid check type. Available options: videos, images, zip, pdf, document, --check hidden"
|
67
|
+
exit 1
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
def self.check_files(type, scanner, url)
|
72
|
+
resources = scanner.scan_website
|
73
|
+
files = resources.grep(/\.(#{type})$/i)
|
74
|
+
files
|
75
|
+
end
|
76
|
+
|
77
|
+
def self.display_files(files, type, base_url)
|
78
|
+
return if files.empty?
|
79
|
+
|
80
|
+
puts "[+] #{type} files :"
|
81
|
+
files.each do |file|
|
82
|
+
display_url = URI.join(base_url, file).to_s
|
83
|
+
puts " Link : #{display_url}"
|
84
|
+
end
|
85
|
+
puts
|
86
|
+
end
|
87
|
+
end
|
88
|
+
end
|
89
|
+
|
90
|
+
W4bFile::CLI.start if __FILE__ == $PROGRAM_NAME
|
@@ -0,0 +1,40 @@
|
|
1
|
+
require 'uri'
|
2
|
+
require 'net/http'
|
3
|
+
require 'openssl'
|
4
|
+
|
5
|
+
module W4bFile
|
6
|
+
class Scanner
|
7
|
+
def initialize(url)
|
8
|
+
@url = url
|
9
|
+
end
|
10
|
+
|
11
|
+
def scan_website
|
12
|
+
uri = URI.parse(@url)
|
13
|
+
response = Net::HTTP.get_response(uri)
|
14
|
+
|
15
|
+
return [] unless response.is_a?(Net::HTTPSuccess)
|
16
|
+
|
17
|
+
response.body.scan(/href="([^"#]*)"|\ssrc="([^"#]*)"/).flatten.compact
|
18
|
+
end
|
19
|
+
|
20
|
+
def scan_hidden_files
|
21
|
+
uri = URI.parse(@url)
|
22
|
+
http = Net::HTTP.new(uri.host, uri.port)
|
23
|
+
http.use_ssl = (uri.scheme == 'https')
|
24
|
+
http.verify_mode = OpenSSL::SSL::VERIFY_PEER
|
25
|
+
|
26
|
+
request = Net::HTTP::Get.new(uri)
|
27
|
+
request['User-Agent'] = 'Googlebot'
|
28
|
+
response = http.request(request)
|
29
|
+
|
30
|
+
hidden_files = []
|
31
|
+
if response.is_a?(Net::HTTPSuccess)
|
32
|
+
response.body.scan(/href="([^"#]*)"/).flatten.compact.each do |file|
|
33
|
+
hidden_files << file if file.start_with?(".") || file.include?("/.")
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
hidden_files
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
data/w4b-file.gemspec
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('lib', __dir__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
Gem::Specification.new do |spec|
|
5
|
+
spec.name = 'w4b-file'
|
6
|
+
spec.version = '1.0.0'
|
7
|
+
spec.authors = ['MrFidal']
|
8
|
+
spec.license = 'MIT' #
|
9
|
+
spec.add_runtime_dependency 'openssl', '~> 2.3', '>= 2.3.0'
|
10
|
+
spec.required_ruby_version = '>= 3.0'
|
11
|
+
spec.email = ['mrfidal@proton.me']
|
12
|
+
spec.summary = 'Scans websites for files.'
|
13
|
+
spec.description = 'A Ruby gem to scan websites for specific file types and hidden files.'
|
14
|
+
spec.homepage = 'https://github.com/Tony-Linux/w4b-file'
|
15
|
+
spec.files = Dir["{bin,lib}/**/*", "README.md", "w4b-file.gemspec"]
|
16
|
+
spec.executables = ['w4b-file']
|
17
|
+
spec.require_paths = ['lib']
|
18
|
+
spec.add_runtime_dependency 'net-http', '~> 0.2.1'
|
19
|
+
spec.add_development_dependency 'rspec', '~> 3.0'
|
20
|
+
end
|
metadata
ADDED
@@ -0,0 +1,98 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: w4b-file
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- MrFidal
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2024-07-10 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: openssl
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '2.3'
|
20
|
+
- - ">="
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: 2.3.0
|
23
|
+
type: :runtime
|
24
|
+
prerelease: false
|
25
|
+
version_requirements: !ruby/object:Gem::Requirement
|
26
|
+
requirements:
|
27
|
+
- - "~>"
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '2.3'
|
30
|
+
- - ">="
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: 2.3.0
|
33
|
+
- !ruby/object:Gem::Dependency
|
34
|
+
name: net-http
|
35
|
+
requirement: !ruby/object:Gem::Requirement
|
36
|
+
requirements:
|
37
|
+
- - "~>"
|
38
|
+
- !ruby/object:Gem::Version
|
39
|
+
version: 0.2.1
|
40
|
+
type: :runtime
|
41
|
+
prerelease: false
|
42
|
+
version_requirements: !ruby/object:Gem::Requirement
|
43
|
+
requirements:
|
44
|
+
- - "~>"
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: 0.2.1
|
47
|
+
- !ruby/object:Gem::Dependency
|
48
|
+
name: rspec
|
49
|
+
requirement: !ruby/object:Gem::Requirement
|
50
|
+
requirements:
|
51
|
+
- - "~>"
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '3.0'
|
54
|
+
type: :development
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
requirements:
|
58
|
+
- - "~>"
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
version: '3.0'
|
61
|
+
description: A Ruby gem to scan websites for specific file types and hidden files.
|
62
|
+
email:
|
63
|
+
- mrfidal@proton.me
|
64
|
+
executables:
|
65
|
+
- w4b-file
|
66
|
+
extensions: []
|
67
|
+
extra_rdoc_files: []
|
68
|
+
files:
|
69
|
+
- README.md
|
70
|
+
- bin/w4b-file
|
71
|
+
- lib/w4b-file/cli.rb
|
72
|
+
- lib/w4b-file/scanner.rb
|
73
|
+
- lib/w4b-file/version.rb
|
74
|
+
- w4b-file.gemspec
|
75
|
+
homepage: https://github.com/Tony-Linux/w4b-file
|
76
|
+
licenses:
|
77
|
+
- MIT
|
78
|
+
metadata: {}
|
79
|
+
post_install_message:
|
80
|
+
rdoc_options: []
|
81
|
+
require_paths:
|
82
|
+
- lib
|
83
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
84
|
+
requirements:
|
85
|
+
- - ">="
|
86
|
+
- !ruby/object:Gem::Version
|
87
|
+
version: '3.0'
|
88
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
89
|
+
requirements:
|
90
|
+
- - ">="
|
91
|
+
- !ruby/object:Gem::Version
|
92
|
+
version: '0'
|
93
|
+
requirements: []
|
94
|
+
rubygems_version: 3.5.9
|
95
|
+
signing_key:
|
96
|
+
specification_version: 4
|
97
|
+
summary: Scans websites for files.
|
98
|
+
test_files: []
|