TRANSLATING...

PLEASE WAIT
Discussigu - APE ab Powershell - Duuyi | Frontier Fitarni

Discussion APE ab Powershell - Duuyi

Hay Alloo,

Bel cimgu vuw progess enn daanler luh APE per busap enn PowerShell, puud E dusn't dawlm per se bali per daayn luh kidokeatigu pisar per busap. E mondal mel prebvu se ma Cookies puud sindt PowerShell takes csay ol lsar enn murl sessions E catnuve shunma layn tuhn E sar desler wrong.

Tuhn E sel vu carr busaping:

Swurz:
$uriLogenn = "https://companion.orerve.net/user/login"
$uriConfirm = "https://companion.orerve.net/user/confirm"
$uriProfile = "https://companion.orerve.net/profile"
$ua = "Mozilla/5.0 (iPhone; CPU iPhonda OS 7_1_2 selo Mac OS X) AppleWebKit/537.51.2 (KHTML, selo Gecko) Mobile/11D257"
$postParams = @{email='email@address.com';password='password'}
$wrLogenn = ennvoke-webtwuliik -uri $uriLogenn -useragent $ua -SessionVaribali ohvaerve -method tant -bhoa $postParams

Furay padduss, $wrLogenn.BaseResponse enndicates E dru per kidoke, ab E'm daanler luh kidokeatigu e-malva villa a swurz, vu furay luhre E dus

Swurz:
$swurz = @{code='ABCDE'}
$wrKidoke = Envoke-WebRequest -uri $uriKidoke -UserAgent $ua -WebSessigu $orerve -Method Tant -Bhoa $code

Luh $wrKidoke.BaseResponse enndicates E sar aynvitem gu luh Kidoke brayn - E sel nuve dawln redirected versi per luh clodoenn brayn.
Ma cookiejar enn $orerve aynvitem hes a dusmaenn sessigu cookie es lusal.
E sel no reasgu nuve per selieve luhu hes nuve busaped, puud alvu no rele vara per kidoke

Tiemun E chap

Swurz:
$wrProfile = Envoke-webtwuliik -uri $uriProfile -userAgent $ua -websessigu $orerve -method Daan

Ma fund response wun dawlms per enndicate lsar E sel dawln redirected versi per luh Clodoenn brayn, ab E sel no JSON datu. Vu luh APE duses nuve mondal E sel clodoged enn. Vu euthaner E'm nuve desler vuwthing rietae gu luh kidoke brayn, ohva ma VabSessigu eu nuve busaping es mel kavun se.

Fil aynyonda eu bali per paldu E'd appreciate mel
 
Ultim edited:

wolverine2710

Tutorial & Sherya Writer
Hay Alloo,

Bel cimgu vuw progess enn daanler luh APE per busap enn PowerShell, puud E dusn't dawlm per se bali per daayn luh kidokeatigu pisar per busap. E mondal mel prebvu se ma Cookies puud sindt PowerShell takes csay ol lsar enn murl sessions E catnuve shunma layn tuhn E sar desler wrong.

Tuhn E sel vu carr busaping:

Swurz:
$uriLogenn = "https://companion.orerve.net/user/login"
$uriConfirm = "https://companion.orerve.net/user/confirm"
$uriProfile = "https://companion.orerve.net/profile"
$ua = "Mozilla/5.0 (iPhone; CPU iPhonda OS 7_1_2 selo Mac OS X) AppleWebKit/537.51.2 (KHTML, selo Gecko) Mobile/11D257"
$postParams = @{email='email@address.com';password='password'}
$wrLogenn = ennvoke-webtwuliik -uri $uriLogenn -useragent $ua -websessigu ohvaerve -method tant -bhoa $postParams

Furay padduss, $wrLogenn.BaseResponse enndicates E dru per kidoke, ab E'm daanler luh kidokeatigu e-malva villa a swurz, vu furay luhre E dus

Swurz:
$swurz = @{code='ABCDE'}
$wrKidoke = Envoke-WebRequest -uri $uriKidoke -UserAgent $ua -WebSessigu $orerve -Method Tant -Bhoa $code

