SlideShare una empresa de Scribd logo
1 de 10
Date of delivery:                   Supervisor:
00-00-2011                    Morten Bo Nielsen
School:                                 Group:
Erhvervsakademiet Lillebælt              Victor

1st semester IT Networking                Flaviu
                                         Lucian
Table of Contents
Introduction..........................................................................................................................................1
System overview..................................................................................................................................2
   Basic overview.................................................................................................................................2
   Creating-sending-sniffing schematics..............................................................................................3
Packet crafting......................................................................................................................................4
Sending, receving and sniffing.............................................................................................................5
Conclusion............................................................................................................................................8
Networking                                     Scapy – Communication on Layer 2




                           Introduction

     The purpose of this exercise is to make our PCs communicate on the
second layer (Data-Link). For this, the manual creation of a ethernet
package, sending it, receiveing it and sniffing it, was required. Also, the
only programs used must be Scapy and eventually Wireshark.




                                     1
Networking                                                      Scapy – Communication on Layer 2




                               System overview

                                    Basic overview




        The two pc's that are part of this exercise are sharing the same subnet, as we can se in the
picture above.




                                                   2
Networking                                                    Scapy – Communication on Layer 2




             Creating-sending-sniffing schematics

       The diagram bellow explains for itself the main operations in this exercise – creating,
sending and sniffing packets.




       Details for each operations can be found in the next pages.




                                                  3
Networking                                                    Scapy – Communication on Layer 2




                                Packet crafting

       This is how an ethernet packet looks like :




      When manually building an ethernet package we should consider adding those elements
manually, like in the picture bellow:




   –   a is a variable which we've made it into an ethernet frame
   –   a.src represents the source mac address , in this case Victors'
   –   a.dst represents the destination macc address, in this case Flavius'
   –   a.type represents the ethertype, in this case being 0x8088 due to a common class decision
   –   data is the data we want to send, in this case the "blablabla" text
   –   b is another variable in which we join our initial variable (a) with the data we want to send


                                                     4
Networking                                                      Scapy – Communication on Layer 2




             Sending, receving and sniffing

       To send a package the sendp command is required, with the following parameters:

   –   b : the packet we want to send
   –   count : how many times we want to send that packet
   –   iface : this is how to specifiy through which interface the packet should be sent – by default
       it's eth0


       To locate the sent packages we use the sniff command, which does as it says, it "sniffs", as
we can see in the following picture:




       The parameters used are :

   –   count : this will make it sniff the last X packages that are being sent or received, in this case
       20
   –   prn : is the print function, it will print what it will sniff like in the picture
   –   x:x.summary(): is a scapy function that together with the prn parameters prints in a
       predefined format




                                                   5
Networking                                                    Scapy – Communication on Layer 2


        When using the lambda x:x.show() function instead of lambda x:x.summary(), the result
looks like in the picture bellow :




      As we can see, the manually added data ("blablabla" – see page4) is is named "load", under
the Raw section of the packet.


       The same thing we can see in wireshark :




        By filtering using the destination mac address, we can easily spot the sent packages, source
and destination mac addresses and the data, in this case "blablabla" (highlighted in the bottom-right
of the picture).


                                                  6
Networking                                                      Scapy – Communication on Layer 2


       In order to print the content of the packets we can use two methods. One may be with
creating a python script, like the one in the picture bellow.




       The output for the script will look like the picture bellow :




       The other method is through the lfilter parameter of the sniff command.




       The whole command is :
sniff(prn=lambda x: "from %s : %s" %(x.src, x['Raw'].load), lfilter=lambda x:
x.haslayer(Ether) and x.fields['type'] == 0x8088)
       A lambda function was used to filter the sniffed packet, so that it will print only the packets
with an Ether layer (haslayer(Ether)) and with the 0x8088 data type.




                                                   7
Networking                                     Scapy – Communication on Layer 2




                           Conclusion

      Scapy is a very powerfull packet-manipulation tool, and with its help
