CyberCriminal - A C# project where you can be a part of

Re: CyberCriminal - A C# project where you can be a part of

Postby joppiesaus » 11 Aug 2013, 14:05

Progress on 0.3:
Code: Select all
v 0.3
- Code fixes. Instead of adding a new line in every function, just add a new line in the command function.
- Improved set system, less code and more efficient.
- You can now start a process directly from a path(C:\ for example);
- Added a new command THROW (pretty useless)
* throw [Exception] - Throws an exception
- Added a new command GAME
* game <game> - plays a game
* if you play fourinarow, you type exit as a row, it will exit.
- Bug with a set argument fixed
joppiesaus
 
Posts: 379
Joined: 20 Aug 2012, 07:28
Location: in a obsedian house, with glass in it so i can see the lava!

Re: CyberCriminal - A C# project where you can be a part of

Postby Conor » 12 Aug 2013, 09:19

Here is something else.

It allows you to encrypt and decrypt messages using a password.

/encrypt [password] [message]
/decrypt [password] [message]

The command method is an example, I'm not sure how you are going to code it exactly into your source, but there is an example of how the if statement will work.

The other methods are used to operate the command.

Code: Select all
       private void command(string message)
        {
            if (message.IndexOf('/') == 0)
            {
                message = message.Substring(1).TrimStart();

                if (message.Contains(" ") && message.Split(' ').Length >= 2)
                {
                    if (message.Split(' ')[0].ToLower() == "encrypt")
                    {
                        onEncrypt(message.Split(' ')[1], message.Split(new char[] { ' ' }, 3)[2]);
                    }
                    else if (message.Split(' ')[0].ToLower() == "decrypt")
                    {
                        // Can just use Split[2] here as encrypted strings do not have any spaces within them
                        onDecrypt(message.Split(' ')[1], message.Split(' ')[2]);
                    }
                }

            }
            command(Console.ReadLine());
        }

        private void onEncrypt(string code, string toEncrypt)
        {
            string Encrypted = Encrypt(toEncrypt, code);
            Console.WriteLine("Encrypted message: ");
            Console.WriteLine(Encrypted);
            Clipboard.SetText(Encrypted);
            Console.WriteLine("This message has been copied to your clipboard.");
        }

        private void onDecrypt(string code, string toDecrypt)
        {
            string Decrypted = Decrypt(toDecrypt, code);
            Console.WriteLine("Decrypted message: ");
            Console.WriteLine(Decrypted);
        }

        // If you change this, byte[] array must be >= 8
        private readonly byte[] _salt = Encoding.ASCII.GetBytes("Conor12345:D");

        private string Encrypt(string toEncrypt, string EncryptionCode)
        {
            try
            {
                string toReturn = null;
                RijndaelManaged aesAlg = null;

                try
                {
                    Rfc2898DeriveBytes key = new Rfc2898DeriveBytes(EncryptionCode, _salt);

                    aesAlg = new RijndaelManaged();
                    aesAlg.Key = key.GetBytes(aesAlg.KeySize / 8);
                    aesAlg.IV = key.GetBytes(aesAlg.BlockSize / 8);

                    ICryptoTransform encryptor = aesAlg.CreateEncryptor(aesAlg.Key, aesAlg.IV);

                    using (MemoryStream msEncrypt = new MemoryStream())
                    {
                        using (CryptoStream csEncrypt = new CryptoStream(msEncrypt, encryptor, CryptoStreamMode.Write))
                        {
                            using (StreamWriter swEncrypt = new StreamWriter(csEncrypt))
                            {
                                swEncrypt.Write(toEncrypt);
                            }
                        }
                        toReturn = Convert.ToBase64String(msEncrypt.ToArray());
                    }
                }
                finally
                {
                    if (aesAlg != null)
                    {
                        aesAlg.Clear();
                    }
                }
                return toReturn;
            }
            catch { return "Error"; }
        }

        private string Decrypt(string toDecrypt, string EncryptionCode)
        {
            try
            {
                RijndaelManaged aesAlg = null;
                string DecryptedString = null;

                try
                {
                    Rfc2898DeriveBytes key = new Rfc2898DeriveBytes(EncryptionCode, _salt);

                    aesAlg = new RijndaelManaged();
                    aesAlg.Key = key.GetBytes(aesAlg.KeySize / 8);
                    aesAlg.IV = key.GetBytes(aesAlg.BlockSize / 8);

                    ICryptoTransform decryptor = aesAlg.CreateDecryptor(aesAlg.Key, aesAlg.IV);

                    byte[] bytes = Convert.FromBase64String(toDecrypt);
                    using (MemoryStream msDecrypt = new MemoryStream(bytes))
                    {
                        using (CryptoStream csDecrypt = new CryptoStream(msDecrypt, decryptor, CryptoStreamMode.Read))
                        {
                            using (StreamReader srDecrypt = new StreamReader(csDecrypt))
                            {
                                DecryptedString = srDecrypt.ReadToEnd();
                            }
                        }
                    }
                }
                finally
                {
                    if (aesAlg != null)
                    {
                        aesAlg.Clear();
                    }
                }
                return DecryptedString;
            }
            catch { return "Error"; }
        }


