SlideShare una empresa de Scribd logo
1 de 49
Introduction to the BitTorrent Protocol Tommy Montgomery // March 2, 2010
What is BitTorrent?
What is BitTorrent? NOT illegal
What is BitTorrent? NOT illegal Peer-to-peer (P2P) file transfer
What is BitTorrent? NOT illegal Peer-to-peer (P2P) file transfer Awesome
What is BitTorrent? NOT illegal Peer-to-peer (P2P) file transfer Awesome
Poppycock! BitTorrent historically has a bad reputation, due to its decentralized method of file transfer This makes it difficult to “remove” a download, such as one that is illegal BitTorrent is not inherently evil People are inherently evil I like bullet points
How does it work?
How does it work:  Consumer Download torrent:  lots-o-cool-stuff-n-things.lulz.torrent Open it in your favorite client:
How does it work Files are downloaded piecemeal, from many different places instead of just one Trackers are the central hub of control for each torrent Each tracker manages your “peers”, which are other people who are trying to download the same file
Glossary
Glossary Seeder
Glossary Seeder Someone who has finished downloading and is only uploading
Glossary Seeder Someone who has finished downloading and is only uploading Leecher
Glossary Seeder Someone who has finished downloading and is only uploading Leecher Someone who is downloading
Glossary Seeder Someone who has finished downloading and is only uploading Leecher Someone who is downloading Peer
Glossary Seeder Someone who has finished downloading and is only uploading Leecher Someone who is downloading Peer The collective term for seeders and leechers
What is a torrent file? A Bencoded metadata file containing information about one or more files Name/size/date of each file # of “pieces” of each file SHA1 hash of each piece Trackers for the torrent
What is a “piece”? Torrents are made up of many small pieces You never download all the pieces from one place (unless there’s only one seed) Pieces are usually less than a couple megabytes each
Bencoding Dictionaries Prefixed with “d”, end with “e” Lists Prefixed with “l”, end with “e” Integers Prefixed with “i”, end with “e” Strings Prefixed with string length + “:”
Bencoding d3:foo3:bar4:lulzi8el5:hello5:worldee
Bencoding d3:foo3:bar4:lulzi8el5:hello5:worldee ,[object Object],[object Object]
String,[object Object]
String
Integer,[object Object]
String
Integer
List,[object Object]
Trackers HTTP service that responds to GET requests Response is text/plain Bencoded dictionary Usually listens on port 6969
Tracker Announce Request Usually has a billion GET params: info_hash peer_id port uploaded downloaded left compact no_peer_id event ip numwant key trackerid
Tracker Announce Request Important GET params: info_hash the SHA1 hash of the piece to download peer_id unique identifier of the person doing the downloading ip/port the IP address and port of the peer uploaded/downloaded/left used for calculating “share ratio”, i.e. how much the tracker likes them
Tracker Announce Response A Bencoded dictionary with these keys: complete incomplete tracker id (yes, that is a space) peers warning message failure reason (only if an error occurred) interval min interval
Tracker Announce Response The relevant parts: peers Dictionary containing each peer’s IP address and port Or, if the client wants it compact, a binary string of each peer’s IP address and port interval/min interval the interval in seconds which the client is allowed to make a request complete/incomplete number of seeders/leechers
Tracker Implementation PHP/MySQL/Apache Why not?
First, of course… We need a Bencoding library. Let’s roll our own.
yay.
It’s tracker time We need a way to keep track of peers, and who’s downloaded what and stuff Let’s use MySQL
It’s tracker time Request is pretty boring, as it’s just a glorified array with error handling
It’s tracker time Response is a Bencoded dictionary, and is also a glorified array
It’s tracker time Now we can set up an exception handler that will send a proper response back in the event of a catastrophe
It’s tracker time Now we can make the tracker announce the peers
Set up the torrent Now, stuff your tracker on a server somewhere, listen on port 6969 Then add your tracker’s announce URL to a torrent e.g. http://likeaboss.biz:6969/announce
Other stuff Trackers are also facilitators and the supreme overlords over the torrents they track The list of peers that gets sent back to the client determines who downloads from whom They will use download/upload statistics to determine who isn’t uploading/seeding, and punish them by giving them crappy peers
Open source trackers OpenTracker (used by what’s left of The Pirate Bay) XBT Tracker – implemented using UDP instead of HTTP for ultimate efficiency MonoTorrent – cross-platform C# implementation (client as well) PeerTracker – PHP 5 implementation

