Damit ich das Programmieren lerne, habe ich mir eine Internetseite zufällig ausgesucht und versuche dort das Login hinzukriegen.
ich komme aber irgendwie nicht weiter. Vielleicht findet ihr den Fehler ?
Dazu der Inhalt der seite
rebuy.de/verkaufen/login_check
POST /verkaufen/login_check HTTP/1.1
Host: rebuy.de
User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:55.0) Gecko/20100101 Firefox/55.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: de,en-US;q=0.7,en;q=0.3
Accept-Encoding: gzip, deflate, br
Content-Type: application/x-www-form-urlencoded
Content-Length: 113
Referer: rebuy.de/verkaufen/auth
Cookie: PHPSESSID=jdff3itvlm0205fuh7r6519d7h; hl=de; green-web-features=%7B%22GREEN_164%22%3A78%7D; abtcid=8189ba7d-1fd4-4ed3-be9a-720fbc7d3b63; abtcnew=1; ud=92; wxn_g=CUX-330__ab_test_29%3Acontrol%3BGREEN-456__ab_test_14%3Avariation; _uetsid=_uetb7e7ce22
DNT: 1
Connection: keep-alive
Upgrade-Insecure-Requests: 1
_username=xxxx@xxx.de&_password=xxxxxxx&submit=&_csrf_token=O2R3uYRTZbXo_frcL36SYHZceHKkDG6f7m_Tsg0KAzU: undefined
HTTP/2.0 302 Found
server: myracloud
date: Sun, 24 Sep 2017 10:32:49 GMT
content-type: text/html; charset=UTF-8
content-length: 368
cache-control: no-cache, private
location: rebuy.de/verkaufen/
p3p: CP="reBuy does not have a P3P policy"
set-cookie: PHPSESSID=hcevbmcr7jjjnritu89hrmiblk; path=/; HttpOnly
set-cookie: ry_previous=deleted; expires=Thu, 01-Jan-1970 00:00:01 GMT; Max-Age=0; path=/; HttpOnly
set-cookie: rbauth=auth%3A09b6debe-d9f8-4b7a-9cc9-7038b9769198; expires=Mon, 24-Sep-2018 10:32:48 GMT; Max-Age=31535999; path=/; secure; HttpOnly
set-cookie: x-rebuy-internal=b0a9212e-04eb-498c-a33f-c998e2bc6df2; path=/; secure; HttpOnly
set-cookie: cart=246b2977-953e-4beb-b5d6-7f79d5a9c3fb; path=/; HttpOnly
set-cookie: phraseapp=deleted; expires=Thu, 01-Jan-1970 00:00:01 GMT; Max-Age=0; path=/; HttpOnly
set-cookie: ud=92; expires=Mon, 24-Sep-2018 10:32:49 GMT; Max-Age=31536000; path=/; domain=rebuy.de
strict-transport-security: max-age=31536000
x-frame-options: SAMEORIGIN
x-source: k8s-public-ingress
X-Firefox-Spdy: h2
----------------------------------------------------------
rebuy.de/verkaufen/
GET /verkaufen/ HTTP/1.1
Host: rebuy.de
User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:55.0) Gecko/20100101 Firefox/55.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: de,en-US;q=0.7,en;q=0.3
Accept-Encoding: gzip, deflate, br
Referer: rebuy.de/verkaufen/auth
Cookie: PHPSESSID=hcevbmcr7jjjnritu89hrmiblk; hl=de; green-web-features=%7B%22GREEN_164%22%3A78%7D; abtcid=8189ba7d-1fd4-4ed3-be9a-720fbc7d3b63; abtcnew=1; ud=92; wxn_g=CUX-330__ab_test_29%3Acontrol%3BGREEN-456__ab_test_14%3Avariation; _uetsid=_uetb7e7ce22; rbauth=auth%3A09b6debe-d9f8-4b7a-9cc9-7038b9769198; x-rebuy-internal=b0a9212e-04eb-498c-a33f-c998e2bc6df2; cart=246b2977-953e-4beb-b5d6-7f79d5a9c3fb
DNT: 1
Connection: keep-alive
Upgrade-Insecure-Requests: 1
HTTP/2.0 200 OK
server: myracloud
date: Sun, 24 Sep 2017 10:32:49 GMT
content-type: text/html; charset=UTF-8
cache-control: max-age=600
content-encoding: gzip
p3p: CP="reBuy does not have a P3P policy"
set-cookie: cart=246b2977-953e-4beb-b5d6-7f79d5a9c3fb; path=/; HttpOnly
set-cookie: phraseapp=deleted; expires=Thu, 01-Jan-1970 00:00:01 GMT; Max-Age=0; path=/; HttpOnly
set-cookie: abtcnew=1; expires=Sun, 24-Sep-2017 11:02:49 GMT; Max-Age=1800; path=/; domain=rebuy.de; HttpOnly
set-cookie: ud=92; expires=Mon, 24-Sep-2018 10:32:49 GMT; Max-Age=31536000; path=/; domain=rebuy.de
strict-transport-security: max-age=31536000
vary: cookie, accept-encoding, accept-language
x-frame-options: SAMEORIGIN
x-source: k8s-public-ingress
expires: Sun, 24 Sep 2017 10:42:49 GMT
etag: "myra-1dd393b5"
X-Firefox-Spdy: h2
Danke ! vlielleicht kann mir ein schlauer Kopf helfen
ich komme aber irgendwie nicht weiter. Vielleicht findet ihr den Fehler ?
VB.NET-Quellcode
- Imports System.IO, System.Net, System.Text, System.Text.RegularExpressions
- Public Class Form1
- Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
- Label5.Text = ""
- Dim xtraHeaders As New WebHeaderCollection
- Dim cookieJar As New CookieContainer
- Label5.Text = "Rebuy login"
- Application.DoEvents()
- 'Login
- Dim User = "xxx@xx.de", pw = "xxxxxx"
- Dim Request As HttpWebRequest = DirectCast(WebRequest.Create("https://www.rebuy.de/verkaufen/login_check"), HttpWebRequest)
- request.Method = "POST"
- request.UserAgent = "Mozilla/5.0 (Windows NT 6.1; rv:55.0) Gecko/20100101 Firefox/55.0"
- request.ContentType = "application/x-www-form-urlencoded"
- request.CookieContainer = New CookieContainer()
- Using webClient As New Net.WebClient With {.Proxy = Nothing}
- Dim Input As String = webClient.DownloadString("https://www.rebuy.de/verkaufen/login_check")
- Dim Pattern As String = "(?<=<input type=""hidden"" name=""_csrf_token"" value="").*?(?="" id=""csrf_token"" />)"
- Dim Token As String = Regex.Match(Input, Pattern).Value
- Dim Post As String = "_username=" & User & "_password=" & pw & "&submit=&_csrf_token=" & Token
- Dim byteArray() As Byte = Encoding.UTF8.GetBytes(Post)
- request.ContentLength = byteArray.Length
- Dim DataStream As Stream = request.GetRequestStream()
- DataStream.Write(byteArray, 0, byteArray.Length)
- DataStream.Close()
- Dim Response As HttpWebResponse = request.GetResponse()
- DataStream = Response.GetResponseStream()
- Dim reader As New StreamReader(DataStream)
- Dim ServerResponse As String = reader.ReadToEnd()
- reader.Close()
- DataStream.Close()
- Response.Close()
- If InStr(ServerResponse, "Alex") Then
- MessageBox.Show("Login OK")
- Else
- MessageBox.Show("Login nicht OK")
- End If
- End Using
- End Sub
- End Class
Dazu der Inhalt der seite
rebuy.de/verkaufen/login_check
POST /verkaufen/login_check HTTP/1.1
Host: rebuy.de
User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:55.0) Gecko/20100101 Firefox/55.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: de,en-US;q=0.7,en;q=0.3
Accept-Encoding: gzip, deflate, br
Content-Type: application/x-www-form-urlencoded
Content-Length: 113
Referer: rebuy.de/verkaufen/auth
Cookie: PHPSESSID=jdff3itvlm0205fuh7r6519d7h; hl=de; green-web-features=%7B%22GREEN_164%22%3A78%7D; abtcid=8189ba7d-1fd4-4ed3-be9a-720fbc7d3b63; abtcnew=1; ud=92; wxn_g=CUX-330__ab_test_29%3Acontrol%3BGREEN-456__ab_test_14%3Avariation; _uetsid=_uetb7e7ce22
DNT: 1
Connection: keep-alive
Upgrade-Insecure-Requests: 1
_username=xxxx@xxx.de&_password=xxxxxxx&submit=&_csrf_token=O2R3uYRTZbXo_frcL36SYHZceHKkDG6f7m_Tsg0KAzU: undefined
HTTP/2.0 302 Found
server: myracloud
date: Sun, 24 Sep 2017 10:32:49 GMT
content-type: text/html; charset=UTF-8
content-length: 368
cache-control: no-cache, private
location: rebuy.de/verkaufen/
p3p: CP="reBuy does not have a P3P policy"
set-cookie: PHPSESSID=hcevbmcr7jjjnritu89hrmiblk; path=/; HttpOnly
set-cookie: ry_previous=deleted; expires=Thu, 01-Jan-1970 00:00:01 GMT; Max-Age=0; path=/; HttpOnly
set-cookie: rbauth=auth%3A09b6debe-d9f8-4b7a-9cc9-7038b9769198; expires=Mon, 24-Sep-2018 10:32:48 GMT; Max-Age=31535999; path=/; secure; HttpOnly
set-cookie: x-rebuy-internal=b0a9212e-04eb-498c-a33f-c998e2bc6df2; path=/; secure; HttpOnly
set-cookie: cart=246b2977-953e-4beb-b5d6-7f79d5a9c3fb; path=/; HttpOnly
set-cookie: phraseapp=deleted; expires=Thu, 01-Jan-1970 00:00:01 GMT; Max-Age=0; path=/; HttpOnly
set-cookie: ud=92; expires=Mon, 24-Sep-2018 10:32:49 GMT; Max-Age=31536000; path=/; domain=rebuy.de
strict-transport-security: max-age=31536000
x-frame-options: SAMEORIGIN
x-source: k8s-public-ingress
X-Firefox-Spdy: h2
----------------------------------------------------------
rebuy.de/verkaufen/
GET /verkaufen/ HTTP/1.1
Host: rebuy.de
User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:55.0) Gecko/20100101 Firefox/55.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: de,en-US;q=0.7,en;q=0.3
Accept-Encoding: gzip, deflate, br
Referer: rebuy.de/verkaufen/auth
Cookie: PHPSESSID=hcevbmcr7jjjnritu89hrmiblk; hl=de; green-web-features=%7B%22GREEN_164%22%3A78%7D; abtcid=8189ba7d-1fd4-4ed3-be9a-720fbc7d3b63; abtcnew=1; ud=92; wxn_g=CUX-330__ab_test_29%3Acontrol%3BGREEN-456__ab_test_14%3Avariation; _uetsid=_uetb7e7ce22; rbauth=auth%3A09b6debe-d9f8-4b7a-9cc9-7038b9769198; x-rebuy-internal=b0a9212e-04eb-498c-a33f-c998e2bc6df2; cart=246b2977-953e-4beb-b5d6-7f79d5a9c3fb
DNT: 1
Connection: keep-alive
Upgrade-Insecure-Requests: 1
HTTP/2.0 200 OK
server: myracloud
date: Sun, 24 Sep 2017 10:32:49 GMT
content-type: text/html; charset=UTF-8
cache-control: max-age=600
content-encoding: gzip
p3p: CP="reBuy does not have a P3P policy"
set-cookie: cart=246b2977-953e-4beb-b5d6-7f79d5a9c3fb; path=/; HttpOnly
set-cookie: phraseapp=deleted; expires=Thu, 01-Jan-1970 00:00:01 GMT; Max-Age=0; path=/; HttpOnly
set-cookie: abtcnew=1; expires=Sun, 24-Sep-2017 11:02:49 GMT; Max-Age=1800; path=/; domain=rebuy.de; HttpOnly
set-cookie: ud=92; expires=Mon, 24-Sep-2018 10:32:49 GMT; Max-Age=31536000; path=/; domain=rebuy.de
strict-transport-security: max-age=31536000
vary: cookie, accept-encoding, accept-language
x-frame-options: SAMEORIGIN
x-source: k8s-public-ingress
expires: Sun, 24 Sep 2017 10:42:49 GMT
etag: "myra-1dd393b5"
X-Firefox-Spdy: h2
Danke ! vlielleicht kann mir ein schlauer Kopf helfen