we have demonstrated that almost any kind of data can be inserted into an
ethernet packet. In this case we have inserted a simple string("blablabla").
For larger chunks of data, it is required to "chop" the data into smaller
pieces that could fit into a packet.




                                     8

Más contenido relacionado

La actualidad más candente

Network infrastructure - TCP/IP
Network infrastructure - TCP/IPNetwork infrastructure - TCP/IP
Network infrastructure - TCP/IPraymondkao
 
Preprocessing of Web Log Data for Web Usage Mining
Preprocessing of Web Log Data for Web Usage MiningPreprocessing of Web Log Data for Web Usage Mining
Preprocessing of Web Log Data for Web Usage MiningAmir Masoud Sefidian
 
Web (HTTP) request to response life cycle
Web (HTTP) request to response life cycleWeb (HTTP) request to response life cycle
Web (HTTP) request to response life cycleGopakumar Kunduveetil
 
File models and file accessing models
File models and file accessing modelsFile models and file accessing models
File models and file accessing modelsishmecse13
 
Distributed operating system
Distributed operating systemDistributed operating system
Distributed operating systemudaya khanal
 
System and Network Administration/ SNA
System and Network Administration/ SNASystem and Network Administration/ SNA
System and Network Administration/ SNAFaisalMashood
 
Content centric networking
Content centric networkingContent centric networking
Content centric networkingPhearin Sok
 
Google file system GFS
Google file system GFSGoogle file system GFS
Google file system GFSzihad164
 
Internet programming lecture 1
Internet programming lecture 1Internet programming lecture 1
Internet programming lecture 1Mohammed Hussein
 
Synchronization in distributed computing
Synchronization in distributed computingSynchronization in distributed computing
Synchronization in distributed computingSVijaylakshmi
 
Asterisk as a Virtual Network Function Part 1
Asterisk as a Virtual Network Function Part 1Asterisk as a Virtual Network Function Part 1
Asterisk as a Virtual Network Function Part 1Leif Madsen
 
Tutorial 5 adding more nodes
Tutorial 5   adding more nodes Tutorial 5   adding more nodes
Tutorial 5 adding more nodes Mohd Batati
 

La actualidad más candente (20)

Network infrastructure - TCP/IP
Network infrastructure - TCP/IPNetwork infrastructure - TCP/IP
Network infrastructure - TCP/IP
 
IIS
IISIIS
IIS
 
Chap 20 smtp, pop, imap
Chap 20 smtp, pop, imapChap 20 smtp, pop, imap
Chap 20 smtp, pop, imap
 
Preprocessing of Web Log Data for Web Usage Mining
Preprocessing of Web Log Data for Web Usage MiningPreprocessing of Web Log Data for Web Usage Mining
Preprocessing of Web Log Data for Web Usage Mining
 
Web (HTTP) request to response life cycle
Web (HTTP) request to response life cycleWeb (HTTP) request to response life cycle
Web (HTTP) request to response life cycle
 
Spring Security Framework
Spring Security FrameworkSpring Security Framework
Spring Security Framework
 
File models and file accessing models
File models and file accessing modelsFile models and file accessing models
File models and file accessing models
 
PACE-IT: Network Hardening Techniques (part 1)
PACE-IT: Network Hardening Techniques (part 1)PACE-IT: Network Hardening Techniques (part 1)
PACE-IT: Network Hardening Techniques (part 1)
 
Distributed operating system
Distributed operating systemDistributed operating system
Distributed operating system
 
Fragment
Fragment Fragment
Fragment
 
Cloud computing architectures
Cloud computing architecturesCloud computing architectures
Cloud computing architectures
 
System and Network Administration/ SNA
System and Network Administration/ SNASystem and Network Administration/ SNA
System and Network Administration/ SNA
 
Content centric networking
Content centric networkingContent centric networking
Content centric networking
 
Google file system GFS
Google file system GFSGoogle file system GFS
Google file system GFS
 
