FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Fix convert char to byte loop · qiufeng1/SimpleShellcodeInjector@bd9a1a5 · GitHub

Repository navigation

Commit bd9a1a5

Browse files
Fix convert char to byte loop
1 parent 6e2db2f commit bd9a1a5

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

‎SimpleShellcodeInjector.c‎

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,16 @@ int main(int argc, char *argv[]) {
2323

2424
printf("%s\n\n", &logo);
2525

26-
for(unsigned int i = 0; i< iterations; i++) {
26+
/*
27+
convert to shellcode:
28+
29+
Iterations is equal to strlen(shellcode) which is the total number of characters (in the above example 1666 shellcode[0] to shellcode[1665]).
30+
We convert in pairs, so for i=0 we are going to read shellcode[0] and shellcode[1] in order to create one byte from those 2 chars.
31+
The last byte will be created for i=1664 which will convert the characters shellcode[1664] and shellcode[1665]. So the last time we are going to enter the loop
32+
will be for i = 1664, meaning i<16665 which is i < 1666-1 or i < iterations-1
33+
*/
34+
35+
for(unsigned int i = 0; i< iterations-1; i++) {
2736
sscanf(shellcode+2*i, "%2X", &char_in_hex);
2837
shellcode[i] = (char)char_in_hex;
2938
}

0 commit comments

Comments
 (0)

Back | FazBrowse Home | New Git URL