projects
/
youtube-dl
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
PEP8 applied
[youtube-dl]
/
devscripts
/
transition_helper_exe
/
youtube-dl.py
diff --git
a/devscripts/transition_helper_exe/youtube-dl.py
b/devscripts/transition_helper_exe/youtube-dl.py
index 6297dfd40f426cbbafbd2d362034c43cd464f8dc..edb449fb30019a6ca7a76e9dd79d30c8f49ead5d 100644
(file)
--- a/
devscripts/transition_helper_exe/youtube-dl.py
+++ b/
devscripts/transition_helper_exe/youtube-dl.py
@@
-4,13
+4,17
@@
import sys, os
import urllib2
import json, hashlib
import urllib2
import json, hashlib
+
def rsa_verify(message, signature, key):
from struct import pack
from hashlib import sha256
from sys import version_info
def rsa_verify(message, signature, key):
from struct import pack
from hashlib import sha256
from sys import version_info
+
def b(x):
def b(x):
- if version_info[0] == 2: return x
- else: return x.encode('latin1')
+ if version_info[0] == 2:
+ return x
+ else:
+ return x.encode('latin1')
assert(type(message) == type(b('')))
block_size = 0
n = key[0]
assert(type(message) == type(b('')))
block_size = 0
n = key[0]
@@
-23,13
+27,17
@@
def rsa_verify(message, signature, key):
raw_bytes.insert(0, pack("B", signature & 0xFF))
signature >>= 8
signature = (block_size - len(raw_bytes)) * b('\x00') + b('').join(raw_bytes)
raw_bytes.insert(0, pack("B", signature & 0xFF))
signature >>= 8
signature = (block_size - len(raw_bytes)) * b('\x00') + b('').join(raw_bytes)
- if signature[0:2] != b('\x00\x01'): return False
+ if signature[0:2] != b('\x00\x01'):
+ return False
signature = signature[2:]
signature = signature[2:]
- if not b('\x00') in signature: return False
+ if not b('\x00') in signature:
+ return False
signature = signature[signature.index(b('\x00'))+1:]
signature = signature[signature.index(b('\x00'))+1:]
- if not signature.startswith(b('\x30\x31\x30\x0D\x06\x09\x60\x86\x48\x01\x65\x03\x04\x02\x01\x05\x00\x04\x20')): return False
+ if not signature.startswith(b('\x30\x31\x30\x0D\x06\x09\x60\x86\x48\x01\x65\x03\x04\x02\x01\x05\x00\x04\x20')):
+ return False
signature = signature[19:]
signature = signature[19:]
- if signature != sha256(message).digest(): return False
+ if signature != sha256(message).digest():
+ return False
return True
sys.stderr.write(u'Hi! We changed distribution method and now youtube-dl needs to update itself one more time.\n')
return True
sys.stderr.write(u'Hi! We changed distribution method and now youtube-dl needs to update itself one more time.\n')
@@
-92,7
+100,7
@@
echo Updating youtube-dl...
ping 127.0.0.1 -n 5 -w 1000 > NUL
move /Y "%s.new" "%s"
del "%s"
ping 127.0.0.1 -n 5 -w 1000 > NUL
move /Y "%s.new" "%s"
del "%s"
- \n""" %(exe, exe, bat))
+ \n""" %
(exe, exe, bat))
b.close()
os.startfile(bat)
b.close()
os.startfile(bat)