Author Topic: Advanced - Problems determining Failed= and Failed2= - Passthepopcorn.org  (Read 12855 times)

Offline chip!

  • Bad Ass
  • Administrator
  • Unstoppable
  • *****
  • Posts: 2301
  • Karma: +629/-6
    • View Profile
First off, failed= is used to determine if a bad user/password was being used.. and failed2= is used to determine if the stored authentication cookies have expired, and bit che needs to "re-login".

Now..

For the site, passthepopcorn.org, we must rely heavily on the winsock log to determine what to set for failed= and failed2=.
For information on who to enable these logs in Bit Che, please see: http://convivea.com/forums/index.php?topic=1465.msg14093


After investigation, it seems that this site does not return HTML as you would expect for a "valid login". For example, when sending a correct login and password:

Code: [Select]

Sent:
POST http://passthepopcorn.org/login.php HTTP/1.0
Accept: text/xml, application/xml, application/xhtml+xml, text/html, image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/x-shockwave-flash, */*
Referer: http://passthepopcorn.org/login.php
Accept-Language: en-us
Content-Type: application/x-www-form-urlencoded
Connection: Close
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.8.1) Gecko/20061010 Firefox/2.0
Host: passthepopcorn.org
Content-Length: 46
Pragma: no-cache

username=BitCheUser&password=correctpassword&keeplogged=0


Received:
HTTP/1.1 302 Moved Temporarily
Server: nginx/0.6.36
Date: Wed, 20 May 2009 06:39:21 GMT
Content-Type: text/html; charset=.utf-8?
Connection: close
X-Powered-By: PHP/5.2.9
Set-Cookie: PHPSESSID=bdbomq3olaru0d7o7p6hrirtg7; path=/
Location: index.php
Cache-Control: no-cache, must-revalidate, post-check=0, pre-check=0
Pragma:
Expires: Wed, 20 May 2009 08:39:21 GMT
Last-Modified: Wed, 20 May 2009 06:39:21 GMT

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<!--bdbomq3olaru0d7o7p6hrirtg7--><head>
<title>Login :: PassThePopcorn.org</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="shortcut icon" href="favicon.ico" />
<link rel="search" type="application/opensearchdescription+xml" title="PassThePopcorn.org - Torrents" href="/opensearch_torrents.xml" />
<link rel="search" type="application/opensearchdescription+xml" title="PassThePopcorn.org - Requests" href="/opensearch_requests.xml" />
<link rel="search" type="application/opensearchdescription+xml" title="PassThePopcorn.org - Forums" href="/opensearch_forums.xml" />
<link rel="search" type="application/opensearchdescription+xml" title="

....ETC....

<script type="text/javascript" language="javascript">
//<![CDATA[
function formVal() {
clearErrors('loginform');
if (!$('username').value.match(/^[a-z0-9_?]+$/i)) { return showError('username','You did not enter a valid username.'); }
if ($('password').value=="" || $('password').value.length>40 || $('password').value.length<6) { return showError('password','You entered an invalid password.'); }
}
//]]>
</script>
<form name="loginform" id="loginform" method="post" action="login.php" onsubmit="return formVal();">
<!--You have <font color="green"><strong>3</strong></font> attempts remaining.<br>
<strong>WARNING:</strong> You will be banned for 6 hours after your login attempts run out.<br>-->
<table cellpadding="2" cellspacing="0" border="0" align="center">
<tr valign="top">
<td colspan="1" align="right">Username&nbsp;</td>
<td colspan="1" align="left"><input width="12" type="text" name="username" id="username" class="inputtext" /></td>
</tr>
<tr valign="top">
<td colspan="1" align="right">Password&nbsp;</td>
<td colspan="1" align="left"><input width="12" type="password" name="password" id="password" class="inputtext" /></td>
</tr>

...ETC...


These 2 lines indicate that the login attempt was successful, and instructs the web browser to move on to the /index.php page:
Set-Cookie: PHPSESSID=bdbo3olaru0d7o7tg7; path=/
Location: index.php


The problem here is that the site ALSO sends the same exact HTML code in that response that it does for a non-logged in user, complete with the HTML code for the login form. (i have cut it off above to save space here, but you will see the full HTML in your winsock log).

So.. with that in mind, we can NOT use standard failed= and failed2= tags to look for, such as

failed=form name="loginform" id="loginform" method="post" action="login.php"
or failed= You entered an invalid password

because those strings are going to be present in the full HTML packet response even when a successful login has happened.



so to set Failed=, i send bogus login/pass to the site:

Code: [Select]
Sent:
POST http://passthepopcorn.org/login.php HTTP/1.0
Accept: text/xml, application/xml, application/xhtml+xml, text/html, image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/x-shockwave-flash, */*
Referer: http://passthepopcorn.org/login.php
Accept-Language: en-us
Content-Type: application/x-www-form-urlencoded
Connection: Close
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.8.1) Gecko/20061010 Firefox/2.0
Host: passthepopcorn.org
Content-Length: 48
Pragma: no-cache

username=BitCheUser&password=BADPASSWORD&keeplogged=0

