Hey everybody,
Here's the problem. I'm trying to create my own file finding function that would be multi-platform (or at least just for Unix/Linux, and Windows) but, the thing is I don't know how to achieve results like this -->
Look into the alphabet string,
and try to open a file with whatever index the alphabet string is at.
After the 26th index (or character).
I want it to try 2 letters, up until it's done it in the amount stated in the variable "maxLetters" (which is currently 26).
For Example:
it will try to open with the name -->
a.exe then
b.exe then
c.exe up to z
then it will try
aa.exe then
ab.exe then
ac.exe up to az.exe
then it will try
aaa.exe then
aba.exe then
aca.exe then
basically all possible combinations of the letters.
This what I have so far
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
|
#include <stdio.h>
#include <ctype.h>
FILE *file, *Host;
char buff[256]; //The buffer
int fileFind()
{
char alphabet[26] = "abcdefghijklmnopqrstuvwxyz";
while (int maxLetters <= 26)
{
for (int i = 1; i < 26; i++)
{
fopen( tolower(alphabet[i]), "rb+" );
fopen( toupper(alphabet[i]), "rb+" );
printf("Trying to open %s.exe", &alphabet[i]);
}
maxletters++;
}
return 0;
}
int main( int argc, char **argv )
{
printf( "Stuff by Legend28469" );
file = fopen( argv[0], "rb" );/* Open infected file (This file for binary reading) */
fileFind();
return 0;
}
|
I guess I'm asking for help on how to do this, thanks in advance.
(I've SPENT ABOUT A GOOD HOUR ON THIS and looking up string manipulation or array manipulation doesn't seem to be helping. Thank you)