Resources View Our FREE Mini-Courses!: Development With MONO - Part One

Download as doc, pdf, or txt
Download as doc, pdf, or txt
You are on page 1of 11

Download & Resources

Sign up for our newsletter to get the latest updates.


View our FREE mini-courses!
Discounted Boot Camps
Open Source .NET !lat"orm-#ndependent .NET $pplication
De%elopment wit& 'ONO ( part one
6
inShare


$)stract
Over the years, the Linux operating system has become more popular among the developer
community due to a significant cost advantage over proprietary platforms. The present problem
with .NT centric applications is that they typically don!t run on Non"#icrosoft operating
systems such as $N%&, #ac and various Linux distributions. To overcome such limitations,
#icrosoft created the Mono pro'ect. This enables you to leverage .NT application and (isual
Studio s)ills in Non"#icrosoft Operating systems. This article introduces you the cross"platform
*+ and .NT development using an open source implementation of .NT using #ono.
!rere*uisite
,irst, you need to configure your wor)station for #ono centric application development. To do
so, download and install the following software
#ono -../.x 0T1 for .NT 2www.go"mono.com3
#ono tools
#ono4evelop %4 2&amarin Studio3
One of the following Operating Systems 25indows 6, 7 ,-//7 server, (ista3
#ono server 2optional3
(#ware or (irtual 8*
ither OS in (#ware OS 9 :OpenS$S, Linux, ,edora ,#ac;
S<L Server -//7 2optional3
'ono
#ono platform is an open"source implementation of #icrosoft that allows the developer to
execute .NT centric applications on other platforms such #ac or Linux. $sing such open
source implementations of .NT, you can create, compile, and execute .NT assemblies on
operating systems other than the #icrosoft platform.
Surprisingly, #ono also provides an installation pac)age for 5indows operating systems. Thus,
it is possible to build and execute .NT assemblies on 5indows without ever installing the
(isual studio %4 or .NT ,ramewor) S41. =ence, under #ono, you can build real time,
production"ready assemblies that use 5indows ,orms, L%N<, &#L web services, >4O.NT
and >S8.NT by ta)ing an advantage of existing core *L? namespaces.
The .NT cross"platform interoperability capabilities implementation approaches are different.
$nli)e 'ava, #icrosoft doesn!t provide .NT installer for #ac and other Linux operating
systems. #icrosoft has documented the formal specifications 2referred to as *L%
implementations3 of interoperability so that other operating systems distributions can use them as
a roadmap for .NT application building on various platforms.
>t present, #ono is compatible with the .NT -./, *+ -//7 and later, which implies you can
build 5indows ,orms >pplications, >S8.NT website. #ono applications are currently unable
to uses 5*,, 58,, 55, >8%s. %n addition, #ono also provides an open source distribution of
Silverlight >8% named Moonlight. The browser runs under Linux can host and run Silverlight
web applications.
The final point of interest about the #ono features sets is that it supports numerous programming
languages! compilers as follows@
Compile
rs
Supported
Languages
(bnc (isual Aasic.NT
#cs *+.NT
%lasm #ono *%L
Aooc #ono Aoo
'ono +or,station #nstallation
0o to the #ono website www.go"mono.com and locate the download tab. =ere, you can
download a variety of installers for specific platform such as 5indows, #ac, and Linux. This
article is tal)ing about the open source nature of .NT so we choose 5indows platform and
select 0t)+ for .NT as follows@
Once you finish with the setup program, by default #ono is installed under 8rogram ,iles#ono"
version. Bou run the vast variety of #ono development tools from command line. To test
whether the #ono is installed properly or not, 'ust run the following command in the in"built
command prompt of #ono as@
5hen you install #ono, you will not be provided the 0$% to test the application code. =owever,
this doesn!t mean that you can!t build or test your applications from command prompt because
ali)e .NT framewor) various tools such csc.exe or vbc.exe. 5e can still test the mono
applications with its in"built command prompt. Aut programmer considers it very complicated to
test the application via command prompt, so we can download the #ono 4eveloper %4 such as
&amarin Studio to ease the way of developer.
>fter installing the &amarin Studio %4, it will loo) ali)e (isual Studio %4 where we can
develop variety of solutions, such as >S8.NT, console based and >ndroid apps by choosing *+
or (A.net languages.
'ono Tools
#ono ships with various development tools that are functionally eCuivalent to .NT S41 tools.
The following table lists the associated tools, such as@
Mono
Utility
Description
0acutil %t interacts with global assembly cache.
%lasm The *%L disammembler.
>l Auild multifile assembly.
5sdl %t generates client side proxy code for web services.
4isco %t discovers the $?L of web services.
#onop %t display the definition of a specified type
0lade %t used to building 0T1+ graphical applications.
S<L %t allows you to interact with relational database using >4O.NT providers.
Buildin- .NET Console $pplication in 'ono
The infrastructure of the #ono console application is similar to the traditional *+.NT console
application .To develop first #ono based console application with &amarin Studio, follow these
steps.
.. Open &amarin studio from Start #enu.
-. 0o to ,ile "D New "D Solution. =ere choose the *onsole >pplication in *+ language.
Select the solution 4irectory and finally assign a pro'ect name as Test*onsole>pp.
E. >fter that, you will found the following wor)ing area with entire solution directories as@
F. Now put the following code in the #ain.cs file as@
.
-
E
F
G
6
6
7
H
./
..
.-
.E
using System;

namespace TestConsoleApp
{
class MainClass
{
public static void Main (string[] args)
{
Console.rite!ine ("elcome# $irst %rogram");
Console.&ead'ey ();
(
(
(
G. ,inally Auild the pro'ect using ,7, and ?un it with ,G to see the output.
6. Bou can also build and debug this solution from #ono command prompt rather than its
0$%.
6. %n this regard open the notepad and put this code to create a I.rsp file asJ
.
-
E
)target*e+e
)out*TestConsoleApp.e+e
main.cs
7. Save this into the solution directory with name TestAuild.rsp and open the #ono
*ommand 8rompt.
H. Navigate to solution Test*onsole>pp folder where the I.rsp file is resided. >nd compile
this solution using the mcs.exe KTestAuild.rsp commandJ
./. %f the solution is compiled successfully, a Test*onsole>pp.exe file is created.
... >t this point, you can load the Test*onsole>pp.exe into the #ono runtime engine by
specifying the name of executable as an argument to #ono as@
.
Mono TestConsoleApp.e+e
.-. Bou can also view the assembly manifest using monodis.exe as@
To run an application under #ono, you must pass it into the #ono ?untime through #ono.exe
utility. %f you do not, you will be loading your assembly into #icrosoft *L?.
Test t&e !lat"orm #ndependence Nature under .inu/ En%ironment
So far, this article has shown us how to create assemblies that you could also have compiled
using the #icrosoft .NT ,ramewor) S41. The real motive behind this article is to execute the
applications which are developed under .NT *L?. =owever, =ere we configure the mono
software framewor) over an open source Linux distribution operating system backtrack to
execute .NT application. So, first download the #ono binaries using the wget utility and
execute these series of commands to configure it properly as@
.
-
E
m,dir a-ay
cd a-ay
.get //no/c0ec,/certi1icate 0ttps*))ra..git0ub.com)nat0anb)i.s/
F
G
snippets)master)mono/install/scripts)ubuntu)install2mono/3.4.s0
c0mod 566 install2mono/3.4.s0
.)install2mono/3.4.s0
Such commands probably would ta)e some time to configure fully mono. >fter that, you can
ensure the mono software installation via this command as@
+ant to learn more00 The %nfoSec %nstitute ?everse ngineering course teaches you
everything from reverse engineering malware to discovering vulnerabilities in
binaries. These s)ills are reCuired in order to properly secure an organiLation from
todayMs ever evolving threats. #n t&is 1 da2 &ands-on course3 2ou will -ain t&e
necessar2 )inar2 anal2sis s,ills to disco%er t&e true nature o" an2 +indows
)inar2. Bou will learn how to recogniLe the high level language constructs 2such as
branching statements, looping functions and networ) soc)et code3 critical to
performing a thorough and professional reverse engineering analysis of a binary.
Some features of this course include@
CRE$ Certi"ication
G days of %ntensive 4ands-On .a)s
=ostile *ode N #alware analysis, including@ 5orms, (iruses, Tro'ans,
?oot)its and Aots
Ainary obfuscation schemes, used by@ =ac)ers, Tro'an writers and copy
protection algorithms
Learn the methodologies, tools, and manual reversing techniCues used real
world situations in our reversing lab.
(%5 ?* *O$?S
Now, export the previously created .NT assembly Test*onsole>pp.exe to bac)trac) by ,T8,
Telnet or other ways. ,inally execute the .NT assembly using the #ono utility as follows@
The above figure shows the exact *onsole output running under open source Linux distribution
OS bac)trac).
Re"erence
www.go"mono.com
*#>"EF@ 4efines the syntax of the *+ programming language.
*#>"EEG@ *ommon Language %nfrastructure specification.
*onclusion
The point of this article was to give an introduction to the cross"platform nature of *+
programming language and .NT platform when using the #ono framewor). %n case you need to
build .NT application that can execute under a variety of operating systems such as Linux,
,edora, Aac)trac) and openS$S, the #ono pro'ect is a wonderful choice for doing so.
Ay >'ay BadavO#ay .Fth, -/.EO?everse ngineeringO.- *omments
S&are T&is Stor23 C&oose 5our !lat"orm!
,aceboo)
Twitter
Lin)ed%n
?eddit
Tumblr
0oogle P.
mail
$)out t&e $ut&or $6a2 5ada%
>'ay Badav is a technocrat professional with eight years experience on multi"faceted profiles,
including Sub'ect #atter xpert, 8enetration Tester, *yber Security >nalyst, Software ngineer
and %nstructor. 8resently he is serves the %ndian %T ministry in a top position. =e received his
#aster 4egree in *omputer Science along with numerous premier certifications in *yber
Security, Software 4evelopment and 4atabase domain from #icrosoft, *"*ouncil and ?edhat.
>'ay freCuently contributes to the developer community by writing blogs, articles, training
material and boo)s on latest and sophisticated technology. =is spare time activities includes
tourism, movies and meditation. =e can be reached a om.a'ay:at;gmail:dot;com
78 Comments
..
sunita #ay .6, -/.E at 6@/E am " ?eply
great wor) a'ay, such article really beneficial for the aspirant .NT open source
developer.
-.
Sa

You might also like