-
Notifications
You must be signed in to change notification settings - Fork 138
Add NetWork
I-Am-Jakoby edited this page May 18, 2022
·
1 revision
Table of Contents
This function will add a network profile to your targets PC
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)"
}
Listed below are payloads that have used one of these functions:
I am Jakoby