File size: 656 Bytes
6fe9fd7
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
d = open('app/ui.py', 'rb').read()

old = b"sampleRows = text.split('\\n').filter(l => l.trim() && !l.startsWith('--')).slice(0, 5);\r\n      headers = ['(SQL dump \xe2\x80\x94 columns detected automatically)'];"

new = b'sampleRows = text.split(String.fromCharCode(10)).filter(l => l.trim() && !l.startsWith("--")).slice(0, 5);\r\n      headers = ["(SQL dump - columns detected automatically)"];'

print('found:', old in d)
if old in d:
    d2 = d.replace(old, new)
    open('app/ui.py', 'wb').write(d2)
    print('written, size:', len(d2))
else:
    # show nearby context
    i = d.find(b'sampleRows = text.split')
    print('nearby:', repr(d[i:i+120]))