Home

Wednesday, July 18, 2018

PowerShell + Fiddler - Learning - Entry 2

INFO:
Playing around with grabbing information about local player accounts through fiddler proxy.

TODO:
I need to write a fiddler script that can be called with auto-responder to save out the header and body of a specified Host call to a chosen directory location.

Keywords:
PowerShell, v5,
Fiddler, xbl, xbox, live, application, windows 10, pc,
regex, Regular Expression, matches, match
look forward, look backward, lazy, greedy,

Resources:
#Personal Note: Source code and resource sights
#https://blogs.msdn.microsoft.com/fiddler/2011/12/10/revisiting-fiddler-and-win8-immersive-applications/
#https://docs.microsoft.com/en-us/windows/uwp/xbox-live/using-xbox-live/troubleshooting/how-to-set-up-fiddler-for-debugging
#https://docs.microsoft.com/en-us/windows/uwp/xbox-apps/uwp-fiddler
#https://docs.microsoft.com/en-us/windows/uwp/xbox-apps/uwp-fiddler

#As seen in xbox + fiddler microsoft documentation
#LoopBack: netsh winhttp set proxy 127.0.0.1:8888 "<-loopback>"


CODE:
$SourceFolder = "$env:USERPROFILE\Desktop"
$XblTitlehub = "40_.json"
$XblSessiondirectory = "45_Response.txt"
$XblAccounts = "19_.json"
$XblProfile = "9_Response.txt"


#========================== peoplehub.xboxlive.com ==========================#
###\ Response\Body


#========================== sessiondirectory.xboxlive.com ==========================#
###\ \ Response\Header or Entire R*
#(?<=gamertag=)(.*)(?=;)
#(?<='string') Look at end of string
#(?='string') Exclude at string

$patternA = "(?<=gamertag=)"
$Match = ".*"
$PatternB = "(?=;)"
$pattern = "$patternA$Match$PatternB"

$sessiond = Get-Content "$SourceFolder\$XblSessiondirectory"
$gamerTag = [Regex]::Matches($sessiond, $pattern).groups[0].value

$pattern = "(?<=sandbox=).*?(?=,)"
$sandBox = [Regex]::Matches($sessiond, $pattern).groups[0].value

$pattern = "(?<=build=).*?(?=,)"
$build = [Regex]::Matches($sessiond, $pattern).groups[0].value

#========================== titlehub.xboxlive.com ==========================#
###\ Response\Body

#Replace empty line
#REGEX: ^[ \t]*$\r?\n

#Prefix every none empty line
#Search  = ^([A-Za-z0-9]+)$
#Replace = able:"\1"
# '^' points to the start of the line
# '$' points to the end of the line
# \1 or [{("'$&'")}] IS the source match within parentheses

$titles = Get-Content "$SourceFolder\$XblTitlehub"
$t = $titles | ConvertFrom-Json