Más contenido relacionado

La actualidad más candente

Bit Torrent presentation
Bit Torrent presentationBit Torrent presentation
Bit Torrent presentationAvula Jagadeesh
 
Bit torrent-technology
Bit torrent-technologyBit torrent-technology
Bit torrent-technologyabhipesit
 
Bit torrent protocol by milan varia
Bit torrent protocol by milan variaBit torrent protocol by milan varia
Bit torrent protocol by milan variaMilan Varia
 
Bit torrent Technology ppt
Bit torrent Technology pptBit torrent Technology ppt
Bit torrent Technology pptAkshay K Sajan
 
UNRAVEILING BIT-TORRENT
UNRAVEILING BIT-TORRENTUNRAVEILING BIT-TORRENT
UNRAVEILING BIT-TORRENTSudhansu Dash
 
Torrent Protocol
Torrent ProtocolTorrent Protocol
Torrent ProtocolHarsht2888
 
Bit torrent protocol
Bit torrent protocolBit torrent protocol
Bit torrent protocolKarwan Jacksi
 
Bit torrent seminar
Bit torrent seminarBit torrent seminar
Bit torrent seminarbalu0503
 
Bit Torrent Protocol Report
Bit Torrent Protocol ReportBit Torrent Protocol Report
Bit Torrent Protocol ReportSridharBR
 
Bittorrent final seminar
Bittorrent final seminarBittorrent final seminar
Bittorrent final seminarChirodeep Das
 
Bit torrent documentation
Bit torrent documentationBit torrent documentation
Bit torrent documentationAvula Jagadeesh
 
Torrent Seminar inc.- working, terms, details
Torrent Seminar inc.- working, terms, detailsTorrent Seminar inc.- working, terms, details
Torrent Seminar inc.- working, terms, detailsMayur Kathale
 

La actualidad más candente (20)

Bit Torrent presentation
Bit Torrent presentationBit Torrent presentation
Bit Torrent presentation
 
Bit torrent-technology
Bit torrent-technologyBit torrent-technology
Bit torrent-technology
 
Bit torrent protocol by milan varia
Bit torrent protocol by milan variaBit torrent protocol by milan varia
Bit torrent protocol by milan varia
 
Bit torrent Technology ppt
Bit torrent Technology pptBit torrent Technology ppt
Bit torrent Technology ppt
 
Torrent
TorrentTorrent
Torrent
 
UNRAVEILING BIT-TORRENT
UNRAVEILING BIT-TORRENTUNRAVEILING BIT-TORRENT
UNRAVEILING BIT-TORRENT
 
Bit Torrent
Bit Torrent Bit Torrent
Bit Torrent
 
Bit torrent
Bit torrentBit torrent
Bit torrent
 
Torrent Protocol
Torrent ProtocolTorrent Protocol
Torrent Protocol
 
Bittorrent
BittorrentBittorrent
Bittorrent
 
Bittorrent
BittorrentBittorrent
Bittorrent
 
Bit torrent protocol
Bit torrent protocolBit torrent protocol
Bit torrent protocol
 
Bit torrent seminar
Bit torrent seminarBit torrent seminar
Bit torrent seminar
 
Bit Torrent Protocol Report
Bit Torrent Protocol ReportBit Torrent Protocol Report
Bit Torrent Protocol Report
 
Torrent technology
Torrent technologyTorrent technology
Torrent technology
 
Bittorrent final seminar
Bittorrent final seminarBittorrent final seminar
Bittorrent final seminar
 