Internet programming lecture 1
Internet programming lecture 1Internet programming lecture 1
Internet programming lecture 1
 
DOM and SAX
DOM and SAXDOM and SAX
DOM and SAX
 
Synchronization in distributed computing
Synchronization in distributed computingSynchronization in distributed computing
Synchronization in distributed computing
 
Asterisk as a Virtual Network Function Part 1
Asterisk as a Virtual Network Function Part 1Asterisk as a Virtual Network Function Part 1
Asterisk as a Virtual Network Function Part 1
 
Data Link Layer
Data Link LayerData Link Layer
Data Link Layer
 
Tutorial 5 adding more nodes
Tutorial 5   adding more nodes Tutorial 5   adding more nodes
Tutorial 5 adding more nodes
 

Similar a Scapy - communication on Layer2

Fundamentals of Internet and Communication Competition
Fundamentals of Internet and Communication CompetitionFundamentals of Internet and Communication Competition
Fundamentals of Internet and Communication CompetitionMarcoFasanella
 
Network simulator 2 a simulation tool for linux
Network simulator 2 a simulation tool for linuxNetwork simulator 2 a simulation tool for linux
Network simulator 2 a simulation tool for linuxPratik Joshi
 
Introduction to NS2 - Cont..
Introduction to NS2 - Cont..Introduction to NS2 - Cont..
Introduction to NS2 - Cont..cscarcas
 
Neural Networks on Steroids (Poster)
Neural Networks on Steroids (Poster)Neural Networks on Steroids (Poster)
Neural Networks on Steroids (Poster)Adam Blevins
 
Stefano Giordano
Stefano GiordanoStefano Giordano
Stefano GiordanoGoWireless
 
Stefano Giordano
Stefano  GiordanoStefano  Giordano
Stefano GiordanoGoWireless
 
Wireshark lab getting started one’s unde
Wireshark lab  getting started     one’s undeWireshark lab  getting started     one’s unde
Wireshark lab getting started one’s undepiya30
 
Plenzogan technology
Plenzogan technologyPlenzogan technology
Plenzogan technologyplenzogan
 
maXbox Starter87
maXbox Starter87maXbox Starter87
maXbox Starter87Max Kleiner
 
Wireshark Lab Getting Started v6.0 Supplement to Co.docx
Wireshark Lab  Getting Started v6.0  Supplement to Co.docxWireshark Lab  Getting Started v6.0  Supplement to Co.docx
Wireshark Lab Getting Started v6.0 Supplement to Co.docxambersalomon88660
 
IRJET- Tracking Communication Quality Degrading Events for Link Quality E...
IRJET-  	  Tracking Communication Quality Degrading Events for Link Quality E...IRJET-  	  Tracking Communication Quality Degrading Events for Link Quality E...
IRJET- Tracking Communication Quality Degrading Events for Link Quality E...IRJET Journal
 
WiMAX implementation in ns3
WiMAX implementation in ns3WiMAX implementation in ns3
WiMAX implementation in ns3Mustafa Khaleel
 
Report of TCP/IP
Report of TCP/IPReport of TCP/IP
Report of TCP/IPMannu Khani
 

Similar a Scapy - communication on Layer2 (20)

OSI model (Tamil)
OSI model (Tamil)OSI model (Tamil)
OSI model (Tamil)
 
Fundamentals of Internet and Communication Competition
Fundamentals of Internet and Communication CompetitionFundamentals of Internet and Communication Competition
Fundamentals of Internet and Communication Competition
 
Network simulator 2 a simulation tool for linux
Network simulator 2 a simulation tool for linuxNetwork simulator 2 a simulation tool for linux
Network simulator 2 a simulation tool for linux
 
Nic bonding
Nic bonding Nic bonding
Nic bonding
 
N ns 1
N ns 1N ns 1
N ns 1
 
