Jump to content

Search the Community

Showing results for tags 'bencode'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • General
    • Announcements and Site News
    • Administration
  • AutoIt v3
    • AutoIt Help and Support
    • AutoIt Technical Discussion
    • AutoIt Example Scripts
  • Scripting and Development
    • Developer General Discussion
    • Language Specific Discussion
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Categories

  • AutoIt Team
    • Beta
    • MVP
  • AutoIt
    • Automation
    • Databases and web connections
    • Data compression
    • Encryption and hash
    • Games
    • GUI Additions
    • Hardware
    • Information gathering
    • Internet protocol suite
    • Maths
    • Media
    • PDF
    • Security
    • Social Media and other Website API
    • Windows
  • Scripting and Development
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Member Title


Location


WWW


Interests

Found 1 result

  1. I've been working on a huge project. Its a torrent downloader. I can't show the source or anything, sorry guies, that would be frowned upon by the Autoit forum moderators. I won't post a link either but it will be posted on google code in the near future so you can always search for it. I believe that any euthastic torrent downloader will absolutely love it. I would like to have a function to decode bencode torrent files. I've done the research. I need help writing this function. I thank you all in advance and really appreciate any help I recieve from these forums. Features to implement once I can decode bencoded files: (1) Generate magnet links from torrent files. (2) List files inside torrent files. (3) Conviently parse tracker response data for checking torrent trackers for torrent information before adding them to the generated magnet link and passing it to the client which actually downloads the torrent. Spec - Wiki Theory Bittorrent Spec - Bencode - At the bottom of this page there are links to implementations in other languages. Info - Wikipedia - Bencode Bencode Editor - https://sites.google.com/site/ultimasites/bencode-editor - This is allegedly written in Autoit. Though I cannot find the source. I completely rewrote the functions as one function. Its works well but is not exactly what I need. now that I can extract the information I need to associate each type appropiately. For Example: Strings =&gt; Integers Lists =&gt; Strings Dictionaries =&gt; Strings Seeds => 1 Peers => 5 Tracker List => Tracker|Tracker|Tracker This is complicated because lists can be in lists in dictionaries inside of dictionaries or other lists. #include <array.au3> $Timer = TimerInit() Example(@ScriptDir & 'ubuntu-12.04-desktop-i386.iso.torrent') ConsoleWrite(@CRLF & @CRLF & "Time: " & Round(TimerDiff($Timer)/1000, 1) & " second(s)" & @CRLF) Func Example($sFilePath) Local $Bencode = FileRead($sFilePath) Local $aData = _Decode_Bencode($Bencode) _ArrayDisplay($aData) EndFunc Func _Decode_Bencode($sBencoded_Data) Local $iIndex = 0, $sDecoded_Data, $iEndIndex, $iDecoded_Integer, $iDecoded_Dim_0 = 0, $iDecoded_Dim_1 = 0, $iDecoded_Indent = 0 Local $aDecoded_Array[20][20] If Not IsString($sBencoded_Data) Then Return SetError(1, 0, 0) EndIf Local $aBencoded_Data = StringSplit($sBencoded_Data, '', 2) While $iIndex <> UBound($aBencoded_Data, 1) - 1 Switch $aBencoded_Data[$iIndex] Case "e" $iIndex += 1 $iDecoded_Dim_0 += 1 If $iDecoded_Indent <> 0 Then $iDecoded_Indent -= 1 $iDecoded_Dim_1 = $iDecoded_Indent ContinueLoop Case "l" $iIndex += 1 $iDecoded_Dim_1 = $iDecoded_Indent $iDecoded_Dim_0 += 1 $iDecoded_Indent += 1 ContinueLoop Case "d" $iIndex += 1 $iDecoded_Dim_1 = $iDecoded_Indent $iDecoded_Dim_0 += 1 $iDecoded_Indent += 1 ContinueLoop Case "i" $iEndIndex = _ArraySearch($aBencoded_Data, "e", $iIndex, 0, 1) $sDecoded_Data = "" For $i = $iIndex + 1 To $iEndIndex - 1 Step 1 $sDecoded_Data &= $aBencoded_Data[$i] $aBencoded_Data[$i] = "" Next $aDecoded_Array[$iDecoded_Dim_0][$iDecoded_Dim_1] = $sDecoded_Data $iIndex = $iEndIndex - 1 $iDecoded_Dim_1 += 1 Case 0 To 9 $iDecoded_Integer = "" $iEndIndex = _ArraySearch($aBencoded_Data, ":", $iIndex) For $i = $iIndex To $iEndIndex - 1 Step 1 $iDecoded_Integer &= $aBencoded_Data[$i] $aBencoded_Data[$i] = "" Next $sDecoded_Data = "" For $i = $iEndIndex + 1 To $iEndIndex + $iDecoded_Integer Step 1 $sDecoded_Data &= $aBencoded_Data[$i] $aBencoded_Data[$i] = "" Next $aDecoded_Array[$iDecoded_Dim_0][$iDecoded_Dim_1] = $sDecoded_Data $iIndex = $iEndIndex + $iDecoded_Integer $iDecoded_Dim_1 += 1 EndSwitch $iIndex += 1 WEnd Return $aDecoded_Array EndFunc *Edited: Original vbscript - http://demon.tw/my-work/vbs-bencode.html Bencoded Torrent File: ubuntu-12.04-desktop-i386.iso.torrent Thanks in advance!
×
×
  • Create New...