Hi guys,
i open this thread for release the unpacker ( with decrypter ) for .NOS files ^^
[Only registered and activated users can see links. Click Here To Register...]
Extractor function
Decrypter
i open this thread for release the unpacker ( with decrypter ) for .NOS files ^^
[Only registered and activated users can see links. Click Here To Register...]
Extractor function
Code:
private: System::Void button1_Click(System::Object^ sender, System::EventArgs^ e) {
System::IO::Stream ^myStream;
OpenFileDialog ^openFileDialog1 = gcnew OpenFileDialog;
openFileDialog1->InitialDirectory = "C:\\Program Files (x86)\\GameforgeLive\\Games\\ITA_ita\\NosTale\\NostaleData\\";
openFileDialog1->Filter = "File NOS|*.NOS";
openFileDialog1->FilterIndex = 2;
openFileDialog1->RestoreDirectory = true;
if (openFileDialog1->ShowDialog() == System::Windows::Forms::DialogResult::OK)
{
if ((myStream = openFileDialog1->OpenFile()) != nullptr)
{
this->f_Name = System::IO::Path::GetFileName(openFileDialog1->FileName);
this->f_Path = System::IO::Path::GetDirectoryName(openFileDialog1->FileName);
//
msclr::interop::marshal_context context;
std::string f_Full = context.marshal_as<std::string>(this->f_Path + "\\" + this->f_Name);
listBox2->Items->Add(gcnew String(f_Full.c_str()));
//
FILE *f;
if((f = fopen(f_Full.c_str(), "rb")) != NULL)
{
unsigned int amount, file_num;
fread(&amount, 1, 4, f);
f_nos *f_Nos = new f_nos[amount];
for (int i = 0; i < amount; i++)
{
fread(&file_num, 1, 4, f);
fread(&f_Nos[file_num].name_len, 1, 4, f);
f_Nos[file_num].name = (char*) malloc(f_Nos[file_num].name_len + 1);
fread(f_Nos[file_num].name, 1, f_Nos[file_num].name_len, f);
f_Nos[file_num].name[f_Nos[file_num].name_len] = 0;
//
listBox1->Items->Add(gcnew String(f_Nos[file_num].name));
//
fread(&f_Nos[file_num].name_end, 1, 4, f);
fread(&f_Nos[file_num].buffer, 1, 4, f);
f_Nos[file_num].content = (unsigned char*) malloc(f_Nos[file_num].buffer+1);
fread(f_Nos[file_num].content, 1, f_Nos[file_num].buffer, f);
f_Nos[file_num].content[f_Nos[file_num].buffer] = 0;
}
fclose(f);
}
else
{
MessageBox::Show("Could not open " + this->f_Name + " /rb");
}
myStream->Close();
}
}
}
Code:
// thanks to cryptic for help ^^
int decryptnosfile(unsigned char *cData, unsigned int f_buffer, unsigned char *cOut, unsigned int &nOut)
{
static unsigned char table[] = { 0, 0x20,'-','.','0','1','2','3','4','5','6','7','8','9', 0x0d };
unsigned int i, offset, len;
unsigned char size, c;
len = f_buffer;
unsigned char *cBuffer;
cBuffer = (unsigned char*)malloc(f_buffer + 1);
memcpy(cBuffer, cData, f_buffer);
offset = nOut = 0;
while(offset < len
{
if(cBuffer[offset] == 0xFFu)
{
offset++;
*(cOut + nOut++) = 0x0d;
continue;
}
size = cBuffer[offset++];
i = 0;
if ((size & 0x80U) == 0)
{
while ((i++ < size) && (offset < len))
{
*(cOut + nOut++) = (cBuffer[offset++] ^ 0x33U);
}
}
else
{
size &= 0x7FU;
while ((i < size) && (offset < len))
{
c = cBuffer[offset++];
*(cOut + nOut++) = (table[(c & 0xF0U) >> 4]);
if (table[c & 0x0FU] != 0)
*(cOut + nOut++) = table[c & 0x0FU];
i += 2;
}
}
}
free(cBuffer);
return offset;
}