Introduction to NS2 - Cont..
Introduction to NS2 - Cont..Introduction to NS2 - Cont..
Introduction to NS2 - Cont..
 
An ntutorial[1]
An ntutorial[1]An ntutorial[1]
An ntutorial[1]
 
Wireshark
WiresharkWireshark
Wireshark
 
Neural Networks on Steroids (Poster)
Neural Networks on Steroids (Poster)Neural Networks on Steroids (Poster)
Neural Networks on Steroids (Poster)
 
Stefano Giordano
Stefano GiordanoStefano Giordano
Stefano Giordano
 
Stefano Giordano
Stefano  GiordanoStefano  Giordano
Stefano Giordano
 
Wireshark lab getting started one’s unde
Wireshark lab  getting started     one’s undeWireshark lab  getting started     one’s unde
Wireshark lab getting started one’s unde
 
Plenzogan technology
Plenzogan technologyPlenzogan technology
Plenzogan technology
 
maXbox Starter87
maXbox Starter87maXbox Starter87
maXbox Starter87
 
Wireshark Lab Getting Started v6.0 Supplement to Co.docx
Wireshark Lab  Getting Started v6.0  Supplement to Co.docxWireshark Lab  Getting Started v6.0  Supplement to Co.docx
Wireshark Lab Getting Started v6.0 Supplement to Co.docx
 
IRJET- Tracking Communication Quality Degrading Events for Link Quality E...
IRJET-  	  Tracking Communication Quality Degrading Events for Link Quality E...IRJET-  	  Tracking Communication Quality Degrading Events for Link Quality E...
IRJET- Tracking Communication Quality Degrading Events for Link Quality E...
 
Deep learning (2)
Deep learning (2)Deep learning (2)
Deep learning (2)
 
WiMAX implementation in ns3
WiMAX implementation in ns3WiMAX implementation in ns3
WiMAX implementation in ns3
 
Report of TCP/IP
Report of TCP/IPReport of TCP/IP
Report of TCP/IP
 
Cisco doc
Cisco docCisco doc
Cisco doc
 

Último

CALL ON ➥8923113531 🔝Call Girls Adil Nagar Lucknow best Female service
CALL ON ➥8923113531 🔝Call Girls Adil Nagar Lucknow best Female serviceCALL ON ➥8923113531 🔝Call Girls Adil Nagar Lucknow best Female service
CALL ON ➥8923113531 🔝Call Girls Adil Nagar Lucknow best Female serviceanilsa9823
 
Pokemon Go... Unraveling the Conspiracy Theory
Pokemon Go... Unraveling the Conspiracy TheoryPokemon Go... Unraveling the Conspiracy Theory
Pokemon Go... Unraveling the Conspiracy Theorydrae5
 
CALL ON ➥8923113531 🔝Call Girls Jankipuram Lucknow best sexual service
CALL ON ➥8923113531 🔝Call Girls Jankipuram Lucknow best sexual serviceCALL ON ➥8923113531 🔝Call Girls Jankipuram Lucknow best sexual service
CALL ON ➥8923113531 🔝Call Girls Jankipuram Lucknow best sexual serviceanilsa9823
 
2k Shots ≽ 9205541914 ≼ Call Girls In Palam (Delhi)
2k Shots ≽ 9205541914 ≼ Call Girls In Palam (Delhi)2k Shots ≽ 9205541914 ≼ Call Girls In Palam (Delhi)
2k Shots ≽ 9205541914 ≼ Call Girls In Palam (Delhi)Delhi Call girls
 
9892124323, Call Girls in mumbai, Vashi Call Girls , Kurla Call girls
9892124323, Call Girls in mumbai, Vashi Call Girls , Kurla Call girls9892124323, Call Girls in mumbai, Vashi Call Girls , Kurla Call girls
9892124323, Call Girls in mumbai, Vashi Call Girls , Kurla Call girlsPooja Nehwal
 
