How to use fiddler to capture mobile phone packets and filters!

1. The difference between Fiddler and other packet capture tools 1. Although Firebug can capture packets, it is not powerful enough to analyze the detailed information of http requests. The function of simulating HTTP requests is not enough, and Firebug often requires “no refresh modification”. If the page is refreshed, all modifications will not be […]

Fiddler captures VSCode and explores

Preface: I encountered some problems recently when using VSCode to debug web programs, and I didn’t know what to do at the time. So I decided to grab it and take a look, and then I operated like a tiger and successfully installed the packet capture software – Fiddler Classic. I did not use heavyweight […]

How to capture packets of APP through Fiddler? and advanced application scenario analysis

Foreword WeoftenneedtouseFiddlerasaproxyservertocapturepacketsforWebandAPPapplications,sothatwecantestanddebuginterfacefunctions,locateproblems,etc.ThisarticlewilldescribehowtocaptureAPPpacketsthroughFiddler,andbrieflyintroducesomeadvancedapplicationscenarios. First,attachtheenvironmentconfigurationlistusedbyFiddler: Windows7 Fiddlerv5.0.20194.41348 BrieflytalkaboutFiddler’spacketcaptureprinciple: Fiddlerservesasaproxyserver,andrequestsinitiatedbymobilephonesarerelayedthroughtheproxy,sothatFiddlerrecordstherequestedcommunicationdatainformation.Let’sgiveavividmetaphor:awaterpipewasoriginallydirectlyconnectedtobothends(serverandAPP),butnowthereisanadditionalwatertank(fiddler)inthemiddle.Thewaterflowsthroughthewatertankandrecordsthewaterflowinformation.(Thinkaboutit:Iftherearetwocirculatingwaterpipesdirectlyconnectedatbothends,whatoperationscanwedoifweconnectawatertankinthemiddle?) UsefiddlerproxytoremotelycaptureAPPrequests Step1:Findtheproxysettingsinthemenubar(path:Tools->FiddlerOptions).Becausemy8888portisalreadyoccupiedbyotherservices,Isettheproxyporthere.for7788.(Note:Fiddlerneedstoberestartedfortheproxysettingstotakeeffect) (Note:UnderWindows,youcanusethecommandnetstat-ano|findstr8888tocheckwhetherport8888isoccupied) Step2:Checkyourownmachine’sIP.Therearetwoways: Method1:MovethemousetotheOnlineiconintheupperrightcornerofFiddlertoobtainthelocalIPinformation.(Thisisrecommended) Method2:Youcanenteripconfiginthecmdcommandwindow(ifconfigunderLinux). Step3.Onthemobilephone,findandconnecttotheWiFiinthesameLANasthecomputer(itcanbeonadifferentnetworksegment,butitneedstobeinthesameLAN),andthensettheproxyinthemobilephone(usuallythepath:mobilephonesettings->WLAN->Longpressthecurrentlyconnectednetwork->Modifynetwork->ShowadvancedoptionsandchangetheproxyfromNonetoManual).EntertheIPoftheproxyservice(thatis,theIPofthePCwherefiddlerisinstalled)andtheport(thatis,thelisteningportsetinfiddler,suchas7788setabove).Inthisway,wecanmonitorallrequestsoftheAPP. Step4.Letusopenanapplication(suchascalendar)onthephoneandseethepacketcaptureresultsofFiddler. IntroductiontoadvancedapplicationscenariosofFiddler 1.URLaddressrewriting URLrewritingistheprocessofinterceptingincomingwebrequestsandautomaticallyredirectingthemtoadifferentURL.Forexample,throughURLaddressrewriting,FiddlerwillhelpyouforwardallHTTPRequestsoriginallysenttoa.comtob.comwithoutanyfeelinginthebrowser.Thisrequirementisoftenencounteredduringtestinganddebugging.(Notethata.comandb.comherearethedomainnamesincludedintherequestURL,ortheycanbeIP) Therearetwomethodsofreplacement,oneistemporaryandtheotherispermanent. Method1.ThetemporarymethodistoentertheQuickExeccommandlineinthelowerleftcornerofFiddler(userscandirectlyenterandquicklyexecutescriptcommands): <spanstyle=”color:#333333″><spanstyle=”background-color:#f5f5f5″>urlreplacea.comb.com</span></span> Asshowninthepictureabove,pressEnterafterinputting,andallHTTPRequestsoriginallysenttoa.comwillbeforwardedtob.com. Toclearforwarding,enterinthesameposition: <spanstyle=”color:#333333″><spanstyle=”background-color:#f5f5f5″>urlreplace</span></span> JusthittheEnterkey. 2)Youcanalsogoto”FiddlerScript”toeditCustomRules.jsdirectly(permanently). Note:CustomRules.jscanbeopenedinthemenubar(Rules->CustomizeRules);inFiddler5.0orabove,itcanbeediteddirectlythroughFiddlerScriptsontheright. PleasefinditinCustomRules.jsfirst: <spanstyle=”color:#333333″><spanstyle=”background-color:#f5f5f5″>staticfunctionOnBeforeRequest(oSession:Session){ //… }</span></span> AddthefollowingtothefunctionOnBeforeRequest: <spanstyle=”color:#333333″><spanstyle=”background-color:#f5f5f5″>if(oSession.HostnameIs(‘a.com’)) oSession.hostname=’b.com’;</span></span> ArchiveCustomRules.js,FiddlerwillautomaticallyreloadCustomRules.js,andtheHTTPRequestoriginallysenttoa.comwillbeautomaticallyforwardedtob.com. 2.HTTPrequest,responsebreakpointdebugging Breakpointcommandintroduction: bpubreaksatstartofrequest bpafterbreakswhenresponsearrives bpsbreaksonspecifichttpstatuscode bpv/bpminterruptswhenaspecificrequestmethodisrequested Whenthesecommandsdonotaddparameters,allHTTPrequestswithbreakpointssetwillbecleared. Tip:EnterhelponthecommandlineandpressEntertoopenapagedetailingallfiddlercommands. Youcanalsosetbreakpointsinthemenubar(Rules->AutomaticBreakpoint->BeforeRequests),whichisforallsessionrequests.Itisnotverypractical.Itisrecommendedtousecommands. Takebpuasanexampletodemonstratethebreakpointfunction: IntheFiddlercommandlineinputarea,enter”bpu”andpressEntertocleartheoriginalbreakpoint,thenenter ? <spanstyle=”color:#333333″><spanstyle=”background-color:#f5f5f5″>bpuhttp://api.justbon.com/app/login.htm</span></span> ? PressEntertoexecute,andthentherequestcontainingthisaddressintheURL(http://api.justbon.com/app/login.htm)willbeinterrupted. ClickontheinterruptedsessioninthesessionlistandenterInspectors–>TextView.Atthistime,therequesthasnotbeensent.Thepparameteristhepassword.Ifwefindthatweentereditwrong,wecanchangeittothecorrectpassword,andthenclickthe”RuntoCompletion”buttontocompletethesubsequentrequest.(Note:Therequestdataismodifiedhere.Otherpostdata,evencookies,referer,user-agent,etc.inheaderscanbemodified) Ifyouclick”BreakonResponse”:thatis,whentheresponsecontentisreturned,fiddlerisinterruptedagain.Theresponsecontenthasbeenreturnedtothelocalmachine,butitisstillhereonthefiddlerproxyandhasnotyetreachedthebrowser(APP). Similarly,afterbpafteracertainurl,youcanmodifythereturnresultatthebreakpoint(modifyitintheTextVieworRawtabpageundertheRuntoCompletionbuttoninthepictureabove),andthenclickthe”RuntoCompletion“buttontocompletethesubsequentresultreturn. Tips:instpectorsismainlyusedtoviewandsharerequestsandresponses,andmonitortheresponsecontentofrequests.Ithasmultiplepaginationtabs.Theinterfaceisdividedintoupperandlowerparts.Theupperpartdisplaysrequest-relatedinformation;thelowerpartdisplaysresponse-relatedinformation. 3.Introductiontothefunctionsontheright […]

