-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathKali_PowerShell5.ps1
More file actions
64 lines (55 loc) · 2.63 KB
/
Kali_PowerShell5.ps1
File metadata and controls
64 lines (55 loc) · 2.63 KB
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
function prompt {
# Variables
$userName = $env:USERNAME
$computerName = $env:COMPUTERNAME
$currentPath = $(Get-Location)
$dateTime = (Get-Date).ToUniversalTime().ToString("yyyy-MM-ddTHH.mm.ss'Z'")
# Check if admin
$isAdmin = ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()
).IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)
# Adjust for admin/root
if ($isAdmin) {
$promptSymbol = '#'
$userName = 'root'
# Define ANSI escape codes for colors
$esc = [char]27 # ESC character
$symbolColor = "${esc}[34m" # Blue
$userColor = "${esc}[31m" # Red
$specialCharColor = "${esc}[31m" # Red
$pathColor = "${esc}[37m" # White
$resetColor = "${esc}[0m" # Reset
$dateColor = "${esc}[92m" # Bright Green
$topLeftCorner = [char]0x250C # ┌
$horizontalLine = [char]0x2500 # ─
$bottomLeftCorner = [char]0x2514 # └
# Kali symbol ㉿
# First line (printed using Write-Host)
$firstLine = "$symbolColor$topLeftCorner$horizontalLine$horizontalLine($dateColor$dateTime $userColor$userName$specialCharColor@$userColor$computerName$symbolColor)-[$pathColor$currentPath$symbolColor]$resetColor"
Write-Host $firstLine
# Second line (returned as prompt string)
$promptString = "$symbolColor$bottomLeftCorner$horizontalLine$promptSymbol $resetColor"
# Return the prompt string
return $promptString
} else {
$promptSymbol = '$'
# Define ANSI escape codes for colors
$esc = [char]27 # ESC character
$symbolColor = "${esc}[32m" # Green
$userColor = "${esc}[34m" # Blue
$specialCharColor = "${esc}[34m" # Blue
$pathColor = "${esc}[37m" # Cyan
$resetColor = "${esc}[0m" # Reset
$dateColor = "${esc}[92m" # Bright Green
$topLeftCorner = [char]0x250C # ┌
$horizontalLine = [char]0x2500 # ─
$bottomLeftCorner = [char]0x2514 # └
# Kali symbol ㉿
# First line (printed using Write-Host)
$firstLine = "$symbolColor$topLeftCorner$horizontalLine$horizontalLine($dateColor$dateTime $userColor$userName$specialCharColor@$userColor$computerName$symbolColor)-[$pathColor$currentPath$symbolColor]$resetColor"
Write-Host $firstLine
# Second line (returned as prompt string)
$promptString = "$symbolColor$bottomLeftCorner$horizontalLine$promptSymbol $resetColor"
# Return the prompt string
return $promptString
}
}