- Prison Code Breaker Diary -

=> aka: Nhật Kí Code Tù

Categories

Programming .NET is one of the first thing I've learned myself long ago, but only available in Windows Operating System.
Somehow, the Mono Project has made .NET Framework become a cross-platform environment that you can freely programming .NET for Windows, Linux, MacOS...in that system directly. Also, you can write a .NET program for Linux under Windows and vice-versa. It's really a great achievement that Mono Project has reached. I expect that Mono Project will achieve more impressive goals with .NET technology in the future as it develops.
I write this guide as a journal in programming .NET under Linux environment by using Mono Project.
You may take this as a reference for Gtk#.

1 - Documentation and Reference:
Here the list that I read and reference from:
Gtk# Tutorial Page by Mono
Mono Documentation Library (equivalent to MSDN)
Mono: A Developer's Notebook (Edd Dumbill, Niel M. Bornstein) - A great book, worth to buy for two reasons:
+ It's the only book on Mono up to this time.
+ It's written as a developer's journal style, so it's really easy to catch the authors' mind concepts.

2 - Programming Gtk# Journal

Lesson 1: Say Hello
Lesson 2: Hello Gtk# (using Form)
Lesson 3: MonoDevelop IDE vs. manual text coding w/ commands. (to be updated...)


Feel free to comment!
Have fun!

Download Project

We do the same thing with Lesson 1 but this time we use form for better GUI.
This is the source code, self-explained fully-commented.



using System;
using Gtk;

public class Lesson_2
{

public static void Main() {

Application.Init();

// create a window
Window window = new Window("Lesson 2: Say hello with Gtk# Form");
window.Resize(400, 40);

// create a label
Label label = new Label("Hello Gtk# .NET");
// add label to the form
window.Add(label);
// show form and its widgets
window.ShowAll();

Application.Run();
}
}


Build and run, this is result:


Have fun!

Download Project: Lesson 1 - Say Hello Gtk#

First, open MonoDevelop and create a new empty project. Then, add an empty class file into project. Copy this code below to the file:


using System;

public class Lesson_1 {

public static void Main() {
Console.WriteLine("Lesson 1: Hello Gtk#! It's so wonderful!");
}
}

If you already know C#, you, hence, know what it means.

Now click on the menu Build -> Build Solution or F8.
Click menu Run -> Run or Ctrl+F5.
You will have result like this:

The result is shown under the Application Output textbox.

However, if you want to compile a single C# file or a C# project manually, then do this.

Open the terminal:

terminal> mcs -pkg:gtk-sharp-2.0 Main.cs

A file named Main.exe will be generated. In order to run this file you have to use mono utility:

terminal> mono Main.exe

The result will show up exactly how it is while using MonoDevelop.

Have fun!

Use xrandr utility to change the screen resolution.
Example, if I want to change my screen resolution into 1280x800 (60 Hz) I will type


terminal> xrandr -s 1280x800

Have fun!

Yea, today Nov-11 a Pepero Day. What is it anyway?
In Korea, it's a day that males and females give chocolate sticks to each others to show his/her love towards other. Sound interesting, huh?
Here the definition:

Pepero
(빼빼로) is a cookie stick, dipped in chocolate syrup, manufactured by Lotte in South Korea since 1983.[1] It was inspired by the Japanese product, Pocky produced by Glico


Love is a sweet chocolate love stick.

Why is this day picked? Some of my friends say that just imagine writing the date and month in number: Nov-11 => 11-11. I don't really get it angkatkening.
But I know for sure Lotte make big money from this duit...
It has become a cultural thing among young Koreans!

What an interesting day!

Situation:

Error 80048820 and extended error 80048416: You can't sign in to Windows Live Messenger

Access Control Panel -> Internet Options
Click tab Advanced, under Security section, clear the tick at "Check for server certificate revocation" check box.
Click OK.

We need some monitoring tools loading up before tracking the malware. In this case, I open ProcessXP, ProcMon and TCPView.




The malware I use this time to monitoring is Trojan.Win32.DesktopPuzzle
Now, activate virus to see what happen next...(s.c.a.r.y... :D)

A dialog appears with some note, like a joke
Don't click OK yet, switch to ProcessXP to check its info



It's like the author intentionally leaving his name there.
The PID is 1424 (it is different from your system), then we switch to ProcMon to filter.
Press CTRL+L or menu Filter->Filter then choose PID, input the malware process id, click Add, Apply, then OK, you will have this result similarly:


Ok! Now it's time to click the OK button of the "Joke Dialog".

This is the funny result after clicking it ...

Yea...it's frikkin' weird..

Now press Ctrl+Alt+Del, the task manager will show up, just kill the malware process and everything comes back to normal.

Check again on ProcessXP, we can see that it stopped and nothing else spawns, which means there is no weird thing running and system is just fine by now.

View on the event log in ProcMon, we can easily see that it doesn't do anything harm to the system. It just creates several files unharmed and access some DLL to create viewport of desktop, which makes desktop like a puzzle.
Since this is just a simple sample of malware, so it's a good practice to start with.
Simple but require lots of skills, you may find a hard one later on.
You can find lots of malware out of Internet and try yourselves.

The one that I use here is called "Joke Slider" - unwanted program :))

Have fun!