miércoles, 16 de mayo de 2012

Ver la BSSID DE UNA WIFI EN LA PS VITA

DEBEMOS INTENTAR CONECTAR ,CON CUALQUIER CONTRASEÑA QUE ADMITA SU CIFRADO

SEGUIDAMENTE VAMOS A ESTADO DE LA CONEXION A INTERNET Y NOS MUESTRA LA BSSID A LA QUE SE ESTA INTENTANDO ASOCIAR

SIENTO QUE SEA EN MAYUSCULAS PERO ME TENGO QUE IR...

Mi primera aplicación para Vita Seguridad WLAN_XXXX Y JAZZTEL_XXXX


Buenas dejo aquí el código de esta aplicación hecha en la tarde en un par de horas con ayuda del UI COMPOSER para los graficos y las librerias http://msdn.microsoft.com/en-us/library/system.security.cryptography.md5.aspx para el md5.


Si alguien la quiere mejorar pues que se disponga a ello, he modificado código principalmente en la parte generada por el UI COMPOSER

Mejoradla :)

Os dejo los códigos,partí como base de un helloworld de ahí que estén los paquetes de ese modo...
Tengo que seguir estudiando...

AppMain.cs

using System;
using System.Collections.Generic;


using Sce.Pss.Core.Environment;
using Sce.Pss.Core.Graphics;
using Sce.Pss.Core.Input;


using Sce.Pss.HighLevel.UI;


namespace HelloWorld
{
public class AppMain
{
private static GraphicsContext graphics;

public static void Main (string[] args)
{
Initialize ();
while (true) {
SystemEvents.CheckEvents ();
Update ();
Render ();
}
}


public static void Initialize ()
{
// Set up the graphics system
graphics = new GraphicsContext ();
UISystem.Initialize(graphics);
var SceneHelloWorld = new HelloworldPsvita.SampleHelloWorldPsvita();
UISystem.SetScene(SceneHelloWorld,null);
}


public static void Update ()
{
// Query gamepad for current state
var gamePadData = GamePad.GetData (0);
List<TouchData> touchDataList = Touch.GetData (0);


            // Update UI Toolkit
            UISystem.Update(touchDataList);
}


public static void Render ()
{
// Clear the screen
graphics.SetClearColor (1.0f, 1.0f, 1.0f, 1.0f);
graphics.Clear ();

UISystem.Render ();
// Present the screen
graphics.SwapBuffers ();
}
}
}


SampleHelloworldPsVita.cs

using System;
using System.Collections.Generic;
using Sce.Pss.Core;
using Sce.Pss.Core.Imaging;
using Sce.Pss.Core.Environment;
using Sce.Pss.HighLevel.UI;


namespace HelloworldPsvita
{
    public partial class SampleHelloWorldPsvita : Scene
    {
        public SampleHelloWorldPsvita()
        {
            InitializeWidget();
        }
    }
}


SampleHelloWorldPsvitacomposer.cs



// AUTOMATICALLY GENERATED CODE


using System;
using System.Collections.Generic;
using Sce.Pss.Core;
using Sce.Pss.Core.Imaging;
using Sce.Pss.Core.Environment;
using Sce.Pss.HighLevel.UI;


using System.Security.Cryptography;
using System.Text;


namespace HelloworldPsvita
{
    partial class SampleHelloWorldPsvita
    {
        Label Label_1;
        EditableText EditableText_1;
        EditableText EditableText_2;
        EditableText EditableText_3;
        Button Button_1;


        private void InitializeWidget()
        {
            InitializeWidget(LayoutOrientation.Horizontal);
        }


        private void InitializeWidget(LayoutOrientation orientation)
        {
            Label_1 = new Label();
            Label_1.Name = "Label_1";
            EditableText_1 = new EditableText();
            EditableText_1.Name = "EditableText_1";
            EditableText_2 = new EditableText();
            EditableText_2.Name = "EditableText_2";
            EditableText_3 = new EditableText();
            EditableText_3.Name = "EditableText_3";
            Button_1 = new Button();
            Button_1.Name = "Button_1";


            // Label_1
            Label_1.TextColor = new UIColor(0f / 255f, 0f / 255f, 0f / 255f, 255f / 255f);
            Label_1.Font = new Font( FontAlias.System, 25, FontStyle.Bold);
            Label_1.LineBreak = LineBreak.Character;


            // EditableText_1
            EditableText_1.TextColor = new UIColor(0f / 255f, 0f / 255f, 0f / 255f, 255f / 255f);
            EditableText_1.Font = new Font( FontAlias.System, 25, FontStyle.Regular);
            EditableText_1.LineBreak = LineBreak.Character;
            // EditableText_2
            EditableText_2.TextColor = new UIColor(0f / 255f, 0f / 255f, 0f / 255f, 255f / 255f);
            EditableText_2.Font = new Font( FontAlias.System, 25, FontStyle.Regular);
            EditableText_2.LineBreak = LineBreak.Character;


            // EditableText_3
            EditableText_3.TextColor = new UIColor(0f / 255f, 0f / 255f, 0f / 255f, 255f / 255f);
            EditableText_3.Font = new Font( FontAlias.System, 25, FontStyle.Regular);
            EditableText_3.LineBreak = LineBreak.Character;


            // Button_1
            Button_1.TextColor = new UIColor(0f / 255f, 0f / 255f, 0f / 255f, 255f / 255f);
            Button_1.TextFont = new Font( FontAlias.System, 25, FontStyle.Regular);
Button_1.ButtonAction+=CalcularContraseña;
            // Scene
            this.RootWidget.AddChildLast(Label_1);
            this.RootWidget.AddChildLast(EditableText_1);
            this.RootWidget.AddChildLast(EditableText_2);
            this.RootWidget.AddChildLast(EditableText_3);
            this.RootWidget.AddChildLast(Button_1);


            SetWidgetLayout(orientation);


            UpdateLanguage();
        }


