Exploits designed target vulnerabilities of the browser itself are difficult to completely rule out, it’s hard to say 100% its can not be exist, even though content render by browser typically sandboxed and isolate from critical parts of the system. While such vunerabilities are generally rare, especially in newer version of browsers, they can technically still occur under certain conditions.I acknowledge that’s my oversight in this matter. After all, no solution can cover every scenario when its come to security.
Sounds FUN, i’m never thought about it like that, i made this Python code technically does same thing as the browser plugins i mentioned:
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.common.action_chains import ActionChains
from selenium.webdriver.chrome.options import Options
from PIL import Image
import io
import os
css="""
::-webkit-scrollbar {
display: none;
}
"""
js=f"""
const thumb=document.createElement('style')
thumb.type='text/css'
thumb.innerHTML=`{css}`
document.getElementsByTagName('head')[0].appendChild(thumb)
"""
def merge(width, height,exceedW, exceedH, frame, incW, incH):
result= Image.new("RGB", (width,height ))
x, y=0,0
index=0
print("-------------------")
while(pos(x, y, width, height, incW, incH)):
if x+incW>width and y+incH>height:
result.paste(frame[index].crop((incW-exceedW, incH-exceedH, incW, incH)), (x, y))
elif x+incW>width:
result.paste(frame[index].crop((incW-exceedW, 0, incW, incH)), (x, y))
elif y+incH>height:
result.paste(frame[index].crop((0, incH-exceedH, incW, incH)), (x, y))
else:
result.paste(frame[index], (x, y))
x,y =pos(x, y, width, height, incW, incH)
index+=1
result.save('Done.png')
def pos(curW, curH, width, height, incW, incH):
if curW<width-100:
return (curW+incW, curH)
else:
if curH>height-100:
return None
return (0, curH+incH)
sizeX, sizeY=1000, 1000# Define size for window here, the more its large, the more faster take picture, but should not exceed size of image target
chrome_options=Options()
chrome_options.add_argument("--headless")
chrome_options.add_argument(f"-window-size={sizeX}, {sizeY}")
chrome_options.add_argument('--proxy-server=123.456.789.123:1234')
chrome_options.add_argument("--user-data-dir=./store")
chrome_options.add_argument("--safebrowsing-enabled")
# chrome_options.add_argument("--disable-javascript")
driver= webdriver.Chrome(options=chrome_options)
path="http://127.0.0.1:5500/index.html"# Define path to image here
driver.get(path)
image= driver.find_elements(By.TAG_NAME, 'img')
width, height=0, 0
if image:
ActionChains(driver).move_to_element(image[0]).click(image[0]).perform()
height=int(image[0].get_attribute('height'))
width=int(image[0].get_attribute('width'))
driver.execute_script(js)
driver.execute_script(f"window.scrollTo(0,0);")
num=0
x, y=0, 0
exceedH, exceedW=0, 0
frame=[]
first_x, first_y=0, 0
stateProcess=-1
while pos(x, y,width, height, sizeX, sizeY):
if int((y/height)*100)>stateProcess:
stateProcess=int((y/height)*100)
os.system('clear')
print(f"Process {stateProcess}%")
x, y=pos(x, y, width, height, sizeX, sizeY)
screenshot_as_png= driver.get_screenshot_as_png()
screenshot= Image.open(io.BytesIO(screenshot_as_png))
frame.append(screenshot)
if first_x==0 and x+sizeX>width:
exceedW=width-x
first_x+=1
elif first_y==0 and y+sizeY>height:
exceedH=height-y
first_y+=1
driver.execute_script(f"window.scrollTo({x}, {y});")
print("Merge...")
merge(width, height, exceedW, exceedH, frame, sizeX, sizeY)
driver.quit()
print(f"Done!")