需要 telnet 登录功能吗?

问题描述

我尝试使用此代码在我的系统中伪造 telnet 蜜罐。 但是,我需要一个交互式 telnet 登录会话,在那里我应该知道他使用哪些词表登录到我的蜜罐。每当有人尝试连接到我的蜜罐时,我都需要制作一个假的登录界面。


import socket
import atexit

#Local IP/Port for the honeypot to listen on (TCP)
LHOST = '0.0.0.0'
LPORT = 23

#Remote IP/Port to send the log data to (TCP)
RHOST = '<RHOSTIP>'
RPORT = 9000

# Banner displayed when connecting to the honeypot
BANNER = 'Ubuntu 14.04 LTS\nlogin: '

# Socket timeout in seconds
TIMEOUT = 10

def main():
    print ('[*] Honeypot starting on ' + LHOST + ':' + str(LPORT))
    atexit.register(exit_handler)
    listener.setsockopt(socket.soL_SOCKET,socket.so_REUSEADDR,1)
    listener.bind((LHOST,LPORT))
    listener.listen(5)
    while True:
        (insock,address) = listener.accept()
        insock.settimeout(TIMEOUT)
        print ('[*] Honeypot connection from ' + address[0] + ':' + str(address[1]) + ' on port ' + str(LPORT))
        try:
            insock.send(BANNER.encode('utf-8'))
            data = insock.recv(1024)
        except socket.error as e:
            sendLog(address[0],'Error: ' + str(e))
        else:
            sendLog(address[0],data)
        finally:
            insock.close()

def sendLog(fromip,message):
    s = socket.socket(socket.AF_INET,socket.soCK_STREAM)
    s.connect((RHOST,RPORT))
    s.send('IP:' + fromip + ' Port:' + str(LPORT) + ' | ' + message.replace('\r\n',' '))
    s.close()

def exit_handler():
    print ('\n[*] Honeypot is shutting down!')
    listener.close()

listener = socket.socket(socket.AF_INET,socket.soCK_STREAM)
if __name__ == '__main__':
    try:
        main()
    except KeyboardInterrupt:
        pass

无论我们提供给他什么登录凭据,蜜罐都必须显示错误。有什么解决方案吗?

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)