Here's some code.
#include <stdio.h>
int main()
{
char npass[] = "$1$bUZXMjKz$08Ps4NPTfj6ZNkoqrsP/D.";
char salt [12];
int i;
for (i = 0; i < 12; i++)
{
npass[i+3] = salt[i];
i++;
}
salt[12] = '\0';
puts(salt);
return 0;
}
Basically, npass is an md5crypt result(password is admin). In order to verify this, I need to separate the salt from the result.
My understanding is that a string in C is really a char array containing all the letters alone(with '\0' at the end). I use a for loop to cut the first three characters but I guess because of ASLR, the results that I get are always random ones. Actually, without ASLR, I get the same random result always.