fixed bug that caused an alleged decompression DOS attack

clean_emacs
TuDatTr 2017-12-21 02:30:19 +01:00
parent ab13b5e4d2
commit e0af067cc7
3 changed files with 47 additions and 47 deletions

2
.gitignore vendored
View File

@ -1,3 +1,3 @@
*~ *~
\#*\# \#*\#
*.log *.log

View File

@ -3,22 +3,24 @@
# A script to manage my dotfiles and copy them to my git # A script to manage my dotfiles and copy them to my git
dotfiles=$HOME/workspace/Git/dotfiles dotfiles=$HOME/workspace/Git/dotfiles
# -avv for debugging purposes
# -v for normal use
copy(){ copy(){
rsync -avv $HOME/$1 $dotfiles/$1 # rsync -avv $HOME/$1 $dotfiles/$1
rsync -a $HOME/$1 $dotfiles/$1
} }
# For Debugging purposes
copy_test(){ copy_test(){
echo rsync -a $HOME/$1 $dotfiles/$1 echo rsync -avv $HOME/$1 $dotfiles/$1
} }
# i3 gaps # i3 gaps
# Powerline fonts must be installed # Powerline fonts must be installed
printf "\nCopying i3 configs...\n" printf "\nCopying i3 configs...\n"
copy .config/i3/ copy .config/i3/
# Termite # Termite
printf "\nCopying Termite configs...\n" printf "\nCopying Termite configs...\n"
copy .config/termite/ copy .config/termite/

View File

@ -1,36 +1,42 @@
import os
from PIL import Image
import datetime import datetime
import os
from PIL import Image
def screenshot(): def screenshot():
os.system('import -window root /tmp/.i3lock.png') os.system('import -window root /tmp/i3lock.png')
def pixelate(): def pixelate():
# backgroundColor = (0,)*3 # backgroundColor = (0,)*3
pixelSize = 9 pixelSize = 9
image = Image.open('/tmp/.i3lock.png') image = Image.open('/tmp/i3lock.png')
image_x, image_y = image.size image_x = image.size[0]
image_y = image.size[1]
image = image.resize((int(image_x/pixelSize), int(image_y/pixelSize)),
Image.NEAREST)
image = image.resize((image_x*pixelSize, image_y*pixelSize),
Image.NEAREST)
# pixel = image.load()
# for i in range(0,image.size[0],pixelSize): image = image.resize((int(image_x / pixelSize), int(image_y / pixelSize)),
# for j in range(0,image.size[1],pixelSize): Image.NEAREST)
# for r in range(pixelSize):
# pixel[i+r,j] = backgroundColor
# pixel[i,j+r] = backgroundColor
image.save('/tmp/.i3lock.png') image_x = image.size[0]
image_y = image.size[1]
image = image.resize((image_x * pixelSize, image_y * pixelSize),
Image.NEAREST)
# image.load()
# for i in range(0,image.size[0],pixelSize):
# for j in range(0,image.size[1],pixelSize):
# for r in range(pixelSize):
# pixel[i+r,j] = backgroundColor
# pixel[i,j+r] = backgroundColor
image.save('/tmp/i3lock.png')
def getResolution(): def getResolution():
image = Image.open('/tmp/.i3lock.png') image = Image.open('/tmp/i3lock.png')
return image.size return image.size
@ -46,11 +52,11 @@ def lock_config():
res_y = int(res[1]) res_y = int(res[1])
# alignments # alignments
left_margin = int(res[0]/25) left_margin = int(res[0] / 25)
# clock pos # clock pos
clock_x = left_margin clock_x = left_margin
clock_y = int(res_y*(83/100)) clock_y = int(res_y * (83 / 100))
date_x = left_margin date_x = left_margin
date_y = clock_y + default_fontsize date_y = clock_y + default_fontsize
@ -61,7 +67,7 @@ def lock_config():
clock = "{} {}".format(lock_clock_args, lock_clock_align) clock = "{} {}".format(lock_clock_args, lock_clock_align)
# time # time
lock_time_pos = '--timepos="{}:{}"'.format(clock_x, clock_y) lock_time_pos = '--timepos="{}:{}"'.format(clock_x, clock_y)
lock_time_size = '--timesize={}'.format(default_fontsize*2) lock_time_size = '--timesize={}'.format(default_fontsize * 2)
time = "{} {}".format(lock_time_pos, lock_time_size) time = "{} {}".format(lock_time_pos, lock_time_size)
# date # date
lock_date_pos = '--datepos="{}:{}"'.format(date_x, date_y) lock_date_pos = '--datepos="{}:{}"'.format(date_x, date_y)
@ -78,8 +84,7 @@ def lock_config():
lock_ver_color = '--insidevercolor 00000000 ' lock_ver_color = '--insidevercolor 00000000 '
# Color of the circle if wrong | Color: transparent # Color of the circle if wrong | Color: transparent
lock_wrong_color = '--insidewrongcolor 00000000 ' lock_wrong_color = '--insidewrongcolor 00000000 '
indicator_inner = "{} {} {}".format(lock_rest_color, indicator_inner = "{} {} {}".format(lock_rest_color, lock_wrong_color,
lock_wrong_color,
lock_ver_color) lock_ver_color)
# indicator_outer_ring # indicator_outer_ring
@ -94,28 +99,21 @@ def lock_config():
# Color on Deletion | Color: orange # Color on Deletion | Color: orange
lock_del = '--bshlcolor D13400FF' lock_del = '--bshlcolor D13400FF'
# Color of seperator | Color: dark-blue # Color of seperator | Color: dark-blue
lock_sep_color = '--seperatorcolor 0000D1FF' lock_sep_color = '--separatorcolor 0000D1FF'
indicator_outer_ring = "{} {} {} {} {} {}".format(lock_ring, indicator_outer_ring = "{} {} {} {} {} {}".format(lock_ring, lock_ring_w,
lock_ring_w, lock_ring_v, lock_press,
lock_ring_v, lock_del, lock_sep_color)
lock_press,
lock_del,
lock_sep_color)
# done # done
indicator = "{} {}".format(indicator_inner, indicator_outer_ring) indicator = "{} {}".format(indicator_inner, indicator_outer_ring)
# background # background
lock_pic = '-i /tmp/.i3lock.png' lock_pic = '-i /tmp/i3lock.png'
return "{} {} {} {} {}".format(lock_core, clock, datetime, indicator,
lock_pic)
return "{} {} {} {} {}".format(lock_core,
clock,
datetime,
indicator,
lock_pic
)
def log_command(command): def log_command(command):
write_mode = '' write_mode = ''
home = os.path.expanduser('~') home = os.path.expanduser('~')
@ -134,9 +132,9 @@ def log_command(command):
def lock(): def lock():
'Locks the System' 'Locks the System'
command = lock_config() command = lock_config()
log_command(command) log_command(command)
os.system(command) os.system(command)