Introducing to billionaire brain wave.pdf
Introducing to billionaire brain wave.pdfIntroducing to billionaire brain wave.pdf
Introducing to billionaire brain wave.pdfnoumannajam04
 
2k Shots ≽ 9205541914 ≼ Call Girls In Dashrath Puri (Delhi)
2k Shots ≽ 9205541914 ≼ Call Girls In Dashrath Puri (Delhi)2k Shots ≽ 9205541914 ≼ Call Girls In Dashrath Puri (Delhi)
2k Shots ≽ 9205541914 ≼ Call Girls In Dashrath Puri (Delhi)Delhi Call girls
 
8377087607 Full Enjoy @24/7-CLEAN-Call Girls In Chhatarpur,
8377087607 Full Enjoy @24/7-CLEAN-Call Girls In Chhatarpur,8377087607 Full Enjoy @24/7-CLEAN-Call Girls In Chhatarpur,
8377087607 Full Enjoy @24/7-CLEAN-Call Girls In Chhatarpur,dollysharma2066
 
2k Shots ≽ 9205541914 ≼ Call Girls In Mukherjee Nagar (Delhi)
2k Shots ≽ 9205541914 ≼ Call Girls In Mukherjee Nagar (Delhi)2k Shots ≽ 9205541914 ≼ Call Girls In Mukherjee Nagar (Delhi)
2k Shots ≽ 9205541914 ≼ Call Girls In Mukherjee Nagar (Delhi)Delhi Call girls
 
LC_YouSaidYes_NewBelieverBookletDone.pdf
LC_YouSaidYes_NewBelieverBookletDone.pdfLC_YouSaidYes_NewBelieverBookletDone.pdf
LC_YouSaidYes_NewBelieverBookletDone.pdfpastor83
 
Lucknow 💋 High Class Call Girls Lucknow 10k @ I'm VIP Independent Escorts Gir...
Lucknow 💋 High Class Call Girls Lucknow 10k @ I'm VIP Independent Escorts Gir...Lucknow 💋 High Class Call Girls Lucknow 10k @ I'm VIP Independent Escorts Gir...
Lucknow 💋 High Class Call Girls Lucknow 10k @ I'm VIP Independent Escorts Gir...anilsa9823
 
The Selfspace Journal Preview by Mindbrush
The Selfspace Journal Preview by MindbrushThe Selfspace Journal Preview by Mindbrush
The Selfspace Journal Preview by MindbrushShivain97
 
$ Love Spells^ 💎 (310) 882-6330 in West Virginia, WV | Psychic Reading Best B...
$ Love Spells^ 💎 (310) 882-6330 in West Virginia, WV | Psychic Reading Best B...$ Love Spells^ 💎 (310) 882-6330 in West Virginia, WV | Psychic Reading Best B...
$ Love Spells^ 💎 (310) 882-6330 in West Virginia, WV | Psychic Reading Best B...PsychicRuben LoveSpells
 
CALL ON ➥8923113531 🔝Call Girls Aliganj Lucknow best sexual service
CALL ON ➥8923113531 🔝Call Girls Aliganj Lucknow best sexual serviceCALL ON ➥8923113531 🔝Call Girls Aliganj Lucknow best sexual service
CALL ON ➥8923113531 🔝Call Girls Aliganj Lucknow best sexual serviceanilsa9823
 
Call Girls Anjuna beach Mariott Resort ₰8588052666
Call Girls Anjuna beach Mariott Resort ₰8588052666Call Girls Anjuna beach Mariott Resort ₰8588052666
Call Girls Anjuna beach Mariott Resort ₰8588052666nishakur201
 
CALL ON ➥8923113531 🔝Call Girls Mahanagar Lucknow best sexual service
CALL ON ➥8923113531 🔝Call Girls Mahanagar Lucknow best sexual serviceCALL ON ➥8923113531 🔝Call Girls Mahanagar Lucknow best sexual service
CALL ON ➥8923113531 🔝Call Girls Mahanagar Lucknow best sexual serviceanilsa9823
 
