How to pull the torrent file from DHT? - bittorrent

I wrote a simple script that finds out example peer IPs for a given info_hash. I can't see this kind of information in BEP-0005: how do I actually pull the torrent file from the DHT?

The DHT does not serve torrents. It simply provides peer lists for individual infohashes. Torrent files, or rather the immutable info dictionary, are provided by the bittorrent swarms themselves.
You will have to partially implement BEP3, BEP10 and finally BEP9 to perform the metadata exchange. Additionally implementing BEP29 and BEP11 may provide improved connectivity, which can be useful when retrieving metadata on small swarms
Secondly, consuming resources of the DHT without providing any, or repeatedly hammering nodes with requests - especially the bootstrap node - is considered bad-mannered. If you intend to obtain a large number of torrent files you should run a DHT node as daemon e.g. via Juliusz Chroboczek's dht lib (C) or mine (java). My implementation also contains a metadata retrieval service. libtorrent should also provide all the necessary parts to achieve the same.

Here's a base64-encoded .pcap file that shows the full communication in practice (note the last data packet). Decoding it and opening in Wireshark will show you the full process - combined with BEPs listed in the8472's answer, this could serve as an example.
Cg0NCnQAAABNPCsaAQAAAP//////////AwAbAExpbnV4IDQuNy43LTEwMC5mYzIzLng4Nl82NAAEAC
0ARHVtcGNhcCAxLjEyLjIgKEdpdCBSZXYgVW5rbm93biBmcm9tIHVua25vd24pAAAAAAAAAHQAAAAB
AAAASAAAAHEAAAAAAAQAAgADAGFueQAJAAEABgAAAAwAGwBMaW51eCA0LjcuNy0xMDAuZmMyMy54OD
ZfNjQAAAAAAEgAAAAGAAAAbAAAAAAAAABePwUAEVBWkkwAAABMAAAAAAQAAQAGvF/0eXJ3AAAIAEUI
ADwSdEAAQAYV/QoFtU4FT02hviznAcLkEQgAAAAAoAJyEEblAAACBAW0BAIICgAwA3wAAAAAAQMDB2
wAAAAGAAAAbAAAAAAAAABePwUAS9dWkkwAAABMAAAAAAAAAQAGAAFcmVhFAAAIAEXIADwAAEAANgYx
sQVPTaEKBbVO5wG+LJHhxT3C5BEJoBKpsBhCAAACBAW0BAIICowrE6cAMAN8AQMDB2wAAAAGAAAAZA
AAAAAAAABePwUAftdWkkQAAABEAAAAAAQAAQAGvF/0e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AgARQgANBKAQABABhX5CgW1TgVPTaG+LOcBwuQRzpHh1UOAEAEx3OQAAAEBCAoAMAR9jCsU
hWQAAAAFAAAAbAAAAAAAAABePwUAe6A2kwEAHABDb3VudGVycyBwcm92aWRlZCBieSBkdW1wY2FwAg
AIAF4/BQCm016RAwAIAF4/BQB4oDaTBAAIAL1BAAAAAAAABQAIABgAAAAAAAAAAAAAAGwAAAA=

Related

Best way to validate DICOM connection request with pynetdicom

What is the preferred way to validate requested DICOM connection against a list of known hosts?
I can connect to the EVT_CONN_OPEN event. But in that, the event.assoc.requestor.info.ae_title element is always empty (b'').
I see from a TCP network analysis, that the name is transmitted. So, where is it?
What is the right way to validate the requesting host?
You could try using EVT_REQUESTED instead, it gets triggered after an association request is received/sent and the AE title information should be available at that point. Unfortunately EVT_CONN_OPEN is triggered on TCP connection which occurs prior to the association request.
If you don't like the host's details you can use the handler to send an association rejection message using event.assoc.acse.send_reject() or abort with event.assoc.abort().
If you're only interested in validating against the AE title you can use the AE.require_calling_aet property to restrict associations to those with matching AE titles.
For the benefit of anyone else looking this up, the correct stage to look this up is in the EVT_REQUESTED event. However you will likely find the details aren't filled in (they are populated AFTER the handler has been called).
So if you want to locate the callers AE in EVT_REQUESTED, you need to locate the A_ASSOCIATE primitive and read them from there. So for example in your handler you can do this to reject remotes:
def handle_request(event):
req_title = event.assoc.requestor.primitive.calling_ae_title.decode('ascii')
if req_title != 'MyAET':
event.assoc.acse.send_reject(0x01, 0x01, 0x03)
return
At least for 1.5.7.

Spring File Inbound Channel Adapter slows down

