Jump to content


Recommended Posts

I have a script here that is suppose to download a torrent files from a site using TCPSend to request and TCPRecv to get the files.

The files I got from the script is different from the ones I got from the browser.

The difference are not huge, but if you use a comparison tool (WinDiff) you can see sometimes is missing a char here and there. I tried changing the maxlen parameter of TCPRecv, but anything other than 1 will give me a much bigger different in the data received.


$data = "UGFiRrYo1m"
$host = ""
$time = TimerInit()

$sPost = "-----------------------------" & $time & @CRLF
$sPost &= "Content-Disposition: form-data; name=""ref""" & @CRLF & @CRLF
$sPost &= $data & @CRLF
$sPost &= "-----------------------------" & $time & "--" & @CRLF

$sPacket = "POST /download.php HTTP/1.1" & @CRLF
$sPacket &= "Host: www.keytrue.com" & @CRLF
$sPacket &= "User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv: Gecko/20100403 Firefox/3.6.3 (Palemoon/3.6.3) (.NET CLR 3.5.30729)" & @CRLF
$sPacket &= "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8" & @CRLF
$sPacket &= "Accept-Language: en-us,en;q=0.5" & @CRLF
$sPacket &= "Accept-Encoding: gzip,deflate" & @CRLF
$sPacket &= "Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7" & @CRLF
$sPacket &= "Keep-Alive: 115" & @CRLF
$sPacket &= "Connection: keep-alive" & @CRLF
$sPacket &= "Referer: http://www.keytrue.com/link.php?ref=" & $data & @CRLF
$sPacket &= "Content-Type: multipart/form-data; boundary=---------------------------" & $time & @CRLF
$sPacket &= "Content-Length: " & StringLen($sPost) & @CRLF & @CRLF & $sPost

$iSocket = TCPConnect($host, 80 )
$iSend = TCPSend($iSocket, $sPacket)
While 1
    $sRecv = TCPRecv($iSocket, 1)
    If $sRecv <> '' Then
        While 1
            $sRecv &= TCPRecv($iSocket, 1)
            If @error Then ExitLoop 2

$sName = "UGFiRrYo1m.org_3.0_for_Windows.4454006.TPB.torrent"
$sData = StringTrimLeft ( $sRecv, StringInStr ( $sRecv, "b3d1") + StringLen ( "b3d1" ) )

$fTemp = FileOpen ( $sName,2 )
FileWrite ( $fTemp, $sData )
FileClose ( $fTemp )
Edited by beserk1
Link to comment
Share on other sites

anyone? I am stuck on this last part of my whole script, everything else checks out, just this part is not working for some reason

edit: ok have another look at the different between the 2 files, it seem when TCPrecv get the char (.) it turns it into (0x00), is there a reason for why it is doing that? I am not sure if the (.) is the period or something else.

edit: I think is the problem with the NULL char that is being pass through tcprecv, instead of the proper char, it being passed as 0x00

Edited by beserk1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...