Bit torrent documentation
Bit torrent documentationBit torrent documentation
Bit torrent documentation
 
Torrent Seminar inc.- working, terms, details
Torrent Seminar inc.- working, terms, detailsTorrent Seminar inc.- working, terms, details
Torrent Seminar inc.- working, terms, details
 
BitTorrent Seminar Report
BitTorrent Seminar ReportBitTorrent Seminar Report
BitTorrent Seminar Report
 
Torrents
TorrentsTorrents
Torrents
 

Similar a Introduction to the Bittorrent Protocol

Similar a Introduction to the Bittorrent Protocol (20)

The big book of bit torrent
The big book of bit torrentThe big book of bit torrent
The big book of bit torrent
 
Bit torrent protocol seminar by Sanjay R
Bit torrent protocol seminar by Sanjay RBit torrent protocol seminar by Sanjay R
Bit torrent protocol seminar by Sanjay R
 
Aditya Pathak
Aditya PathakAditya Pathak
Aditya Pathak
 
P2P: Grid-oriented Distribution Systems
P2P: Grid-oriented Distribution SystemsP2P: Grid-oriented Distribution Systems
P2P: Grid-oriented Distribution Systems
 
Bittorrent_project_Srikanth_Vanama
Bittorrent_project_Srikanth_VanamaBittorrent_project_Srikanth_Vanama
Bittorrent_project_Srikanth_Vanama
 
(130316) #fitalk bit torrent protocol
(130316) #fitalk   bit torrent protocol(130316) #fitalk   bit torrent protocol
(130316) #fitalk bit torrent protocol
 
Bit torrent protocol
Bit torrent protocolBit torrent protocol
Bit torrent protocol
 
Bittorrent
BittorrentBittorrent
Bittorrent
 
Bittorrent
BittorrentBittorrent
Bittorrent
 
Bittorrent
BittorrentBittorrent
Bittorrent
 
Bittorrent
BittorrentBittorrent
Bittorrent
 
Bit torrent and tracker
Bit torrent and trackerBit torrent and tracker
Bit torrent and tracker
 
P2P Seminar
P2P SeminarP2P Seminar
P2P Seminar
 
Bittorrent
BittorrentBittorrent
Bittorrent
 
Bit torrent
Bit torrentBit torrent
Bit torrent
 
Bittorrent
BittorrentBittorrent
Bittorrent
 
Bit torrent by SANDA SOLUTIONS
Bit torrent by SANDA SOLUTIONSBit torrent by SANDA SOLUTIONS
Bit torrent by SANDA SOLUTIONS
 
Peer to Peer networks and piracy
Peer to Peer networks and piracyPeer to Peer networks and piracy
Peer to Peer networks and piracy
 
BitTorrent.pdf
BitTorrent.pdfBitTorrent.pdf
BitTorrent.pdf
 
Bit Torrent Protocol
Bit Torrent ProtocolBit Torrent Protocol
Bit Torrent Protocol
 

Último

Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Enterprise Knowledge
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Scott Keck-Warren
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024Stephanie Beckett
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxLoriGlavin3
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .Alan Dix
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionDilum Bandara
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyAlfredo García Lavilla
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity PlanDatabarracks
 

Último (20)

Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An Introduction
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easy
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity Plan
 