Top Rated Pune Call Girls Tingre Nagar ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated  Pune Call Girls Tingre Nagar ⟟ 6297143586 ⟟ Call Me For Genuine Se...Top Rated  Pune Call Girls Tingre Nagar ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated Pune Call Girls Tingre Nagar ⟟ 6297143586 ⟟ Call Me For Genuine Se...Call Girls in Nagpur High Profile
 
call Now 9811711561 Cash Payment乂 Call Girls in Dwarka Mor
call Now 9811711561 Cash Payment乂 Call Girls in Dwarka Morcall Now 9811711561 Cash Payment乂 Call Girls in Dwarka Mor
call Now 9811711561 Cash Payment乂 Call Girls in Dwarka Morvikas rana
 
call girls in candolim beach 9870370636] NORTH GOA ..
call girls in candolim beach 9870370636] NORTH GOA ..call girls in candolim beach 9870370636] NORTH GOA ..
call girls in candolim beach 9870370636] NORTH GOA ..nishakur201
 

Último (20)

CALL ON ➥8923113531 🔝Call Girls Adil Nagar Lucknow best Female service
CALL ON ➥8923113531 🔝Call Girls Adil Nagar Lucknow best Female serviceCALL ON ➥8923113531 🔝Call Girls Adil Nagar Lucknow best Female service
CALL ON ➥8923113531 🔝Call Girls Adil Nagar Lucknow best Female service
 
Pokemon Go... Unraveling the Conspiracy Theory
Pokemon Go... Unraveling the Conspiracy TheoryPokemon Go... Unraveling the Conspiracy Theory
Pokemon Go... Unraveling the Conspiracy Theory
 
CALL ON ➥8923113531 🔝Call Girls Jankipuram Lucknow best sexual service
CALL ON ➥8923113531 🔝Call Girls Jankipuram Lucknow best sexual serviceCALL ON ➥8923113531 🔝Call Girls Jankipuram Lucknow best sexual service
CALL ON ➥8923113531 🔝Call Girls Jankipuram Lucknow best sexual service
 
2k Shots ≽ 9205541914 ≼ Call Girls In Palam (Delhi)
2k Shots ≽ 9205541914 ≼ Call Girls In Palam (Delhi)2k Shots ≽ 9205541914 ≼ Call Girls In Palam (Delhi)
2k Shots ≽ 9205541914 ≼ Call Girls In Palam (Delhi)
 
9892124323, Call Girls in mumbai, Vashi Call Girls , Kurla Call girls
9892124323, Call Girls in mumbai, Vashi Call Girls , Kurla Call girls9892124323, Call Girls in mumbai, Vashi Call Girls , Kurla Call girls
9892124323, Call Girls in mumbai, Vashi Call Girls , Kurla Call girls
 
Introducing to billionaire brain wave.pdf
Introducing to billionaire brain wave.pdfIntroducing to billionaire brain wave.pdf
Introducing to billionaire brain wave.pdf
 
2k Shots ≽ 9205541914 ≼ Call Girls In Dashrath Puri (Delhi)
2k Shots ≽ 9205541914 ≼ Call Girls In Dashrath Puri (Delhi)2k Shots ≽ 9205541914 ≼ Call Girls In Dashrath Puri (Delhi)
2k Shots ≽ 9205541914 ≼ Call Girls In Dashrath Puri (Delhi)
 
8377087607 Full Enjoy @24/7-CLEAN-Call Girls In Chhatarpur,
8377087607 Full Enjoy @24/7-CLEAN-Call Girls In Chhatarpur,8377087607 Full Enjoy @24/7-CLEAN-Call Girls In Chhatarpur,
8377087607 Full Enjoy @24/7-CLEAN-Call Girls In Chhatarpur,
 
