Webbrowser generierter Code ?

  • VB.NET

Es gibt 5 Antworten in diesem Thema. Der letzte Beitrag () ist von dotNetCoding.

    Webbrowser generierter Code ?

    hallo mir wa langweilig wusste nicht was ich progen sollte darauf mache ich ein Login bei facebook um so meine kenntnisse zu verbessern doch dann wollte ich noch mit meine Programm eine nachricht senden und fand in livehttpheaders das hier :

    phstamp=16581681211115372103117

    sieht aus wie ein generierter code vom Browser
    da ich das nirgents in den Quelltext finden kann ,
    nun komme ich nciht weiter und würde das problem gerne lösen weiß jemand wie
    oder liege ich mit meiner Vermutung falsch

    LG
    also mein Code sieht so aus :

    VB.NET-Quellcode

    1. Option Strict On
    2. Imports System.Net, System.IO, System.Text.RegularExpressions
    3. Public Class Form1
    4. Public containa As New CookieContainer
    5. Public facebook2 As String = req("http://www.facebook.com/profile.php?", "", "GET")
    6. Public face As String = req("http://www.facebook.com/profile.php?", "", "POST")
    7. Public facebook As String = req("http://www.Facebook.com", "", "GET")
    8. Public Function req(ByVal site As String, ByVal post As String, ByVal met As String) As String
    9. Dim r As HttpWebRequest = CType(HttpWebRequest.Create(site), HttpWebRequest)
    10. r.Method = met
    11. r.UserAgent = "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:11.0) Gecko/20100101 Firefox/11.0"
    12. r.ContentType = "application/x-www-form-urlencoded"
    13. r.CookieContainer = containa
    14. r.AllowAutoRedirect = True
    15. If r.Method = "POST" Then
    16. Dim u As New StreamWriter(r.GetRequestStream(), System.Text.Encoding.Default)
    17. u.Write(post)
    18. u.Close()
    19. End If
    20. Dim t As New StreamReader(r.GetResponse.GetResponseStream())
    21. Dim o As String = t.ReadToEnd
    22. t.Close()
    23. Return o
    24. End Function
    25. Public Function login(ByVal nick As String, ByVal pass As String) As Boolean
    26. Dim location As String = Regex.Match(facebook, """locale"":""([^""]+)").Groups(1).Value
    27. Dim time As String = Regex.Match(facebook, "time=([^&]+)").Groups(1).Value
    28. Dim lngr As String = Regex.Match(facebook, "name=""lgnrnd"" value=""([^""]+)").Groups(1).Value
    29. Dim lsd As String = Regex.Match(facebook, "name=""lsd"" value=""([^""]+)").Groups(1).Value
    30. Dim log As String = req("https://www.facebook.com/login.php?login_attempt=1", "lsd=" & lsd & "&email=" & clText(nick) & "&pass=" & pass & "&default_persistent=0&charset_test=%E2%82%AC%2C%C2%B4%2C%E2%82%AC%2C%C2%B4%2C%E6%B0%B4%2C%D0%94%2C%D0%84&timezone=-120&lgnrnd=" & lngr & "&lgnjs=" & time & "&locale=" & location, "POST")
    31. Return log.Contains("Facebook") AndAlso Not log.Contains("Anmelden | Facebook")
    32. End Function
    33. Public Function clText(ByVal text As String) As String
    34. text = text.Replace("%40", "@")
    35. Return text
    36. End Function
    37. Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
    38. If login(TextBox1.Text, TextBox2.Text) Then
    39. MessageBox.Show("Erfolgreich Eingeloggt")
    40. Else
    41. MessageBox.Show("Login Fehlgeschlagen")
    42. End If
    43. End Sub
    44. Public Function DoAPost(ByVal text As String) As Boolean
    45. Dim userID As String = Regex.Match(facebook2, "envFlush\({""user"":""([^""]+)").Groups(1).Value
    46. Dim hxpc As String = Regex.Match(facebook2, "xhpc_ismeta"" value=""([\d]+)").Groups(1).Value
    47. Dim fbx As String = Regex.Match(facebook2, "xhpc_fbx"" value=""([\d]+)").Groups(1).Value
    48. Dim targetID As String = Regex.Match(facebook2, "xhpc_targetid"" value=""([^""]+)").Groups(1).Value
    49. Dim composerID As String = Regex.Match(facebook2, "composerid"" value=""([^""]+)").Groups(1).Value
    50. Dim fb As String = Regex.Match(facebook2, "fb_dtsg"":""([^""]+)").Groups(1).Value
    51. Dim post As String = req("http://www.facebook.com/ajax/updatestatus.php?__a=1", "fb_dtsg=" & fb & "&xhpc_composerid=" & composerID & "&xhpc_targetid=" & targetID & "&xhpc_context=profile&xhpc_fbx=" & fbx & "&xhpc_timeline=&xhpc_ismeta=" & hxpc & "&xhpc_message_text=" & text & "&xhpc_message=" & text & "&composertags_place=&composertags_place_name=&composer_predicted_city=&composer_session_id=" & composerID & "&is_explicit_place=&audience[0][value]=80&composertags_city=&disable_location_sharing=false&nctr[_mod]=pagelet_wall&__user=" & userID & "&phstamp=16581681211115372103117", "POST")
    52. Return post.Contains("") AndAlso Not post.Contains("")
    53. End Function
    54. Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
    55. DoAPost("hallo")
    56. End Sub
    57. End Class


    und bei der DoAPost Function sieht man hinten den 23 langen key
    der warscheinlich irgentiwe vom Webbrowser generiert wird , ich habe schon eine Lösung gefunden hier :

    VB.NET-Quellcode

    1. function generatePhstamp(qs, dtsg) {
    2. var input_len = qs.length;
    3. numeric_csrf_value='';
    4. for(var ii=0;ii<dtsg.length;ii++) {
    5. numeric_csrf_value+=dtsg.charCodeAt(ii);
    6. }
    7. return '1' + numeric_csrf_value + input_len;
    8. }


    aber leider nur in c++ wurde das gecode natürlich kann ich einiges verstehen auch ohne c++ kenntnisse aber könnte mir jemand das in VB übersetzen oder so das wäre jut



    LG
    habe es hin bekommen ^^

    VB.NET-Quellcode

    1. [21:20:40] Easy MhM: Private Function GeneratePhPStamp(ByVal Qs As String, ByVal Dtsg As String) As String
    2. Dim Stamp As String = String.Empty
    3. For i As Integer = 0 To Dtsg.Length - 1
    4. Stamp &= AscW(Dtsg(i))
    5. Next
    6. Return "1" & Stamp & Qs.Length
    7. End Function


    so easy ^^