|
You last visited: Today at 06:46
Advertisement
Help NPP Cookie
Discussion on Help NPP Cookie within the WarRock forum part of the Shooter category.
04/28/2014, 18:34
|
#1
|
elite*gold: 26
Join Date: Nov 2013
Posts: 410
Received Thanks: 249
|
Help NPP Cookie
After few month i return back...I see which nexon change server structure and use SSL for authentication on web site.
This is my old code which i use for get NPP Cookie but now don't work i think for SSL encryption.
Code:
string cookieval = string.Empty;
string s = "{\"account\":{\"userId\":\"" + HttpUtility.UrlEncode(username) + "\",\"password\":\"" + HttpUtility.UrlEncode(password) + "\",\"accessedGame\":\"Warrock\",\"captcha\":\"\",\"isSaveID\":false}}";
CookieContainer webCookieContainer = new CookieContainer();
HttpWebRequest webRequest = (HttpWebRequest)HttpWebRequest.Create(new Uri("https://passport.nexoneu.com/Service/....."));
webRequest.CookieContainer = webCookieContainer;
webRequest.KeepAlive = true;
webRequest.Method = "POST";
webRequest.ContentType = "application/json;";
webRequest.UserAgent = "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/34.0.1847.116 Safari/537.36";
webRequest.Timeout = 20000;
webRequest.ContentLength = s.Length;
webRequest.Proxy = null;
using (Stream wr = webRequest.GetRequestStream())
{
byte[] stringa = Encoding.ASCII.GetBytes(s);
wr.Write(stringa, 0, stringa.Length);
wr.Close();
}
HttpWebResponse webResponse = (HttpWebResponse)webRequest.GetResponse();
using (StreamReader read = new StreamReader(webResponse.GetResponseStream()))
{
string content = read.ReadToEnd();
MessageBox.Show(content);
}
When i send data i riceve this response:
There is one can help me to try to resolve this first problem?Thanks.
|
|
|
04/28/2014, 19:09
|
#2
|
elite*gold: 0
Join Date: Jan 2012
Posts: 391
Received Thanks: 107
|
maybe you can sniff the new packet and change it in your source
|
|
|
04/28/2014, 19:24
|
#3
|
elite*gold: 26
Join Date: Nov 2013
Posts: 410
Received Thanks: 249
|
packet data send is the same...:S
|
|
|
04/28/2014, 19:36
|
#4
|
elite*gold: 0
Join Date: Jul 2013
Posts: 274
Received Thanks: 186
|
Even though you are a "CLB coder!", you should just turn on Fiddler or Wireshark and check whats going on..
|
|
|
04/28/2014, 19:43
|
#5
|
elite*gold: 26
Join Date: Nov 2013
Posts: 410
Received Thanks: 249
|
lol?
I open this topic because i already sniff with Fiddler and Wireshark...
|
|
|
04/28/2014, 19:43
|
#6
|
elite*gold: 20
Join Date: Mar 2014
Posts: 50
Received Thanks: 31
|
ez u have to read before normal cookies
|
|
|
04/28/2014, 19:55
|
#7
|
elite*gold: 26
Join Date: Nov 2013
Posts: 410
Received Thanks: 249
|
Don't work
|
|
|
04/28/2014, 20:07
|
#8
|
elite*gold: 0
Join Date: Jul 2013
Posts: 274
Received Thanks: 186
|
Quote:
Originally Posted by Alliance™
lol?
I open this topic because i already sniff with Fiddler and Wireshark...
|
So what is your issue? You see whats going on so implement it.
|
|
|
04/28/2014, 20:12
|
#9
|
elite*gold: 26
Join Date: Nov 2013
Posts: 410
Received Thanks: 249
|
My issue is this:
I read the normal cookie first and after send data but dont work...
|
|
|
04/28/2014, 20:13
|
#10
|
elite*gold: 20
Join Date: Mar 2014
Posts: 50
Received Thanks: 31
|
1) WebRequest on Nexon main webpage, store cookie in the container
2) WebRequest login on  with JSON post data
3) Get your NPP
|
|
|
04/28/2014, 20:28
|
#11
|
elite*gold: 26
Join Date: Nov 2013
Posts: 410
Received Thanks: 249
|
i alredy use this method but i dont know why not work
|
|
|
04/28/2014, 22:30
|
#12
|
elite*gold: 26
Join Date: Dec 2010
Posts: 4,343
Received Thanks: 2,395
|
Code:
Public Shared Function loginToWebserver(ByVal Username As String, ByVal Password As String) As String
Dim str_npp As String = String.Empty
Dim con_cookieContainer As New CookieContainer
Dim httpWebRequest As HttpWebRequest = DirectCast(WebRequest.Create("https://passport.nexoneu.com/login/?nexoneuTheme=Warrock"), HttpWebRequest)
httpWebRequest.KeepAlive = True
httpWebRequest.Accept = "application/json, text/javascript, */*; q=0.01"
httpWebRequest.UserAgent = "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/28.0.1500.95 Safari/537.36"
httpWebRequest.CookieContainer = con_cookieContainer
Dim response0 As HttpWebResponse = DirectCast(httpWebRequest.GetResponse(), HttpWebResponse)
Dim Request As HttpWebRequest = CType(WebRequest.Create("https://passport.nexoneu.com/Service/Authentication.asmx/Login"), HttpWebRequest)
Request.Method = "POST"
Request.ContentType = "application/json; charset=UTF-8"
Request.Referer = "https://passport.nexoneu.com/login/?nexoneuTheme=Warrock"
Request.CookieContainer = con_cookieContainer
Request.Accept = "application/json, text/javascript, */*; q=0.01"
Request.UserAgent = "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/28.0.1500.95 Safari/537.36"
Dim Post As String = "{" + Chr(34) + "account" + Chr(34) + ":{" + Chr(34) + "userId" + Chr(34) + ":" + Chr(34) + Username + Chr(34) + "," + Chr(34) + "password" + Chr(34) + ":" + Chr(34) + Password + Chr(34) + "," + Chr(34) + "accessedGame" + Chr(34) + ":" + Chr(34) + "Warrock" + Chr(34) + "," + Chr(34) + "captcha" + Chr(34) + ":" + Chr(34) + Chr(34) + "," + Chr(34) + "isSaveID" + Chr(34) + ":false}}"
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 Response1 As HttpWebResponse = CType(Request.GetResponse(), HttpWebResponse)
DataStream = Response1.GetResponseStream()
Dim reader As New StreamReader(DataStream)
reader.Close()
DataStream.Close()
Response1.Close()
For Each CookieFromServer In con_cookieContainer.GetCookies(Request.RequestUri)
If CookieFromServer.ToString.Contains("NPP=NP12") Then
Dim NPP As String() = Split(CookieFromServer.ToString, "=")
str_npp = NPP(1)
Exit For
End If
Next
If str_npp <> String.Empty Then
Return str_npp
Else
Return String.Empty
End If
End Function
|
|
|
04/30/2014, 17:17
|
#13
|
elite*gold: 20
Join Date: Mar 2014
Posts: 50
Received Thanks: 31
|
Quote:
Originally Posted by hero9910
Code:
Public Shared Function loginToWebserver(ByVal Username As String, ByVal Password As String) As String
Dim str_npp As String = String.Empty
Dim con_cookieContainer As New CookieContainer
Dim httpWebRequest As HttpWebRequest = DirectCast(WebRequest.Create("https://passport.nexoneu.com/login/?nexoneuTheme=Warrock"), HttpWebRequest)
httpWebRequest.KeepAlive = True
httpWebRequest.Accept = "application/json, text/javascript, */*; q=0.01"
httpWebRequest.UserAgent = "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/28.0.1500.95 Safari/537.36"
httpWebRequest.CookieContainer = con_cookieContainer
Dim response0 As HttpWebResponse = DirectCast(httpWebRequest.GetResponse(), HttpWebResponse)
Dim Request As HttpWebRequest = CType(WebRequest.Create("https://passport.nexoneu.com/Service/Authentication.asmx/Login"), HttpWebRequest)
Request.Method = "POST"
Request.ContentType = "application/json; charset=UTF-8"
Request.Referer = "https://passport.nexoneu.com/login/?nexoneuTheme=Warrock"
Request.CookieContainer = con_cookieContainer
Request.Accept = "application/json, text/javascript, */*; q=0.01"
Request.UserAgent = "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/28.0.1500.95 Safari/537.36"
Dim Post As String = "{" + Chr(34) + "account" + Chr(34) + ":{" + Chr(34) + "userId" + Chr(34) + ":" + Chr(34) + Username + Chr(34) + "," + Chr(34) + "password" + Chr(34) + ":" + Chr(34) + Password + Chr(34) + "," + Chr(34) + "accessedGame" + Chr(34) + ":" + Chr(34) + "Warrock" + Chr(34) + "," + Chr(34) + "captcha" + Chr(34) + ":" + Chr(34) + Chr(34) + "," + Chr(34) + "isSaveID" + Chr(34) + ":false}}"
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 Response1 As HttpWebResponse = CType(Request.GetResponse(), HttpWebResponse)
DataStream = Response1.GetResponseStream()
Dim reader As New StreamReader(DataStream)
reader.Close()
DataStream.Close()
Response1.Close()
For Each CookieFromServer In con_cookieContainer.GetCookies(Request.RequestUri)
If CookieFromServer.ToString.Contains("NPP=NP12") Then
Dim NPP As String() = Split(CookieFromServer.ToString, "=")
str_npp = NPP(1)
Exit For
End If
Next
If str_npp <> String.Empty Then
Return str_npp
Else
Return String.Empty
End If
End Function
|
For Each CookieFromServer In con_cookieContainer.GetCookies(Request.RequestUri)
If CookieFromServer.ToString.Contains("NPP=NP12") Then
Dim NPP As String() = Split(CookieFromServer.ToString, "=")
str_npp = NPP(1)
Exit For
End If
Next
 ...
|
|
|
04/30/2014, 18:18
|
#14
|
elite*gold: 26
Join Date: Dec 2010
Posts: 4,343
Received Thanks: 2,395
|
Quote:
Originally Posted by -ToXiiC
For Each CookieFromServer In con_cookieContainer.GetCookies(Request.RequestUri)
If CookieFromServer.ToString.Contains("NPP=NP12") Then
Dim NPP As String() = Split(CookieFromServer.ToString, "=")
str_npp = NPP(1)
Exit For
End If
Next
 ...
|
What's your problem?
Ok, the split-function is a bit "out of date" but it still working & I know this function from vba.
I can also use the "new" split function.
|
|
|
04/30/2014, 19:37
|
#15
|
elite*gold: 20
Join Date: Mar 2014
Posts: 50
Received Thanks: 31
|
foreach(Cookie cookie in request.CookieContainer.GetCookies("url"))
{
if(cookie.Name == "NPP")
{
this.NPP = cookie.Value;
break;
}
}
|
|
|
Similar Threads
|
PHP Cookie
10/09/2012 - Web Development - 5 Replies
Servus,
ich hab mal vor längerer Zeit eine Klasse für Cookies geschrieben.
Wollte es grad testen, funktioniert aber nur bedingt.
Unter Firefox wird das Cookie normal gesetzt, unter Chrome jedoch nicht.
Dies funktioniert jedoch einwandfrei:
setcookie ("test", "value");
|
Cookie Fix
06/28/2012 - DarkOrbit - 1 Replies
So all you have to do is use Google Chrome. And use incognito mode. What this does is
No save cookies? No bad
|
All times are GMT +1. The time now is 06:48.
|
|