Received:
HTTP/1.1 200 OK
Server: nginx/0.6.36
Date: Wed, 20 May 2009 06:37:32 GMT
Content-Type: text/html; charset=.utf-8?
Connection: close
X-Powered-By: PHP/5.2.9
Set-Cookie: PHPSESSID=gl3g844udibc9juhoc84u2h6v6; path=/
Set-Cookie: keeplogged=deleted; expires=Tue, 20-May-2008 06:37:31 GMT; path=/; domain=.passthepopcorn.org
Cache-Control: no-cache, must-revalidate, post-check=0, pre-check=0
Pragma:
Expires: Wed, 20 May 2009 08:37:32 GMT
Last-Modified: Wed, 20 May 2009 06:37:32 GMT

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Login :: PassThePopcorn.org</title>
<meta http-equiv="Pragma" content="no-cache" />
<meta http-equiv="Expires" content="-1" />
...ETC...

since the full HTML is sent with that as well, we have to ignore it (because if the HTML is the same for different states, then its impossible to distinguish what state we are in)..

but, concentrating on the HTML header response, I notice that this line seems to be unique.. meaning, i dont see it with other HTML requests, and I only see it when i have sent a bad username/password request (above), so it looks like we can use this as our failed=... letting Bit Che know that we just entered a wrong password:

Set-Cookie: keeplogged=deleted; expires=Tue, 20-May-2008 06:37:31 GMT; path=/; domain=.passthepopcorn.org

from this line:
failed=keeplogged=deleted;

because its the shortest unique and not changing string..


Next... we need to find failed2= to determine when our cookies have expired, and Bit Che needs to attempt to re-login.


So, if possible, login correctly with Bit Che. But if thats not possible because your script isnt working quite yet, then just edit settings.ini directly, under the site name, and put in something like "cookie=anythingboguscookie=temp;" so that a cookie is stored (thus Bit Che thinks it has logged in successfully... cookies are only stored if the login was successful).

settings.ini example:

[PassThePopcorn]
profile_0_enabled=1
user=BitCheUser
password=6AS46BEMREF
profile_0=http://passthepopcorn.org/torrents.php?order_by=s1&order_way=DESC&disablegrouping=1&searchstr=%SEARCH%&filter_cat%5B1%5D=1
cookie=PHPSESSID=AHBABBEDBABDEBABABES;

if you were able to login correctly with Bit Che, then just quickly edit settings.ini and change your cookie= to anything else.

Now that Bit Che has an invalid cookie to use, we can launch HTTP search request, and the response will simulate what we should expect to see if our cookies had expired:

Quote
Sent:
GET http://passthepopcorn.org/torrents.php?order_by=s1&order_way=DESC&disablegrouping=1&searchstr=2009&filter_cat%5B1%5D=1 HTTP/1.0
Accept: text/xml, application/xml, application/xhtml+xml, text/html, image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/x-shockwave-flash, */*
Accept-Language: en-us
Referer: http://passthepopcorn.org/torrents.php?order_by=s1&order_way=DESC&disablegrouping=1&searchstr=2009&filter_cat%5B1%5D=1
Connection: Close
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.8.1) Gecko/20061010 Firefox/2.0
Cookie: PHPSESSID=AHBABBEDBABDEBABABES;
Host: passthepopcorn.org

Received:
HTTP/1.1 302 Moved Temporarily
Server: nginx/0.6.36
Date: Wed, 20 May 2009 07:01:12 GMT
Content-Type: text/html; charset=.utf-8?
Connection: close
X-Powered-By: PHP/5.2.9
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma: no-cache
Location: login.php


From this, we have very little to work with.. but it seems that the line: "Location: login.php" is unique to this situation, expired cookie & needs to re-login.

So, failed2= should be this line:

failed2=Location: login.php



After updating the script to use both failed= and failed2=, it seems to be working... if Bit Che's cookie expires, it seems to properly re-login and then resume the search.


alright, this is just a quick, sorta advanced tutorial, on how to attempt to properly set failed and failed2 for a difficult site to work with.. ;)

feel free to ask questions.

« Last Edit: May 19, 2009, 06:06:50 pm by chip! »
  -  https://convivea.com  -   And...  boom goes the dynamite.

Offline Topy44

  • Newbie
  • *
  • Posts: 1
  • Karma: +0/-0
    • View Profile
Thanks a lot, solves my questions  ;D

Offline CuF

  • Sr. Member
  • ****
  • Posts: 331
  • Karma: +40/-0
    • View Profile
Good and useful information.  Probably should be part of script documentation.
Perhaps making it a sticky?

Offline Groverolen

  • Newbie
  • *
  • Posts: 1
  • Karma: +0/-0
    • View Profile
Problems determining failed, Now what is our next step? Could you please help me to get problems and also give me myjdw app way to find solution. But this time do something serious and not waste time.
« Last Edit: April 13, 2022, 04:23:04 am by Groverolen »

Offline nyloky

  • Newbie
  • *
  • Posts: 1
  • Karma: +0/-0
    • View Profile
They are additionally tracking down that a few medications used to treat Alzheimer's may
wet brain  help improve a portion of the memory harm, however contemplates worried that are as yet in progress.