SlideShare uma empresa Scribd logo
1 de 35
Hearthstone: an analysis of game network protocols
Andrea Del Fiandra & Marco Cuciniello
MILAN 25-26 NOVEMBER 2016
Wow
Such surprise
Very unpredictable
What are google protocol buffers?
• data serialization format
• flexible and efficient
• easily portable
How do protocol buffers work?
message Person {
required string name = 1;
required int32 id = 2;
optional string email = 3;
enum PhoneType {
MOBILE = 0;
HOME = 1;
WORK = 2;
}
message PhoneNumber {
required string number = 1;
optional PhoneType type = 2 [default = HOME];
}
repeated PhoneNumber phone = 4;
}
Games using protocol buffers
github.com/Armax/Pokemon-GO-node-api
github.com/Armax/Elix
Back to Hearthstone
halp pls
Time for decompilation
How to extract .proto files
github.com/HearthSim/proto-extractor
Packets used during a Hearthstone match
{
"1": "GetGameState",
"2": "ChooseOption",
"3": "ChooseEntities",
"11": "Concede",
"13": "EntitiesChosen",
"14": "AllOptions",
"15": "UserUI",
"16": "GameSetup",
"17": "EntityChoices",
"19": "PowerHistory",
"24": "SpectatorNotify",
"115": "Ping",
"116": "Pong",
"168": "Handshake"
}
Packets used during a Hearthstone match
Handshake
message Handshake {
enum PacketID {
ID = 168;
}
required int32 game_handle = 1;
required string password = 2;
required int64 client_handle = 3;
optional int32 mission = 4;
required string version = 5;
required PegasusShared.Platform platform = 7;
}
Packets used during a Hearthstone match
GameSetup
message GameSetup {
enum PacketID {
ID = 16;
}
required int32 board = 1;
required int32 max_secrets_per_player = 2;
required int32 max_friendly_minions_per_player = 3;
optional int32 keep_alive_frequency_seconds = 4;
optional int32 disconnect_when_stuck_seconds = 5;
}
Packets used during a Hearthstone match
Ping & Pong
message Ping {
enum PacketID {
ID = 115;
}
}
message Pong {
enum PacketID {
ID = 116;
}
}
Packets used during a Hearthstone match
PowerHistory
message PowerHistory {
enum PacketID {
ID = 19;
}
repeated PowerHistoryData list = 1;
}
message PowerHistoryData {
optional PowerHistoryEntity full_entity = 1;
optional PowerHistoryEntity show_entity = 2;
optional PowerHistoryHide hide_entity = 3;
optional PowerHistoryTagChange tag_change = 4;
optional PowerHistoryCreateGame create_game = 5;
optional PowerHistoryStart power_start = 6;
optional PowerHistoryEnd power_end = 7;
optional PowerHistoryMetaData meta_data = 8;
optional PowerHistoryEntity change_entity = 9;
Packets used during a Hearthstone match
PowerHistoryEntity
message PowerHistoryEntity {
required int32 entity = 1;
required string name = 2;
repeated Tag tags = 3;
}
Packets used during a Hearthstone match
EntityChoices
message EntityChoices {
enum PacketID {
ID = 17;
}
required int32 id = 1;
required int32 choice_type = 2;
required int32 count_min = 4;
required int32 count_max = 5;
repeated int32 entities = 6 [packed = true];
optional int32 source = 7;
required int32 player_id = 8;
}
Implementation
Demo Time
What we learnt
Encryption
Encryption
Encryption
// Modules
var ProtoBuf = require('protobufjs');
var PegasusPacket = require('./pegasuspacket').PegasusPacket;
var net = require('net');
var client = new net.Socket();
var builder = ProtoBuf.loadProtoFile(__dirname + '/proto/game.proto');
var PegasusGame = builder.build();
var serverIp = "127.0.0.1"
var handshake = "qAAAAFkAAAAIpoKkChIGY0RnZ2xvGLmgmQIgggIqBjI4OTYwNjo6CAIQBBoOTWFjQm9va1BybzExLDUqJEJBQTVGNzV
handshake.game_handle = 1;
// Crafting ping packet
var ping = new PegasusGame.PegasusGame.Ping();
var encoded_ping = PegasusGame.PegasusGame.Ping.encode(ping);
var type = PegasusGame.PegasusGame.Ping.PacketID.ID;
var pegasus_ping = new PegasusPacket();
var encoded_pegasus_ping = pegasus_ping.Encode(encoded_ping, type);
// Craft USERUI packet
var userui = new PegasusGame.PegasusGame.UserUI();
userui.mouse_info = null;
userui.emote = 4;
userui.player_id = null;
var encoded_userui = PegasusGame.PegasusGame.UserUI.encode(userui);
var type_userui = PegasusGame.PegasusGame.UserUI.PacketID.ID;
var pegasus_userui = new PegasusPacket();
var encoded_pegasus_userui = pegasus_ping.Encode(encoded_userui, type_userui);
client.connect(3724, serverIp, function() {
client.write(Buffer.from(args.options.handshake, 'base64'));
setInterval(function() {
console.log("[+] ping sent");
client.write(encoded_pegasus_ping);
}, 5000);
setInterval(function() {
client.write(encoded_pegasus_userui);
}, 1000);
net.createServer(function(sock) {
console.log('[+] connection from: ' + sock.remoteAddress +':'+ sock.remotePort);
sock.on('data', function(data) {
var pegasuspacket = new PegasusPacket();
var bytes_decoded = pegasuspacket.Decode(data, 0, data.length);
if(bytes_decoded >= 4) {
var decoded = Hearthnode.Decode(pegasuspacket);
if(decoded != null && decoded != "unimplemented") {
// Handling
console.log(pegasuspacket.Type);
switch(pegasuspacket.Type) {
// Handshake
case 168:
console.log("[i] Received handshake from client");
console.log(decoded);
// Reply with GameSetup
var GameSetup = new PegasusGame.PegasusGame.GameSetup();
GameSetup.board = 6;
GameSetup.max_secrets_per_player = 5;
GameSetup.max_friendly_minions_per_player = 7;
GameSetup.keep_alive_frequency_seconds = 5;
GameSetup.disconnect_when_stuck_seconds = 25;
var encoded_GameSetup = PegasusGame.PegasusGame.GameSetup.encode(GameSetup);
var type = PegasusGame.PegasusGame.GameSetup.PacketID.ID;
var pegasus_GameSetup = new PegasusPacket();
var encoded_pegasus_GameSetup = pegasus_GameSetup.Encode(encoded_GameSetup, type);
sock.write(encoded_pegasus_GameSetup);
break;
case 115:
// Crafting ping packet
console.log("[i] Received ping from client");
console.log(decoded)
var Pong = new PegasusGame.PegasusGame.Pong();
var encoded_Pong = PegasusGame.PegasusGame.Pong.encode(Pong);
var type = PegasusGame.PegasusGame.Pong.PacketID.ID;
var pegasus_Pong = new PegasusPacket();
var encoded_pegasus_Pong = pegasus_ping.Encode(encoded_Pong, type);
sock.write(encoded_pegasus_Pong);
break;
case 15:
// Received UserUI
console.log("[i] Received UserUI");
console.log(decoded);
Demo Time
Server / Client
Q & A Time!
Thanks for your attention
Marco Cuciniello - arm4x@becreatives.com
Andrea Del Fiandra - delfioh@gmail.com

Mais conteúdo relacionado

Mais procurados

ASP.NET과 C#으로 개발하는 대규모 소셜 게임
ASP.NET과 C#으로 개발하는 대규모 소셜 게임ASP.NET과 C#으로 개발하는 대규모 소셜 게임
ASP.NET과 C#으로 개발하는 대규모 소셜 게임
흥배 최
 

Mais procurados (20)

[IGC 2017] 아마존 구승모 - 게임 엔진으로 서버 제작 및 운영까지
[IGC 2017] 아마존 구승모 - 게임 엔진으로 서버 제작 및 운영까지[IGC 2017] 아마존 구승모 - 게임 엔진으로 서버 제작 및 운영까지
[IGC 2017] 아마존 구승모 - 게임 엔진으로 서버 제작 및 운영까지
 
[IGC2018] 청강대 이득우 - 언리얼에디터확장을위해알아야할것들
[IGC2018] 청강대 이득우 - 언리얼에디터확장을위해알아야할것들[IGC2018] 청강대 이득우 - 언리얼에디터확장을위해알아야할것들
[IGC2018] 청강대 이득우 - 언리얼에디터확장을위해알아야할것들
 
[C++ Korea 3rd Seminar] 새 C++은 새 Visual Studio에, 좌충우돌 마이그레이션 이야기
[C++ Korea 3rd Seminar] 새 C++은 새 Visual Studio에, 좌충우돌 마이그레이션 이야기[C++ Korea 3rd Seminar] 새 C++은 새 Visual Studio에, 좌충우돌 마이그레이션 이야기
[C++ Korea 3rd Seminar] 새 C++은 새 Visual Studio에, 좌충우돌 마이그레이션 이야기
 
[2013 CodeEngn Conference 09] Park.Sam - 게임 해킹툴의 변칙적 공격 기법 분석
[2013 CodeEngn Conference 09] Park.Sam - 게임 해킹툴의 변칙적 공격 기법 분석[2013 CodeEngn Conference 09] Park.Sam - 게임 해킹툴의 변칙적 공격 기법 분석
[2013 CodeEngn Conference 09] Park.Sam - 게임 해킹툴의 변칙적 공격 기법 분석
 
ASP.NET과 C#으로 개발하는 대규모 소셜 게임
ASP.NET과 C#으로 개발하는 대규모 소셜 게임ASP.NET과 C#으로 개발하는 대규모 소셜 게임
ASP.NET과 C#으로 개발하는 대규모 소셜 게임
 
메이플스토리 사례를 통해 살펴보는 서버사이드 봇/핵 탐지 시스템
메이플스토리 사례를 통해 살펴보는 서버사이드 봇/핵 탐지 시스템 메이플스토리 사례를 통해 살펴보는 서버사이드 봇/핵 탐지 시스템
메이플스토리 사례를 통해 살펴보는 서버사이드 봇/핵 탐지 시스템
 
Mobile Application Design & Development
Mobile Application Design & DevelopmentMobile Application Design & Development
Mobile Application Design & Development
 
KGC 2016: HTTPS 로 모바일 게임 서버 구축한다는 것 - Korea Games Conference
KGC 2016: HTTPS 로 모바일 게임 서버 구축한다는 것 - Korea Games ConferenceKGC 2016: HTTPS 로 모바일 게임 서버 구축한다는 것 - Korea Games Conference
KGC 2016: HTTPS 로 모바일 게임 서버 구축한다는 것 - Korea Games Conference
 
Pubg topic
Pubg topicPubg topic
Pubg topic
 
What are Push Notifications?
What are Push Notifications?What are Push Notifications?
What are Push Notifications?
 
Android.ppt
Android.pptAndroid.ppt
Android.ppt
 
[야생의 땅: 듀랑고] 서버 아키텍처 - SPOF 없는 분산 MMORPG 서버
[야생의 땅: 듀랑고] 서버 아키텍처 - SPOF 없는 분산 MMORPG 서버[야생의 땅: 듀랑고] 서버 아키텍처 - SPOF 없는 분산 MMORPG 서버
[야생의 땅: 듀랑고] 서버 아키텍처 - SPOF 없는 분산 MMORPG 서버
 
프로그래머스 프론트엔드 아키텍처 변천사: 좋은 개발 경험을 찾아서
프로그래머스 프론트엔드 아키텍처 변천사: 좋은 개발 경험을 찾아서프로그래머스 프론트엔드 아키텍처 변천사: 좋은 개발 경험을 찾아서
프로그래머스 프론트엔드 아키텍처 변천사: 좋은 개발 경험을 찾아서
 
Mobile Programming
Mobile Programming Mobile Programming
Mobile Programming
 
mobile Os
mobile Osmobile Os
mobile Os
 
Unity - Game Engine
Unity - Game EngineUnity - Game Engine
Unity - Game Engine
 
Unreal animation system
Unreal animation systemUnreal animation system
Unreal animation system
 
[160402_데브루키_박민근] UniRx 소개
[160402_데브루키_박민근] UniRx 소개[160402_데브루키_박민근] UniRx 소개
[160402_데브루키_박민근] UniRx 소개
 
그럴듯한 랜덤 생성 컨텐츠 만들기
그럴듯한 랜덤 생성 컨텐츠 만들기그럴듯한 랜덤 생성 컨텐츠 만들기
그럴듯한 랜덤 생성 컨텐츠 만들기
 
C++20 Key Features Summary
C++20 Key Features SummaryC++20 Key Features Summary
C++20 Key Features Summary
 

Destaque

Tenshi gamification for gamers march 2012
Tenshi gamification for gamers march 2012Tenshi gamification for gamers march 2012
Tenshi gamification for gamers march 2012
jonathannewth
 

Destaque (20)

8 bit e 4 toni di grigio: sviluppare giochi per Gameboy by Giovanni Simotti
8 bit e 4 toni di grigio: sviluppare giochi per Gameboy by Giovanni Simotti8 bit e 4 toni di grigio: sviluppare giochi per Gameboy by Giovanni Simotti
8 bit e 4 toni di grigio: sviluppare giochi per Gameboy by Giovanni Simotti
 
Understanding Angular 2 - Shmuela Jacobs - Codemotion Milan 2016
Understanding Angular 2 - Shmuela Jacobs - Codemotion Milan 2016Understanding Angular 2 - Shmuela Jacobs - Codemotion Milan 2016
Understanding Angular 2 - Shmuela Jacobs - Codemotion Milan 2016
 
Time to market: when a worse game is better - Mattia Traverso - Codemotion Mi...
Time to market: when a worse game is better - Mattia Traverso - Codemotion Mi...Time to market: when a worse game is better - Mattia Traverso - Codemotion Mi...
Time to market: when a worse game is better - Mattia Traverso - Codemotion Mi...
 
Human vs Bot: Giocare a Sasso-Carta-Forbici - Matteo Valoriani, Antimo Musone...
Human vs Bot: Giocare a Sasso-Carta-Forbici - Matteo Valoriani, Antimo Musone...Human vs Bot: Giocare a Sasso-Carta-Forbici - Matteo Valoriani, Antimo Musone...
Human vs Bot: Giocare a Sasso-Carta-Forbici - Matteo Valoriani, Antimo Musone...
 
Tenshi gamification for gamers march 2012
Tenshi gamification for gamers march 2012Tenshi gamification for gamers march 2012
Tenshi gamification for gamers march 2012
 
GAMERS LEAGUE 2015
GAMERS LEAGUE 2015GAMERS LEAGUE 2015
GAMERS LEAGUE 2015
 
Hololens: Primo Contatto - Marco Dal Pino - Codemotion Milan 2016
Hololens: Primo Contatto - Marco Dal Pino - Codemotion Milan 2016Hololens: Primo Contatto - Marco Dal Pino - Codemotion Milan 2016
Hololens: Primo Contatto - Marco Dal Pino - Codemotion Milan 2016
 
Android Testing Support Library: The Nitty Gritty - Zan Markan - Codemotion M...
Android Testing Support Library: The Nitty Gritty - Zan Markan - Codemotion M...Android Testing Support Library: The Nitty Gritty - Zan Markan - Codemotion M...
Android Testing Support Library: The Nitty Gritty - Zan Markan - Codemotion M...
 
Nobody likes working with you - Luigi G. Valle - Codemotion Milan 2016
Nobody likes working with you - Luigi G. Valle - Codemotion Milan 2016Nobody likes working with you - Luigi G. Valle - Codemotion Milan 2016
Nobody likes working with you - Luigi G. Valle - Codemotion Milan 2016
 
Put yourself in the appsec pipe - Paolo Perego - Codemotion Milan 2016
Put yourself in the appsec pipe - Paolo Perego - Codemotion Milan 2016Put yourself in the appsec pipe - Paolo Perego - Codemotion Milan 2016
Put yourself in the appsec pipe - Paolo Perego - Codemotion Milan 2016
 
Virtual Reality gaming: analysis of Yon Paradox development - Fabio Mosca - C...
Virtual Reality gaming: analysis of Yon Paradox development - Fabio Mosca - C...Virtual Reality gaming: analysis of Yon Paradox development - Fabio Mosca - C...
Virtual Reality gaming: analysis of Yon Paradox development - Fabio Mosca - C...
 
Keynote: Community Innovation Alaina Percival - Codemotion Milan 2016
Keynote: Community Innovation Alaina Percival - Codemotion Milan 2016Keynote: Community Innovation Alaina Percival - Codemotion Milan 2016
Keynote: Community Innovation Alaina Percival - Codemotion Milan 2016
 
Pronti per la legge sulla data protection GDPR? No Panic! - Stefano Sali, Dom...
Pronti per la legge sulla data protection GDPR? No Panic! - Stefano Sali, Dom...Pronti per la legge sulla data protection GDPR? No Panic! - Stefano Sali, Dom...
Pronti per la legge sulla data protection GDPR? No Panic! - Stefano Sali, Dom...
 
Keynote: The Most Important Thing - Mike Lee - Codemotion Milan 2016
Keynote: The Most Important Thing - Mike Lee - Codemotion Milan 2016Keynote: The Most Important Thing - Mike Lee - Codemotion Milan 2016
Keynote: The Most Important Thing - Mike Lee - Codemotion Milan 2016
 
The game design behind Redout - Giuseppe Enrico Franchi - Codemotion Milan 2016
The game design behind Redout - Giuseppe Enrico Franchi - Codemotion Milan 2016The game design behind Redout - Giuseppe Enrico Franchi - Codemotion Milan 2016
The game design behind Redout - Giuseppe Enrico Franchi - Codemotion Milan 2016
 
Milano Chatbots Meetup - Paolo Montrasio - Codemotion Milan 2016
Milano Chatbots Meetup - Paolo Montrasio - Codemotion Milan 2016Milano Chatbots Meetup - Paolo Montrasio - Codemotion Milan 2016
Milano Chatbots Meetup - Paolo Montrasio - Codemotion Milan 2016
 
Elixir and Lambda talk with a Telegram bot - Paolo Montrasio - Codemotion Mil...
Elixir and Lambda talk with a Telegram bot - Paolo Montrasio - Codemotion Mil...Elixir and Lambda talk with a Telegram bot - Paolo Montrasio - Codemotion Mil...
Elixir and Lambda talk with a Telegram bot - Paolo Montrasio - Codemotion Mil...
 
Games of Simplicity - Pozzi; Molinari - Codemotion Milan 2016
Games of Simplicity - Pozzi; Molinari - Codemotion Milan 2016Games of Simplicity - Pozzi; Molinari - Codemotion Milan 2016
Games of Simplicity - Pozzi; Molinari - Codemotion Milan 2016
 
Universal JavaScript Web Applications with React - Luciano Mammino - Codemoti...
Universal JavaScript Web Applications with React - Luciano Mammino - Codemoti...Universal JavaScript Web Applications with React - Luciano Mammino - Codemoti...
Universal JavaScript Web Applications with React - Luciano Mammino - Codemoti...
 
Public speaking 4 geeks - Lorenzo Barbieri - Codemotion Milan 2016
Public speaking 4 geeks - Lorenzo Barbieri - Codemotion Milan 2016Public speaking 4 geeks - Lorenzo Barbieri - Codemotion Milan 2016
Public speaking 4 geeks - Lorenzo Barbieri - Codemotion Milan 2016
 

Semelhante a Hearthstone: an analysis of game network protocols - Marco Cuciniello, Andrea Del Fiandra - Codemotion Milan 2016

Lab01Filesbuild.bat@echo offclsset DRIVE_LETTER=1.docx
Lab01Filesbuild.bat@echo offclsset DRIVE_LETTER=1.docxLab01Filesbuild.bat@echo offclsset DRIVE_LETTER=1.docx
Lab01Filesbuild.bat@echo offclsset DRIVE_LETTER=1.docx
DIPESH30
 
Magic Clusters and Where to Find Them 2.0 - Eugene Pirogov
Magic Clusters and Where to Find Them 2.0 - Eugene Pirogov Magic Clusters and Where to Find Them 2.0 - Eugene Pirogov
Magic Clusters and Where to Find Them 2.0 - Eugene Pirogov
Elixir Club
 
I need help building a dictionary for the unique packets tha.pdf
I need help building a dictionary for the unique packets tha.pdfI need help building a dictionary for the unique packets tha.pdf
I need help building a dictionary for the unique packets tha.pdf
sukhvir71
 
A Development of Log-based Game AI using Deep Learning
A Development of Log-based Game AI using Deep LearningA Development of Log-based Game AI using Deep Learning
A Development of Log-based Game AI using Deep Learning
Suntae Kim
 
14 key management & exchange
14   key management & exchange14   key management & exchange
14 key management & exchange
drewz lin
 
Kernel Recipes 2019 - GNU poke, an extensible editor for structured binary data
Kernel Recipes 2019 - GNU poke, an extensible editor for structured binary dataKernel Recipes 2019 - GNU poke, an extensible editor for structured binary data
Kernel Recipes 2019 - GNU poke, an extensible editor for structured binary data
Anne Nicolas
 
Final requirement in programming niperos
Final requirement in programming   niperosFinal requirement in programming   niperos
Final requirement in programming niperos
markings17
 

Semelhante a Hearthstone: an analysis of game network protocols - Marco Cuciniello, Andrea Del Fiandra - Codemotion Milan 2016 (20)

Lab01Filesbuild.bat@echo offclsset DRIVE_LETTER=1.docx
Lab01Filesbuild.bat@echo offclsset DRIVE_LETTER=1.docxLab01Filesbuild.bat@echo offclsset DRIVE_LETTER=1.docx
Lab01Filesbuild.bat@echo offclsset DRIVE_LETTER=1.docx
 
Serialization in Go
Serialization in GoSerialization in Go
Serialization in Go
 
Magic Clusters and Where to Find Them 2.0 - Eugene Pirogov
Magic Clusters and Where to Find Them 2.0 - Eugene Pirogov Magic Clusters and Where to Find Them 2.0 - Eugene Pirogov
Magic Clusters and Where to Find Them 2.0 - Eugene Pirogov
 
I need help building a dictionary for the unique packets tha.pdf
I need help building a dictionary for the unique packets tha.pdfI need help building a dictionary for the unique packets tha.pdf
I need help building a dictionary for the unique packets tha.pdf
 
IntroToEngineDevelopment.pdf
IntroToEngineDevelopment.pdfIntroToEngineDevelopment.pdf
IntroToEngineDevelopment.pdf
 
A Development of Log-based Game AI using Deep Learning
A Development of Log-based Game AI using Deep LearningA Development of Log-based Game AI using Deep Learning
A Development of Log-based Game AI using Deep Learning
 
Poker, packets, pipes and Python
Poker, packets, pipes and PythonPoker, packets, pipes and Python
Poker, packets, pipes and Python
 
Network
NetworkNetwork
Network
 
C++ How I learned to stop worrying and love metaprogramming
C++ How I learned to stop worrying and love metaprogrammingC++ How I learned to stop worrying and love metaprogramming
C++ How I learned to stop worrying and love metaprogramming
 
14 key management & exchange
14   key management & exchange14   key management & exchange
14 key management & exchange
 
Secure coding for developers
Secure coding for developersSecure coding for developers
Secure coding for developers
 
Magic Clusters and Where to Find Them - Eugene Pirogov
Magic Clusters and Where to Find Them - Eugene PirogovMagic Clusters and Where to Find Them - Eugene Pirogov
Magic Clusters and Where to Find Them - Eugene Pirogov
 
Encryption Boot Camp at JavaZone 2010
Encryption Boot Camp at JavaZone 2010Encryption Boot Camp at JavaZone 2010
Encryption Boot Camp at JavaZone 2010
 
Kernel Recipes 2019 - GNU poke, an extensible editor for structured binary data
Kernel Recipes 2019 - GNU poke, an extensible editor for structured binary dataKernel Recipes 2019 - GNU poke, an extensible editor for structured binary data
Kernel Recipes 2019 - GNU poke, an extensible editor for structured binary data
 
Parallel Futures of a Game Engine
Parallel Futures of a Game EngineParallel Futures of a Game Engine
Parallel Futures of a Game Engine
 
Much ado about randomness. What is really a random number?
Much ado about randomness. What is really a random number?Much ado about randomness. What is really a random number?
Much ado about randomness. What is really a random number?
 
Secure Programming Practices in C++ (NDC Security 2018)
Secure Programming Practices in C++ (NDC Security 2018)Secure Programming Practices in C++ (NDC Security 2018)
Secure Programming Practices in C++ (NDC Security 2018)
 
Final requirement in programming niperos
Final requirement in programming   niperosFinal requirement in programming   niperos
Final requirement in programming niperos
 
Process management
Process managementProcess management
Process management
 
Zn task - defcon russia 20
Zn task  - defcon russia 20Zn task  - defcon russia 20
Zn task - defcon russia 20
 

Mais de Codemotion

Mais de Codemotion (20)

Fuzz-testing: A hacker's approach to making your code more secure | Pascal Ze...
Fuzz-testing: A hacker's approach to making your code more secure | Pascal Ze...Fuzz-testing: A hacker's approach to making your code more secure | Pascal Ze...
Fuzz-testing: A hacker's approach to making your code more secure | Pascal Ze...
 
Pompili - From hero to_zero: The FatalNoise neverending story
Pompili - From hero to_zero: The FatalNoise neverending storyPompili - From hero to_zero: The FatalNoise neverending story
Pompili - From hero to_zero: The FatalNoise neverending story
 
Pastore - Commodore 65 - La storia
Pastore - Commodore 65 - La storiaPastore - Commodore 65 - La storia
Pastore - Commodore 65 - La storia
 
Pennisi - Essere Richard Altwasser
Pennisi - Essere Richard AltwasserPennisi - Essere Richard Altwasser
Pennisi - Essere Richard Altwasser
 
Michel Schudel - Let's build a blockchain... in 40 minutes! - Codemotion Amst...
Michel Schudel - Let's build a blockchain... in 40 minutes! - Codemotion Amst...Michel Schudel - Let's build a blockchain... in 40 minutes! - Codemotion Amst...
Michel Schudel - Let's build a blockchain... in 40 minutes! - Codemotion Amst...
 
Richard Süselbeck - Building your own ride share app - Codemotion Amsterdam 2019
Richard Süselbeck - Building your own ride share app - Codemotion Amsterdam 2019Richard Süselbeck - Building your own ride share app - Codemotion Amsterdam 2019
Richard Süselbeck - Building your own ride share app - Codemotion Amsterdam 2019
 
Eward Driehuis - What we learned from 20.000 attacks - Codemotion Amsterdam 2019
Eward Driehuis - What we learned from 20.000 attacks - Codemotion Amsterdam 2019Eward Driehuis - What we learned from 20.000 attacks - Codemotion Amsterdam 2019
Eward Driehuis - What we learned from 20.000 attacks - Codemotion Amsterdam 2019
 
Francesco Baldassarri - Deliver Data at Scale - Codemotion Amsterdam 2019 -
Francesco Baldassarri  - Deliver Data at Scale - Codemotion Amsterdam 2019 - Francesco Baldassarri  - Deliver Data at Scale - Codemotion Amsterdam 2019 -
Francesco Baldassarri - Deliver Data at Scale - Codemotion Amsterdam 2019 -
 
Martin Förtsch, Thomas Endres - Stereoscopic Style Transfer AI - Codemotion A...
Martin Förtsch, Thomas Endres - Stereoscopic Style Transfer AI - Codemotion A...Martin Förtsch, Thomas Endres - Stereoscopic Style Transfer AI - Codemotion A...
Martin Förtsch, Thomas Endres - Stereoscopic Style Transfer AI - Codemotion A...
 
Melanie Rieback, Klaus Kursawe - Blockchain Security: Melting the "Silver Bul...
Melanie Rieback, Klaus Kursawe - Blockchain Security: Melting the "Silver Bul...Melanie Rieback, Klaus Kursawe - Blockchain Security: Melting the "Silver Bul...
Melanie Rieback, Klaus Kursawe - Blockchain Security: Melting the "Silver Bul...
 
Angelo van der Sijpt - How well do you know your network stack? - Codemotion ...
Angelo van der Sijpt - How well do you know your network stack? - Codemotion ...Angelo van der Sijpt - How well do you know your network stack? - Codemotion ...
Angelo van der Sijpt - How well do you know your network stack? - Codemotion ...
 
Lars Wolff - Performance Testing for DevOps in the Cloud - Codemotion Amsterd...
Lars Wolff - Performance Testing for DevOps in the Cloud - Codemotion Amsterd...Lars Wolff - Performance Testing for DevOps in the Cloud - Codemotion Amsterd...
Lars Wolff - Performance Testing for DevOps in the Cloud - Codemotion Amsterd...
 
Sascha Wolter - Conversational AI Demystified - Codemotion Amsterdam 2019
Sascha Wolter - Conversational AI Demystified - Codemotion Amsterdam 2019Sascha Wolter - Conversational AI Demystified - Codemotion Amsterdam 2019
Sascha Wolter - Conversational AI Demystified - Codemotion Amsterdam 2019
 
Michele Tonutti - Scaling is caring - Codemotion Amsterdam 2019
Michele Tonutti - Scaling is caring - Codemotion Amsterdam 2019Michele Tonutti - Scaling is caring - Codemotion Amsterdam 2019
Michele Tonutti - Scaling is caring - Codemotion Amsterdam 2019
 
Pat Hermens - From 100 to 1,000+ deployments a day - Codemotion Amsterdam 2019
Pat Hermens - From 100 to 1,000+ deployments a day - Codemotion Amsterdam 2019Pat Hermens - From 100 to 1,000+ deployments a day - Codemotion Amsterdam 2019
Pat Hermens - From 100 to 1,000+ deployments a day - Codemotion Amsterdam 2019
 
James Birnie - Using Many Worlds of Compute Power with Quantum - Codemotion A...
James Birnie - Using Many Worlds of Compute Power with Quantum - Codemotion A...James Birnie - Using Many Worlds of Compute Power with Quantum - Codemotion A...
James Birnie - Using Many Worlds of Compute Power with Quantum - Codemotion A...
 
Don Goodman-Wilson - Chinese food, motor scooters, and open source developmen...
Don Goodman-Wilson - Chinese food, motor scooters, and open source developmen...Don Goodman-Wilson - Chinese food, motor scooters, and open source developmen...
Don Goodman-Wilson - Chinese food, motor scooters, and open source developmen...
 
Pieter Omvlee - The story behind Sketch - Codemotion Amsterdam 2019
Pieter Omvlee - The story behind Sketch - Codemotion Amsterdam 2019Pieter Omvlee - The story behind Sketch - Codemotion Amsterdam 2019
Pieter Omvlee - The story behind Sketch - Codemotion Amsterdam 2019
 
Dave Farley - Taking Back “Software Engineering” - Codemotion Amsterdam 2019
Dave Farley - Taking Back “Software Engineering” - Codemotion Amsterdam 2019Dave Farley - Taking Back “Software Engineering” - Codemotion Amsterdam 2019
Dave Farley - Taking Back “Software Engineering” - Codemotion Amsterdam 2019
 
Joshua Hoffman - Should the CTO be Coding? - Codemotion Amsterdam 2019
Joshua Hoffman - Should the CTO be Coding? - Codemotion Amsterdam 2019Joshua Hoffman - Should the CTO be Coding? - Codemotion Amsterdam 2019
Joshua Hoffman - Should the CTO be Coding? - Codemotion Amsterdam 2019
 

Último

Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
vu2urc
 

Último (20)

Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 

Hearthstone: an analysis of game network protocols - Marco Cuciniello, Andrea Del Fiandra - Codemotion Milan 2016

  • 1. Hearthstone: an analysis of game network protocols Andrea Del Fiandra & Marco Cuciniello MILAN 25-26 NOVEMBER 2016
  • 2.
  • 4. What are google protocol buffers? • data serialization format • flexible and efficient • easily portable
  • 5. How do protocol buffers work? message Person { required string name = 1; required int32 id = 2; optional string email = 3; enum PhoneType { MOBILE = 0; HOME = 1; WORK = 2; } message PhoneNumber { required string number = 1; optional PhoneType type = 2 [default = HOME]; } repeated PhoneNumber phone = 4; }
  • 6.
  • 7. Games using protocol buffers github.com/Armax/Pokemon-GO-node-api github.com/Armax/Elix
  • 9. halp pls Time for decompilation
  • 10.
  • 11.
  • 12. How to extract .proto files github.com/HearthSim/proto-extractor
  • 13. Packets used during a Hearthstone match { "1": "GetGameState", "2": "ChooseOption", "3": "ChooseEntities", "11": "Concede", "13": "EntitiesChosen", "14": "AllOptions", "15": "UserUI", "16": "GameSetup", "17": "EntityChoices", "19": "PowerHistory", "24": "SpectatorNotify", "115": "Ping", "116": "Pong", "168": "Handshake" }
  • 14. Packets used during a Hearthstone match Handshake message Handshake { enum PacketID { ID = 168; } required int32 game_handle = 1; required string password = 2; required int64 client_handle = 3; optional int32 mission = 4; required string version = 5; required PegasusShared.Platform platform = 7; }
  • 15. Packets used during a Hearthstone match GameSetup message GameSetup { enum PacketID { ID = 16; } required int32 board = 1; required int32 max_secrets_per_player = 2; required int32 max_friendly_minions_per_player = 3; optional int32 keep_alive_frequency_seconds = 4; optional int32 disconnect_when_stuck_seconds = 5; }
  • 16. Packets used during a Hearthstone match Ping & Pong message Ping { enum PacketID { ID = 115; } } message Pong { enum PacketID { ID = 116; } }
  • 17. Packets used during a Hearthstone match PowerHistory message PowerHistory { enum PacketID { ID = 19; } repeated PowerHistoryData list = 1; } message PowerHistoryData { optional PowerHistoryEntity full_entity = 1; optional PowerHistoryEntity show_entity = 2; optional PowerHistoryHide hide_entity = 3; optional PowerHistoryTagChange tag_change = 4; optional PowerHistoryCreateGame create_game = 5; optional PowerHistoryStart power_start = 6; optional PowerHistoryEnd power_end = 7; optional PowerHistoryMetaData meta_data = 8; optional PowerHistoryEntity change_entity = 9;
  • 18. Packets used during a Hearthstone match PowerHistoryEntity message PowerHistoryEntity { required int32 entity = 1; required string name = 2; repeated Tag tags = 3; }
  • 19. Packets used during a Hearthstone match EntityChoices message EntityChoices { enum PacketID { ID = 17; } required int32 id = 1; required int32 choice_type = 2; required int32 count_min = 4; required int32 count_max = 5; repeated int32 entities = 6 [packed = true]; optional int32 source = 7; required int32 player_id = 8; }
  • 20.
  • 27.
  • 28.
  • 29. // Modules var ProtoBuf = require('protobufjs'); var PegasusPacket = require('./pegasuspacket').PegasusPacket; var net = require('net'); var client = new net.Socket(); var builder = ProtoBuf.loadProtoFile(__dirname + '/proto/game.proto'); var PegasusGame = builder.build(); var serverIp = "127.0.0.1" var handshake = "qAAAAFkAAAAIpoKkChIGY0RnZ2xvGLmgmQIgggIqBjI4OTYwNjo6CAIQBBoOTWFjQm9va1BybzExLDUqJEJBQTVGNzV handshake.game_handle = 1; // Crafting ping packet var ping = new PegasusGame.PegasusGame.Ping(); var encoded_ping = PegasusGame.PegasusGame.Ping.encode(ping); var type = PegasusGame.PegasusGame.Ping.PacketID.ID; var pegasus_ping = new PegasusPacket(); var encoded_pegasus_ping = pegasus_ping.Encode(encoded_ping, type); // Craft USERUI packet var userui = new PegasusGame.PegasusGame.UserUI(); userui.mouse_info = null; userui.emote = 4; userui.player_id = null; var encoded_userui = PegasusGame.PegasusGame.UserUI.encode(userui); var type_userui = PegasusGame.PegasusGame.UserUI.PacketID.ID; var pegasus_userui = new PegasusPacket(); var encoded_pegasus_userui = pegasus_ping.Encode(encoded_userui, type_userui); client.connect(3724, serverIp, function() { client.write(Buffer.from(args.options.handshake, 'base64')); setInterval(function() { console.log("[+] ping sent"); client.write(encoded_pegasus_ping); }, 5000); setInterval(function() { client.write(encoded_pegasus_userui); }, 1000);
  • 30. net.createServer(function(sock) { console.log('[+] connection from: ' + sock.remoteAddress +':'+ sock.remotePort); sock.on('data', function(data) { var pegasuspacket = new PegasusPacket(); var bytes_decoded = pegasuspacket.Decode(data, 0, data.length); if(bytes_decoded >= 4) { var decoded = Hearthnode.Decode(pegasuspacket); if(decoded != null && decoded != "unimplemented") { // Handling console.log(pegasuspacket.Type); switch(pegasuspacket.Type) { // Handshake case 168: console.log("[i] Received handshake from client"); console.log(decoded); // Reply with GameSetup var GameSetup = new PegasusGame.PegasusGame.GameSetup(); GameSetup.board = 6; GameSetup.max_secrets_per_player = 5; GameSetup.max_friendly_minions_per_player = 7; GameSetup.keep_alive_frequency_seconds = 5; GameSetup.disconnect_when_stuck_seconds = 25; var encoded_GameSetup = PegasusGame.PegasusGame.GameSetup.encode(GameSetup); var type = PegasusGame.PegasusGame.GameSetup.PacketID.ID; var pegasus_GameSetup = new PegasusPacket(); var encoded_pegasus_GameSetup = pegasus_GameSetup.Encode(encoded_GameSetup, type); sock.write(encoded_pegasus_GameSetup); break; case 115: // Crafting ping packet console.log("[i] Received ping from client"); console.log(decoded) var Pong = new PegasusGame.PegasusGame.Pong(); var encoded_Pong = PegasusGame.PegasusGame.Pong.encode(Pong); var type = PegasusGame.PegasusGame.Pong.PacketID.ID; var pegasus_Pong = new PegasusPacket(); var encoded_pegasus_Pong = pegasus_ping.Encode(encoded_Pong, type); sock.write(encoded_pegasus_Pong); break; case 15: // Received UserUI console.log("[i] Received UserUI"); console.log(decoded);
  • 33.
  • 34. Q & A Time!
  • 35. Thanks for your attention Marco Cuciniello - arm4x@becreatives.com Andrea Del Fiandra - delfioh@gmail.com