summaryrefslogtreecommitdiff
path: root/src/main/scala/com/tylerstonge/honeypot/ftp/FtpFileReceiver.scala
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/scala/com/tylerstonge/honeypot/ftp/FtpFileReceiver.scala')
-rw-r--r--src/main/scala/com/tylerstonge/honeypot/ftp/FtpFileReceiver.scala5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/main/scala/com/tylerstonge/honeypot/ftp/FtpFileReceiver.scala b/src/main/scala/com/tylerstonge/honeypot/ftp/FtpFileReceiver.scala
index fa54d28..bf74e8b 100644
--- a/src/main/scala/com/tylerstonge/honeypot/ftp/FtpFileReceiver.scala
+++ b/src/main/scala/com/tylerstonge/honeypot/ftp/FtpFileReceiver.scala
@@ -10,6 +10,7 @@ import akka.event.{Logging, LoggingAdapter}
import akka.io.Tcp._
import akka.io.{IO, Tcp}
import akka.util.{ByteString, ByteStringBuilder}
+import com.tylerstonge.honeypot.messages.{MFoundFile, MFoundPassword}
object FtpFileReceiver {
@@ -18,6 +19,7 @@ object FtpFileReceiver {
class FtpFileReceiver(port: Int, controller: ActorRef) extends Actor {
+ val path = "/home/dropkick/honeypot/"
val log: LoggingAdapter = Logging(context.system, this)
IO(Tcp)(context.system) ! Bind(self, new InetSocketAddress("127.0.0.1", port))
val fileData: ByteStringBuilder = ByteString.newBuilder
@@ -40,7 +42,8 @@ class FtpFileReceiver(port: Int, controller: ActorRef) extends Actor {
fileData.addAll(data)
case PeerClosed =>
log.debug("peer closed connection, writing file to disk")
- val out = Files.newByteChannel(new File("C:\\Users\\dropkick\\Documents\\dev\\honeypot\\" + this.name).toPath, StandardOpenOption.CREATE_NEW, StandardOpenOption.WRITE)
+ val out = Files.newByteChannel(new File(this.path + "/" + this.name).toPath, StandardOpenOption.CREATE_NEW, StandardOpenOption.WRITE)
+ context.system.eventStream.publish(MFoundFile(this.path + "/" + this.name))
out.write(fileData.result().toByteBuffer)
out.close()
controller.tell(Write(ByteString.apply("226 File transferred.\n")), context.parent)