repo.or.cz
/
hband-tools.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
blame
|
history
|
raw
|
HEAD
make getpeername() return the original socket address which before it was intercepted
[hband-tools.git]
/
user-tools
/
json2bencode
blob
1f9f5e100d5b74921c2fceaf8d3acefea4e5f026
1
#!/usr/bin/env python
2
3
"""
4
=pod
5
6
=head1 NAME
7
8
json2bencode - Convert JSON to Bencode (BitTorrent's loosely structured data)
9
10
=cut
11
12
"""
13
14
import
sys
15
import
json
16
import
bencode
17
18
json
.
stdout
.
write
(
bencode
.
bencode
(
json
.
load
(
sys
.
stdin
)))