>have a sequence of images named 1.png, 2.png, 3.png, and so on in a new folder
>place this script.py into the same folder with ONLY the image files
>run script.py x y
>x is the number of images and y is the name you want to give to the gif
import imageio
import os
import argparse
import sys
g = int(sys.argv[1])
print(g)
x=1
files = []
for x in range (x,g):
print(x)
files.append(str(x)+'.png')
x+1
print(files)
images = [imageio.imread(file) for file in files]
imageio.mimwrite(str(sys.argv[2])+'.gif', images, fps=7)
>grab the windows background files from this directory:
>C:\Users\USERNAME\AppData\Local\Packages\Microsoft.Windows.ContentDeliveryManager_cw5n1h2txyewy\LocalState\Assets
>place them in a new folder, place this script.py in the same folder, and run it.
import os
for file in os.listdir(path):
if file =="script.py":
pass
else:
os.rename(file, file+".png")
print(file)
#######Step 1: Imports
#pip install pillow https://pypi.org/project/Pillow/2.2.1/
#And use the tkinter module that comes standard with your python install
#use PIL as a pointer to the pillow module because it is a fork of the now dead PIL module)
from PIL import Image, ExifTags
#use filedialog to select the image file using the OS directory instead of manually typing in the location
from tkinter import filedialog
#######Step 2: the main function
def main():
# open the file dialog and choose the image to get the location string
img = filedialog.askopenfilename()
a = str(img.rsplit('/',1)[1])
a = a.rsplit('.',1)[0]
print(a)
#we open the image with PIL
img = Image.open(img)
#use a try-except block to error handle in case there is no exif data
try:
#with the _getexif().items() we first try to obtain a dictionary of all the exif data on the image
exif = { ExifTags.TAGS[k]: v for k, v in img._getexif().items() if k in ExifTags.TAGS }
#if there is none we exit this block and move to the exception
#we grab the image data without the exif data and set it to an object called data
data = list(img.getdata())
#create a new image using the same mode and size of the original image
image_without_exif = Image.new(img.mode, img.size)
#place back the pixel data into the new image
image_without_exif.putdata(data)
#initiate the orientation object
for orientation in ExifTags.TAGS.keys():
if ExifTags.TAGS[orientation]=='Orientation':
break
#PIL does not copy metadata when saving a new image
#So first read the metadata, grab the orientation, and set up the new image with
#the correct orientation
#this means we are adding our own metadata to the new image
rotate=dict(img._getexif().items())
if rotate[orientation] == 3:
img=img.rotate(180, expand=True)
elif rotate[orientation] == 6:
img=img.rotate(270, expand=True)
elif rotate[orientation] == 8:
img=img.rotate(90, expand=True)
else:
pass
#clean up and final save
img.save(u"scrubbed_{}".format(a+'.jpg'))
except Exception as e:
#print the error
print(e)
return
if __name__=="__main__":
main()
#cleaning the brave bookmark txt file for easy reading
def brave():
a = open("Bookmarks.txt", "r", encoding='utf-8')
new_file = open("bookmarks_cleaned.txt", "w", encoding='utf-8')
for line in a:
if "date_added" in line:
pass
elif '"guid":' in line:
pass
elif '"id":' in line:
pass
elif '"type":' in line:
pass
else:
line = line.replace('"name":', '')
line = line.replace('"url":', '')
line = line.replace('"', '')
line = line.replace('{', '')
line = line.replace('}', '')
line = line.replace(',', '')
new_file.write(line)
if __name__=="__main__":
brave()
#py script.py filename import hashlib import sys def main(x): BLOCKSIZE = 65536 hasher = hashlib.sha1() with open(str(x[1]), 'rb') as afile: buf = afile.read(BLOCKSIZE) while len(buf) > 0: hasher.update(buf) buf = afile.read(BLOCKSIZE) print(hasher.hexdigest()) if __name__=='__main__': main(sys.argv)
(get-item C:\Users\USER\Documents).lastaccesstime
@echo off echo 'Hello World' mkdir hello_world_folder echo: echo Created hello_world_folder echo: end local :: Pause allowing the user to read the shell pause
soffice --headless --convert-to pdf document.docx
import os
import sys
path = sys.argv[1]
dir_list = os.listdir(path)
print(dir_list)
g = open(path+'/dir_list.txt', 'w')
for item in dir_list:
g.write(item+'\n')
g.close()
wget --user-agent="Mozilla/5.0 (Windows NT 5.2; rv:2.0.1) Gecko/20100101 Firefox/4.0.1" "tmalinowski.com"
#replace smb with any protocol ls -al /usr/share/nmap/scripts | grep -e "smb-"
openssl s_client -connect tmalinowski.com:443 -quiet
mysql -h tmalinowski.com -u root
#this assumes the target has python3 installed
python3 -c 'import pty;pty.spawn("/bin/bash")'
#sC uses common scripts to discover further information about target #sV probes open ports for service version information nmap -sC -sV tmalinowski.com
#check python version: python3 exit() sudo apt install -y python3-pip python3-venv cd Documents/ mkdir python cd python mkdir environments cd environments python3 -m venv stocks_project ls stonks source stocks_project/bin/activate pip3 install package_name
curl --socks5 localhost:9050 --socks5-hostname localhost:9050 -A "Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Firefox/81.0" --cookie "ID=" -s domain or curl --socks5 localhost:9050 --socks5-hostname localhost:9050 -A "Mozilla/5.0 (Windows NT 5.2; rv:2.0.1) Gecko/20100101 Firefox/4.0.1" --header="Accept: text/html" --referer "" -s "https://"