@@ -37,6 +37,11 @@ def initialize(info = {})
37
37
] , Exploit ::Remote ::HttpServer
38
38
)
39
39
40
+ register_advanced_options ( [
41
+ OptAddress . new ( 'URIHOST' , [ false , 'Host to use in URI (useful for tunnels)' ] ) ,
42
+ OptPort . new ( 'URIPORT' , [ false , 'Port to use in URI (useful for tunnels)' ] )
43
+ ] )
44
+
40
45
# Used to keep track of resources added to the service manager by
41
46
# this module. see #add_resource and #cleanup
42
47
@my_resources = [ ]
@@ -76,6 +81,11 @@ def print_status(msg='')
76
81
end
77
82
# :category: print_* overrides
78
83
# Prepends client and module name if inside a thread with a #cli
84
+ def print_good ( msg = '' )
85
+ ( cli ) ? super ( "#{ cli . peerhost . ljust ( 16 ) } #{ self . shortname } - #{ msg } " ) : super
86
+ end
87
+ # :category: print_* overrides
88
+ # Prepends client and module name if inside a thread with a #cli
79
89
def print_error ( msg = '' )
80
90
( cli ) ? super ( "#{ cli . peerhost . ljust ( 16 ) } #{ self . shortname } - #{ msg } " ) : super
81
91
end
@@ -103,6 +113,11 @@ def vprint_status(msg='')
103
113
end
104
114
# :category: print_* overrides
105
115
# Prepends client and module name if inside a thread with a #cli
116
+ def vprint_good ( msg = '' )
117
+ ( cli ) ? super ( "#{ cli . peerhost . ljust ( 16 ) } #{ self . shortname } - #{ msg } " ) : super
118
+ end
119
+ # :category: print_* overrides
120
+ # Prepends client and module name if inside a thread with a #cli
106
121
def vprint_error ( msg = '' )
107
122
( cli ) ? super ( "#{ cli . peerhost . ljust ( 16 ) } #{ self . shortname } - #{ msg } " ) : super
108
123
end
@@ -449,7 +464,9 @@ def get_resource
449
464
def get_uri ( cli = self . cli )
450
465
ssl = !!( datastore [ "SSL" ] )
451
466
proto = ( ssl ? "https://" : "http://" )
452
- if ( cli and cli . peerhost )
467
+ if datastore [ 'URIHOST' ]
468
+ host = datastore [ 'URIHOST' ]
469
+ elsif ( cli and cli . peerhost )
453
470
host = Rex ::Socket . source_address ( cli . peerhost )
454
471
else
455
472
host = srvhost_addr
@@ -459,7 +476,9 @@ def get_uri(cli=self.cli)
459
476
host = "[#{ host } ]"
460
477
end
461
478
462
- if ( ssl and datastore [ "SRVPORT" ] == 443 )
479
+ if datastore [ 'URIPORT' ]
480
+ port = ':' + datastore [ 'URIPORT' ] . to_s
481
+ elsif ( ssl and datastore [ "SRVPORT" ] == 443 )
463
482
port = ''
464
483
elsif ( !ssl and datastore [ "SRVPORT" ] == 80 )
465
484
port = ''
@@ -494,7 +513,9 @@ def get_uri(cli=self.cli)
494
513
#
495
514
# @return [String]
496
515
def srvhost_addr
497
- if ( datastore [ 'LHOST' ] and ( !datastore [ 'LHOST' ] . strip . empty? ) )
516
+ if datastore [ 'URIHOST' ]
517
+ host = datastore [ 'URIHOST' ]
518
+ elsif ( datastore [ 'LHOST' ] and ( !datastore [ 'LHOST' ] . strip . empty? ) )
498
519
host = datastore [ "LHOST" ]
499
520
else
500
521
if ( datastore [ 'SRVHOST' ] == "0.0.0.0" or datastore [ 'SRVHOST' ] == "::" )
0 commit comments