Escrito por
tognu en
Redes
undefined
undefined
undefined1 I.S.C. Juan Alberto Antonio Velázquez undefined
undefined1Alanís
García Teresa, 1Cruz
Cruz Laura, 1 Martínez Solano Cristhian, 1 Montoya García Oscar, 1 Sánchez Ávila José Carlos, 1 Yessenia Sánchez Torres, 1 Serrano Avelino Pascual Jesús, 1 Pérez Alva Iliana, undefined
undefined
undefined
undefined1 Tecnológico de Estudios Superiores de Jocotitlán undefined
undefinedCarretera
Toluca-Atlacomulco, km. 44.8 Ejido de San Juan y San Agustín CP.
50700, Jocotitlán México
Abstract.
The MAC, IP address and network name are network Ids, which allow
proper communication of computers in a network. The IP address
identifies a logical and hierarchical, to an interface of a device
within a network using IP protocol. The MAC (Media Access Control) is
a 48-bit identifier that uniquely corresponds to an Ethernet network,
also known as the physical address. This project describes how to
obtain these addresses and the names of network devices, also are
described the state of the TCP, ICMP and UDP protocols of the
computer where is running the application.
Resumen. La dirección MAC, dirección IP y el nombre de red son
identificadores de red, que permiten la comunicación correcta de las
computadoras en una red. La dirección IP identifica, de manera
lógica y jerárquica, a una interfaz de un dispositivo dentro de una
red que utilice el protocolo IP. La dirección MAC (control de acceso
al medio) es un identificador de 48 bits que corresponde de forma
única a una Ethernet de red, conocida también como la dirección
física. En este proyecto se describe como obtener estas direcciones
así como el nombre de los dispositivos de red, también se describen
el estado de los protocolos TCP, ICMP y UDP del ordenar donde se
ejecuta la aplicación.
INTRODUCTION
This article talks about how get the
address MAC and the IP (Internet protocol) of LAN devices, it shows
too the hostname of every one of the devices.
This small application
tries to capture the status of some network protocols, like IP, TCP,
ICMP and UDP.
The program was developed
using some commands which are nast and netstat and implemented in
java. These commands provide us the necessary information to obtain
the requirements which we describe in this article.
MAC ADDRESS
The
MAC address is a unique value associated with a network adapter. MAC
addresses are also known as hardware addresses or physical addresses.
They uniquely identify an adapter on a LAN.
MAC
addresses are 12-digit hexadecimal numbers (48 bits in length). By
convention, MAC addresses are usually written in one of the following
two formats:
MM:MM:MM:SS:SS:SS
The
first half of a MAC address contains the ID number of the adapter
manufacturer. These IDs are regulated by an Internet standards body
(see sidebar). The second half of a MAC address represents the serial
number assigned to the adapter by the manufacturer. In the example:
00:A0:C9:14:C8:29
The
prefix 00A0C9 indicates the manufacturer is Intel Corporation.
Whereas
MAC addressing works at the data link layer, IP addressing functions
at the network layer (layer 3). It's a slight oversimplification, but
one can think of IP addressing as supporting the software
implementation and MAC addresses as supporting the hardware
implementation of the network stack.
IP ADDRESS
An
Internet Protocol (IP) address is a numerical label that is assigned
to devices participating in a computer network that uses the Internet
Protocol for communication between its nodes. An IP address serves
two principal functions: host or network interface identification and
location addressing. Its role has been characterized as follows: "A
name indicates what we seek. An address indicates where it is. A
route indicates how to get there.
IP
addresses specify the locations of the source and destination nodes
in the topology of the routing system. For this purpose, some of the
bits in an IP address are used to designate a subnetwork. The number
of these bits is indicated in CIDR notation, appended to the IP
address; e.g., 208.77.188.166/24.
NAST
The
Network Analyzer Sniffer Tool or nast is a packet capturing program
that displays the captured information in various ways depending on
the command line options you specify.
IP
Network
layer protocol in the TCP/IP stack offering a connectionless
internetworking service. IP provides features for addressing,
type-of-service specification, fragmentation and reassembly and
security.
TRANSMISSION
CONTROL PROTOCOL (TCP)
TCP
is the protocol used as the basis of most internet services. It is
used in conjuction with the internet protocol (IP). It allows for
reliable communication, ensuring that packets reach their intended
destinations
INTERNET
CONTROL MESSAGING PROTOCOL (ICMP)
Internet
messaging protocol. Network layer internet protocol that reports
errors and provides other information relevant to IP packet
processing.
USER
DATAGRAM PROTOCOL (UDP)
A
connectionless transport layer protocol in the transmission Control
Protocol/Internet Protocol (TCP/IP) stack. UDP is a simple protocol
that exchanges datagrams without acknowledgments or guaranteed
delivery, and requires that error processing and retransmission be
handle by other protocols.
CODE
package
redes;
import
java.io.*;
import
java.util.*;
import
java.util.logging.Level;
import
java.util.logging.Logger;
import
javax.swing.*;
import
java.net.*;
public
class Caddress extends JFrame {
String
SRes="“,SAux=”";
int
IAux=0;
InetAddress
IAddress;
boolean
BEstado=false;
private
void initComponents() {
LTitulo
= new javax.swing.JLabel();
BObtener
= new javax.swing.JButton();
BSalir
= new javax.swing.JButton();
jScrollPane1
= new javax.swing.JScrollPane();
TARes
= new javax.swing.JTextArea();
LNombre
= new javax.swing.JLabel();
LDireccion
= new javax.swing.JLabel();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
setBackground(new
java.awt.Color(51, 102, 255));
LTitulo.setFont(new
java.awt.Font(“Comic Sans MS”, 1, 18));
LTitulo.setText(“DIRECCIONES
IP”);
BObtener.setText(“OBTENER”);
BObtener.addActionListener(new
java.awt.event.ActionListener() {
public
void actionPerformed(java.awt.event.ActionEvent evt) {
BObtenerActionPerformed(evt);
}
});
BSalir.setText(“SALIR”);
BSalir.addActionListener(new
java.awt.event.ActionListener() {
public
void actionPerformed(java.awt.event.ActionEvent evt) {
BSalirActionPerformed(evt);
}
});
TARes.setColumns(20);
TARes.setRows(5);
jScrollPane1.setViewportView(TARes);
LNombre.setFont(new
java.awt.Font(“Comic Sans MS”, 1, 12));
LNombre.setText(“MAC”);
LDireccion.setFont(new
java.awt.Font(“Comic Sans MS”, 1, 12));
LDireccion.setText(“IP
NOMBRE”);
javax.swing.GroupLayout layout =
new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(20,
20, 20)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jScrollPane1,
javax.swing.GroupLayout.PREFERRED_SIZE, 450,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addGroup(layout.createSequentialGroup()
.addComponent(BObtener,
javax.swing.GroupLayout.PREFERRED_SIZE, 101,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED,
77, Short.MAX_VALUE)
.addComponent(BSalir,
javax.swing.GroupLayout.PREFERRED_SIZE, 101,
javax.swing.GroupLayout.PREFERRED_SIZE)))
.addContainerGap(23,
javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(layout.createSequentialGroup()
.addGap(21,
21, 21)
.addComponent(LNombre)
.addGap(130,
130, 130)
.addComponent(LDireccion,
javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGap(43,
43, 43))
.addGroup(layout.createSequentialGroup()
.addGap(66,
66, 66)
.addComponent(LTitulo,
javax.swing.GroupLayout.PREFERRED_SIZE, 165,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(91,
Short.MAX_VALUE))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(16,
16, 16)
.addComponent(LTitulo)
.addGap(18,
18, 18)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(LNombre)
.addComponent(LDireccion))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED,
9, Short.MAX_VALUE)
.addComponent(jScrollPane1,
javax.swing.GroupLayout.PREFERRED_SIZE, 172,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(BObtener)
.addComponent(BSalir))
.addGap(12,
12, 12))
);
pack();
}//
</editor-fold>//GEN-END:initComponents
private
void BObtenerActionPerformed(java.awt.event.ActionEvent evt)
{//GEN-FIRST:event_BObtenerActionPerformed
//
TODO add your handling code here:
Process
proc=null;
try
{
proc
= Runtime.getRuntime().exec(“nast -m”);
}
catch
(IOException ex) {
Logger.getLogger(Main.class.getName()).log(Level.SEVERE,
null, ex);
}
InputStream
is=proc.getInputStream();
int
size;
String
s;
try
{
int
exCode = proc.waitFor();
}
catch
(InterruptedException ex) {
Logger.getLogger(Main.class.getName()).log(Level.SEVERE,
null, ex);
}
StringBuffer
ret=new StringBuffer();
try
{
while
((size = is.available()) != 0) {
byte[]
b = new byte[size];
is.read(b);
s
= new String(b);
ret.append(s);
}
}
catch (IOException ex) {
Logger.getLogger(Main.class.getName()).log(Level.SEVERE,
null, ex);
}
//protocolos
Process
proc2=null;
try
{
proc2
= Runtime.getRuntime().exec(“netstat -s”);
}
catch
(IOException ex) {
Logger.getLogger(Main.class.getName()).log(Level.SEVERE,
null, ex);
}
InputStream
is2=proc2.getInputStream();
try
{
int
exCode = proc2.waitFor();
}
catch
(InterruptedException ex) {
Logger.getLogger(Main.class.getName()).log(Level.SEVERE,
null, ex);
}
StringBuffer
ret2=new StringBuffer();
size=0;
s="";
try
{
while
((size = is2.available()) != 0) {
byte[]
b = new byte[size];
is2.read(b);
s
= new String(b);
ret2.append(s);
}
}
catch (IOException ex) {
Logger.getLogger(Main.class.getName()).log(Level.SEVERE,
null, ex);
}
int
Ipos=ret.indexOf(“=”);
ret.delete(0,
Ipos+60);
Ipos=ret.indexOf(“This”);
ret.delete(Ipos-4,ret.length());
while(ret.indexOf(“(”)
> 0 && ret.indexOf(“)”) > 0)
{
ret.delete(ret.indexOf(“(”),ret.indexOf(“)”)+1);
//ret.insert(ret.indexOf(“)”),“
”);
}
try
{
String
SAux=ret.toString();
String
SDir[]=SAux.split(“\\s+”);
String
Aux="";
for(int
x=1;x<SDir.length;x=x+2)
{
System.out.println(SDir[x]+“>\n”);
Aux+=SDir[x-1]+“\t”+SDir[x]+“\t
”;
InetAddress
IAddress = InetAddress.getByName(SDir[x]);
Aux+=IAddress.getHostName()+“\n”;
}
TARes.setText(“\n”+Aux+“\n”+ret2.toString());
}catch(Exception
e){}
}//GEN-LAST:event_BObtenerActionPerformed
private
void BSalirActionPerformed(java.awt.event.ActionEvent evt)
{//GEN-FIRST:event_BSalirActionPerformed
System.exit(0);
// TODO add your handling code here:
}//GEN-LAST:event_BSalirActionPerformed
/**
*
@param args the command line arguments
*/
public
static void main(String args[]) {
java.awt.EventQueue.invokeLater(new
Runnable() {
public
void run() {
new
Caddress().setVisible(true);
}
});
}
//
Variables declaration - do not modify//GEN-BEGIN:variables
private
javax.swing.JButton BObtener;
private
javax.swing.JButton BSalir;
private
javax.swing.JLabel LDireccion;
private
javax.swing.JLabel LNombre;
private
javax.swing.JLabel LTitulo;
private
javax.swing.JTextArea TARes;
private
javax.swing.JScrollPane jScrollPane1;
//
End of variables declaration//GEN-END:variables
}
References
[1]COMO PROGRAMAR EN
JAVA
DEITEL AND DEITEL
ED PEARSON EDUCACION
[2]GUIA DEL PRIMER
AÑO CCNA 1 Y2
3ª EDICION
ED CISCO
[3]GUIA Y PROTOLOS
DE ENRUTAMIENTO
JOHNSON ALLAN
ED TRILLAS
Escrito por
tognu en
Redes
</p>
Gustavo
Fabián Gregorio, David Melitón Prisciliano, Antonio Rojas Benito,
Julio Cesar Medina Jiménez, Mario Alberto Venegas de la Cruz, Uriel
Romero Montiel, Esperanza Mondragón Alvarado, Juan Antonio Mauro. y
Jesús Antonio Álvarez Cedillo
INTRODUCCION
El
poder manejar programas en Ubuntu y en Windows hoy en día es un
privilegio, sin embargo hay que tener muy en claro las diferencias de
cada sistema operativo en este articulo les mostramos un ejemplo
donde obtenemos la ip y la Mac address tanto en Windows como en
Ubuntu, realizado en la plataforma net beans.
DEFINICIONES
Dirección
IP: Una dirección
IP es un
número que identifica de manera lógica y jerárquica a una interfaz
de un dispositivo (habitualmente una computadora) dentro de una red
que utilice el protocolo IP (Internet
Protocolo),
que corresponde al nivel de red del protocolo TCP/IP. Dicho número no se ha de confundir con la dirección MAC que es un número
hexadecimal fijo que es asignado a la tarjeta o dispositivo de red
por el fabricante, mientras que la dirección IP se puede cambiar.
Esta dirección puede cambiar 2 ó 3 veces al día; y a esta forma de
asignación de dirección IP se denomina una dirección
IP dinámica (normalmente se abrevia como IP
dinámica).
Mac
address: En redes de ordenadores la dirección
MAC (siglas
en inglés de Media
Access Control o control de
acceso al medio)
es un identificador de 48 bits (6 bloques hexadecimales) que
corresponde de forma única a una Ethernet de red. Se conoce también
como la dirección física en cuanto identificar dispositivos de red.
Es individual, cada dispositivo tiene su propia dirección MAC
determinada y configurada por el IEEE (los
últimos 24 bits)
y el fabricante (los
primeros 24 bits)
utilizando el OUI. La mayoría de los protocolos que trabajan en la
capa 2 del modelo OSI usan una de las tres numeraciones manejadas por
el IEEE: MAC-48,
EUI-48, y EUI-64 las cuales han sido diseñadas para ser identificadores globalmente
únicos. No todos los protocolos de comunicación usan direcciones
MAC, y no todos los protocolos requieren identificadores globalmente
únicos.
NetBeans:
a plataforma NetBeans permite que las aplicaciones sean desarrolladas
a partir de un conjunto de componentes
de software llamados módulos.
Un módulo es un archivo Java que contiene clases de java escritas
para interactuar con las APIs de NetBeans y un archivo especial
(manifest file) que lo identifica como módulo. Las aplicaciones
construidas a partir de módulos pueden ser extendidas agregándole
nuevos módulos. Debido a que los módulos pueden ser desarrollados
independientemente, las aplicaciones basadas en la plataforma
NetBeans pueden ser extendidas fácilmente por otros desarrolladores
de software.
El
siguiente programa muestra como se puede obtener la IP y la Mac de
una red de computadoras usando el Netbeans en Linux al momento que se
corre el programa este puede capturar los dos protocolos que se han
dicho y el código es el siguiente:
import
java.io.BufferedInputStream;
import
java.io.IOException;
import
java.io.InputStream;
import
java.net.InetAddress;
import
java.text.ParseException;
import
java.util.StringTokenizer;
public
final class DireccionMac {
private
final static String getMacAddress() throws IOException {
String
os = System.getProperty(“os.name”);
try
{
if
(os.startsWith(“Windows”)) {
return
windowsParseMacAddress(windowsRunIpConfigCommand());
}
else if (os.startsWith(“Linux”)) {
return
linuxParseMacAddress(linuxRunIfConfigCommand());
}
else {
throw
new IOException(“Sistema operativo desconocido: ” + os);
}
}
catch (ParseException ex) {
ex.printStackTrace();
throw
new IOException(ex.getMessage());
}
}
private
final static String linuxParseMacAddress(String ipConfigResponse)
throws
ParseException {
String
localHost = null;
try
{
localHost
= InetAddress.getLocalHost().getHostAddress();
}
catch (java.net.UnknownHostException ex) {
ex.printStackTrace();
throw
new ParseException(ex.getMessage(), 0);
}
StringTokenizer
tokenizer = new StringTokenizer(ipConfigResponse, “\n”);
String
lastMacAddress = null;
while
(tokenizer.hasMoreTokens()) {
String
line = tokenizer.nextToken().trim();
boolean
containsLocalHost = line.indexOf(localHost) >= 0;
if
(containsLocalHost && lastMacAddress != null) {
return
lastMacAddress;
}
int
macAddressPosition = line.indexOf(“HWaddr”);
if
(macAddressPosition <= 0)
continue;
String
macAddressCandidate = line.substring(macAddressPosition + 6)
.trim();
if
(linuxIsMacAddress(macAddressCandidate)) {
lastMacAddress
= macAddressCandidate;
continue;
}
}
ParseException
ex = new ParseException(
“Imposible
obtener la dirección MAC ” + localHost + “ desde [”
+
ipConfigResponse + “]”, 0);
ex.printStackTrace();
throw
ex;
}
private
final static boolean linuxIsMacAddress(String macAddressCandidate) {
if
(macAddressCandidate.length() != 17)
return
false;
return
true;
}
private
final static String linuxRunIfConfigCommand() throws IOException {
Process
p = Runtime.getRuntime().exec(“ifconfig”);
InputStream
stdoutStream = new BufferedInputStream(p.getInputStream());
StringBuffer
buffer = new StringBuffer();
for
(;;) {
int
c = stdoutStream.read();
if
(c == -1)
break;
buffer.append((char)
c);
}
String
outputText = buffer.toString();
stdoutStream.close();
return
outputText;
}
private
final static String windowsParseMacAddress(String ipConfigResponse)
throws
ParseException {
String
localHost = null;
try
{
localHost
= InetAddress.getLocalHost().getHostAddress();
}
catch (java.net.UnknownHostException ex) {
ex.printStackTrace();
throw
new ParseException(ex.getMessage(), 0);
}
StringTokenizer
tokenizer = new StringTokenizer(ipConfigResponse, “\n”);
String
lastMacAddress = null;
while
(tokenizer.hasMoreTokens()) {
String
line = tokenizer.nextToken().trim();
if
(line.endsWith(localHost) && lastMacAddress != null) {
return
lastMacAddress;
}
int
macAddressPosition = line.indexOf(“:”);
if
(macAddressPosition <= 0)
continue;
String
macAddressCandidate = line.substring(macAddressPosition + 1)
.trim();
if
(windowsIsMacAddress(macAddressCandidate)) {
lastMacAddress
= macAddressCandidate;
continue;
}
}
ParseException
ex = new ParseException(
“Imposible
obtener dirección MAC desde [” + ipConfigResponse
+
“]”, 0);
ex.printStackTrace();
throw
ex;
}
private
final static boolean windowsIsMacAddress(String macAddressCandidate)
{
if
(macAddressCandidate.length() != 17)
return
false;
return
true;
}
private
final static String windowsRunIpConfigCommand() throws IOException {
Process
p = Runtime.getRuntime().exec(“ipconfig /all”);
InputStream
stdoutStream = new BufferedInputStream(p.getInputStream());
StringBuffer
buffer = new StringBuffer();
for
(;;) {
int
c = stdoutStream.read();
if
(c == -1)
break;
buffer.append((char)
c);
}
String
outputText = buffer.toString();
stdoutStream.close();
return
outputText;
}
public
final static void main(String[] args) {
try
{
System.out.println(“Sistema
Operativo : ”
+
System.getProperty(“os.name”));
System.out.println(“Dirección
IP : ”
+
InetAddress.getLocalHost().getHostAddress());
System.out.println(“Dirección
Física (MAC): ” + getMacAddress());
}
catch (Throwable t) {
t.printStackTrace();
}
}
}
Conclusiones:
Con
el desarrollo del programa nos pudimos dar cuenta que cada
computadora tiene una dirección IP que es un numero que identifica
de manera lógica a una interfaz de un dispositivo que se encuentra
dentro de una red que utilice el protocolo IP este número puede
crear una red dentro de internet conectándolo con alguna otra
computadora con el mismo número IP, en este programa que se
muestra anteriormente realiza la obtención de la dirección IP y la
MAC address al momento de ejecutarlo en la plataforma de NetBeans
captura los dos protocolos mostrándolos en la pantalla, en otro caso
en el sistema operativo Ubuntu o Linux entrando desde lugares,
terminal aparece un cuadro en el que para saber cuál es la dirección
en la red por medio del IP se le da la instrucción.
#ifconfig
y
automáticamente te manda el resultado que en ese momento se
encuentra en la red WLAN que puede cambiar varias veces al día aquí
mismo te muestra la MAC en una red LAN que es individual , cada
dispositivo tiene su propia dirección MAC determinada y configurada,
después para conectar dos o más computadoras en red con este número
lo insertas en las computadoras donde dice http: e introduces el
numero:
http://[
la dirección IP que dice la WLAN]
Ubuntu ships with Mono pre-installed, but due to the rapid release cycles on the Mono project, the version that ships with Ubuntu is
often outdated by the time the Ubuntu release ships. Due to the impressive release schedule of Mono, you do really need to keep up
with the new releases as every new release dramatically improves the entire framework.
Unfortunately for Ubuntu users, there are no dedicated Ubuntu packages for download from the Mono Project web site, which means that
you best bet is be to compile the project yourself. While I know that most Linux newbies find that concept intimidating, it actually
isn't nearly as hard as it sounds.
To that end, I'll walk you through compiling and installing the latest release of Mono (version 2.4 at time of writing) on Ubuntu.
Note that these instructions should also work on newer versions of Mono.
These instructions were created by installing Mono 2.4 on an absolutely fresh installation of Ubuntu. For those Windows users wishing
to try this out at home, I would suggest installing Ubuntu on a Virtual PC 2007 virtual machine. Arcanecode has an excellent post on
getting this to work first time.
IMPORTANT: If you're installing on a VPS, make sure that you have at least 400 MB of RAM available, or otherwise the mono compilation
process will fail.
WARNING
Following these instructions will result in all your pre-installed Mono applications being removed from your Ubuntu box. In most cases
the only way to get them back is going to be by installing them from source too (not always a bad idea).
If you'd like to play with Mono 2.4, but keep things like F-Spot and Beagle, I would suggest rather using the instructions
provided by Jan Dzik.
Update: I now have a script that automates the install, see this post: Mono Compile & Install Script
Installing Mono
Open a terminal window if you're using the Ubuntu GUI or log on using SSH if you're accessing a remote server.
All these instructions assume that you have root privileges, so if you're not logged in as root, enter the following and
enter you password when prompted.
$ sudo bash
First you need to remove the version of Mono that is pre-installed with Ubuntu.
$ apt-get remove mono-common
That will remove all the extra packages that are installed with mono as they all depend on it. Be aware that it will also remove
applications like f-spot and beagle, which will have to be re-installed after the mono upgrade if you wish to use them.
Next, create a folder for the source code you're about to compile:
$ mkdir /src
Then change to the src directory:
$ cd /src
Make sure that your /etc/apt/sources.list file has the universe and multiverse repositories included. If you installation didn't
have any internet connectivity, there may be a chance that the installer disabled those repositories due to being unable to verify
them. If that is the case, do the following:
$ nano /etc/apt/sources.list
Remove the # characters from the universe and multiverse entries and save the file (a Nano Basics Guide is available for people new
to nano). I personally just enable everything.
Refresh the apt-get database.
$ apt-get update
You now need to install some Mono build dependencies (and some optional enhancements):
$ apt-get install build-essential pkg-config libglib2.0-dev bison libcairo2-dev libungif4-dev libjpeg62-dev libtiff4-dev gettext
Download libgdiplus:
$ wget http://ftp.novell.com/pub/mono/sources/libgdiplus/libgdiplus-2.4.tar.bz2
$ tar -xvf libgdiplus-2.4.tar.bz2
$ cd libgdiplus-2.4/
Now we can compile libgdiplus and install it:
$ ./configure --prefix=/usr/local; make; make install
Now go make yourself a snack, especially if you're doing this on a VM 
After the compilation finally finishes, we need to make sure the new packages are visible to the system:
$ sh -c “echo /usr/local/lib >> /etc/ld.so.conf”
$ /sbin/ldconfig
Now change back to the /src folder and download the latest release of mono (about 17 MB):
$ cd /src
$ wget http://ftp.novell.com/pub/mono/sources/mono/mono-2.4.tar.bz2
Extract the compressed file, change into the mono folder and compile:
$ tar -xvf mono-2.4.tar.bz2
$ cd mono-2.4
$ ./configure --prefix=/usr/local; make; make install
You can go make yourself a gourmet meal at this point as the compilation process takes a seriously long time (ok, maybe not that
long, but us generation X/Y types don't really have the patience for C++ compilation).
Add mono to the bash path:
$ nano ~/.bashrc
And add the following lines at the end:
PATH=/usr/local/bin:$PATH
LD_LIBRARY_PATH=/usr/local/lib/:$LD_LIBRARY_PATH
PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:$PKG_CONFIG_PATH
In order for the changes to take effect, you need to either close and open your terminal again, or simply type:
$ bash
to start a new instance of bash command line.
To check your new mono version, type:
$ mono -V
You should see the following:
Mono JIT compiler version 2.4 (tarball Wed Apr 1 04:49:16 CDT 2009)
Copyright (C) 2002-2008 Novell, Inc and Contributors. www.mono-project.com
TLS: __thread
GC: Included Boehm (with typed GC)
SIGSEGV: altstack
Notifications: epoll
Architecture: amd64
Disabled: none
Congratulations, you have a working copy of the latest Mono released installed on your Ubuntu machine!
Installing XSP
XSP is the Mono web server that Apache delegates to (via mod_mono) when serving ASP.NET pages on Linux. In order
to run ASP.NET pages
you will need to compile and build the XSP web server.
Change to your /src directory, download the XSP sources, unzip them and compile:
$ cd /src
$ wget http://ftp.novell.com/pub/mono/sources/xsp/xsp-2.4.tar.bz2
$ tar -xvf xsp-2.4.tar.bz2
$ cd xsp-2.4/
$ ./configure --prefix=/usr/local; make; make install
Once the compilation is done, we can test the XSP server. Change to the XSP test installation folder and run the XSP server:
$ cd /usr/local/lib/xsp/test
$ xsp2
You should see something like the following:
xsp2
Listening on address: 0.0.0.0
Root directory: /root
Listening on port: 8080 (non-secure)
Hit Return to stop the server.
Open your browser and point it to http://localhost:8080 (or your domain/ip if you're doing this remotely). You should see the XSP test page.
Installing Mod_Mono
Mod_mono is the name of the apache2 module that links the XSP server and apache. This allows for apache to handle all incoming
requests and hand them off to the XSP process in order to server your ASP.NET pages. You only need to install Mod_mono if you
plan on using Apache2 to serve web pages. You will also need to have apache2 (and it's development files) pre-installed to
compile mod_mono.
Install apache2 and the necessary build dependencies:
$ apt-get install apache2 apache2-threaded-dev
Once that's done, we can compile mod_mono.
Change to our source directory, download the mod_mono sources, unzip them and compile:
$ cd /src
$ wget http://ftp.novell.com/pub/mono/sources/mod_mono/mod_mono-2.4.tar.bz2
$ tar -xvf mod_mono-2.4.tar.bz2
$ cd mod_mono-2.4/
$ ./configure --prefix=/usr/local; make; make install
We need to include the mod_mono.conf file in the apache2 configuration file, so open the apache2.conf file in a text editor:
$ nano /etc/apache2/apache2.conf
Scroll to the bottom of the file and include the following line:
Include /etc/apache2/mod_mono.conf
Now lets copy the test content from XSP to our apache2 public folder to we can have an ASP.NET application with which to test the
mod_mono installation:
$ cp -r /usr/local/lib/xsp/test /var/www/test
When you compile Mod_mono from source, the necessary apache2 configuration files are not created for you, so we will have to do them manually.
Firstly, create the mod_mono.load file with a text editor:
$ nano /etc/apache2/mods-available/mod_mono.load
Add the following line to the file:
LoadModule mono_module /usr/lib/apache2/modules/mod_mono.so
Next we create the mod_mono.conf file:
$ nano /etc/apache2/mods-available/mod_mono.conf
Add the following to the file:
AddType application/x-asp-net .aspx .ashx .asmx .ascx .asax .config .ascx
DirectoryIndex index.aspx
include /usr/local/lib/mono/2.0/mono-server2-hosts.conf
Next, create the mono-server2-hosts.conf file:
$ nano /usr/local/lib/mono/2.0/mono-server2-hosts.conf
And add the following:
<IfModule mod_mono.c>
MonoUnixSocket /tmp/.mod_mono_server2
MonoServerPath /usr/local/lib/mono/2.0/mod-mono-server2.exe
AddType application/x-asp-net .aspx .ashx .asmx .ascx .asax .config .ascx
MonoApplicationsConfigDir /usr/local/lib/mono/2.0
MonoPath /usr/local/lib/mono/2.0:/usr/local/lib
</IfModule>
Configure Apache2 Virtual Hosts
The virtual hosts configuration really requires a tutorial on its own, but for now I'll just show you how to make the test application
the default site on your apache2 server.
Edit the default virtual host file for apache2:
$ nano /etc/apache2/sites-enabled/000-default
Replace the contents of the file with the following (you may want to backup the file first):
<VirtualHost *>
ServerName www.local.com
ServerAdmin webmaster@localhost
DocumentRoot /var/www/test
DirectoryIndex index.html index.aspx
MonoDocumentRootDir “/var/www/test”
MonoServerPath rootsite “/usr/local/bin/mod-mono-server2”
MonoApplications rootsite “/:/var/www/test”
<Directory /var/www/test>
MonoSetServerAlias rootsite
SetHandler mono
AddHandler mod_mono .aspx .ascx .asax .ashx .config .cs .asmx
</Directory>
</VirtualHost>
Now restart apache2:
$ /etc/init.d/apache2 restart
Now open your browser and navigate to http://localhost/. You should see the XSP test web app appear.
Restart Errors
When you restart apache2 using the command above, you are likely to see an error message similar to the following:
- Restarting web server apache2
[Fri Nov 06 00:41:41 2009] [crit] (13)Permission denied: Failed to attach to existing dashboard, and removing dashboard
file '/tmp/mod_mono_dashboard_XXGLOBAL_1' failed (Operation not permitted). Further action impossible.
This is quite normal and will not affect the operation of your Mono websites.
References:
Escrito por
tognu en
cursos
Feliz navidad a todos , estas son sus calificaciones.
TEORIA DE LENGUAJES
PROGRAMACION PARALELA
By tognu.
1.- En el principio Dios creó el Bit y el Byte. 2.- Y había dos Bytes en la Palabra; y nada más existía. Y Dios separó el Uno del Cero y vio que era bueno.
3.-
Y Dios dijo: que se hagan los Datos; y así pasó. Y Dios dijo: Dejemos
los Datos en sus correspondientes sitios. Y creó los diskettes, los
HDD, los CD/DVD y las Flash.
4.- Y Dios dijo: Que se hagan las PC,
así habrá un lugar para poner los disquetes, los HDD, etc. Así Dios
creó a las PC, y les llamó hardware.
5.- Pero aún no había software.
Pero Dios creó los programas; grandes y pequeños… y les dijo: Iros,
multiplicaros y llenad toda la memoria.
6.- Y Dios dijo: crearé el programador; y el programador creará nuevos programas y gobernará las PC, los programas y los datos.
7.- Y Dios creó al programador; y lo puso en el Centro de Datos; y Dios le enseñó al programador el
directorio y le dijo: Puedes usar todos los volúmenes y sub-directorios, pero NO USES WINDOWS.
8.-
Y Dios dijo: no es bueno que el programador esté sólo, cogió un hueso
del cuerpo del programador y creó una criatura que miraría al
programador y le admiraría, y amaría las cosas que el programador
hiciese. Y Dios llamó a la criatura 'El Usuario'.
9.- Y el programador y el usuario fueron dejados en el desnudo DOS y eso era bueno.
10.-
Pero Bill era más listo que todas las otras criaturas de Dios, y Bill
le dijo al usuario: ¿Te dijo Dios realmente que no ejecutaras todos los
programas?
11.- Y el usuario respondió: Dios nos dijo que podíamos usar cualquier programa, pero que no usáramos Windows.
12.-
Y Bill le dijo al usuario: ¿Cómo puedes hablar de algo que ni siquiera
has probado? En el momento en que ejecutes Windows serás igual a Dios,
serás capaz de crear cualquier cosa que quieras con el simple toque del
ratón.
13.- Y el usuario vio que los frutos del Windows eran más
bonitos y fáciles de usar. Y el usuario vio que todo conocimiento era
inútil, ya que Windows podía reemplazarlo.
14.- Así el usuario instaló Windows en su PC; y le dijo al programador que era bueno.
15.-
Y el programador inmediatamente empezó a buscar nuevos controladores. Y
Dios le preguntó: ¿qué buscas? y el programador respondió: Estoy
buscando nuevos controladores, porqué no puedo encontrarlos en el DOS.
Y Dios dijo: ¿quién te dijo que necesitabas nuevos controladores? ,
¿acaso ejecutaste Windows? y el programador dijo: fue Bill quien nos lo
dijo…
16.- Y Dios le dijo a Bill: por lo que hiciste, serás odiado
por todas las criaturas. Y el usuario siempre estará descontento
contigo. Y siempre venderás Windows.
17.- Y Dios le dijo al usuario:
por lo que hiciste, el Windows te decepcionará y se comerá todos tus
recursos; y tendrás que usar malos programas; y siempre permanecerás
bajo la ayuda del programador.
18.- Y Dios le dijo al
programador: por haber escuchado al usuario nunca serás feliz. Todos
tus programas tendrán errores y tendrás que corregirlos y corregirlos
hasta el final de los tiempos.
19.- Y Dios les echó a todos del Centro de Datos y bloqueó la puerta con una clave de acceso. Y eso no fue bueno.
20.- Y desde entonces Dios no descansa, ni ve progresos en las PC con Windows.
Escrito por
tognu en
cuda
BY TOGNU
1. Open a terminal and paste the following commands to add the Launchpad
repository:
-Ubuntu Karmic Koala
sudo add-apt-repository ppa:nvidia-vdpau/ppa
-Ubuntu Jaunty Jackalope, Intrepid Ibex, Hardy Heron:
sudo sh -c “echo 'deb http://ppa.launchpad.net/nvidia-vdpau/ppa/ubuntu UBUNTU_VERSION main' >> /etc/apt/sources.list” sudo sh -c “echo 'deb-src http://ppa.launchpad.net/nvidia-vdpau/ppa/ubuntu UBUNTU_VERSION main' >> /etc/apt/sources.list”
In the two lines above, replace UBUNTU_VERSION with your Ubuntu
version (in lowercase: jaunty, intrepid or hardy).
2. Import the GPG key (skip this for Karmic Koala if you used the
add-apt-repository command):
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys CEC06767
3. Now you can install
the Nvidia 190.xx stable drivers:
sudo apt-get update && sudo apt-get install nvidia-190-modaliases nvidia-glx-190
or 185.xx:
sudo apt-get update && sudo apt-get install nvidia-185-modaliases nvidia-glx-185
Install the drive using envyng
Code:
sudo apt-get install envyng-core; envyng -t
use the option 1
Install the Nvidia driver,now the option 0
and restart you computer.
The new driver
its showed
well, now open a
terminal and put in
Code:
sudo apt-get install build-essential libglut3-devsudo sudo apt-get install mesa-common-dev freeglut3-dev glutg3-dev libglut3
Furthermore we also need to get 3 more packages namely
sudo apt-get install libxmu-dev
sudo apt-get install libxmu-headers
sudo apt-get install libxi-dev
These can
be installed with sudo apt-get in a terminal or by finding them in
synaptic.
With these downloaded and installed we can continue
and install the Nvidia driver. Note that this is on a fresh install
and there are more steps to be taken if you are doing it with an
older Nvidia driver already installed. There are already posts on the
forum about that so I wont go into that here.
Next we need
to install the toolkit. To do this we open a terminal and type in
Code:
chmod +x ./cudatoolkit_2.3_linux_64_ubuntu9.04.run sudo ./cudatoolkit_2.3_linux_64_ubuntu9.04.run
You get to pick your install directory, here I will assume its in the
default.
The next step is to add the necessary environment
variables. In a terminal type in this. (Just type or copy it in one
line at a time!)
Code:
echo "# CUDA stuff PATH=\$PATH:/usr/local/cuda/bin
LD_LIBRARY_PATH=\$LD_LIBRARY_PATH:/usr/local/cuda/lib64
export PATH
export LD_LIBRARY_PATH" >> ~/.bashrc
Like the toolkit installer says, if you run a 32 bit version you must
leave out the 64 part.
Next we install the SDK. In a terminal
type in the following.
Code:
chmod +x ./cudasdk_2.3_linux.run ./cudasdk_2.3_linux.run
You dont need to be a superuser to install this.
First you get
asked where you want to put the files, and where the CUDA toolkit was
installed. (Check that this dir is the same as the one you installed
it in, even if it says it located it. The dir need to be the same and
not have additions of nvcc or the like!)
Last we need to
compile the SDK files. In a terminal type (I assume default install
dir)
Code:
sudo apt-get install gcc-4.1 g++-4.1
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.1 60 --slave /usr/bin/g++ g++ /usr/bin/g++-4.1 sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.4 40 --slave /usr/bin/g++ g++ /usr/bin/g++-4.4
cd NVIDIA_GPU_Computing_SDK/C make
Now it should unpack everything succesfully. You may get a lot of
warnings during the process, but these can safely be ignored.
Once
it is done you can test that everything does in fact work by going
into
Code:
cd NVIDIA_GPU_Computing_SDK/C/bin/linux/release/
Escrito por
tognu en
cursos Entregar antes del 17 de Noviembre de 2009.
Respuestas copiadas se tacharan.
EXAMEN Escrito por
tognu en
Congresos
SITEC 2009 CELAYA
Saludos, publico las platicas de seguridad y de ubuntu del Congreso SITEC 2009
Realizado en la ciudad de Celaya.
Filosofia Ubuntu
Pen test
Google Hacking

El camino hacia la nueva versión 9.10 de Ubuntu, que llevará el nombre de Karmic Koala,
continúa siendo recorrido por el equipo de desarrollo y ya se ha
completado con exito. Su lanzamiento final llegará el 29 de octubre.undefined
undefinedEn esta nueva edición nos encontramos con:
- la última versión del kernel 2.6.31 de Linux y de los entornos de escritorio GNOME y KDE (en el caso de Kubuntu).
- el servicio Ubuntu One por defecto, plenamente integrado en el escritorio.
- Grub2 como gestor de arranque y Ext4 como sistema de ficheros por defecto.
- arquitectura UXA para el driver de gráficas Intel, disponible pero todavía en pruebas.
undefinedUna mejora importante en esta versión es el cambio total del
arranque del sistema, el cual ha mejorado enormemente en cuanto a su aspecto visual y también en el tiempo empleado para arrancar:undefined
undefinedAdemás, nos encontramos ya con el nuevo proyecto
Ubuntu Software Store, del cual hablaremos en un post próximamente con más detalle.undefined
undefinedDescargalo
aqui
undefinedPor TOGNUundefined
undefinedExiste un número considerable de aplicaciones portables disponibles
para Ubuntu (Linux)en formato “.RUNZ” el cual no es reconocido por
ubuntu , es por eso que deberas de instalar un framework para correlo.undefined
undefinedLa extension .RUNZ es como un archivo .EXE en Windows y como un archivo .DMG en la Mac.undefined
undefinedPara poder interpretarlo será necesario instalar la extension .RUNZ ya que es un archivo tipo DEBundefined undefined
undefined
Sigue estos simples pasos para hacerlo funcionar
undefined
Bajar el framework 0.8.9.8 para Ubuntu [
Verifica la última versión]undefined
undefinedGuarda el archivo .deb e instalalo usando el instalador de paquetes (Package Installer).undefined

Package Installer – .RUNZ

Installation Finished
undefinedDespues de la instalación deberas de reiniciar tu sistema para activar el framework.undefined
undefinedAhora podras integrar cualquier aplicación y correla directamenteundefined

RUNZ Icon
undefinedundefined