Download, install and use Fiddler (including use in testing)

1. Download and install Fiddler 1.Introduction to Fiddler 1.1 Definition and functions of Fiddler Fiddler is a free network proxy debugging tool. Fiddler is a very useful packet capture tool. Data packets sent and received during network transmission can be intercepted, retransmitted, edited, and transferred. It can also be used to detect network security. 1.2 […]

Use fiddler to test APP and advanced applications

We often need to use Fiddler as a proxy server to capture packets for Web and APP applications, so that we can test and debug interface functions, locate problems, etc. This article will describe how to capture APP packets through Fiddler, and briefly introduce some advanced application scenarios. First, attach the environment configuration list used […]

Use Python+Flask/Moco framework/Fiddler to build a simple interface Mock service

1. Mock test 1. Introduction Mock: It is the process of using virtual technology to implement testing for some objects that are difficult to construct. Mock testing: During the testing process, some objects that are not easy to construct or obtain can be replaced by a virtual object. Interface mock testing: During the interface testing […]

Eight practical tips for Fiddler

Everyone should be familiar with Fiddler, but there are some techniques in it that you may not necessarily know. Here are eight practical tips that can improve everyone’s testing efficiency by customizing Fiddler. 1. When you double-click the Session, the response page is always displayed on the “json” tab page; the request page is always […]

Use fiddler to test APP and advanced applications

We often need to use Fiddler as a proxy server to capture packets for Web and APP applications, so that we can test and debug interface functions, locate problems, etc. This article will describe how to capture APP packets through Fiddler, and briefly introduce some advanced application scenarios. First, attach the environment configuration list used […]

fiddler bpu intercepts multiple requests

Modification 1: 》 Modification 2: Modification 3: Make changes and save. Return to the fiddler page.Command input:bpu http://www.xxxx.com/xxx111 http://www.xxxx.com/xxx222The two URIs are separated by spaces.Then press Enter to execute the commandCancel breakpoint input:bpu Just press Enter. Then, both pages can be blocked. Code: import System; import System.Windows.Forms; import Fiddler; //INTRODUCTION // // Well, hello there! […]