I have a spring-integration flow that starts with a file inbound-channel-adapter activated by a transactional poller (tx is handled by atomikos).
The text in the file is processed and the message goes down through the flow until it gets sent to one of the JMS queues (JMS outbound-channel-adapter).
In the middle, there are some database writes within a nested transaction.
The system is meant to run 24/7.
It happens that the single message flow, progressively slows down and when I investigated, I found that the stage that is responsable for the increasing delay is the read from filesystem.
Below, the first portion fo the integration flow:
<logging-channel-adapter id="logger" level="INFO"/>
<transaction-synchronization-factory id="sync-factory">
<after-commit expression="payload.delete()" channel="after-commit"/>
</transaction-synchronization-factory>
<service-activator input-channel="after-commit" output-channel="nullChannel" ref="tx-after-commit-service"/>
<!-- typeb inbound from filesystem -->
<file:inbound-channel-adapter id="typeb-file-inbound-adapter"
auto-startup="${fs.typeb.enabled:true}"
channel="typeb-inbound"
directory="${fs.typeb.directory.in}"
filename-pattern="${fs.typeb.filter.filenamePattern:*}"
prevent-duplicates="${fs.typeb.preventDuplicates:false}" >
<poller id="poller"
fixed-delay="${fs.typeb.polling.millis:1000}"
max-messages-per-poll="${fs.typeb.polling.numMessages:-1}">
<transactional synchronization-factory="sync-factory"/>
</poller>
</file:inbound-channel-adapter>
<channel id="typeb-inbound">
<interceptors>
<wire-tap channel="logger"/>
</interceptors>
</channel>
I read something about issues related to the prevent-duplicates option that stores a list of seen files, but that is not the case because I turned it off.
I don't think that it may be related to the filter (filename-pattern) because the expression I use in my config (*.RCV) is easy to apply and the input folder does not contain a lot of files (less than 100) at the same time.
Still, there is something that gradually makes the read from filesystem slower and slower over time, from a few millis to over 3 seconds within a few days of up-time.
Any hints?
You should remove, or move files after they have been processed; otherwise the whole directory has to be rescanned.
In newer versions, you can use a WatchServiceDirectoryScanner which is more efficient.
But it's still best practice to clean up old files.
Finally I got the solution.
The issue was related to the specific version of Spring I was using (4.3.4) that is affected by a bug I had not discovered yet.
The problem is something about DefaultConversionService and the use of converterCache (look at this for more details https://jira.spring.io/browse/SPR-14929).
Upgrading to a more recent version has resolved.

Limiting the scope of a transaction in Apache Camel

I have a transacted Camel route with a number of processors
from(Constant.RouteA)
.transacted()
.process(processor1)
.process(processor2)
.process(processor3)
.wireTap(Constant.RouteB)
.wireTap(Constant.RouteC)
.end()
My problem is that I don't want the final part of the route (the wiretaps) to be part of the transaction i.e. I want them to be executed once processor3 has finished and the transaction committed.
Initially I looked at using onCompletion() but it doesn't seem to work together with transacted().
So I found another way which requires using policy() to limit the transaction scope i.e.
from(Constant.RouteA)
.policy("PROPAGATION_REQUIRED")
.process(processor1)
.process(processor2)
.process(processor3)
.end()
.wireTap(Constant.RouteB)
.wireTap(Constant.RouteC)
.end()
The problem is that this solution requires to define the SpringTransactionPolicy in the Spring configuration, but the software I'm working on doesn't use Spring. Transactions are managed by Bitronix and everything works just by using the transacted() method, which as far as I can tell doesn't allow you to limit the scope of a transaction.
Is there a simple way to achieve my goal? Hopefully without bringing Spring into the picture. Thank you!
Try to create two routes. For example:
from(direct:startRoute)
.to(Constant.RouteA)
.wireTap(Constant.RouteB)
.wireTap(Constant.RouteC);
from(Constant.RouteA)
.transacted()
.process(processor1)
.process(processor2)
.process(processor3);
Once route "Constant.RouteA" is finished all changes will committed.

Errbit keeps spamming emails

im using errbit 0-3 stable and its working really good .
but the problem is sometimes it start spamming me emails for the same error but different hashes like the following :
Mongo::Error::NoServerAvailable: No server is available matching preference: #<Mongo::ServerSelector::Primary:0x007fdba42891f0 #tag_sets=[], #options={:database=>"db_test", :max_pool_size=>200, :wait_queue_timeout=>5, :write=>{"w"=>0}}, #server_selection_timeout=30>
Mongo::Error::NoServerAvailable: No server is available matching preference: #<Mongo::ServerSelector::Primary:0x007fdbb8148e30 #tag_sets=[], #options={:database=>"db_test", :max_pool_size=>200, :wait_queue_timeout=>5, :write=>{"w"=>0}}, #server_selection_timeout=30>
How can i filter them so it would group them into 1 error only ?
There's two ways to deal with this.
Option 1) Catch the errors in your application and scrub the uniqueness out of the error messages before sending them to Errbit.
Option 2) Errbit supports configurable "fingerprinting" so you can actually tell Errbit what attributes contribute to the uniqueness of error notifications. This can be done system-wide or on individual Errbit apps. In your case, you could toggle off the error message as part of the Error fingerprint.
From the Errbit README:
The way Errbit arranges notices into error groups is configurable. By
default, Errbit uses the notice's error class, error message, complete
backtrace, component (or controller), action and environment name to
generate a unique fingerprint for every notice. Notices with identical
fingerprints appear in the UI as different occurences of the same
error and notices with differing fingerprints are displayed as
separate errors.
Changing the fingerprinter (under the 'config' menu) applies to all
apps and the change affects only notices that arrive after the change.
If you want to refingerprint old notices, you can run rake
errbit:notice_refingerprint.

PlayReady SME parameters on GoogleCast

1. When using encrypted media extensions on GoogleCast, from the example code here (section 8.4)
https://dvcs.w3.org/hg/html-media/raw-file/tip/encrypted-media/encrypted-media.html#examples:
what should be specified for PlayReady in:
video.setMediaKeys(new MediaKeys(keySystem));
as a keySystem?
2. In the same function, there is initData var (event.initData) in function handleKeyNeeded(event). If it is extended by adding custom data, will it be preserved by the DRM engine while license request generating and if not, how to workaround it?
In answer to your first question:
video.setMediaKeys(new MediaKeys("com.microsoft.playready"));
However it would be prudent to query the what systems are supported for given media types using iTypeSupported as per:
https://dvcs.w3.org/hg/html-media/raw-file/tip/encrypted-media/encrypted-media.html#dom-istypesupported

Resources