Skip to content

Instantly share code, notes, and snippets.

View wasi0013's full-sized avatar
💤

Wasi wasi0013

💤
View GitHub Profile
@wasi0013
wasi0013 / captcha_solver.py
Last active August 4, 2018 12:53
Solves basic alpha numeric captchas using pytesseract and PIL
"""
Solves basic alpha numeric captchas using pytesseract and PIL
NOTE: This program is written for testing difficulties of captchas generated by captcha generator.
PLEASE, DO NOT USE IT FOR SPAMMING OR, ABUSING SYSTEMS!
Usage:
>>> get_captcha_text("https://i.imgur.com/4u7PESk.png")
'hWA K n h'
It is also possible to use proxy i.e:
>>> proxies = {"http": "http://104.236.13.100:8888", "https": "http://104.236.13.100:8888"}
@wasi0013
wasi0013 / keybase.md
Created March 14, 2019 14:42
keybase proof

Keybase proof

I hereby claim:

  • I am wasi0013 on github.
  • I am wasi0013 (https://keybase.io/wasi0013) on keybase.
  • I have a public key ASCAGYNlyVRTqJo6mqNbusXrz5U2eWcFuYYLhCB4EkhYfAo

To claim this, I am signing this object:

@wasi0013
wasi0013 / http_version.py
Created March 23, 2019 10:31
HTTP/2 Test using requests_html by parsing keycdn website https://tools.keycdn.com/http2-test
import requests_html
def http2_enabled(url):
"""
scrape https://tools.keycdn.com/http2-test to find http 2/0 support of the given domain url
"""
url = url.replace("https://", "").replace("http://", "")
session = requests_html.HTMLSession()
response = session.get("https://tools.keycdn.com/http2-test")
@wasi0013
wasi0013 / find_broken_links.py
Last active March 25, 2019 06:15
Find all the broken links from a website.
@wasi0013
wasi0013 / download_tiny_file.py
Last active October 4, 2019 13:26
how to download tiny files using python requests
import requests
filename = "logo.png"
document_url = "https://wasi0013.files.wordpress.com/2018/11/my_website_logo_half_circle_green-e1546027650125.png"
with open(filename, 'wb') as f:
f.write(requests.get(document_url).content)
@wasi0013
wasi0013 / download_file_using_python.py
Created October 4, 2019 13:59
How to download a file that requires custom headers and cookies
import requests
chunk_size = 4096
filename = "logo.png"
document_url = "https://wasi0013.files.wordpress.com/2018/11/my_website_logo_half_circle_green-e1546027650125.png"
headers = {
"User-Agent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3865.90 Safari/537.36",
"Connection": "keep-alive",
}
s = requests.Session()
cookie = requests.cookies.create_cookie('COOKIE_NAME','COOKIE_VALUE')
from selenium import webdriver
import requests
username = "Your Username"
password = "Your Password"
driver = webdriver.Chrome()
# authenticate using username, password
login_url = "https://your.target_website.com/login/"
driver.get(login_url)
import json
import time
from pyvirtualdisplay import Display
from selenium import webdriver
document_url = "https://www.adobe.com/content/dam/acom/en/accessibility/products/acrobat/pdfs/acrobat-x-accessibility-checker.pdf"
download_dir = "/path/to/dir/"
# setup a virtual display using pyvirtualdisplay
display = Display(visible=0, size=(1768, 1368))
# Compute 333.75y6 + x2(11x2y2 – y6 – 121y4 – 2) + 5.5y8 + x/(2y) where x = 77617, y = 33096
defmodule Pow do
# https://stackoverflow.com/a/32030190/3083094
require Integer
def pow(_, 0), do: 1
def pow(x, n) when Integer.is_odd(n), do: x * pow(x, n - 1)
def pow(x, n) do
result = pow(x, div(n, 2))
@wasi0013
wasi0013 / optimized_image_check.py
Created March 23, 2019 10:51
Find un-optimized images of a webpage using requests_html python
import requests_html
def unoptimized_images(url):
"""
find unoptimized images in a webpage
:param url: webpage_url
:return : tuple of image_count in int, images list of dict
"""
session = requests_html.HTMLSession()
response = session.get(url)
images = []