Hi guys, I know C# well and now I want to try to create a bot for ikariam. What I need to learn for making the bot?
Cheers,
Tinwor
Cheers,
Tinwor
Or just HttpWebRequests, because it's a browsergame and I think it's without any real client, except the browser itself.Quote:
Which has nothing todo with a packetbot :P
Reverse the Client, rebuild encryption and authentication
Gather and analyse packets.
Rebuild the Client.
try cookiecontainer...if you dont save the cookies the server will think you are not logged inQuote:
Ok thanks. I have this problem now, i use the httpwebrequest but after one request the server close the connection. I try to set keepalive=true but nothing, someone can help me?
public string get(string uri)
{
HttpWebRequest webRequest = (HttpWebRequest)WebRequest.Create(uri);
webRequest.ContentType = "application/x-www-form-urlencoded";
webRequest.Method = "GET";
webRequest.UserAgent = "Mozilla/5.0 (Windows NT 5.0; rv:5.0) Gecko/20100101 Firefox/5.0";
try
{
WebResponse webResponse = webRequest.GetResponse();
if (webResponse == null)
return null;
StreamReader sr = new StreamReader(webResponse.GetResponseStream());
return sr.ReadToEnd().Trim();
}
catch (WebException ex)
{
HttpWebResponse response = (HttpWebResponse)ex.Response;
StreamReader sr = new StreamReader(response.GetResponseStream());
HTTPRequests.requests++;
return sr.ReadToEnd().Trim();
}
catch (Exception)
{
throw;
}
}
public string post(string uri, string parameters)
{
HttpWebRequest webRequest = (HttpWebRequest)WebRequest.Create(uri);
webRequest.ContentType = "application/x-www-form-urlencoded";
webRequest.Method = "POST";
webRequest.UserAgent = "Mozilla/5.0 (Windows NT 5.0; rv:5.0) Gecko/20100101 Firefox/5.0";
byte[] bytes = Encoding.ASCII.GetBytes(parameters);
Stream sendstream = null;
try
{
webRequest.ContentLength = bytes.Length;
sendstream = webRequest.GetRequestStream();
sendstream.Write(bytes, 0, bytes.Length);
sendstream.Close();
}
catch (Exception)
{
throw;
}
try
{
WebResponse webResponse = webRequest.GetResponse();
if (webResponse == null)
return null;
StreamReader sr = new StreamReader(webResponse.GetResponseStream());
return sr.ReadToEnd().Trim();
}
catch (WebException ex)
{
HttpWebResponse response = (HttpWebResponse)ex.Response;
StreamReader sr = new StreamReader(response.GetResponseStream());
HTTPRequests.requests++;
return sr.ReadToEnd().Trim();
}
catch (Exception)
{
throw;
}
}
private CookieContainer CookieContainer;
webRequest.CookieContainer = CookieContainer;