-
Notifications
You must be signed in to change notification settings - Fork 13.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Rex::Proto::Mysql client to align peerhost and peerport
- Loading branch information
1 parent
faa22a0
commit bb8fc3f
Showing
5 changed files
with
32 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
require 'mysql' | ||
|
||
module Rex | ||
module Proto | ||
|
||
# This is a Rex Proto wrapper around the ::Mysql client which is currently coming from the 'ruby-mysql' gem. | ||
# The purpose of this wrapper is to provide 'peerhost' and 'peerport' methods to ensure the client interfaces | ||
# are consistent between various SQL implementations/protocols. | ||
class Mysql < ::Mysql | ||
# @return [String] The remote IP address that the Mysql server is running on | ||
def peerhost | ||
io.remote_address.ip_address | ||
end | ||
|
||
# @return [Integer] The remote port that the Mysql server is running on | ||
def peerport | ||
io.remote_address.ip_port | ||
end | ||
end | ||
end | ||
end | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters