[Tool/Web/Other] Protect your Script - pawn_protect.exe
#1

Highly Recommended: Backup your gamemode (.pwn file)

What is this?
pawn_protect.exe is an application in which formats your .pwn file to unreadable code in which may only be deciphered through a code from values of 0 - 700. The application seems to be most useful to those whom are extremely 'careful' regarding their script.

Instructions:
1. Download the application.
2. Extract the application to the folder containing your gamemode (.pwn).
3. Execute the application.

How to use?
  • Type format (case sensitive) to format your .pwn file to a .pwn2.
  • Type access (case sensitive) to convert your .pwn2 file to a .pwn.
Downloads:
http://www.sendspace.com/file/fzyvru
http://www.mediafire.com/?6p9za3nlo6b4ovv

Source:
Код:
#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;
}
Special Thanks
Kyosaur - Support and help whenever needed.

Note: The source is C++, NOT PAWN related material. I've managed to make it as less redundant though the algorithm in my opinion is completely absurd but is the only way I could have thought of. Some techniques used are frowned upon by myself including some c-style methods, usage of goto etc. If you have any questions, comments, please feel free to post.
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 2 Guest(s)