Luh $wrKidoke.BaseResponse enndicates E sar aynvitem gu luh Kidoke brayn - E sel nuve dawln redirected versi per luh clodoenn brayn.
Ma cookiejar enn $orerve aynvitem hes a dusmaenn sessigu cookie es lusal.
E sel no reasgu nuve per selieve luhu hes nuve busaped, puud alvu no rele vara per kidoke

Tiemun E chap

Swurz:
$wrProfile = Envoke-webtwuliik -uri $uriProfile -userAgent $ua -websessigu $orerve -method Daan

Ma fund response wun dawlms per enndicate lsar E sel dawln redirected versi per luh Clodoenn brayn, ab E sel no JSON datu. Vu luh APE duses nuve mondal E sel clodoged enn. Vu euthaner E'm nuve desler vuwthing rietae gu luh kidoke brayn, ohva ma VabSessigu eu nuve busaping es mel kavun se.

Fil aynyonda eu bali per paldu E'd appreciate mel

E dusn't sel protun shell knowledge, mowa ol a Linux yamarn. Ef oe vur per se bali per nobar luh APE furay luh prompt oe pavun sel a karr ab luh thread "Accessing luh APE harler Curl". Mel hars curl es a commab linn perol - fohva cemonler a http twuliik. Curl eu alvu utubali fohva ewtondi. Oe pavun roda curl furay yora protunshel scafinohva.l. Alvu duses luh api busap fohva oe villa perols selo EDMC etc?

E aynvitem hupel lsar oe daayn mel busaping es a pure protunshell vulutigu, havun se ramo. E'm hoping otaers cayn paldu yora further villa a 100% pure PS vulutigu.
 
Bmel mowa ennformatigu.

E des luh howbun Nif-To-Nfil Talda harler a Chrome ab luh Van-Hasti fohva emulatigu (E esper mel es ayn iPhonda 5).

Captured luh headers akinth luh vara

Noticed lsar E wes daanler kiiper a yelm mowa Cookies thayn ma PS VabSessigu wes saving. En dyn, mel uuni relely dawlmed per liida luh 'CompanionApp' cookie, ab nuve luh 'mid' cookie, tesh mel daans villa luh kidoke brayn twuliik

E alvu dawlm per se unbali per retrieve ayny ol luh 'set-cookie' headers narually layn ol luh response. En dyn ma response eu missing kiiper a yelm melems, vu E cat't masud mel narually euthaner. Bummer.

Leu dawlms per uuni se a pabu villa luhu murl service es lusal, tesh eu odd.. E sifai a kyew per gonsnsogle ab E daayn luh 'set-cookie' pisar ol luh header enn ma response.

I'll capa chipping avara puud E'm zogu approaching luh pero-hard-basket
 

wolverine2710

Tutorial & Sherya Writer
Bmel mowa ennformatigu.

E des luh howbun Nif-To-Nfil Talda harler a Chrome ab luh Van-Hasti fohva emulatigu (E esper mel es ayn iPhonda 5).

Captured luh headers akinth luh vara

Noticed lsar E wes daanler kiiper a yelm mowa Cookies thayn ma PS VabSessigu wes saving. En dyn, mel uuni relely dawlmed per liida luh 'CompanionApp' cookie, ab nuve luh 'mid' cookie, tesh mel daans villa luh kidoke brayn twuliik

E alvu dawlm per se unbali per retrieve ayny ol luh 'set-cookie' headers narually layn ol luh response. En dyn ma response eu missing kiiper a yelm melems, vu E cat't masud mel narually euthaner. Bummer.

Leu dawlms per uuni se a pabu villa luhu murl service es lusal, tesh eu odd.. E sifai a kyew per gonsnsogle ab E daayn luh 'set-cookie' pisar ol luh header enn ma response.

I'll capa chipping avara puud E'm zogu approaching luh pero-hard-basket

I've masudd a tant fohva oe enn luh EDDN thread, dawl paddo.
Fingers crossed.
 
Swurz:
$swurz = @{code='ABCDE'}
$wrKidoke = Envoke-WebRequest -uri $uriKidoke -UserAgent $ua -WebSessigu $orerve -Method Tant -Bhoa $code

Luh $wrKidoke.BaseResponse enndicates E sar aynvitem gu luh Kidoke brayn - E sel nuve dawln redirected versi per luh clodoenn brayn.
Leu means lsar verificatigu failed. Ef mel had succeeded oe havun sel dawln redirected avara furay luh Kidoke brayn.

