diff options
Diffstat (limited to 'src/main/scala/com/tylerstonge/honeypot/ftp/FtpHandler.scala')
-rw-r--r-- | src/main/scala/com/tylerstonge/honeypot/ftp/FtpHandler.scala | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/main/scala/com/tylerstonge/honeypot/ftp/FtpHandler.scala b/src/main/scala/com/tylerstonge/honeypot/ftp/FtpHandler.scala index 840ce97..46263c6 100644 --- a/src/main/scala/com/tylerstonge/honeypot/ftp/FtpHandler.scala +++ b/src/main/scala/com/tylerstonge/honeypot/ftp/FtpHandler.scala @@ -5,6 +5,8 @@ import akka.event.{Logging, LoggingAdapter} import akka.io.Tcp.{PeerClosed, Received, Write} import akka.util.ByteString +import scala.util.Random + object FtpHandler { def props(client: ActorRef): Props = Props(new FtpHandler(client)) } @@ -31,9 +33,12 @@ class FtpHandler(client: ActorRef) extends Actor { case "quit" => "221 Goodbye.\n" case "pasv" => log.info("entering passive mode") - context.actorOf(FtpFileReceiver.props(1287, client), name = "passive-connection") + val r = new Random() + val p1 = r.nextInt(200) + val p2 = r.nextInt(200) + context.actorOf(FtpFileReceiver.props(p1 * 256 + p2, client), name = "passive-connection") Thread.sleep(256) - "227 entering passive mode (127,0,0,1,5,7)\n" + "227 entering passive mode (127,0,0,1," + p1 + "," + p2 + ")\n" case "stor" => log.info("stor: {}", msg(1)) "150 File status okay; about to open data connection.\n" |