Skip to content

Instantly share code, notes, and snippets.

View samduy's full-sized avatar

Duy K. samduy

  • Eurecom, Bell Labs
  • Paris, France
  • X @duykham_
View GitHub Profile
@samduy
samduy / grep.py
Created December 31, 2017 12:48
Read all files in folder and search for regex
import glob, re
for msg in glob.glob('/tmp/*.txt'):
filer = open((msg),'r')
data = filer.read()
message = re.findall(r'<message>(.*?)>/message>', data, re.DOTALL)
print "File %s contains %s" % (str(msg), message)
filer.close()
@samduy
samduy / base64_wordlist.py
Created December 31, 2017 12:16
Python base64 wordlist
#!/usr/bin/python
import base64
file1=open("pwd.lst","r")
file2=open("b64pwds.lst,"w")
for line in file1:
clear = "administrator:" + str.strip(line)
new = base64.encodestring(clear)
file2.write(new)
@samduy
samduy / port_scanner.py
Created December 31, 2017 12:06
Python port scanner
import socket as sk
for port in range(1,1024):
try:
s=sk.socket(sk.AF_NET,sk.SOCK_STREAM)
s.settimeout(1000)
s.connect(('127.0.0.1',port))
print '%d: OPEN' % (port)
s.close
except: continue