elhacker.net cabecera Bienvenido(a), Visitante. Por favor Ingresar o Registrarse
¿Perdiste tu email de activación?.

 

 


Tema destacado: Usando Git para manipular el directorio de trabajo, el índice y commits (segunda parte)


  Mostrar Mensajes
Páginas: 1 ... 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 [65] 66 67 68 69 70 71 72 73 74 75 76 77
641  Programación / .NET (C#, VB.NET, ASP) / Necesito una rutina para bloquear la APP ? en: 16 Febrero 2013, 00:54 am
Holas chicos pues veran yo tengo un timer que pasada las 2 horas si mi programa no se ha conectado a internet pues necesito que se bloquee y que aunque se abra y cierre no funcione, ideas...

Gracias de antemano
642  Programación / .NET (C#, VB.NET, ASP) / Re: Enviar un Form usando Httprequest !! en: 13 Febrero 2013, 19:52 pm
Holas de nuevo chicos pues miren los avances y con ellos nuevas frustaciones, leyendo sobre como subir archivos encontre que el code anterior no se aplica hay que hacerle algunas correciones por lo que pongo mis modificaciones..

Código
  1.  
  2.    Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
  3.        'UploadLocalFile()
  4.        Dim CookieJar As New CookieContainer
  5.        Dim Url As String = "http://lok.myvnc.com/insertar-anuncio.html?isDBMode=1"
  6.        Dim parametros As New NameValueCollection()
  7.  
  8.        ' Create the data we want to send
  9.        parametros.Add("var1", "1235")
  10.        parametros.Add("var2", "524")
  11.        parametros.Add("var3", "Mas información para mandar")
  12.        parametros.Add("var4", "Mas informacion para mandar")
  13.        parametros.Add("var5", "jdueybd@gjhf.com")
  14.        parametros.Add("var6", "123456")
  15.        parametros.Add("var7", "654321")
  16.        parametros.Add("var8", "Pepin")
  17.  
  18.        Uploaddata(CookieJar, Url, "C:\corazon.jpeg", "ad_picture_a", "image,jpeg", parametros)
  19.    End Sub
  20.  
  21. 'Funcion que manda la información
  22.  
  23. Public Function Uploaddata(ByVal containa As CookieContainer, ByVal uri As String, ByVal filePath As String, ByVal fileParameterName As String, ByVal contentType As String, ByVal otherParameters As Specialized.NameValueCollection) As String
  24.  
  25.        Dim boundary As String = "---------------------------" & DateTime.Now.Ticks.ToString("x")
  26.        Dim newLine As String = System.Environment.NewLine
  27.        Dim boundaryBytes As Byte() = System.Text.Encoding.ASCII.GetBytes(newLine & "--" & boundary & newLine)
  28.        Dim request As Net.HttpWebRequest = Net.WebRequest.Create(Uri)
  29.  
  30.        request.ContentType = "multipart/form-data; boundary=" & boundary
  31.        request.Method = "POST"
  32.        request.Referer = "http://lok.myvnc.com/vivienda/casa-en-la-playa/insertar-anuncio.html"
  33.        request.Headers.Add("Accept-Encoding", "gzip, deflate")
  34.        request.Accept = "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"
  35.        request.UserAgent = "Mozilla/5.0 (Windows NT 5.1; rv:16.0) Gecko/20100101 Firefox/16.0"
  36.        request.CookieContainer = containa
  37.        request.AllowAutoRedirect = True
  38.        request.Timeout = -1
  39.        request.KeepAlive = True
  40.        request.AllowWriteStreamBuffering = False
  41.  
  42.        Dim ms As New MemoryStream()
  43.        Dim formDataTemplate As String = "Content-Disposition: form-data; name=""{0}""{1}{1}{2}"
  44.  
  45.        For Each key As String In otherParameters.Keys
  46.            ms.Write(boundaryBytes, 0, boundaryBytes.Length)
  47.            Dim formItem As String = String.Format(formDataTemplate, key, newLine, otherParameters(key))
  48.            Dim formItemBytes As Byte() = System.Text.Encoding.UTF8.GetBytes(formItem)
  49.            ms.Write(formItemBytes, 0, formItemBytes.Length)
  50.        Next key
  51.  
  52.        ms.Write(boundaryBytes, 0, boundaryBytes.Length)
  53.  
  54.        Dim headerTemplate As String = "Content-Disposition: form-data; name=""{0}""; filename=""{1}""{2}Content-Type: {3}{2}{2}"
  55.        Dim header As String = String.Format(headerTemplate, fileParameterName, filePath, newLine, contentType)
  56.        Dim headerBytes As Byte() = System.Text.Encoding.UTF8.GetBytes(header)
  57.        ms.Write(headerBytes, 0, headerBytes.Length)
  58.  
  59.        Dim length As Long = ms.Length
  60.        length += New FileInfo(filePath).Length
  61.        request.ContentLength = length
  62.  
  63.        Using requestStream As IO.Stream = request.GetRequestStream()
  64.            Dim bheader() As Byte = ms.ToArray()
  65.            requestStream.Write(bheader, 0, bheader.Length)
  66.            Using fileStream As New IO.FileStream(filePath, IO.FileMode.Open, IO.FileAccess.Read)
  67.  
  68.                Dim buffer(4096) As Byte
  69.                Dim bytesRead As Int32 = fileStream.Read(buffer, 0, buffer.Length)
  70.  
  71.                Do While (bytesRead > 0)
  72.                    requestStream.Write(buffer, 0, bytesRead)
  73.                    bytesRead = fileStream.Read(buffer, 0, buffer.Length)
  74.                Loop
  75.            End Using
  76.            requestStream.Close()
  77.        End Using
  78.  
  79.        Dim response As Net.WebResponse = Nothing
  80.        Dim responseText = ""
  81.  
  82.        Try
  83.  
  84.            response = request.GetResponse()
  85.  
  86.            Using responseStream As IO.Stream = response.GetResponseStream()
  87.  
  88.                Using responseReader As New IO.StreamReader(responseStream)
  89.  
  90.                    responseText = responseReader.ReadToEnd()
  91.  
  92.                End Using
  93.  
  94.            End Using
  95.  
  96.        Catch exception As Net.WebException
  97.  
  98.            MsgBox(exception.Message)
  99.  
  100.        Finally
  101.  
  102.            response.Close()
  103.            response = Nothing
  104.            request = Nothing
  105.        End Try
  106.  
  107.        Return responseText
  108.  
  109.    End Function
  110.  
  111. End Class
  112.  
  113.  


Bueno el codigo funciona perfecto cuando abro la pagina para ver si lo que publico todo bien menos la maldita imagen que no se porque no la sube.. ahora busque un Sniffer HTTP para ver a nivel de protoclo que sucede y hay varias cosas que note esto:

Ejemplo de publicacion con el Firefox:

-----------------------------265001916915724
Content-Disposition: form-data; name="ad_picture_a"; filename="corazon.jpg"
Content-Type: image/jpeg

'Aqui va todo el archivo en codificado lenguaje maquina al server
-----------------------------265001916915724

Y otros parametros que se envian pero que el Form no me pide ningun dato de ellos, sera eso lo que esta sucediendo?.. Me parece tambien que el modo de codificacion del archivo no es el mismo que el del Mozilla lo digo porque vi ambos ejemplos y no se parecen en nada,  tambien quisiera saber si es obligatorio el orden en el que se mandan yo creo que no pero bueno... ahora algo que quiero dejar claro, el Form los datos que me exige son los que paso en el codigo quiero decir que si no pongo alguno de esos al dar click en el boton de enviar me vuelve a cargar la pagina señalandome los campos obligatorios, supongo entonces que si se publica entonces esos parametros que se envian junto con el form no son el problema en si...
643  Programación / .NET (C#, VB.NET, ASP) / Enviar un Form usando Httprequest !! en: 12 Febrero 2013, 00:55 am
Amigos tengo un code con el que envio un FORM usando HTTPrequest con el metodo POST sin problemas, lo que sucede es que ese FORM tiene para mandar 3 fotos y ahi es donde se me traba el paraguas el CODE que tengo hasta ahora es este..

Código
  1.  
  2. Imports System
  3. Imports System.IO
  4. Imports System.Net
  5. Imports System.Text
  6.  
  7. Public Class Form1
  8.  
  9.    Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
  10.  
  11.  
  12.        Dim precio As String, categoria As String, titulo As String, cuerpo As String, _
  13.        filesize As String, email As String, phone As String
  14.        'Dim boundary As String = "---------------------------" + DateTime.Now.Ticks.ToString("x")
  15.  
  16.  
  17.        ' Create the data we want to send
  18.        precio = "25"
  19.        categoria = "105"
  20.        titulo = "titulo del form"
  21.        cuerpo = "aki va el cuerpo del mensaje"
  22.        email = "user@gnome.com"
  23.        phone = "1234567"
  24.        filesize = "307200"
  25.  
  26.        ' Create a request using a URL that can receive a post.
  27.        Dim request As HttpWebRequest = HttpWebRequest.Create("URL")
  28.        ' Set the Method property of the request to POST.
  29.        request.Method = "POST"
  30.        request.Accept = "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"
  31.  
  32.  
  33.        Dim postdata As String = "ad_price=" & precio & "&category=" & categoria & "&ad_headline=" & _
  34.            titulo & "&ad_text=" & cuerpo & "&email=" & email & "&phone=" & phone & "&MAX_FILE_SIZE=" & filesize
  35.  
  36.  
  37.        Dim byteArray As Byte() = Encoding.UTF8.GetBytes(postdata)
  38.        ' Set the ContentType property of the WebRequest.
  39.        request.ContentType = "application/x-www-form-urlencoded"
  40.        ' Set the ContentLength property of the WebRequest.
  41.        request.ContentLength = byteArray.Length
  42.        ' Get the request stream.
  43.        Dim dataStream As Stream = request.GetRequestStream()
  44.        ' Write the data to the request stream.
  45.        dataStream.Write(byteArray, 0, byteArray.Length)
  46.        ' Close the Stream object.
  47.        dataStream.Close()
  48.        ' Get the response.
  49.        Dim response As WebResponse = request.GetResponse()
  50.        ' Display the status.
  51.        Console.WriteLine(CType(response, HttpWebResponse).StatusDescription)
  52.        ' Get the stream containing content returned by the server.
  53.        dataStream = response.GetResponseStream()
  54.        ' Open the stream using a StreamReader for easy access.
  55.        Dim reader As New StreamReader(dataStream)
  56.        ' Read the content.
  57.        Dim responseFromServer As String = reader.ReadToEnd()
  58.        ' Display the content.
  59.        txtoutput.Text = responseFromServer
  60.        ' Clean up the streams.
  61.        reader.Close()
  62.        dataStream.Close()
  63.        response.Close()
  64.    End Sub
  65.  
  66. End Class
  67.  
  68.  

Muchas gracias por cualquier ayuda
644  Programación / .NET (C#, VB.NET, ASP) / Necesito anclar mi APP ? en: 3 Febrero 2013, 02:19 am
Hola pues eso ando buscando algun dato en el Pc que nunca varie aunque formateen el Pc y reinstalen tambien que no se pueda simular en otra Pc, para que mi app lo verifique siempre antes de iniciar y nada mas corra en al Pc que yo quiera...

Tambien si es posible diganme algun metodo seguro para cifrar mi App, conozco el programa Armadillo pero no se si es necesario llegar hasta alla...

Salu2
645  Programación / .NET (C#, VB.NET, ASP) / SerialPort y Modem ? en: 27 Enero 2013, 23:43 pm
Lo que espero es un Ok del Modem mas recibo un 65 alguna idea, quizas sea por el tipo de lectura que estoy haciendo....Salu2

Disculpen por repetir el Topic si pudieran borrar el otro estaria agradecido...gracias

Código
  1.  
  2. Imports System.IO.Ports
  3.  
  4. Public Class Form1
  5.  
  6.    Private mySerialPort As New SerialPort
  7.    Private comBuffer As Byte()
  8.    Private Delegate Sub UpdateFormDelegate()
  9.    Private UpdateFormDelegate1 As UpdateFormDelegate
  10.  
  11.    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
  12.        Try
  13.            AddHandler mySerialPort.DataReceived, AddressOf mySerialPort_DataReceived
  14.            CommPortSetup()
  15.        Catch ex As Exception
  16.            MessageBox.Show(ex.Message)
  17.        End Try
  18.    End Sub
  19.  
  20.    Private Sub mySerialPort_DataReceived(ByVal sender As Object, ByVal e As SerialDataReceivedEventArgs)
  21.        'Handles serial port data received events
  22.        UpdateFormDelegate1 = New UpdateFormDelegate(AddressOf UpdateDisplay)
  23.        Dim n As Integer = mySerialPort.BytesToRead 'find number of bytes in buf
  24.        comBuffer = New Byte(n - 1) {} 're dimension storage buffer
  25.        mySerialPort.Read(comBuffer, 0, n) 'read data from the buffer
  26.  
  27.        Me.Invoke(UpdateFormDelegate1) 'call the delegate
  28.    End Sub
  29.  
  30.    Private Sub UpdateDisplay()
  31.        Label2.Text = CStr(comBuffer(0))
  32.    End Sub
  33.  
  34.    Private Sub CommPortSetup()
  35.        With mySerialPort
  36.            .PortName = "COM3"
  37.            .BaudRate = 9600
  38.            .DataBits = 8
  39.            .Parity = Parity.None
  40.            .StopBits = StopBits.One
  41.            .Handshake = Handshake.None
  42.        End With
  43.        Try
  44.            mySerialPort.Open()
  45.        Catch ex As Exception
  46.            MessageBox.Show(ex.Message)
  47.        End Try
  48.    End Sub
  49.  
  50.    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
  51.        mySerialPort.WriteLine("AT+VCID")
  52.    End Sub
  53. End Class
  54.  
  55.  
646  Programación / .NET (C#, VB.NET, ASP) / Trabajando con Puerto COM - SerialPort !! Dudita ! en: 24 Enero 2013, 01:18 am
holas estoy tratando de leer la respuesta del Modem al comando que le paso y me devuelve un numero, no entiendo porque quizas sea en el tipo de lectura que se hace que es con un buffer....

Alguna idea...Lo que espero es un OK

Código
  1. Imports System.IO.Ports
  2.  
  3. Public Class Form1
  4.  
  5.    Private mySerialPort As New SerialPort
  6.    Private comBuffer As Byte()
  7.    Private Delegate Sub UpdateFormDelegate()
  8.    Private UpdateFormDelegate1 As UpdateFormDelegate
  9.  
  10.    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
  11.        Try
  12.            AddHandler mySerialPort.DataReceived, AddressOf mySerialPort_DataReceived
  13.            CommPortSetup()
  14.        Catch ex As Exception
  15.            MessageBox.Show(ex.Message)
  16.        End Try
  17.    End Sub
  18.  
  19.    Private Sub mySerialPort_DataReceived(ByVal sender As Object, ByVal e As SerialDataReceivedEventArgs)
  20.        'Handles serial port data received events
  21.        UpdateFormDelegate1 = New UpdateFormDelegate(AddressOf UpdateDisplay)
  22.        Dim n As Integer = mySerialPort.BytesToRead 'find number of bytes in buf
  23.        comBuffer = New Byte(n - 1) {} 're dimension storage buffer
  24.        mySerialPort.Read(comBuffer, 0, n) 'read data from the buffer
  25.  
  26.        Me.Invoke(UpdateFormDelegate1) 'call the delegate
  27.    End Sub
  28.  
  29.    Private Sub UpdateDisplay()
  30.        Label2.Text = CStr(comBuffer(0))
  31.    End Sub
  32.  
  33.    Private Sub CommPortSetup()
  34.        With mySerialPort
  35.            .PortName = "COM3"
  36.            .BaudRate = 9600
  37.            .DataBits = 8
  38.            .Parity = Parity.None
  39.            .StopBits = StopBits.One
  40.            .Handshake = Handshake.None
  41.        End With
  42.        Try
  43.            mySerialPort.Open()
  44.        Catch ex As Exception
  45.            MessageBox.Show(ex.Message)
  46.        End Try
  47.    End Sub
  48.  
  49.    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
  50.        mySerialPort.WriteLine("AT+VCID")
  51.    End Sub
  52. End Class
  53.  
647  Programación / .NET (C#, VB.NET, ASP) / Re: Necesito consultar la fecha en Internet ?? en: 15 Enero 2013, 01:32 am
Gracias en las busquedas que hice di con el, pero nose lo vi tan extenso que no me atrevi ni a testearlo, es que no creo que sea necesario tanto code para algo tan simple, digo yo... orita me lo llevo para la casa y hago las pruebas, lo estuve mirando por arriba y no vi como llamar a la funcion que revisa la fecha... bueno supongo que despues la vere, si tienes alguno mas simple te lo agradecere...

Orita no tendre ni con que agradecerte, jajajajaja.... bye

Te comento que ya casi tengo el proyecto listo...

Me falta poder generar unos reportes muy simples, tambien necesito poder eliminar cuentas de usuarios creadas en el Windows XP, asi como crear un grupo local y eliminarlos y otras boberias....

Salu2
648  Programación / .NET (C#, VB.NET, ASP) / Necesito consultar la fecha en Internet ?? en: 14 Enero 2013, 03:53 am
Holas chikos quizas alguno tenga algun codigo sobre consultar con algun server la fecha, es que el que tengo no me gusta...

Lo que hago es consultar una web y buscar en ella la fecha...

Se que hay un protocolo que atiende eso el NTP pero no encuentro un proyecto que me funcione sin problemas...

Salu2 y gracias cualquier idea...
649  Seguridad Informática / Bugs y Exploits / Re: DISEÑO DE EXPLOIT en: 14 Enero 2013, 03:34 am
¿por que lo ayudan con esas cosas?
no se supone que esas cosas están prohibidas en este foro???
o hay preferencias doblemoralistas ?

No le veo nada de malo a eso, hasta donde el pregunto no veo nada malo...

Tampoco exageremos

Salu2
650  Programación / .NET (C#, VB.NET, ASP) / Re: Problemilla con Sqlite !! en: 21 Diciembre 2012, 17:33 pm
Tu problema ahora es que tienes valores no nullables a los cuales no les estas asignando nada :P

Increible bueno pues si y no....

Lo que sucede es que tengo un campo de tipo Fecha que al parecer no le estoy pasando el formato de fecha correcto y me esta dando esa violacion, pq todos los tengo puesto como NULL jajajajaja, en cuanto cambie el campo ese por VARCHAR entro que jodia, un millon de gracias sos un barbaro... Dios te bendiga que tengas mucha dicha bro, salu2

Nos vemos orita con mas problemas jajajajaja
Páginas: 1 ... 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 [65] 66 67 68 69 70 71 72 73 74 75 76 77
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines