package com.tylerstonge.honeypot.ftp import java.net.InetSocketAddress import akka.actor.{Actor, Props} import akka.event.{Logging, LoggingAdapter} import akka.io.Tcp._ import akka.io.{IO, Tcp} import akka.util.ByteString class FtpListener (port: Int) extends Actor { val log: LoggingAdapter = Logging(context.system, this) IO(Tcp)(context.system) ! Bind(self, new InetSocketAddress("localhost", port)) override def receive: Receive = { case Bound(localAddress) => log.info("listening on {}", localAddress) case CommandFailed(_: Bind) => context.stop(self) case Connected => val handler = context.actorOf(Props[FtpHandler]) val connection = sender() connection ! Register(handler) connection ! Write(ByteString.apply("220 (vulnFTPd 2.0.1)\n")) } }