#include <iostream>
#include <windows.h>
#include <stdio.h>
#include <fstream>
using namespace std;
void enc(char * _cEnc, int _shf);
void dec(char * _cDec, int _shf);
void enc(char * _cEnc, int _shf)
{
for(int i=0; _cEnc[i] != '\0'; ++i)
_cEnc[i]+=_shf;
}
void dec(char * _cDec, int _shf)
{
for(int i=0; _cDec[i] != '\0'; ++i)
_cDec[i]-=_shf;
}
int main (void)
{
string _input;
string _filename;
int _code;
system("title script_protect.exe");
cout << "Author: Gh05t\nDate Published: 1/28/12\nVersion: 1.0.0\n\n";
EXECUTE:
cin >> _input;
if(_input == "format")
{
cout << "Filename: ";
cin >> _filename;
string _pwn_filename = _filename + ".pwn"; //append...
ifstream file(_pwn_filename.c_str());
if(!file.good())
{
cout << "[Error]: " <<"unable to retrieve " << _pwn_filename << "! \n\n";
file.close();
goto EXECUTE;
}
else
{
CODE:
cout << "Insert a code (values from 0 - 700): ";
cin >> _code;
if(_code < 1 || _code > 700)
{
cout << "[Error]: invalid code.\n\n";
goto CODE;
}
string _pwn2_filename = _filename + ".pwn2"; //format...
ofstream _pwn2_filecreate(_pwn2_filename.c_str());
string _data;
char _cStr[999999];
ifstream _file_1;
_file_1.open(_pwn_filename.c_str());
ofstream _file_2;
_file_2.open (_pwn2_filename.c_str());
cout << "Formatting..." << endl;
while(_file_1)
{
getline(_file_1, _data);
//cout << _data << endl;
strcpy(_cStr, _data.c_str()); //to char...
enc(_cStr, _code);
_file_2 << _cStr << endl;
}
_file_1.close();
_file_2.close();
file.close();
cout << "Formatting completed!\n" << endl;
remove( _pwn_filename.c_str() );
goto EXECUTE;
}
}
else if(_input == "access")
{
cout << "Filename: ";
cin >> _filename;
string _pwn2_filename = _filename + ".pwn2";
ifstream file(_pwn2_filename.c_str());
if(!file.good())
{
cout << "[Error]: " <<"unable to retrieve " << _pwn2_filename << "! \n\n";
file.close();
goto EXECUTE;
}
else
{
CODE2:
cout << "Code: ";
cin >> _code;
if(_code < 1 || _code > 700)
{
cout << "[Error]: invalid code.\n\n";
goto CODE2;
}
string _pwn_filename = _filename + ".pwn";
ofstream _pwn_filecreate(_pwn_filename.c_str());
string _data;
char _cStr[999999];
ifstream _file_1;
_file_1.open (_pwn2_filename.c_str());
ofstream _file_2;
_file_2.open(_pwn_filename.c_str());
cout << "Formatting..." << endl;
while(_file_1)
{
getline(_file_1, _data);
//cout << _data << endl;
strcpy(_cStr, _data.c_str()); //to char...
dec(_cStr, _code);
_file_2 << _cStr << endl;
}
_file_1.close();
_file_2.close();
file.close();
cout << "Formatting completed!\n" << endl;
remove( _pwn2_filename.c_str() );
goto EXECUTE;
}
}
else if(_input != "format" || _input != "access")
{
cout << "[Error]: invalid command(_input)\n\n";
goto EXECUTE;
}
goto EXECUTE;
}
void enc(char * _cEnc, int _shf)
{
for(int i=0; _cEnc[i] != '\0'; ++i)
_cEnc[i]+=_shf;
}
void enc(char * _cEnc, int _shf)
{
for(int i=0; *_cEnc[i] != '\0'; ++i)
*_cEnc[i]+=_shf;
}
|
pawn Код:
|
|
btw Isn't it:
pawn Код:
|
|
From now on every guy that sees a file .pwn2 will take the difference between the real EoF and the cripted one and boom. I got the key.
|
|
Originally Posted by Stewie`
Not to mention that scripts can have characters up to the char limit.
|
|
I suggest you you use some cryptography like whirlpool, aes, sha, etc.
|
|
People who get their scripts 'stolen' from someone have made the mistake of uploading it somewhere or physically giving it to someone else. I doubt people who do such will have the capabilities of downloading this (very limited) protective application.
|
|
unless anyone comes up with a method to decrypt an encrypted file with no code, the application will remain at it's current state until I have found a most better method.
|