        private LayoutOrientation _currentLayoutOrientation;
        public void SetWidgetLayout(LayoutOrientation orientation)
        {
            switch (orientation)
            {
            case LayoutOrientation.Vertical:
                this.DesignWidth = 544;
                this.DesignHeight = 960;


                Label_1.SetPosition(107, 139);
                Label_1.SetSize(214, 36);
                Label_1.Anchors = Anchors.Top | Anchors.Height | Anchors.Left | Anchors.Width;
                Label_1.Visible = true;


                EditableText_1.SetPosition(264, 199);
                EditableText_1.SetSize(360, 56);
                EditableText_1.Anchors = Anchors.Top | Anchors.Height | Anchors.Left | Anchors.Width;
                EditableText_1.Visible = true;


                EditableText_2.SetPosition(264, 313);
                EditableText_2.SetSize(360, 56);
                EditableText_2.Anchors = Anchors.Top | Anchors.Height | Anchors.Left | Anchors.Width;
                EditableText_2.Visible = true;


                EditableText_3.SetPosition(264, 427);
                EditableText_3.SetSize(360, 56);
                EditableText_3.Anchors = Anchors.Top | Anchors.Height | Anchors.Left | Anchors.Width;
                EditableText_3.Visible = true;


                Button_1.SetPosition(292, 136);
                Button_1.SetSize(214, 56);
                Button_1.Anchors = Anchors.Top | Anchors.Height | Anchors.Left | Anchors.Width;
                Button_1.Visible = true;


                break;


            default:
                this.DesignWidth = 960;
                this.DesignHeight = 544;


                Label_1.SetPosition(264, 76);
                Label_1.SetSize(418, 36);
                Label_1.Anchors = Anchors.Top | Anchors.Height | Anchors.Left | Anchors.Width;
                Label_1.Visible = true;


                EditableText_1.SetPosition(264, 152);
                EditableText_1.SetSize(360, 56);
                EditableText_1.Anchors = Anchors.Top | Anchors.Height | Anchors.Left | Anchors.Width;
                EditableText_1.Visible = true;


                EditableText_2.SetPosition(264, 239);
                EditableText_2.SetSize(360, 56);
                EditableText_2.Anchors = Anchors.Top | Anchors.Height | Anchors.Left | Anchors.Width;
                EditableText_2.Visible = true;


                EditableText_3.SetPosition(264, 313);
                EditableText_3.SetSize(360, 56);
                EditableText_3.Anchors = Anchors.Top | Anchors.Height | Anchors.Left | Anchors.Width;
                EditableText_3.Visible = true;


                Button_1.SetPosition(642, 313);
                Button_1.SetSize(214, 56);
                Button_1.Anchors = Anchors.Top | Anchors.Height | Anchors.Left | Anchors.Width;
                Button_1.Visible = true;


                break;
            }
            _currentLayoutOrientation = orientation;
        }
        public void UpdateLanguage()
        {
            Label_1.Text = "Seguridad WLAN_XXXX Y JAZZTEL_XXXX";
            EditableText_1.Text = "Introduzca XXXX";
            EditableText_1.DefaultText = "Introduzca XXXX";
            EditableText_2.Text = "Introduzca la BSSID sin los puntos";
            EditableText_2.DefaultText = "Introduzca la BSSID sin los puntos";
            EditableText_3.Text = "Resultado";
            EditableText_3.DefaultText = "Resultado";
            Button_1.Text = "OK";
        }
        private void onShowing(object sender, EventArgs e)
        {
            switch (_currentLayoutOrientation)
            {
                case LayoutOrientation.Vertical:
                {
                }
                break;


                default:
                {
                }
                break;
            }
        }

        static string GetMd5Hash(MD5 md5Hash, string input)
        {


            // Convert the input string to a byte array and compute the hash.
            byte[] data = md5Hash.ComputeHash(Encoding.UTF8.GetBytes(input));


            // Create a new Stringbuilder to collect the bytes
            // and create a string.
            StringBuilder sBuilder = new StringBuilder();


            // Loop through each byte of the hashed data
            // and format each one as a hexadecimal string.
            for (int i = 0; i < data.Length; i++)
            {
                sBuilder.Append(data[i].ToString("x2"));
            }


            // Return the hexadecimal string.
            return sBuilder.ToString();
        }

private void CalcularContraseña(object sender, TouchEventArgs e){
String cadena;
cadena="bcgbghgg"+EditableText_2.Text.Remove(8)+EditableText_1.Text+EditableText_2.Text;
using (MD5 md5Hash = MD5.Create())
            {
                string password = GetMd5Hash(md5Hash, cadena);
EditableText_3.Text=password.Remove(20);
            }


}

        private void onShown(object sender, EventArgs e)
        {
            switch (_currentLayoutOrientation)
            {
                case LayoutOrientation.Vertical:
                {
                }
                break;


                default:
                {
                }
                break;
            }
        }
    }
}

NI QUE DECIR TIENE QUE ES PARA PROBAR LA SEGURIDAD DE TU ROUTER O DE TUS AMIGOS, CON CONSENTIMIENTO,ETC

martes, 15 de mayo de 2012