
Utilitaire simple pour l'analyse du trafic HTTP/HTTPS déchiffré sur un appareil macOS/iOS (jailbreaké ou non)
Utilitaire simple en pur Python pour l'analyse du trafic HTTP/HTTPS déchiffré enregistré par l'une des API d'Apple peu documentées.
python3 -m pip install -U harlogger
Cette méthode s'applique au profil CFNetwork d'Apple. Ce profil est destiné au débogage des processus utilisant le framework CFNetwork. Cette méthode n'inclut pas le corps de la requête/réponse.
Téléchargez le profil CFNetwork d'Apple pour macOS :
Installez-le en double-cliquant
C'est tout ! :) Vous pouvez maintenant commencer à intercepter tout le trafic en utilisant :
python3 -m harlogger profile
Cette méthode s'applique au profil CFNetwork d'Apple. Ce profil est destiné au débogage des processus utilisant le framework CFNetwork. Cette méthode n'inclut pas le corps de la requête/réponse.
Téléchargez le profil CFNetwork d'Apple pour iOS :
Installez-le de la manière que vous préférez. J'utilise pymobiledevice3 :
# if you don't already have it
python3 -m pip install -U pymobiledevice3
# install the profile
pymobiledevice3 profile install CFNetworkDiagnostics.mobileconfig
C'est tout ! :) Vous pouvez maintenant commencer à intercepter tout le trafic en utilisant :
python3 -m harlogger mobile profile
La sortie devrait ressembler à :
➜ harlogger git:(master) ✗ python3 -m harlogger profile
➡️️ POST https://www.bing.com/fd/ls/lsp.aspx HTTP/1.1
Accept: */*
Content-Type: text/xml
Origin: https://www.bing.com
Accept-Encoding: gzip, deflate, br
Cookie: SRCHHPGUSR=CW=414&CH=622&SW=414&SH=736&DPR=3&UTC=180&DM=1&SRCHLANG=en&HV=1634801804; _HPVN=CS=eyJQbiI6eyJDbiI6MiwiU3QiOjAsIlFzIjowLCJQcm9kIjoiUCJ9LCJTYyI6eyJDbiI6MiwiU3QiOjAsIlFzIjowLCJQcm9kIjoiSCJ9LCJReiI6eyJDbiI6MiwiU3QiOjAsIlFzIjowLCJQcm9kIjoiVCJ9LCJBcCI6dHJ1ZSwiTXV0ZSI6dHJ1ZSwiTGFkIjoiMjAyMS0xMC0yMVQwMDowMDowMFoiLCJJb3RkIjowLCJEZnQiOm51bGwsIk12cyI6MCwiRmx0IjowLCJJbXAiOjEwfQ==; SUID=M; _EDGE_S=SID=1BF42681120765EF1EA73656137A640E; _SS=SID=1BF42681120765EF1EA73656137A640E; MUID=1B0D347B85756FDD055524B284086E36; SRCHD=AF=NOFORM; SRCHUID=V=2&GUID=5B989717430E450D9314C927C97602C9&dmnchg=1; SRCHUSR=DOB=20211007; _EDGE_V=1; MUIDB=1B0D347B85756FDD055524B284086E36
User-Agent: Mozilla/5.0 (iPhone; CPU iPhone OS 14_5_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.1 Mobile/15E148 Safari/604.1
Referer: https://www.bing.com/
Content-Length: 458
Accept-Language: en-us
⬅️ HTTP/2.0 204 (request POST https://www.bing.com/fd/ls/lsp.aspx HTTP/1.1)
x-msedge-ref: Ref A: E5B5AE34FBA148E6BDFFBF421B940462 Ref B: VIEEDGE1816 Ref C: 2021-10-21T07:36:44Z
Date: Thu, 21 Oct 2021 07:36:44 GMT
x-cache: CONFIG_NOCACHE
Access-Control-Allow-Origin: *
Les appareils iOS 14.x contiennent une fonctionnalité cachée permettant d'intercepter le trafic HTTP/HTTPS déchiffré de tous les processus utilisant le framework CFNetwork, au format HAR. Pour déclencher cette fonctionnalité sur un appareil jailbreaké, il suffit de placer la configuration correcte pour com.apple.CFNetwork et de déclencher la notification com.apple.CFNetwork.har-capture-update.
Cette méthode inclut également le corps des requêtes/réponses.
iOS 13.x ou inférieur ne dispose pas de cette fonctionnalité.
/var/mobile/Library/Preferences/python3 -m harlogger preference
La sortie devrait ressembler à :
➜ harlogger git:(master) ✗ python3 -m harlogger mobile preference
➡️ CFNetwork(1140) POST https://www.bing.com/fd/ls/lsp.aspx
POST /fd/ls/lsp.aspx HTTP/2.0
Accept: */*
Content-Type: text/plain
Origin: https://www.bing.com
Cache-Control: max-age=0
Content-Length: 472
Accept-Language: en-us
User-Agent: Mozilla/5.0 (iPhone; CPU iPhone OS 14_5_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.1 Mobile/15E148 Safari/604.1
Accept-Encoding: gzip, deflate, br
Referer: https://www.bing.com/
⬅️ CFNetwork(1140) 0
➡️ CFNetwork(1140) POST https://www.bing.com/fd/ls/lsp.aspx
POST /fd/ls/lsp.aspx HTTP/2.0
Accept: */*
Content-Type: text/xml
Origin: https://www.bing.com
Content-Length: 378
Accept-Language: en-us
Host: www.bing.com
User-Agent: Mozilla/5.0 (iPhone; CPU iPhone OS 14_5_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.1 Mobile/15E148 Safari/604.1
Referer: https://www.bing.com/
Accept-Encoding: gzip, deflate, br
Connection: keep-alive
<ClientInstRequest><Events><E><T>Event.ClientInst</T><IG>EB94C422BC394F90A876D39A790BECBC</IG><TS>1634801882467</TS><D><![CDATA[[{"T":"CI.BoxModel","FID":"CI","Name":"v2.8","SV":"4","P":{"C":1,"N":5,"I":"5iv","S":"V","M":"V+L+M+MT+E+N+C+K+BD","T":1669960,"F":0},"V":"zrpx/////////visible/+zryw/////////hidden/@p"}]]]></D></E></Events><STS>1634801882467</STS></ClientInstRequest>
À partir d'iOS 15.0, l'appareil exigera que le processus cible possède l'une des exigences suivantes :
com.apple.private.cfnetwork.har-capture-delegationget-task-allowcom.apple.security.get-task-allowdebugAfin de permettre à l'appareil d'activer la journalisation HAR, vous pouvez
utiliser pymobiledevice3 comme suit :
python3 -m pymobiledevice3 developer dvt har
Vous pouvez maintenant commencer le sniffing en utilisant la méthode de préférence :
python3 -m harlogger preference