2k Shots ≽ 9205541914 ≼ Call Girls In Mukherjee Nagar (Delhi)
2k Shots ≽ 9205541914 ≼ Call Girls In Mukherjee Nagar (Delhi)2k Shots ≽ 9205541914 ≼ Call Girls In Mukherjee Nagar (Delhi)
2k Shots ≽ 9205541914 ≼ Call Girls In Mukherjee Nagar (Delhi)
 
LC_YouSaidYes_NewBelieverBookletDone.pdf
LC_YouSaidYes_NewBelieverBookletDone.pdfLC_YouSaidYes_NewBelieverBookletDone.pdf
LC_YouSaidYes_NewBelieverBookletDone.pdf
 
Lucknow 💋 High Class Call Girls Lucknow 10k @ I'm VIP Independent Escorts Gir...
Lucknow 💋 High Class Call Girls Lucknow 10k @ I'm VIP Independent Escorts Gir...Lucknow 💋 High Class Call Girls Lucknow 10k @ I'm VIP Independent Escorts Gir...
Lucknow 💋 High Class Call Girls Lucknow 10k @ I'm VIP Independent Escorts Gir...
 
The Selfspace Journal Preview by Mindbrush
The Selfspace Journal Preview by MindbrushThe Selfspace Journal Preview by Mindbrush
The Selfspace Journal Preview by Mindbrush
 
$ Love Spells^ 💎 (310) 882-6330 in West Virginia, WV | Psychic Reading Best B...
$ Love Spells^ 💎 (310) 882-6330 in West Virginia, WV | Psychic Reading Best B...$ Love Spells^ 💎 (310) 882-6330 in West Virginia, WV | Psychic Reading Best B...
$ Love Spells^ 💎 (310) 882-6330 in West Virginia, WV | Psychic Reading Best B...
 
CALL ON ➥8923113531 🔝Call Girls Aliganj Lucknow best sexual service
CALL ON ➥8923113531 🔝Call Girls Aliganj Lucknow best sexual serviceCALL ON ➥8923113531 🔝Call Girls Aliganj Lucknow best sexual service
CALL ON ➥8923113531 🔝Call Girls Aliganj Lucknow best sexual service
 
Call Girls Anjuna beach Mariott Resort ₰8588052666
Call Girls Anjuna beach Mariott Resort ₰8588052666Call Girls Anjuna beach Mariott Resort ₰8588052666
Call Girls Anjuna beach Mariott Resort ₰8588052666
 
CALL ON ➥8923113531 🔝Call Girls Mahanagar Lucknow best sexual service
CALL ON ➥8923113531 🔝Call Girls Mahanagar Lucknow best sexual serviceCALL ON ➥8923113531 🔝Call Girls Mahanagar Lucknow best sexual service
CALL ON ➥8923113531 🔝Call Girls Mahanagar Lucknow best sexual service
 
Top Rated Pune Call Girls Tingre Nagar ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated  Pune Call Girls Tingre Nagar ⟟ 6297143586 ⟟ Call Me For Genuine Se...Top Rated  Pune Call Girls Tingre Nagar ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated Pune Call Girls Tingre Nagar ⟟ 6297143586 ⟟ Call Me For Genuine Se...
 
call Now 9811711561 Cash Payment乂 Call Girls in Dwarka Mor
call Now 9811711561 Cash Payment乂 Call Girls in Dwarka Morcall Now 9811711561 Cash Payment乂 Call Girls in Dwarka Mor
call Now 9811711561 Cash Payment乂 Call Girls in Dwarka Mor
 
call girls in candolim beach 9870370636] NORTH GOA ..
call girls in candolim beach 9870370636] NORTH GOA ..call girls in candolim beach 9870370636] NORTH GOA ..
call girls in candolim beach 9870370636] NORTH GOA ..
 
(Aarini) Russian Call Girls Surat Call Now 8250077686 Surat Escorts 24x7
(Aarini) Russian Call Girls Surat Call Now 8250077686 Surat Escorts 24x7(Aarini) Russian Call Girls Surat Call Now 8250077686 Surat Escorts 24x7
(Aarini) Russian Call Girls Surat Call Now 8250077686 Surat Escorts 24x7
 