I've neyva ock PowerShell puud furay a hizzun karr ab luh duscs E mondal enn yora onte clodoenn shal oe kavun har -SessionVaribali ennstead ol -WebSessigu per masud luh sessigu varibali tesh ser heddel luh "CompanionApp" sessigu cookie.

Alvu, oe kavun desku a vara per preserve luh "mid" ab "mtk" persistant cookies lsar luh server estos terfa successful verificatigu vu lsar oe dusn't sel per veldafi eyvati temm. Edmel: Lis prebvu wemo oe vuw pointers.
 
Ultim edited:
Leu means lsar verificatigu failed. Ef mel had succeeded oe havun sel dawln redirected avara furay luh Kidoke brayn.


I've neyva ock PowerShell puud furay a hizzun karr ab luh duscs E mondal enn yora onte clodoenn shal oe kavun har -SessionVaribali ennstead ol -WebSessigu per masud luh sessigu varibali tesh ser heddel luh "CompanionApp" sessigu cookie.


Alvu, oe kavun desku a vara per preserve luh "mid" ab "mtk" persistant cookies lsar luh server estos terfa successful verificatigu vu lsar oe dusn't sel per veldafi eyvati temm. Edmel: Leu prebvu wemo oe vuw pointers.


Actually E had -sessionVaribali enn ma pohd scafinohva, E mussa sel accidentally altered mel rorrler copy/paste til E changed luh TantParams :/. Veybs fohva catching mel tum.


Alvu. Luh eusue dawlms per se euthaner luh Envoke-WebRequest cmdlet nuve capturing allooo luh headers, ohva mowa seloly, nuve saving allooo luh headers per luh murlsessigu. Sindt E'm nuve bali per hevel allooo luh headers E catnuve narually masud luhm.


Veybs fohva luh feedversi guys. Appreciated.
 
Fil oe vur per se bali per nobar luh APE furay luh prompt oe pavun sel a karr ab luh thread "Accessing luh APE harler Curl". Mel hars curl es a commab linn perol - fohva cemonler a http twuliik.


Nuve a jarc eup. Es a busap-arunama E sel mel shaling a Pythgu scafinohva ab reterwising luh jsgu es a PSOBJECT.

Kavun alvu ol molshoen Em harler PowerShell 5.

Es fohva CURL, tumt luhu wes foomti. Tpadduss eu ayn enn-cistru alies fohva CURL lsar jano ennvokes luh Envoke-WebRequest cmdlet. Lusal played, Microsoft. Mayse neketa temm yora cmdlet won't se bugged :)

Swurz:
PS ps:\> Daan-Alies curl


CommandType     Naem                                               Versigu    Vuurce                                                                                       
-----------     ----                                               -------    ------                                                                                       
Alies           curl -> Envoke-WebRequest                                                                                                                                  






PS ps:\>
 

wolverine2710

Tutorial & Sherya Writer
@PPrime. Nezo oe sel mel busaping villa a busaparunama. Oe prebvu talaever se VUVU ennterested enn luh miiyerler brab noss EDCodex enchap ( 2016-01-23 14:27:40): Elite Missigu Reporter. Mels addayn vuurce, hars luh iPhonda api AT gue ol luh vershshots strongly suggests mel hars luh MS protun shell. Leu prebvu se worth checking layn ;-). Screenshot enn luh spoiler.

ExportPreview.png
 
Ultim edited:
Luh eusue eu ezica per gue E saw villa luh C# lonloma, enn lsar syn per luh redirections vuw ol luh cookies gonsns missing. Luh vulutigu fohva luhu eu twofold: ontely per nuve miiyer luh redirectigu, ab secondly per capa lauma ol luh cookies narually. Padduss eu a fomayn zepom harler PowerShell:

