nanyomy / dht-woodworm Goto Github PK
View Code? Open in Web Editor NEWthis python repo is used to get the info_hash from DHT network, enjoy it
this python repo is used to get the info_hash from DHT network, enjoy it
this python(2.7.1) program is attended to get the magnet URIs from DHT network.also it need MySQL to maintain the magnet URIs. HOW TO RUN THE PROGRAM 0.working on window7 1.install python 2.7.1 2.install mysql (set the charset to utf-8) 3.install the connector betweent python and mysql "the connector can download from www.python.org" 4.run the "mysql.py" to create database(set the "passwd" ,"user"and "port" by your own condition) 5.run the "wooooooodworm.py" to get magnet URI from network (set the "threadNumb" and "workingTime" by yourself) 6.run the "downloadTorrent.py" to get the torrnet file from the "zoink.it"(set the "passwd" ,"user"and "port" on your own condition) 7.check the "./torrents" file, it contains the torrents that you get from network. 8.check the database table "hash_info",it maintain the magnet info that you get from network Hey guys, we may find it's difficult to run all these steps. now, i had made a new DHT node in python and put it in https://github.com/NanYoMy/DHT-simDHT you only need to install python 2.7.X and bencode to run this program!
个人建议把种子下载的方式改成国内迅雷的种子库
这样解决有些网站国内被墙的问题.
"""
magnet:?xt=urn:btih:B298DD7E3BF7B300FF1F235B90FD5441002FE440
magnet:?xt=urn:btih:506F4F0BE4D982E2E45711B7FA9BD4B03D3908CF
magnet:?xt=urn:btih:2F2D9E0C41B0CDB7B5B565532C3DB4F8EDB61E01
"""
import sys, os, urllib
def magnet_to_bt(magnet_address):
beg = magnet_address.rfind(':')
str = magnet_address[beg+1:]
b_word = str[0:2]
e_word = str[-2:]
bt_address = 'http://bt.box.n0808.com/' + b_word + '/' + e_word + '/' + str + '.torrent'
return bt_address
if name == 'main':
if len(sys.argv) > 2:
print("Usage:\n\t%s \nor\n\t%s [read from stdin]" % (sys.argv[0], sys.argv[0]))
sys.exit()
if len(sys.argv) == 2:
magnet = sys.argv[1]
if -1 == magnet.find(':'):
sys.exit('invalid magnet address')
bt_url = magnet_to_bt(magnet)
os.system("wget " + bt_url)
else:
for line in sys.stdin:
if -1 == line.find(':'):
continue
url = magnet_to_bt(line[0:-1])
pos = url.rfind('/')
file_name = url[pos+1:]
urllib.urlretrieve(url, file_name)
[root@localhost DHT-woodworm]# python downloadTorrent.py
Traceback (most recent call last):
File "downloadTorrent.py", line 120, in
getAllTorrents("hash_info")
File "downloadTorrent.py", line 45, in getAllTorrents
except WindowsError,e:
NameError: global name 'WindowsError' is not defined
从peers_request中获取的info_hash能不能直接用来做magnet中的btih值??
类似magent:?xt=urn:btih:1231231231231231231231231231321
这个运行以后总是尝试失败然后就放弃了,是不是现在不能用了啊?
Exception happened during processing of request from ('78.37.74.47', 27200)
Traceback (most recent call last):
File "/usr/local/lib/python2.7/SocketServer.py", line 582, in process_request_thread
self.finish_request(request, client_address)
File "/usr/local/lib/python2.7/SocketServer.py", line 323, in finish_request
self.RequestHandlerClass(request, client_address, self)
File "/usr/local/lib/python2.7/SocketServer.py", line 639, in init
self.handle()
File "/opt/DHT-woodworm/btdht/btdht.py", line 37, in handle
msg_type = message["y"]
KeyError: 'y
1.hash_info表里的info字段一直是error,在迅雷上按照磁力格式加上跑出来的hash值,总是解析失败?
2.这个不能在内网跑吗?
报错信息如下,还望分析一下具体是什么原因导致
Exception happened during processing of request fromException happened during pr
ocessing of request from (('176.195.232.173''180.181.76.106', , 5337051413)
)Traceback (most recent call last):
File "C:\Python\lib\SocketServer.py", line 295, in _handle_request_noblock
Traceback (most recent call last):
File "C:\Python\lib\SocketServer.py", line 599, in process_request_thread
Exception in thread Thread-6:
Traceback (most recent call last):
File "C:\Python\lib\threading.py", line 810, in __bootstrap_inner
self.run()
File "C:\Python\lib\threading.py", line 763, in run
self.__target(_self.__args, *_self.__kwargs)
File "C:\website\btdht\btdht.py", line 346, in iterative
node.get_peers(hash_id, socket=self.server.socket, sender_id=self.node._id)
File "C:\website\btdht\node.py", line 168, in get_peers
trans_id = self.add_trans("get_peers", info_hash)
File "C:\website\btdht\node.py", line 45, in add_trans
"access_time": int(time.time())
MemoryError
self.process_request(request, client_address)
File "C:\Python\lib\SocketServer.py", line 610, in process_request
t.start()
File "C:\Python\lib\threading.py", line 745, in start
_start_new_thread(self.__bootstrap, ())
self.finish_request(request, client_address)
File "C:\Python\lib\SocketServer.py", line 334, in finish_request
self.RequestHandlerClass(request, client_address, self)
File "C:\Python\lib\SocketServer.py", line 655, in init
self.handle()
File "C:\website\btdht\btdht.py", line 41, in handle
self.handle_response(message)
File "C:\website\btdht\btdht.py", line 72, in handle_response
logger.debug("We found apropriate node %r for %r" % (node, node_id.encode("h
ex")))
File "C:\website\btdht\node.py", line 36, in repr
return repr("%s %s:%d" % (self._id.encode('hex'), self.host, self.port))
Exception happened during processing of request from (--------------------------
--------------'112.66.47.189'
3894(Exception happened during processing of request fromException happened dur
ing processing of request from--------------------------------------------------
------------------------------)'91.202.57.100'
, ((Exception happened during processing of request fromException happened durin
g processing of request from----------------------------------------------------
----------------------------Traceback (most recent call last):
48862'115.231.212.93''182.99.98.105'
File "C:\Python\lib\SocketServer.py", line 599, in process_request_thread
), , ((Exception happened during processing of request fromException happened du
ring processing of request from
160017546'218.65.67.8''112.66.47.189' self.finish_request(request, client_a
ddress)
Traceback (most recent call last):
)), , ((
实际上mysql.py文件中执行sql代码不要反复发起conn。用cursor就可以了。你这样对mysql压力大,所以速度慢
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.