Skip to content

Commit f0686d4

Browse files
authored
Merge pull request #464 from spkal01/master
Rework PEASS url logic for the metasploit module
2 parents 46193aa + 99e8eb7 commit f0686d4

File tree

2 files changed

+14
-6
lines changed

2 files changed

+14
-6
lines changed

metasploit/README.md

+4-3
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,10 @@ Basic options:
3737
---- --------------- -------- -----------
3838
PARAMETERS no Parameters to pass to the script
3939
PASSWORD um1xipfws17nkw1bi1ma3bh7tzt4mo3e no Password to encrypt and obfuscate the script (randomly generated). The length must be 32B. If no password is set, only base64 will be used
40-
.
41-
PEASS_URL https://raw.githubusercontent.com/peass-ng/PEASS-ng/master/winPEAS/wi yes Path to the PEASS script. Accepted: http(s):// URL or absolute local path. Linpeas: https://raw.githubusercontent.com/peass-ng/PEASS-ng
42-
nPEASexe/binaries/Obfuscated%20Releases/winPEASany.exe /master/linPEAS/linpeas.sh
40+
41+
WINPEASS true yes Use PEASS for Windows or PEASS for linux. Default is windows change to false for linux.
42+
CUSTOM_URL no Path to the PEASS script. Accepted: http(s):// URL or absolute local path.
43+
4344
SESSION yes The session to run this module on.
4445
SRVHOST no Set your metasploit instance IP if you want to download the PEASS script from here via http(s) instead of uploading it.
4546
SRVPORT 443 no Port to download the PEASS script from using http(s) (only used if SRVHOST)

metasploit/peass.rb

+10-3
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,8 @@ def initialize(info={})
3737
))
3838
register_options(
3939
[
40-
OptString.new('PEASS_URL', [true, 'Path to the PEASS script. Accepted: http(s):// URL or absolute local path. Linpeas: https://github.com/peass-ng/PEASS-ng/releases/latest/download/linpeas.sh', "https://github.com/peass-ng/PEASS-ng/releases/latest/download/winPEASany_ofs.exe"]),
40+
OptString.new('WINPEASS', [true, 'Which PEASS script to use. Use True for WinPeass and false for LinPEASS', true]),
41+
OptString.new('CUSTOM_URL', [false, 'URL to download the PEASS script from (if not using the default one). Accepts http(s) or absolute path. Overrides the WINPEASS variable', '']),
4142
OptString.new('PASSWORD', [false, 'Password to encrypt and obfuscate the script (randomly generated). The length must be 32B. If no password is set, only base64 will be used.', rand(36**32).to_s(36)]),
4243
OptString.new('TEMP_DIR', [false, 'Path to upload the obfuscated PEASS script inside the compromised machine. By default "C:\Windows\System32\spool\drivers\color" is used in Windows and "/tmp" in Unix.', '']),
4344
OptString.new('PARAMETERS', [false, 'Parameters to pass to the script', nil]),
@@ -237,8 +238,14 @@ def fetch(uri_str, limit = 10)
237238
def load_peass
238239
# Load the PEASS script from a local file or from Internet
239240
peass_script = ""
240-
url_peass = datastore['PEASS_URL']
241-
241+
url_peass = ""
242+
# If no URL is set, use the default one
243+
if datastore['CUSTOM_URL'] != ""
244+
url_peass = datastore['CUSTOM_URL']
245+
else
246+
url_peass = datastore['WINPEASS'] ? "https://github.com/peass-ng/PEASS-ng/releases/latest/download/winPEASany_ofs.exe" : "https://github.com/peass-ng/PEASS-ng/releases/latest/download/linpeas.sh"
247+
end
248+
# If URL is set, check if it is a valid URL or local file
242249
if url_peass.include?("http://") || url_peass.include?("https://")
243250
target = URI.parse url_peass
244251
raise 'Invalid URL' unless target.scheme =~ /https?/

0 commit comments

Comments
 (0)