summaryrefslogtreecommitdiff
path: root/src/main/scala/com/tylerstonge/honeypot/ftp/FtpHandler.scala
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/scala/com/tylerstonge/honeypot/ftp/FtpHandler.scala')
-rw-r--r--src/main/scala/com/tylerstonge/honeypot/ftp/FtpHandler.scala15
1 files changed, 9 insertions, 6 deletions
diff --git a/src/main/scala/com/tylerstonge/honeypot/ftp/FtpHandler.scala b/src/main/scala/com/tylerstonge/honeypot/ftp/FtpHandler.scala
index 46263c6..b7b6f03 100644
--- a/src/main/scala/com/tylerstonge/honeypot/ftp/FtpHandler.scala
+++ b/src/main/scala/com/tylerstonge/honeypot/ftp/FtpHandler.scala
@@ -4,6 +4,7 @@ import akka.actor.{Actor, ActorRef, Props}
import akka.event.{Logging, LoggingAdapter}
import akka.io.Tcp.{PeerClosed, Received, Write}
import akka.util.ByteString
+import com.tylerstonge.honeypot.messages.{MFoundPassword, MFoundUsername}
import scala.util.Random
@@ -18,21 +19,23 @@ class FtpHandler(client: ActorRef) extends Actor {
override def receive: Receive = {
case Received(data) => client ! Write(ByteString.apply(parse(sanitize(data))))
case PeerClosed =>
- log.info("peer closed connection")
+ log.debug("peer closed connection")
context.stop(self)
}
def parse(msg: Array[String]): String = msg(0) match {
case "user" =>
- log.info("attempted login with username: {}", msg(1))
+ log.debug("attempted login with username: {}", msg(1))
+ context.system.eventStream.publish(MFoundUsername(msg(1)))
"331 Please specify password.\n"
case "pass" =>
- log.info("attempted login with password: {}", msg(1))
+ log.debug("attempted login with password: {}", msg(1))
+ context.system.eventStream.publish(MFoundPassword(msg(1)))
"230 Login successful.\n"
case "pwd" => "257 \"/\" is the current directory\n"
case "quit" => "221 Goodbye.\n"
case "pasv" =>
- log.info("entering passive mode")
+ log.debug("entering passive mode")
val r = new Random()
val p1 = r.nextInt(200)
val p2 = r.nextInt(200)
@@ -40,10 +43,10 @@ class FtpHandler(client: ActorRef) extends Actor {
Thread.sleep(256)
"227 entering passive mode (127,0,0,1," + p1 + "," + p2 + ")\n"
case "stor" =>
- log.info("stor: {}", msg(1))
+ log.debug("stor: {}", msg(1))
"150 File status okay; about to open data connection.\n"
case _ =>
- log.info("unsupported command received: {}", msg.mkString(" "))
+ log.debug("unsupported command received: {}", msg.mkString(" "))
"451 Requested action aborted. Local error in processing.\n"
}