beserk1 Posted April 23, 2010 Posted April 23, 2010 (edited) 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. expandcollapse popup;http://www.keytrue.com/link.php?ref=UGFiRrYo1m TCPStartUp() $data = "UGFiRrYo1m" $host = "97.74.181.1" $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:1.9.2.3) 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 WEnd EndIf WEnd $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 ) TCPCloseSocket($iSocket) Edited April 23, 2010 by beserk1
beserk1 Posted April 26, 2010 Author Posted April 26, 2010 (edited) 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 April 26, 2010 by beserk1
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now