[C++ Release] NOS Unpacker + Decrypter

08/13/2013 00:55 Sm•ke#1
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

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();
					 }
				 }
			 }
Decrypter

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;
		}
08/13/2013 01:08 Elektrochemie#2
Quote:
Originally Posted by Sm•ke View Post
unpacker ( with decrypter ) for .NOS files ^^
String .NOS Files. :rolleyes:
08/13/2013 14:22 scream52#3
Hi, I would like to know where I have put the source code? On what software?
08/13/2013 15:02 DoDo1997#4
Quote:
Originally Posted by ernilos View Post
Where is C++? only i see in .Net objects lol

you suck... you give only bad comments, release something than you can talk...-.-

Can you release a compiled version of the tool? my Visual Studio sucks...
08/13/2013 18:01 Sm•ke#5
Last edited by ernilos; Today at 17:54
my message: Today, 17:52

i'm not stupid, u edited after, yeah.. i hate boost libraries, then ? is your problem ? i prefer _beginthread, u say "u need use boost thread" but u use _beginthread like me ! aahh
08/15/2013 16:32 RemoverPL#6
I have a problem while compiling :/

Quote:
C:\cpp\test.cpp|1|error: expected unqualified-id before 'private'|
||=== Build finished: 1 errors, 0 warnings ===|
This problem is in string 1:
Code:
private: System::Void button1_Click(System::Object^  sender, System::EventArgs^  e) {
I was compiling this code in Code::Blocks. Help :(
08/16/2013 00:58 ernilos#7
Quote:
Originally Posted by RemoverPL View Post
I have a problem while compiling :/



This problem is in string 1:
Code:
private: System::Void button1_Click(System::Object^  sender, System::EventArgs^  e) {
I was compiling this code in Code::Blocks. Help :(
U need look the decompress algorythm how works, it's a reference no an code for C&P
09/18/2013 04:55 misty2#8
hi, can i unpack the sprites with this tool? i have installed the visual studio but i have no idea whats next, an empty project and then i paste the unpacker? what should i do?
09/18/2013 12:42 szymek111#9
Upload build... not code .. lol
09/18/2013 13:13 Sm•ke#10
Quote:
Originally Posted by szymek111 View Post
Upload build... not code .. lol
nope, i don't give the built code.. if u want use this, u need to study ^.^
09/18/2013 17:07 nekomee#11
What about packer? >.>
09/21/2013 16:24 Vilius242lt#12
How do you make this work?
09/26/2013 21:23 Dracula##13
Smoke,please give to exe
09/28/2013 14:05 ernilos#14
Click [Only registered and activated users can see links. Click Here To Register...] for download the .exe and fully code source ;)
09/30/2013 20:13 Vilius242lt#15
Quote:
Originally Posted by ernilos View Post
Click [Only registered and activated users can see links. Click Here To Register...] for download the .exe and fully code source ;)

The program crashes when you open a .nos file with it