@@ -19,11 +19,11 @@ def initialize
19
19
register_options (
20
20
[
21
21
OptString . new ( 'TARGETURI' , [ true , 'UPnP control URL' , '/' ] ) ,
22
- OptString . new ( 'INTERNAL_IP ' , [ false , 'New Internal Client ' ] ) ,
23
- OptString . new ( 'EXTERNAL_IP ' , [ false , 'New Internal Client ' ] ) ,
22
+ OptAddress . new ( 'INTERNAL_CLIENT ' , [ false , 'Internal client hostname/IP ' ] ) ,
23
+ OptAddress . new ( 'EXTERNAL_CLIENT ' , [ false , 'External client hostname/IP ' ] ) ,
24
24
OptEnum . new ( 'PROTOCOL' , [ true , 'Transport level protocol to map' , 'TCP' , %w( TCP UDP ) ] ) ,
25
- OptInt . new ( 'INTERNAL_PORT' , [ true , 'New Internal Port ' ] ) ,
26
- OptInt . new ( 'EXTERNAL_PORT' , [ true , 'New External Port ' ] ) ,
25
+ OptInt . new ( 'INTERNAL_PORT' , [ true , 'Internal port ' ] ) ,
26
+ OptInt . new ( 'EXTERNAL_PORT' , [ true , 'External port ' ] ) ,
27
27
OptInt . new ( 'LEASE_DURATION' , [ true , 'Lease time for mapping, in seconds' , 3600 ] )
28
28
] ,
29
29
self . class
@@ -34,16 +34,16 @@ def internal_port
34
34
@internal_port ||= datastore [ 'INTERNAL_PORT' ]
35
35
end
36
36
37
- def internal_ip
38
- @internal_ip ||= datastore [ 'INTERNAL_IP ' ]
37
+ def internal_client
38
+ @internal_client ||= datastore [ 'INTERNAL_CLIENT ' ]
39
39
end
40
40
41
41
def external_port
42
42
@external_port ||= datastore [ 'EXTERNAL_PORT' ]
43
43
end
44
44
45
- def external_ip
46
- @external_ip ||= datastore [ 'EXTERNAL_IP ' ]
45
+ def external_client
46
+ @external_client ||= datastore [ 'EXTERNAL_CLIENT ' ]
47
47
end
48
48
49
49
def lease_duration
@@ -61,10 +61,10 @@ def run
61
61
content << "<m:AddPortMapping xmlns:m=\" urn:schemas-upnp-org:service:WANIPConnection:1\" >"
62
62
content << "<NewPortMappingDescription>#{ Rex ::Text . rand_text_alpha ( 8 ) } </NewPortMappingDescription>"
63
63
content << "<NewLeaseDuration>#{ lease_duration } </NewLeaseDuration>"
64
- content << "<NewInternalClient>#{ internal_ip } </NewInternalClient>"
64
+ content << "<NewInternalClient>#{ internal_client } </NewInternalClient>"
65
65
content << "<NewEnabled>1</NewEnabled>"
66
66
content << "<NewExternalPort>#{ external_port } </NewExternalPort>"
67
- content << "<NewRemoteHost>#{ external_ip } </NewRemoteHost>"
67
+ content << "<NewRemoteHost>#{ external_client } </NewRemoteHost>"
68
68
content << "<NewProtocol>#{ protocol } </NewProtocol>"
69
69
content << "<NewInternalPort>#{ internal_port } </NewInternalPort>"
70
70
content << "</m:AddPortMapping>"
@@ -81,7 +81,7 @@ def run
81
81
)
82
82
83
83
if res
84
- map = "#{ rhost } :#{ external_port } /#{ protocol } -> #{ internal_ip } :#{ internal_port } /#{ protocol } "
84
+ map = "#{ rhost } :#{ external_port } /#{ protocol } -> #{ internal_client } :#{ internal_port } /#{ protocol } "
85
85
if res . code == 200
86
86
print_good ( "#{ peer } successfully mapped #{ map } " )
87
87
else
0 commit comments