Forum Discussion

KenG's avatar
KenG
Icon for Nimbostratus rankNimbostratus
May 19, 2017

Inject commands on an FTP connection

Does anyone know if it is possible to inject a command into an FTP conversation?

 

I've trying to work around a bug in the application that is incorrectly asking for a transfer in ascii mode and prior to any GET I'd like to inject a BIN command. It looks like the server defaults to ASCII so I can't just remove the ASCII command from the stream so the [TCP::Payload] replacement thing doesn't seem appropriate.

 

Anyone got any bright ideas?

 

  • Anesh's avatar
    Anesh
    Icon for Cirrostratus rankCirrostratus

    try the below

    when SERVER_CONNECTED {
    TCP::collect
    }
    when SERVER_DATA {
    if {[TCP::payload] contains "string after which you want to inject BIN" }
    TCP::respond "BIN"
    TCP::payload replace 0 [TCP::payload length] ""
    TCP::release
    
    }