Skip to content

Instantly share code, notes, and snippets.

@THEMVFFINMAN
THEMVFFINMAN / PYPMapper
Created June 29, 2015 16:32
Takes an IP Address and returns the location based on the pygeoip library.
import pygeoip
gi = pygeoip.GeoIP('/opt/GeoIP/Geo.dat')
def printRecord(tgt):
rec = gi.record_by_name(tgt)
city = rec['city']
#Note in older versions of pygeoip region_code is region_name
region = rec['region_code']
country = rec['country_name']
@THEMVFFINMAN
THEMVFFINMAN / WordEnder.py
Created June 20, 2015 21:03
Finds words that end in a certain text
import argparse, urllib2, re, bs4
from bs4 import BeautifulSoup
def parseWord(word):
url = "http://www.wordfind.com/ends-with/{0}/".format(word)
urlContent = urllib2.urlopen(url).read()
soup = BeautifulSoup(urlContent)
predicate = {'href' : re.compile("/word/.*")}
letterCount = len(soup.find(**predicate).get_text())
@THEMVFFINMAN
THEMVFFINMAN / PyRecover
Created June 20, 2015 18:10
Find out who deleted what in the Windows Recycle Bin
import os
from _winreg import *
def returnDir():
dirs=['C:\\Recycler\\','C:\\Recycled\\','C:\\$Recycle.Bin\\']
for recycleDir in dirs:
if os.path.isdir(recycleDir):
return recycleDir
@THEMVFFINMAN
THEMVFFINMAN / PipUpdater.py
Last active August 29, 2015 14:23
Updates all pip libraries
import pip
from subprocess import call
for dist in pip.get_installed_distributions():
call("pip install --upgrade " + dist.project_name, shell=True)
@THEMVFFINMAN
THEMVFFINMAN / FTPAnonChecker.py
Created June 15, 2015 02:30
FTP anonymous checker
import ftplib
def anonLogin(hostname):
try:
ftp = ftplib.FTP(hostname)
ftp.login('anonymous', '[email protected]')
print '\n[*] ' + str(hostname) + ' FTP Anonymous Logon Succeeded.'
ftp.quit()
@THEMVFFINMAN
THEMVFFINMAN / PySSHBotnet
Created June 15, 2015 02:08
A not real Py SSH Botnet
import argparse, pxssh
class Client:
def __init__(self, host, user, password):
self.host = host
self.user = user
self.password = password
self.session = self.connect()
@THEMVFFINMAN
THEMVFFINMAN / FileValidation
Created June 12, 2015 23:00
Python file validation snippet
def validateFile():
if len(sys.argv) == 2:
filename = sys.argv[1]
if not os.path.isfile(filename):
print '[-] ' + filename + ' does not exist.'
exit(0)
if not os.access(filename, os.R_OK):
print '[-] ' + filename + ' access denied.'
exit(0)
print '[+] Reading Vulnerabilities From: ' + filename
@THEMVFFINMAN
THEMVFFINMAN / negcommentdeleter.py
Created May 31, 2015 20:17
Deletes comments with karma below 1
import praw, time
USERNAME = "blendt"
PASSWORD = "MYPASSWORD"
WAIT = 60
WAITS = str(WAIT)
r = praw.Reddit("Comment Deleter")
r.login(USERNAME, PASSWORD)
@THEMVFFINMAN
THEMVFFINMAN / BigIntegerRandom
Created January 12, 2015 18:04
BigInteger uniformNumber Random
public BigInteger uniformNumber(BigInteger max) {
// Get the bit count of a number (rounding up)
double bit_count = BigInteger.Log(max, 2);
int length = (int)Math.Ceiling(bit_count);
// Grab some random int from the persisted random instance
int random_int = random.Next();
// Generate some BigInt with at least bit_count above
BigInteger random_number = 0;
@THEMVFFINMAN
THEMVFFINMAN / RedComDeleter.py
Last active December 21, 2015 02:36
Reddit-Comment-Deleter
#This will edit all of your reddit comments to be blank and then delete them so the originals will be erased forever
# This gist is now deprecated, go here for the updated version: https://github.com/THEMVFFINMAN/Reddit-History-Eraser