Skip to content

Commit

Permalink
Fix IPv6 Obfuscation
Browse files Browse the repository at this point in the history
  • Loading branch information
nickvourd committed Mar 31, 2024
1 parent 0e39d0e commit 7544d2a
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions Packages/Obfuscators/Obfuscators.go
Original file line number Diff line number Diff line change
Expand Up @@ -198,8 +198,8 @@ func IPv6Obfuscation(shellcode string) ([]string, int, []string) {
remaining := 32 - (len(shellcode) % 32)

// Generate random hexadecimal values and append them to the shellcode
for i := 0; i < remaining; i++ {
randomHex := fmt.Sprintf("%X", rand.Intn(16))
for i := 0; i < remaining; i = i + 2 {
randomHex := fmt.Sprintf("%X", rand.Intn(240)+16)
shellcode += strings.ToLower(randomHex)
randomHexValues = append(randomHexValues, randomHex)
randomHexCount++
Expand Down Expand Up @@ -356,7 +356,7 @@ func DetectObfuscation(obfuscation string, shellcode []string) string {
if randomHexCount > 0 {
// if count more than one
if randomHexCount > 1 {
pronousChar = "characters"
pronousChar = "bytes"
pronous = "them"
}

Expand All @@ -370,7 +370,7 @@ func DetectObfuscation(obfuscation string, shellcode []string) string {
}

// Remove comma
obfuscatedShellcodeString = obfuscatedShellcodeString[:len(obfuscatedShellcodeString)-2]
obfuscatedShellcodeString = obfuscatedShellcodeString[:len(obfuscatedShellcodeString)-1]

return obfuscatedShellcodeString
case "mac":
Expand Down Expand Up @@ -424,11 +424,7 @@ func CustomPayloadMessage(obfuscation string, randomHexCount int, randomHexValue
// Declare variables
var hexString string

if obfuscation != "ipv6" {
fmt.Printf("[+] Configure payload length evenly for %s obfuscation by adding %d random %s:\n\n", obfuscation, randomHexCount, pronousChar)
} else {
fmt.Printf("[+] Configure payload length evenly for %s obfuscation by adding %d random %s:\n\n", obfuscation, randomHexCount, pronousChar)
}
fmt.Printf("[+] Configure payload length evenly for %s obfuscation by adding %d random %s:\n\n", obfuscation, randomHexCount, pronousChar)

// Iterate over each character
for i, char := range randomHexValues {
Expand Down

0 comments on commit 7544d2a

Please sign in to comment.