Skip to content

Instantly share code, notes, and snippets.

View j178's full-sized avatar
🕶️
Living

Jo j178

🕶️
Living
View GitHub Profile

Keybase proof

I hereby claim:

  • I am j178 on github.
  • I am j178 (https://keybase.io/j178) on keybase.
  • I have a public key ASDwwkUUC1UvGUF2DjZudNwJTDU-SrydNVpaIk4AudKdrQo

To claim this, I am signing this object:

#!/usr/bin/env python3
import base64
import random
import re
import string
import requests
sess = requests.Session()
randstr = lambda len=5: ''.join(random.choice(string.ascii_lowercase) for _ in range(len))
#!/usr/bin/env python3
import re
import requests
import base64
sess = requests.Session()
target = 'http://localhost/discuzx/'
# login target site first, and copy the cookie here
@j178
j178 / base64.py
Created August 31, 2017 12:19
Reinvent the wheel: implemente base64 encoding and decoing in Python.
CHARS = b'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'
NUMS = [62, 0, 0, 0, 63,
*range(52, 62),
0, 0, 0, 0, 0, 0, 0,
*range(26),
0, 0, 0, 0, 0, 0,
*range(26, 52)]
def to_val(c):
@j178
j178 / strip.py
Last active September 1, 2017 03:36
Self implemented strip funciton compared to built-in
from string import whitespace
import timeit
def strip(string, chars=whitespace):
if not isinstance(string, (str, bytes)) \
or not isinstance(chars, type(string)):
raise ValueError
left = 0
for left, s in enumerate(string):