Introduction to the Bittorrent Protocol

  • 1. Introduction to the BitTorrent Protocol Tommy Montgomery // March 2, 2010
  • 3. What is BitTorrent? NOT illegal
  • 4. What is BitTorrent? NOT illegal Peer-to-peer (P2P) file transfer
  • 5. What is BitTorrent? NOT illegal Peer-to-peer (P2P) file transfer Awesome
  • 6. What is BitTorrent? NOT illegal Peer-to-peer (P2P) file transfer Awesome
  • 7. Poppycock! BitTorrent historically has a bad reputation, due to its decentralized method of file transfer This makes it difficult to “remove” a download, such as one that is illegal BitTorrent is not inherently evil People are inherently evil I like bullet points
  • 8. How does it work?
  • 9. How does it work: Consumer Download torrent: lots-o-cool-stuff-n-things.lulz.torrent Open it in your favorite client:
  • 10. How does it work Files are downloaded piecemeal, from many different places instead of just one Trackers are the central hub of control for each torrent Each tracker manages your “peers”, which are other people who are trying to download the same file
  • 13. Glossary Seeder Someone who has finished downloading and is only uploading
  • 14. Glossary Seeder Someone who has finished downloading and is only uploading Leecher
  • 15. Glossary Seeder Someone who has finished downloading and is only uploading Leecher Someone who is downloading
  • 16. Glossary Seeder Someone who has finished downloading and is only uploading Leecher Someone who is downloading Peer
  • 17. Glossary Seeder Someone who has finished downloading and is only uploading Leecher Someone who is downloading Peer The collective term for seeders and leechers
  • 18. What is a torrent file? A Bencoded metadata file containing information about one or more files Name/size/date of each file # of “pieces” of each file SHA1 hash of each piece Trackers for the torrent
  • 19. What is a “piece”? Torrents are made up of many small pieces You never download all the pieces from one place (unless there’s only one seed) Pieces are usually less than a couple megabytes each
  • 20. Bencoding Dictionaries Prefixed with “d”, end with “e” Lists Prefixed with “l”, end with “e” Integers Prefixed with “i”, end with “e” Strings Prefixed with string length + “:”
  • 22.
  • 23.
  • 25.
  • 28.
  • 29. Trackers HTTP service that responds to GET requests Response is text/plain Bencoded dictionary Usually listens on port 6969
  • 30. Tracker Announce Request Usually has a billion GET params: info_hash peer_id port uploaded downloaded left compact no_peer_id event ip numwant key trackerid
  • 31. Tracker Announce Request Important GET params: info_hash the SHA1 hash of the piece to download peer_id unique identifier of the person doing the downloading ip/port the IP address and port of the peer uploaded/downloaded/left used for calculating “share ratio”, i.e. how much the tracker likes them
  • 32. Tracker Announce Response A Bencoded dictionary with these keys: complete incomplete tracker id (yes, that is a space) peers warning message failure reason (only if an error occurred) interval min interval
  • 33. Tracker Announce Response The relevant parts: peers Dictionary containing each peer’s IP address and port Or, if the client wants it compact, a binary string of each peer’s IP address and port interval/min interval the interval in seconds which the client is allowed to make a request complete/incomplete number of seeders/leechers
  • 35. First, of course… We need a Bencoding library. Let’s roll our own.
  • 36.
  • 37. yay.
  • 38. It’s tracker time We need a way to keep track of peers, and who’s downloaded what and stuff Let’s use MySQL
  • 39.
  • 40. It’s tracker time Request is pretty boring, as it’s just a glorified array with error handling
  • 41. It’s tracker time Response is a Bencoded dictionary, and is also a glorified array
  • 42.
  • 43. It’s tracker time Now we can set up an exception handler that will send a proper response back in the event of a catastrophe
  • 44. It’s tracker time Now we can make the tracker announce the peers
  • 45.
  • 46.
  • 47. Set up the torrent Now, stuff your tracker on a server somewhere, listen on port 6969 Then add your tracker’s announce URL to a torrent e.g. http://likeaboss.biz:6969/announce
  • 48. Other stuff Trackers are also facilitators and the supreme overlords over the torrents they track The list of peers that gets sent back to the client determines who downloads from whom They will use download/upload statistics to determine who isn’t uploading/seeding, and punish them by giving them crappy peers
  • 49. Open source trackers OpenTracker (used by what’s left of The Pirate Bay) XBT Tracker – implemented using UDP instead of HTTP for ultimate efficiency MonoTorrent – cross-platform C# implementation (client as well) PeerTracker – PHP 5 implementation
  • 50. In short… Unless you want to implement some weird rules for who gets to download stuff, don’t write your own. I only did it for fun. Because it’s fun.