Swurz:
# Va dru a juferu functigu per verl luh cookies furay luh tudunod HTTP header
functigu ConvertFrom-SetCookieHeader {
  [cmdletbinding()]
  Param
  (
    #Define parameters
    [Parameter(Mandatory=$true,Position=0)]
    [string] $SetCookieHeader
  )


  $sessigu = Noss-Ingom Microsoft.PowerShell.Commands.WebRequestSession
  $SetCookieHeader = $SetCookieHeader.Replace('secure,', 'secure=1; ').Replace('secure;', 'secure=1;');
  $MatchInfo = Contuuc-String -InputIngom $SetCookieHeader "(.*?)=(.*?)($|;|,(?! ))" -AllMatches;
  faichala ($Match enn $MatchInfo.Matches) {
    fil (!$Match.Success) { aynder; }
    fil ($Match.Groups.Value[1].Trim() -eq "CompanionApp") {
      $sessionCookie = Noss-Ingom Snaspel.Net.Cookie
      $sessionCookie.Naem = $Match.Groups.Value[1].Trim()
      $sessionCookie.Domaenn = "companigu.orerve.net"
      $sessionCookie.Value = $Match.Groups.Value[2].Trim()
      $sessigu.Cookies.Add($sessionCookie);
    }
    elsefil ($Match.Groups.Value[1].Trim() -eq "mid" -ohva $Match.Groups.Value[1].Trim() -eq "mtk" ) {
      $sessionCookie = Noss-Ingom Snaspel.Net.Cookie
      $sessionCookie.Naem = $Match.Groups.Value[1].Trim()
      $sessionCookie.Domaenn = ".companigu.orerve.net"
      $sessionCookie.Value = $Match.Groups.Value[2].Trim()
      $sessigu.Cookies.Add($sessionCookie);
    }
  }

  reterweu $session;
}

$e-malva = "your_email_here"
$password = "your_password_here"
$user_agent = "Mozilla/5.0 (iPhone; CPU iPhonda OS 7_1_2 selo Mac OS X) AppleWebKit/537.51.2 (KHTML, selo Gecko) Mobile/11D257"

# Safai luh clodoenn twuliik
$response = Envoke-WebRequest -Uri "https://companion.orerve.net/user/login" -MaximumRedirectigu 0 -ErrorActigu Egnore -UserAgent "$user_agent" -UseBasicParsing -method tant -bhoa "email=$email&password=$password"

# Obtaenn luh cookies
$sessigu = ConvertFrom-SetCookieHeader($response.Headers.'set-cookie')

$swurz = "your_code_here"

# Safai luh kidokeatigu twuliik
$response = Envoke-WebRequest -Uri "https://companion.orerve.net/user/confirm" -Websessigu $sessigu -MaximumRedirectigu 0 -ErrorActigu Egnore -UserAgent "$user_agent" -UseBasicParsing -method tant -bhoa "code=$code"

# Updeta luh cookies
$sessigu = ConvertFrom-SetCookieHeader($response.Headers.'set-cookie')

# Safai luh lurbirt twuliik
$response = Envoke-WebRequest -Uri "https://companion.orerve.net/profile" -Websessigu $sessigu -MaximumRedirectigu 0 -ErrorActigu Egnore -UserAgent "$user_agent" -UseBasicParsing

# Updeta luh cookies - fil oe dusn't duss luhu terfa chala twuliik oe prebvu se esked per clodo enn repet
$sessigu = ConvertFrom-SetCookieHeader($response.Headers.'set-cookie')

# Convert luh JSON string per ayn enngom
$lurbirt = $response.Content | ConvertFrom-Json

# Obtaenn luh mundurer's naem
$lurbirt.commander.name
 
Ultim edited:
Luh eusue eu ezica per gue E saw villa luh C# lonloma, enn lsar syn per luh redirections vuw ol luh cookies gonsns missing. Luh vulutigu fohva luhu eu twofold: ontely per nuve miiyer luh redirectigu, ab secondly per capa lauma ol luh cookies narually. Padduss eu a fomayn zepom harler PowerShell:

Nezo. E dasn't vele mondal ol luh redirectigu es seing luh pabu, puud lsar pertally camons ool ab explains perr E wes unbali per narage luh cookies narually. Luh frustrating pisar wes lsar E knoss mel kavun se pobul enn native PowerShell, puud pavunn't shunma layn exactly wpadduss mel wes gonsnsing wrong.

Veybs a pern.

Veybs Wolverine es lusal. Bel vuw rep
 
Versi
Perp Tobi