-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathpayload.ps1
85 lines (75 loc) · 2.96 KB
/
payload.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
param(
[Parameter(Mandatory=$False)]
[int]
$operation
)
Begin{
function disable-Firewall{
Write-Output "Disabling Windows Firewall"
netsh advfirewall set allprofiles state off
}
function disable-NetAdapters{
param([string]$netAdapter='Ethernet')
Write-Output "Disabling Network dapters"
Get-WmiObject Win32_NetworkAdapter -filter "NetConnectionID LIKE '%'" | ?{$_.NetConnectionID -notlike "$netAdapter"} | %{netsh interface set interface "$($_.NetConnectionID)" DISABLED}
}
function enable-dhcp{
param([string]$netAdapter='Eth')
Write-Output "Enabling DHCP"
Get-WmiObject Win32_NetworkAdapter -filter "NetConnectionID LIKE '%'" | ?{$_.NetConnectionID -like "$netAdapter*"} | %{netsh interface ip set address "$($_.NetConnectionID)" dhcp}
}
function enable-NetAdapters{
param([string]$netAdapter='Eth')
Write-Output "Enabling Net Adapters"
Get-WmiObject Win32_NetworkAdapter -filter "NetConnectionID LIKE '%'" | ?{$_.NetConnectionID -like "$netAdapter*"} | %{netsh interface set interface "$($_.NetConnectionID)" ENABLED}
}
function release-renew{
ipconfig.exe /release
ipconfig.exe /renew
}
function install-usbEth {
switch([string]([enviornment]::OSVersion.Version.major)+"."+[string]([enviornment]::OSVersion.Version.minor)){
$DuckyDir = (split-path $SCRIPT:MyInvocation.MyCommand.Path -parent)
'10.0' {& "$DuckyDir\USB2Eth_Drivers\Win10\setup.exe"}
'6.2','6.3' {& "$DuckyDir\USB2Eth_Drivers\Win8\setup.exe"}
'6.1' {& "$DuckyDir\USB2Eth_Drivers\Win7\setup.exe"}
Default {& "$DuckyDir\USB2Eth_Drivers\WinXP_Vista\setup.exe"}
}
}
}
Process{
$operation = (Read-Host "Select Operation:`nFull(0); Disable Firewall & non-Ethernet(1); Enable all Network adapters(2); Refresh IP(3); Install USB2Eth(4)")
switch ($operation) {
0 {
Write-verbose "Disabling Firewall"
disable-Firewall
Write-verbose "Disabling Network Adapters"
disable-NetAdapters -netAdapter "1"
Write-verbose "Enabling DHCP"
enable-dhcp
Start-Sleep 1
Write-verbose "Enabling Ethernet Adapters"
enable-NetAdapters
}
1 {
Write-verbose "Disabling Firewall and Non-Ethernet"
disable-Firewall
disable-NetAdapters
}
2 {
Write-Verbose "Enabling all network adapters"
enable-NetAdapters -netAdapter '*'
}
3 {
Write-Verbose "Doing release renew"
release-renew
}
4 {
Write-verbose "Installing Ethernet Driver for " + [string]([enviornment]::OSVersion.Version.major)+"."+[string]([enviornment]::OSVersion.Version.minor)
install-usbEth
}
Default {Write-Warning "I didn't do anything!"}
}
}
End{
}