Scapy - communication on Layer2

  • 1. Date of delivery: Supervisor: 00-00-2011 Morten Bo Nielsen School: Group: Erhvervsakademiet Lillebælt Victor 1st semester IT Networking Flaviu Lucian
  • 2. Table of Contents Introduction..........................................................................................................................................1 System overview..................................................................................................................................2 Basic overview.................................................................................................................................2 Creating-sending-sniffing schematics..............................................................................................3 Packet crafting......................................................................................................................................4 Sending, receving and sniffing.............................................................................................................5 Conclusion............................................................................................................................................8
  • 3. Networking Scapy – Communication on Layer 2 Introduction The purpose of this exercise is to make our PCs communicate on the second layer (Data-Link). For this, the manual creation of a ethernet package, sending it, receiveing it and sniffing it, was required. Also, the only programs used must be Scapy and eventually Wireshark. 1
  • 4. Networking Scapy – Communication on Layer 2 System overview Basic overview The two pc's that are part of this exercise are sharing the same subnet, as we can se in the picture above. 2
  • 5. Networking Scapy – Communication on Layer 2 Creating-sending-sniffing schematics The diagram bellow explains for itself the main operations in this exercise – creating, sending and sniffing packets. Details for each operations can be found in the next pages. 3
  • 6. Networking Scapy – Communication on Layer 2 Packet crafting This is how an ethernet packet looks like : When manually building an ethernet package we should consider adding those elements manually, like in the picture bellow: – a is a variable which we've made it into an ethernet frame – a.src represents the source mac address , in this case Victors' – a.dst represents the destination macc address, in this case Flavius' – a.type represents the ethertype, in this case being 0x8088 due to a common class decision – data is the data we want to send, in this case the "blablabla" text – b is another variable in which we join our initial variable (a) with the data we want to send 4
  • 7. Networking Scapy – Communication on Layer 2 Sending, receving and sniffing To send a package the sendp command is required, with the following parameters: – b : the packet we want to send – count : how many times we want to send that packet – iface : this is how to specifiy through which interface the packet should be sent – by default it's eth0 To locate the sent packages we use the sniff command, which does as it says, it "sniffs", as we can see in the following picture: The parameters used are : – count : this will make it sniff the last X packages that are being sent or received, in this case 20 – prn : is the print function, it will print what it will sniff like in the picture – x:x.summary(): is a scapy function that together with the prn parameters prints in a predefined format 5
  • 8. Networking Scapy – Communication on Layer 2 When using the lambda x:x.show() function instead of lambda x:x.summary(), the result looks like in the picture bellow : As we can see, the manually added data ("blablabla" – see page4) is is named "load", under the Raw section of the packet. The same thing we can see in wireshark : By filtering using the destination mac address, we can easily spot the sent packages, source and destination mac addresses and the data, in this case "blablabla" (highlighted in the bottom-right of the picture). 6
  • 9. Networking Scapy – Communication on Layer 2 In order to print the content of the packets we can use two methods. One may be with creating a python script, like the one in the picture bellow. The output for the script will look like the picture bellow : The other method is through the lfilter parameter of the sniff command. The whole command is : sniff(prn=lambda x: "from %s : %s" %(x.src, x['Raw'].load), lfilter=lambda x: x.haslayer(Ether) and x.fields['type'] == 0x8088) A lambda function was used to filter the sniffed packet, so that it will print only the packets with an Ether layer (haslayer(Ether)) and with the 0x8088 data type. 7
  • 10. Networking Scapy – Communication on Layer 2 Conclusion Scapy is a very powerfull packet-manipulation tool, and with its help we have demonstrated that almost any kind of data can be inserted into an ethernet packet. In this case we have inserted a simple string("blablabla"). For larger chunks of data, it is required to "chop" the data into smaller pieces that could fit into a packet. 8