Natas Powershell and JavaScript Helper (OverTheWire)

I did most of Natas from work, and there i couldn't have anything but Windows PowerShell, or the browser's console for Javascript, so here are examples how to use it for the game for anyone in the same position.

SPOILER ALERT

even though i tried not to have this a the solutions, its kinda the solution.

Level 4: HTTP Headers


# basics for working with .Net WebClient
# create a variable with a value
$u = "http://natas4.natas.labs.overthewire.org"
# creating new Object you need to specify the full namespaces and classes route
$wc = New-Object System.Net.WebClient
# this is how you send user and pass 
$c = New-Object System.Net.NetworkCredential("natas4", "............")
$wc.Credentials = $c
# adding headers.
# # adding a cookie is just "cookie", "name=value".
$wc.Headers.Add("header-name", "header-value")
# download the same html you see in "view-source".
# you can also more elegantly store this in a variable and print it lik
# $res = $wc.DownloadString(); $res.    with ";" you can chain commands in 1 line
$wc.DownloadString($u)


Level 5: HTTP Cookies

notice that the "WebClient" class doesn't have a cookie collection, so its either crafting a sub-class, or using "HttpRequest" class, but there is always this option


$wc.Headers.Add("cookie", "name=value")


Level 18: Session Hijack

Just  how to do "For" loop in PS with some tip...


For ($i=0; $i -le 24000) {
    $wc.Headers.clear();
    .....
    If($response.Contains("string value")) {
        .....
        break;
    }
}





Comments

Post a Comment

Popular posts from this blog

OverTheWire[.com] Natas Walkthrough - JUST HINT, NO SPOILERS

Asp.Net Ending Response options, Response.End() vs CompleteRequest()

SOLVED The item could not be indexed successfully because the item failed in the indexing subsystem