Skip to content

Commit 2eae2c5

Browse files
authored
Merge pull request #24 from nickvourd/dev
Fix Obfuscation
2 parents d2e5e35 + be53bbd commit 2eae2c5

File tree

6 files changed

+39
-62
lines changed

6 files changed

+39
-62
lines changed

Packages/Arguments/Arguments.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ type FlagOptions struct {
2323
}
2424

2525
var (
26-
version = "3.1"
27-
versionName = "Blue Moon"
26+
version = "3.5"
27+
versionName = "Star Dust"
2828
license = "MIT"
2929
author = "@nickvourd"
3030
github = "https://github.com/nickvourd/Supernova"

Packages/Converters/Converters.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@ func ShellcodeDecimalArray2String(decArray []int) string {
243243
func ConvertObfShellcode2Template(shellcode string, language string, variable string) string {
244244
switch language {
245245
case "c":
246-
template := fmt.Sprintf(`unsigned char %s[] = {%s};`, variable, shellcode)
246+
template := fmt.Sprintf(`char* %s[] = {%s};`, variable, shellcode)
247247
return template
248248
case "csharp":
249249
template := fmt.Sprintf(`string[] %s = new string[] {%s};`, variable, shellcode)

Packages/Obfuscators/Obfuscators.go

Lines changed: 28 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import (
55
"Supernova/Packages/Converters"
66
"fmt"
77
"log"
8-
"math/rand"
98
"os"
109
"strings"
1110
)
@@ -58,12 +57,14 @@ func EnsureSegmentLength(segment string, desiredLength int) (string, int, []stri
5857
if len(segment) < desiredLength {
5958
// Append random hex values until the segment reaches the desired length
6059
for len(segment) < desiredLength {
61-
randomHex := fmt.Sprintf("%02X", rand.Intn(240)+16)
60+
//randomHex := fmt.Sprintf("%02X", rand.Intn(240)+16)
61+
randomHex := "90"
6262
segment += strings.ToLower(randomHex)
6363
randomHexValues = append(randomHexValues, randomHex)
6464
totalRandomHexAdded++
6565
}
6666
}
67+
6768
return segment, totalRandomHexAdded, randomHexValues
6869
}
6970

@@ -166,7 +167,8 @@ func MacObfuscation(shellcode string) (string, int, []string) {
166167
if len(group) < 6 {
167168
// Generate and append random hex values to the group
168169
for j := len(group); j < 6; j++ {
169-
randomHex := fmt.Sprintf("%02X", rand.Intn(240)+16)
170+
//randomHex := fmt.Sprintf("%02X", rand.Intn(240)+16)
171+
randomHex := "90"
170172
group = append(group, strings.ToLower(randomHex))
171173
randomHexValues = append(randomHexValues, randomHex)
172174
randomHexCount++
@@ -201,7 +203,8 @@ func IPv6Obfuscation(shellcode string) ([]string, int, []string) {
201203

202204
// Generate random hexadecimal values and append them to the shellcode
203205
for i := 0; i < remaining; i = i + 2 {
204-
randomHex := fmt.Sprintf("%X", rand.Intn(240)+16)
206+
//randomHex := fmt.Sprintf("%X", rand.Intn(240)+16)
207+
randomHex := "90"
205208
shellcode += strings.ToLower(randomHex)
206209
randomHexValues = append(randomHexValues, randomHex)
207210
randomHexCount++
@@ -233,15 +236,10 @@ func IPv6Obfuscation(shellcode string) ([]string, int, []string) {
233236
}
234237

235238
// IPv4Obfuscation function
236-
func IPv4Obfuscation(shellcode string) string {
239+
func IPv4Obfuscation(shellcode string) (string, int, []string) {
237240
// Arrays to store added numbers and their hexadecimal representations
238-
var addedNumbers []int
239241
var hexRepresentations []string
240-
241-
// Variables eclaration
242-
var pronous string = "it"
243-
var pronousNum string = "number"
244-
var result string
242+
var addedNumbers []int
245243

246244
// Split the original string into chunks of four digits
247245
chunks := strings.Fields(shellcode)
@@ -267,18 +265,15 @@ func IPv4Obfuscation(shellcode string) string {
267265

268266
// Loop until the length of chunkResult is equal to 4
269267
for len(chunkResult) < 4 {
270-
// Generate a random decimal from 0 to 255
271-
randomNumber := rand.Intn(256)
272-
273-
// Convert decimal to hexadecimal
274-
randomHex := fmt.Sprintf("0x%X", randomNumber)
268+
//randomHex := fmt.Sprintf("0x%X", randomNumber)
269+
randomNumber := 90
275270

276271
// Convert the random number to a string
277272
randomString := fmt.Sprintf("%d", randomNumber)
278273

279274
// Add the random number and its hexadecimal representation to arrays
280275
addedNumbers = append(addedNumbers, randomNumber)
281-
hexRepresentations = append(hexRepresentations, randomHex)
276+
hexRepresentations = append(hexRepresentations, randomString)
282277

283278
// Add the random string to the slice
284279
chunkResult = append(chunkResult, randomString)
@@ -287,45 +282,12 @@ func IPv4Obfuscation(shellcode string) string {
287282
// Print the message with the count of added numbers and their details
288283
count := len(addedNumbers)
289284

290-
// if count more than one
291-
if count > 1 {
292-
pronousNum = "numbers"
293-
}
294-
295-
if count > 0 {
296-
fmt.Printf("[+] Configure payload length evenly for IPv4 obfuscation by adding %d random %s:\n\n", count, pronousNum)
297-
298-
// Iterate over each element and build the result string
299-
for i, num := range addedNumbers {
300-
hexRep := hexRepresentations[i]
301-
302-
// Append the formatted string to the result
303-
if i < count-1 {
304-
result += fmt.Sprintf(Colors.BoldRed("%d "), num)
305-
result += fmt.Sprintf("=> byte(%s)", Colors.BoldMagneta(strings.ToLower(hexRep)))
306-
result += ", "
307-
} else {
308-
result += fmt.Sprintf(Colors.BoldRed("%d "), num)
309-
result += fmt.Sprintf("=> byte(%s)", Colors.BoldMagneta(strings.ToLower(hexRep)))
310-
}
311-
}
312-
313-
fmt.Print(" " + result + "\n\n")
314-
315-
// if generated numbers are more than one
316-
if count > 1 {
317-
pronous = "them"
318-
}
319-
320-
fmt.Printf("[!] Be sure to remove %s during the implementation process!\n\n", pronous)
321-
}
322-
323285
// Join the last remaining elements into a string with dots
324286
configResult := strings.Join(chunkResult, ".")
325287

326288
shellcodeProperty += "\"" + configResult + "\""
327289

328-
return shellcodeProperty
290+
return shellcodeProperty, count, hexRepresentations
329291
}
330292

331293
// DetectObfuscation function
@@ -347,7 +309,19 @@ func DetectObfuscation(obfuscation string, shellcode []string) string {
347309
shellcodeStr := Converters.ShellcodeDecimalArray2String(shellcodeDecArray)
348310

349311
// Call function named IPv4Obfuscation
350-
obfuscatedShellcodeString = IPv4Obfuscation(shellcodeStr)
312+
obfuscatedShellcodeString, randomHexCount, randomHexValues := IPv4Obfuscation(shellcodeStr)
313+
314+
// if count more than zero
315+
if randomHexCount > 0 {
316+
// if count more than one
317+
if randomHexCount > 1 {
318+
pronousChar = "bytes"
319+
pronous = "them"
320+
}
321+
322+
// Call function named CustomPayloadMessage
323+
CustomPayloadMessage(obfuscation, randomHexCount, randomHexValues, pronous, pronousChar)
324+
}
351325

352326
return obfuscatedShellcodeString
353327
case "ipv6":
@@ -429,7 +403,7 @@ func CustomPayloadMessage(obfuscation string, randomHexCount int, randomHexValue
429403
// Declare variables
430404
var hexString string
431405

432-
fmt.Printf("[+] Configure payload length evenly for %s obfuscation by adding %d random %s:\n\n", obfuscation, randomHexCount, pronousChar)
406+
fmt.Printf("[+] Configure payload length evenly for %s obfuscation by adding %d NOP %s:\n\n", strings.ToUpper(obfuscation), randomHexCount, pronousChar)
433407

434408
// Iterate over each character
435409
for i, char := range randomHexValues {
@@ -444,6 +418,5 @@ func CustomPayloadMessage(obfuscation string, randomHexCount int, randomHexValue
444418

445419
fmt.Print(" " + hexString + "\n\n")
446420

447-
fmt.Printf("[!] Be sure to remove %s during the implementation process!\n\n", pronous)
448-
421+
//fmt.Printf("[!] Be sure to remove %s during the implementation process!\n\n", pronous)
449422
}

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ Real fucking shellcode encryptor & obfuscator.
1515
Supernova is an open-source tool that empowers users to securely encrypt and/or obfuscate their raw shellcode.
1616

1717
![Static Badge](https://img.shields.io/badge/Golang-cyan?style=flat&logoSize=auto)
18-
![Static Badge](https://img.shields.io/badge/Version-3.1%20(Blue%20Moon)-red?link=https%3A%2F%2Fgithub.com%2Fnickvourd%2FSupernova%2Freleases)
18+
![Static Badge](https://img.shields.io/badge/Version-3.5%20(Star%20Dust)-red?link=https%3A%2F%2Fgithub.com%2Fnickvourd%2FSupernova%2Freleases)
1919

2020
Supernova supports various features beyond those typically found in a common shellcode encryptor tool. Please refer to the <a href="#features"> Features</a> section for more information.
2121

@@ -142,7 +142,7 @@ go build Supernova
142142
███████║╚██████╔╝██║ ███████╗██║ ██║██║ ╚████║╚██████╔╝ ╚████╔╝ ██║ ██║
143143
╚══════╝ ╚═════╝ ╚═╝ ╚══════╝╚═╝ ╚═╝╚═╝ ╚═══╝ ╚═════╝ ╚═══╝ ╚═╝ ╚═╝
144144
145-
Supernova v3.1 - Real fucking shellcode encryptor & obfuscator tool.
145+
Supernova v3.5 - Real fucking shellcode encryptor & obfuscator tool.
146146
Supernova is an open source tool licensed under MIT.
147147
Written with <3 by @nickvourd.
148148
Please visit https://github.com/nickvourd/Supernova for more...

go.mod

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@ toolchain go1.24.2
66

77
require (
88
github.com/fatih/color v1.18.0
9-
golang.org/x/crypto v0.37.0
9+
golang.org/x/crypto v0.38.0
1010
)
1111

1212
require (
1313
github.com/mattn/go-colorable v0.1.14 // indirect
1414
github.com/mattn/go-isatty v0.0.20 // indirect
15-
golang.org/x/sys v0.32.0 // indirect
15+
golang.org/x/sys v0.33.0 // indirect
1616
)

go.sum

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWE
66
github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
77
golang.org/x/crypto v0.37.0 h1:kJNSjF/Xp7kU0iB2Z+9viTPMW4EqqsrywMXLJOOsXSE=
88
golang.org/x/crypto v0.37.0/go.mod h1:vg+k43peMZ0pUMhYmVAWysMK35e6ioLh3wB8ZCAfbVc=
9+
golang.org/x/crypto v0.38.0 h1:jt+WWG8IZlBnVbomuhg2Mdq0+BBQaHbtqHEFEigjUV8=
10+
golang.org/x/crypto v0.38.0/go.mod h1:MvrbAqul58NNYPKnOra203SB9vpuZW0e+RRZV+Ggqjw=
911
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
1012
golang.org/x/sys v0.32.0 h1:s77OFDvIQeibCmezSnk/q6iAfkdiQaJi4VzroCFrN20=
1113
golang.org/x/sys v0.32.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k=
14+
golang.org/x/sys v0.33.0 h1:q3i8TbbEz+JRD9ywIRlyRAQbM0qF7hu24q3teo2hbuw=
15+
golang.org/x/sys v0.33.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k=

0 commit comments

Comments
 (0)