Dependable references:
Code: Select all
using System;
using System.IO;
using System.Security.Cryptography;
using System.Text;
using System.Windows.Forms;


In case you can't figure out why System.Windows.Forms won't appear; a console application does not automatically add a reference to System.Windows.Forms.dll, right-click your project in Solution Explorer and select Add reference, and then find System.Windows.Forms and add it.
Conor (Conanza121)
User avatar
Conor
Coder
 
Posts: 390
Joined: 10 Oct 2012, 21:36
Location: @21Conor

Re: CyberCriminal - A C# project where you can be a part of

Postby joppiesaus » 12 Aug 2013, 09:27

Conor wrote:ninja'd

Wow! This is something cool! Thank you!
I am going to use it in some way.
But why do you need
Code: Select all
System.Windows.Forms
?
joppiesaus
 
Posts: 379
Joined: 20 Aug 2012, 07:28
Location: in a obsedian house, with glass in it so i can see the lava!

Re: CyberCriminal - A C# project where you can be a part of

Postby Conor » 12 Aug 2013, 17:31

joppiesaus wrote:
Conor wrote:ninja'd

Wow! This is something cool! Thank you!
I am going to use it in some way.
But why do you need
Code: Select all
System.Windows.Forms
?


For the one usage of the Clipboard class.

You can put it directly into the code instead, if you'd prefer.
Code: Select all
System.Windows.Forms.Clipboard.SetText(Encrypted);
Conor (Conanza121)
User avatar
Conor
Coder
 
Posts: 390
Joined: 10 Oct 2012, 21:36
Location: @21Conor

Re: CyberCriminal - A C# project where you can be a part of

Postby joppiesaus » 22 Aug 2013, 13:45

I am planning to liquidate this project due to lack of interest(And also my interest).
It was nice as long as it took. I thank Conor for all his code.

And the release of 0.3:
Code: Select all
v 0.3   -     14:40 22-8-2013
- Code fixes. Instead of adding a new line in every function, just add a new line in the command function.
- Improved set system, less code and more efficient.
- You can now start a process directly from a path(C:\ for example);
- Added a new command THROW (pretty useless)
* throw [Exception] - Throws an exception
- Added a new command GAME
* game <game> - plays a game
* if you play fourinarow, you type exit as a row, it will exit.
- Bug with a set argument fixed


Source code:
CyberCriminal Source 0_3.zip
CyberCriminal Source code v 0.3
(12.67 KiB) Downloaded 38 times


Executable:
CyberCriminal.zip
CyberCriminal Executable v 0.3
(10.31 KiB) Downloaded 45 times



CyberCriminal will be liquidated in two weeks unless there will be more interest in this project.

Thank you all.
joppiesaus
 
Posts: 379
Joined: 20 Aug 2012, 07:28
Location: in a obsedian house, with glass in it so i can see the lava!

Re: CyberCriminal - A C# project where you can be a part of

Postby lucasds12 » 24 Aug 2013, 01:07

Incredible program, you have grew so much since you joined here, you used to be a coder that has to learn code from other users', in public, you generated such finery in code this year, your work is outstanding, we are all very proud to have you here Yoppie.
-Lucas
There is only one thing I do in life, that's contributing here.
lucasds12
 
Posts: 334
Joined: 17 Apr 2013, 16:17
Location: In the deep caves.

Re: CyberCriminal - A C# project where you can be a part of

Postby _Retaliate_ » 02 Oct 2013, 17:46

So...this was liquidated? :( sad.
Image
_Retaliate_
 
Posts: 68
Joined: 26 Sep 2013, 11:16

Previous

Return to Off-Topic

Who is online

Users browsing this forum: No registered users and 3 guests

cron