#xuidtitles
$t.xuid
#titles
$t.titles
    #titleId
    $t.titles.titleId
    #pfn
    $t.titles.pfn
    #bingId
    $t.titles.bingId
    #serviceConfigId
    $t.titles.serviceConfigId
    #windowsPhoneProductId
    $t.titles.windowsPhoneProductId
    #name
    $t.titles.name
    #type
    $t.titles.type
    #devices
    $t.titles.devices
    #displayImage
    $t.titles.displayImage.
    #mediaItemType
    $t.titles.mediaItemType
    #modernTitleId
    $t.titles.modernTitleId
    #isBundle
    $t.titles.isBundle
    #achievement
    $t.titles.achievement
        #currentAchievements
        $t.titles.achievement.currentAchievements
        #totalAchievements
        $t.titles.achievement.totalAchievements
        #currentGamerscore
        $t.titles.achievement.currentGamerscore
        #totalGamerscore
        $t.titles.achievement.totalGamerscore
        #progressPercentage
        $t.titles.achievement.progressPercentage
        #sourceVersion
        $t.titles.achievement.sourceVersion
    #stats
    $t.titles.stats
    #images
    $t.titles.images
        #BoxArt
        $t.titles.images[0]
        #BrandedKeyArt
        $t.titles.images[1]
        #Poster
        $t.titles.images[2]
        #FeaturePromotionalSquareArt
        $t.titles.images[3]
        #ImageGallery
        $t.titles.images[4]
        #ImageGallery
        $t.titles.images[5]
        #ImageGallery
        $t.titles.images[6]
        #TitledHeroArt
        $t.titles.images[7]
        #SuperHeroArt
        $t.titles.images[8]
    #titleHistory
    $t.titles.titleHistory
        #lastTimePlayed
        $t.titles.titleHistory.lastTimePlayed
        #visible
        $t.titles.titleHistory.visible
        #canHide
        $t.titles.titleHistory.canHide
    #detail
    $t.titles.detail
    #friendsWhoPlayed
    $t.titles.friendsWhoPlayed
    #alternateTitleIds
    $t.titles.alternateTitleIds
    #contentBoards
    $t.titles.contentBoards
    #xboxLiveTier
    $t.titles.xboxLiveTier


#========================== accounts.xboxlive.com ==========================#
###\ Response\Body

$account = Get-Content "$SourceFolder\$XblAccounts"
$a = $account | ConvertFrom-Json

#familyId
$a.familyId
#familyUsers
$a.familyUsers
    #userId
    $a.familyUsers[0].userId
    #email
    $a.familyUsers[0].email
    #firstName
    $a.familyUsers[0].firstName
    #lastName
    $a.familyUsers[0].lastName
    #imageUrl
    $a.familyUsers[0].imageUrl
    #gamerTag
    $a.familyUsers[0].gamerTag
    #xuid
    $a.familyUsers[0].xuid
    #role
    $a.familyUsers[0].role
    #canViewRestrictedContent
    $a.familyUsers[0].canViewRestrictedContent
    #canViewTVAdultContent
    $a.familyUsers[0].canViewTVAdultContent
    #activityReporting
    $a.familyUsers[0].activityReporting
    #contentExceptions
    $a.familyUsers[0].contentExceptions
    #maturityLevel
    $a.familyUsers[0].maturityLevel
    #webFilteringLevel
    $a.familyUsers[0].webFilteringLevel
    #webFilteringExceptions
    $a.familyUsers[0].webFilteringExceptions
    #allowPurchaseAndDownloads
    $a.familyUsers[0].allowPurchaseAndDownloads


#========================== profile.xboxlive.com ==========================#
###\ Response\Body

$profile = Get-Content "$SourceFolder\$XblProfile"
$p = $profile | ConvertFrom-Json

#ID: Proporty Name, Value: Proporty value

#profileUsers[{ }]
$p.profileUsers
    #Id
    $p.profileUsers.id
    #hostId
    $p.profileUsers.hostId
    #isSponsoredUser
    $p.profileUsers.isSponsoredUser
    #settings[{ }]
    $p.profileUsers.settings
        #GameDisplayPicRaw
        $p.profileUsers.settings[0]
        #Gamerscore
        $p.profileUsers.settings[1]
        #Gamertag
        $p.profileUsers.settings[2]
        #AccountTier
        $p.profileUsers.settings[3]
        #XboxOneRep
        $p.profileUsers.settings[4]
        #PreferredColor
        $p.profileUsers.settings[5]
        #RealName
        $p.profileUsers.settings[6]
        #Bio
        $p.profileUsers.settings[7]
        #TenureLevel
        $p.profileUsers.settings[8]
        #Watermarks
        $p.profileUsers.settings[9]
        #Location
        $p.profileUsers.settings[10]
        #IsDeleted
        $p.profileUsers.settings[11]
        #ShowUserAsAvatar
        $p.profileUsers.settings[12]

No comments:

Post a Comment

Conduct: Be nice and don't advertise or plug without adding value to the conversation.